From 01160fe8ca6b6e94a30da43b2a9a9042d30f66bf Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Sun, 7 May 2023 10:04:12 +0000 Subject: [PATCH 1/2] feat: Max concurrent backfill tasks You can now set the number of maximum concurrent backfill tasks for a stream using the Datastream API. PiperOrigin-RevId: 530067890 Source-Link: https://github.com/googleapis/googleapis/commit/b2c290faf99f388efb1e080333cba620f38e5afc Source-Link: https://github.com/googleapis/googleapis-gen/commit/83c5413e535cb6fa710541dc6e169a8a44b8a65d Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWRhdGFzdHJlYW0vLk93bEJvdC55YW1sIiwiaCI6IjgzYzU0MTNlNTM1Y2I2ZmE3MTA1NDFkYzZlMTY5YThhNDRiOGE2NWQifQ== --- .../google-cloud-datastream/v1/.eslintignore | 7 + .../google-cloud-datastream/v1/.eslintrc.json | 3 + .../google-cloud-datastream/v1/.gitignore | 14 + .../google-cloud-datastream/v1/.jsdoc.js | 55 + .../google-cloud-datastream/v1/.mocharc.js | 33 + .../google-cloud-datastream/v1/.prettierrc.js | 22 + .../google-cloud-datastream/v1/README.md | 1 + .../v1/linkinator.config.json | 16 + .../google-cloud-datastream/v1/package.json | 64 + .../cloud/datastream/v1/datastream.proto | 1075 ++++ .../datastream/v1/datastream_resources.proto | 1049 ++++ .../datastream.create_connection_profile.js | 95 + .../datastream.create_private_connection.js | 90 + .../generated/v1/datastream.create_route.js | 86 + .../generated/v1/datastream.create_stream.js | 95 + .../datastream.delete_connection_profile.js | 76 + .../datastream.delete_private_connection.js | 81 + .../generated/v1/datastream.delete_route.js | 76 + .../generated/v1/datastream.delete_stream.js | 76 + .../datastream.discover_connection_profile.js | 91 + .../v1/datastream.fetch_static_ips.js | 73 + .../v1/datastream.get_connection_profile.js | 61 + .../v1/datastream.get_private_connection.js | 61 + .../generated/v1/datastream.get_route.js | 61 + .../generated/v1/datastream.get_stream.js | 61 + .../v1/datastream.get_stream_object.js | 61 + .../v1/datastream.list_connection_profiles.js | 84 + .../v1/datastream.list_private_connections.js | 87 + .../generated/v1/datastream.list_routes.js | 86 + .../v1/datastream.list_stream_objects.js | 76 + .../generated/v1/datastream.list_streams.js | 84 + .../v1/datastream.lookup_stream_object.js | 66 + .../v1/datastream.start_backfill_job.js | 62 + .../v1/datastream.stop_backfill_job.js | 62 + .../datastream.update_connection_profile.js | 93 + .../generated/v1/datastream.update_stream.js | 93 + ...t_metadata.google.cloud.datastream.v1.json | 1247 ++++ .../google-cloud-datastream/v1/src/index.ts | 25 + .../v1/src/v1/datastream_client.ts | 4160 +++++++++++++ .../v1/src/v1/datastream_client_config.json | 163 + .../v1/src/v1/datastream_proto_list.json | 4 + .../v1/src/v1/gapic_metadata.json | 297 + .../v1/src/v1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1/system-test/install.ts | 49 + .../v1/test/gapic_datastream_v1.ts | 5201 +++++++++++++++++ .../google-cloud-datastream/v1/tsconfig.json | 19 + .../v1/webpack.config.js | 64 + .../v1alpha1/.eslintignore | 7 + .../v1alpha1/.eslintrc.json | 3 + .../v1alpha1/.gitignore | 14 + .../v1alpha1/.jsdoc.js | 55 + .../v1alpha1/.mocharc.js | 33 + .../v1alpha1/.prettierrc.js | 22 + .../v1alpha1/README.md | 1 + .../v1alpha1/linkinator.config.json | 16 + .../v1alpha1/package.json | 64 + .../datastream/v1alpha1/datastream.proto | 895 +++ .../v1alpha1/datastream_resources.proto | 683 +++ .../datastream.create_connection_profile.js | 86 + .../datastream.create_private_connection.js | 86 + .../v1alpha1/datastream.create_route.js | 86 + .../v1alpha1/datastream.create_stream.js | 95 + .../datastream.delete_connection_profile.js | 76 + .../datastream.delete_private_connection.js | 81 + .../v1alpha1/datastream.delete_route.js | 76 + .../v1alpha1/datastream.delete_stream.js | 76 + .../datastream.discover_connection_profile.js | 87 + .../v1alpha1/datastream.fetch_errors.js | 61 + .../v1alpha1/datastream.fetch_static_ips.js | 73 + .../datastream.get_connection_profile.js | 61 + .../datastream.get_private_connection.js | 61 + .../v1alpha1/datastream.get_route.js | 61 + .../v1alpha1/datastream.get_stream.js | 61 + .../datastream.list_connection_profiles.js | 84 + .../datastream.list_private_connections.js | 86 + .../v1alpha1/datastream.list_routes.js | 86 + .../v1alpha1/datastream.list_streams.js | 84 + .../datastream.update_connection_profile.js | 84 + .../v1alpha1/datastream.update_stream.js | 93 + ...data.google.cloud.datastream.v1alpha1.json | 1051 ++++ .../v1alpha1/src/index.ts | 25 + .../src/v1alpha1/datastream_client.ts | 3291 +++++++++++ .../v1alpha1/datastream_client_config.json | 143 + .../src/v1alpha1/datastream_proto_list.json | 4 + .../v1alpha1/src/v1alpha1/gapic_metadata.json | 253 + .../v1alpha1/src/v1alpha1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + .../v1alpha1/system-test/install.ts | 49 + .../test/gapic_datastream_v1alpha1.ts | 3927 +++++++++++++ .../v1alpha1/tsconfig.json | 19 + .../v1alpha1/webpack.config.js | 64 + 94 files changed, 27924 insertions(+) create mode 100644 owl-bot-staging/google-cloud-datastream/v1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-datastream/v1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-datastream/v1/.gitignore create mode 100644 owl-bot-staging/google-cloud-datastream/v1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/README.md create mode 100644 owl-bot-staging/google-cloud-datastream/v1/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-datastream/v1/package.json create mode 100644 owl-bot-staging/google-cloud-datastream/v1/protos/google/cloud/datastream/v1/datastream.proto create mode 100644 owl-bot-staging/google-cloud-datastream/v1/protos/google/cloud/datastream/v1/datastream_resources.proto create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_connection_profile.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_private_connection.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_route.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_stream.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_connection_profile.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_private_connection.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_route.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_stream.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.discover_connection_profile.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.fetch_static_ips.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_connection_profile.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_private_connection.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_route.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_stream.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_stream_object.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_connection_profiles.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_private_connections.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_routes.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_stream_objects.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_streams.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.lookup_stream_object.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.start_backfill_job.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.stop_backfill_job.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.update_connection_profile.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.update_stream.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/snippet_metadata.google.cloud.datastream.v1.json create mode 100644 owl-bot-staging/google-cloud-datastream/v1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_client.ts create mode 100644 owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_client_config.json create mode 100644 owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_proto_list.json create mode 100644 owl-bot-staging/google-cloud-datastream/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-datastream/v1/src/v1/index.ts create mode 100644 owl-bot-staging/google-cloud-datastream/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-datastream/v1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-datastream/v1/test/gapic_datastream_v1.ts create mode 100644 owl-bot-staging/google-cloud-datastream/v1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-datastream/v1/webpack.config.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/.eslintignore create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/.eslintrc.json create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/.gitignore create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/.jsdoc.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/.mocharc.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/.prettierrc.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/README.md create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/linkinator.config.json create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/package.json create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/protos/google/cloud/datastream/v1alpha1/datastream.proto create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/protos/google/cloud/datastream/v1alpha1/datastream_resources.proto create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_connection_profile.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_private_connection.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_route.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_stream.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_connection_profile.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_private_connection.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_route.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_stream.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.discover_connection_profile.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.fetch_errors.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.fetch_static_ips.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_connection_profile.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_private_connection.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_route.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_stream.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_connection_profiles.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_private_connections.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_routes.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_streams.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.update_connection_profile.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.update_stream.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/snippet_metadata.google.cloud.datastream.v1alpha1.json create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/src/index.ts create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_client.ts create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_client_config.json create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_proto_list.json create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/gapic_metadata.json create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/index.ts create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/install.ts create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/test/gapic_datastream_v1alpha1.ts create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/tsconfig.json create mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/webpack.config.js diff --git a/owl-bot-staging/google-cloud-datastream/v1/.eslintignore b/owl-bot-staging/google-cloud-datastream/v1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-datastream/v1/.eslintrc.json b/owl-bot-staging/google-cloud-datastream/v1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-datastream/v1/.gitignore b/owl-bot-staging/google-cloud-datastream/v1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +/.coverage +/coverage +/.nyc_output +/docs/ +/out/ +/build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/google-cloud-datastream/v1/.jsdoc.js b/owl-bot-staging/google-cloud-datastream/v1/.jsdoc.js new file mode 100644 index 00000000000..cb79c804665 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2023 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/datastream', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-datastream/v1/.mocharc.js b/owl-bot-staging/google-cloud-datastream/v1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/google-cloud-datastream/v1/.prettierrc.js b/owl-bot-staging/google-cloud-datastream/v1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/google-cloud-datastream/v1/README.md b/owl-bot-staging/google-cloud-datastream/v1/README.md new file mode 100644 index 00000000000..a7903c0b77c --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/README.md @@ -0,0 +1 @@ +Datastream: Nodejs Client diff --git a/owl-bot-staging/google-cloud-datastream/v1/linkinator.config.json b/owl-bot-staging/google-cloud-datastream/v1/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/google-cloud-datastream/v1/package.json b/owl-bot-staging/google-cloud-datastream/v1/package.json new file mode 100644 index 00000000000..fbd522f5bde --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/datastream", + "version": "0.1.0", + "description": "Datastream client for Node.js", + "repository": "googleapis/nodejs-datastream", + "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 datastream", + "datastream", + "datastream" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.5.7" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^4.0.0", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.1.2", + "mocha": "^10.2.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.0.1", + "ts-loader": "^8.4.0", + "typescript": "^4.8.4", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-datastream/v1/protos/google/cloud/datastream/v1/datastream.proto b/owl-bot-staging/google-cloud-datastream/v1/protos/google/cloud/datastream/v1/datastream.proto new file mode 100644 index 00000000000..bf0b13f5e2a --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/protos/google/cloud/datastream/v1/datastream.proto @@ -0,0 +1,1075 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.datastream.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/datastream/v1/datastream_resources.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.Datastream.V1"; +option go_package = "cloud.google.com/go/datastream/apiv1/datastreampb;datastreampb"; +option java_multiple_files = true; +option java_outer_classname = "DatastreamProto"; +option java_package = "com.google.cloud.datastream.v1"; +option php_namespace = "Google\\Cloud\\Datastream\\V1"; +option ruby_package = "Google::Cloud::Datastream::V1"; + +// Datastream service +service Datastream { + option (google.api.default_host) = "datastream.googleapis.com"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; + + // Use this method to list connection profiles created in a project and + // location. + rpc ListConnectionProfiles(ListConnectionProfilesRequest) + returns (ListConnectionProfilesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/connectionProfiles" + }; + option (google.api.method_signature) = "parent"; + } + + // Use this method to get details about a connection profile. + rpc GetConnectionProfile(GetConnectionProfileRequest) + returns (ConnectionProfile) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/connectionProfiles/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Use this method to create a connection profile in a project and location. + rpc CreateConnectionProfile(CreateConnectionProfileRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/connectionProfiles" + body: "connection_profile" + }; + option (google.api.method_signature) = + "parent,connection_profile,connection_profile_id"; + option (google.longrunning.operation_info) = { + response_type: "ConnectionProfile" + metadata_type: "OperationMetadata" + }; + } + + // Use this method to update the parameters of a connection profile. + rpc UpdateConnectionProfile(UpdateConnectionProfileRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{connection_profile.name=projects/*/locations/*/connectionProfiles/*}" + body: "connection_profile" + }; + option (google.api.method_signature) = "connection_profile,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "ConnectionProfile" + metadata_type: "OperationMetadata" + }; + } + + // Use this method to delete a connection profile. + rpc DeleteConnectionProfile(DeleteConnectionProfileRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/connectionProfiles/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Use this method to discover a connection profile. + // The discover API call exposes the data objects and metadata belonging to + // the profile. Typically, a request returns children data objects of a + // parent data object that's optionally supplied in the request. + rpc DiscoverConnectionProfile(DiscoverConnectionProfileRequest) + returns (DiscoverConnectionProfileResponse) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/connectionProfiles:discover" + body: "*" + }; + } + + // Use this method to list streams in a project and location. + rpc ListStreams(ListStreamsRequest) returns (ListStreamsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/streams" + }; + option (google.api.method_signature) = "parent"; + } + + // Use this method to get details about a stream. + rpc GetStream(GetStreamRequest) returns (Stream) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/streams/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Use this method to create a stream. + rpc CreateStream(CreateStreamRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/streams" + body: "stream" + }; + option (google.api.method_signature) = "parent,stream,stream_id"; + option (google.longrunning.operation_info) = { + response_type: "Stream" + metadata_type: "OperationMetadata" + }; + } + + // Use this method to update the configuration of a stream. + rpc UpdateStream(UpdateStreamRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{stream.name=projects/*/locations/*/streams/*}" + body: "stream" + }; + option (google.api.method_signature) = "stream,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Stream" + metadata_type: "OperationMetadata" + }; + } + + // Use this method to delete a stream. + rpc DeleteStream(DeleteStreamRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/streams/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Use this method to get details about a stream object. + rpc GetStreamObject(GetStreamObjectRequest) returns (StreamObject) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/streams/*/objects/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Use this method to look up a stream object by its source object identifier. + rpc LookupStreamObject(LookupStreamObjectRequest) returns (StreamObject) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/streams/*}/objects:lookup" + body: "*" + }; + } + + // Use this method to list the objects of a specific stream. + rpc ListStreamObjects(ListStreamObjectsRequest) + returns (ListStreamObjectsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/streams/*}/objects" + }; + option (google.api.method_signature) = "parent"; + } + + // Use this method to start a backfill job for the specified stream object. + rpc StartBackfillJob(StartBackfillJobRequest) + returns (StartBackfillJobResponse) { + option (google.api.http) = { + post: "/v1/{object=projects/*/locations/*/streams/*/objects/*}:startBackfillJob" + body: "*" + }; + option (google.api.method_signature) = "object"; + } + + // Use this method to stop a backfill job for the specified stream object. + rpc StopBackfillJob(StopBackfillJobRequest) + returns (StopBackfillJobResponse) { + option (google.api.http) = { + post: "/v1/{object=projects/*/locations/*/streams/*/objects/*}:stopBackfillJob" + body: "*" + }; + option (google.api.method_signature) = "object"; + } + + // The FetchStaticIps API call exposes the static IP addresses used by + // Datastream. + rpc FetchStaticIps(FetchStaticIpsRequest) returns (FetchStaticIpsResponse) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*}:fetchStaticIps" + }; + option (google.api.method_signature) = "name"; + } + + // Use this method to create a private connectivity configuration. + rpc CreatePrivateConnection(CreatePrivateConnectionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/privateConnections" + body: "private_connection" + }; + option (google.api.method_signature) = + "parent,private_connection,private_connection_id"; + option (google.longrunning.operation_info) = { + response_type: "PrivateConnection" + metadata_type: "OperationMetadata" + }; + } + + // Use this method to get details about a private connectivity configuration. + rpc GetPrivateConnection(GetPrivateConnectionRequest) + returns (PrivateConnection) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/privateConnections/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Use this method to list private connectivity configurations in a project + // and location. + rpc ListPrivateConnections(ListPrivateConnectionsRequest) + returns (ListPrivateConnectionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/privateConnections" + }; + option (google.api.method_signature) = "parent"; + } + + // Use this method to delete a private connectivity configuration. + rpc DeletePrivateConnection(DeletePrivateConnectionRequest) + returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/privateConnections/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Use this method to create a route for a private connectivity configuration + // in a project and location. + rpc CreateRoute(CreateRouteRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/privateConnections/*}/routes" + body: "route" + }; + option (google.api.method_signature) = "parent,route,route_id"; + option (google.longrunning.operation_info) = { + response_type: "Route" + metadata_type: "OperationMetadata" + }; + } + + // Use this method to get details about a route. + rpc GetRoute(GetRouteRequest) returns (Route) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/privateConnections/*/routes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Use this method to list routes created for a private connectivity + // configuration in a project and location. + rpc ListRoutes(ListRoutesRequest) returns (ListRoutesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/privateConnections/*}/routes" + }; + option (google.api.method_signature) = "parent"; + } + + // Use this method to delete a route. + rpc DeleteRoute(DeleteRouteRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/privateConnections/*/routes/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } +} + +// Request message for 'discover' ConnectionProfile request. +message DiscoverConnectionProfileRequest { + // Required. The parent resource of the connection profile type. Must be in + // the format `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/ConnectionProfile" + } + ]; + + // The connection profile on which to run discover. + oneof target { + // An ad-hoc connection profile configuration. + ConnectionProfile connection_profile = 200; + + // A reference to an existing connection profile. + string connection_profile_name = 201; + } + + // The depth of the retrieved hierarchy of data objects. + oneof hierarchy { + // Whether to retrieve the full hierarchy of data objects (TRUE) or only the + // current level (FALSE). + bool full_hierarchy = 3; + + // The number of hierarchy levels below the current level to be retrieved. + int32 hierarchy_depth = 4; + } + + // The data object to populate with child data objects and metadata. + oneof data_object { + // Oracle RDBMS to enrich with child data objects and metadata. + OracleRdbms oracle_rdbms = 100; + + // MySQL RDBMS to enrich with child data objects and metadata. + MysqlRdbms mysql_rdbms = 101; + + // PostgreSQL RDBMS to enrich with child data objects and metadata. + PostgresqlRdbms postgresql_rdbms = 102; + } +} + +// Response from a discover request. +message DiscoverConnectionProfileResponse { + // The data object that has been enriched by the discover API call. + oneof data_object { + // Enriched Oracle RDBMS object. + OracleRdbms oracle_rdbms = 100; + + // Enriched MySQL RDBMS object. + MysqlRdbms mysql_rdbms = 101; + + // Enriched PostgreSQL RDBMS object. + PostgresqlRdbms postgresql_rdbms = 102; + } +} + +// Request message for 'FetchStaticIps' request. +message FetchStaticIpsRequest { + // Required. The resource name for the location for which static IPs should be + // returned. Must be in the format `projects/*/locations/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Maximum number of Ips to return, will likely not be specified. + int32 page_size = 2; + + // A page token, received from a previous `ListStaticIps` call. + // will likely not be specified. + string page_token = 3; +} + +// Response message for a 'FetchStaticIps' response. +message FetchStaticIpsResponse { + // list of static ips by account + repeated string static_ips = 1; + + // A token that can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for listing connection profiles. +message ListConnectionProfilesRequest { + // Required. The parent that owns the collection of connection profiles. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/ConnectionProfile" + } + ]; + + // Maximum number of connection profiles to return. + // If unspecified, at most 50 connection profiles will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // Page token received from a previous `ListConnectionProfiles` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListConnectionProfiles` + // must match the call that provided the page token. + string page_token = 3; + + // Filter request. + string filter = 4; + + // Order by fields for the result. + string order_by = 5; +} + +// Response message for listing connection profiles. +message ListConnectionProfilesResponse { + // List of connection profiles. + repeated ConnectionProfile connection_profiles = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for getting a connection profile. +message GetConnectionProfileRequest { + // Required. The name of the connection profile resource to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/ConnectionProfile" + } + ]; +} + +// Request message for creating a connection profile. +message CreateConnectionProfileRequest { + // Required. The parent that owns the collection of ConnectionProfiles. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/ConnectionProfile" + } + ]; + + // Required. The connection profile identifier. + string connection_profile_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The connection profile resource to create. + ConnectionProfile connection_profile = 3 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only validate the connection profile, but don't create any + // resources. The default is false. + bool validate_only = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Create the connection profile without validating it. + bool force = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Connection profile update message. +message UpdateConnectionProfileRequest { + // Optional. Field mask is used to specify the fields to be overwritten in the + // ConnectionProfile resource by the update. + // The fields specified in the update_mask are relative to the resource, not + // the full request. A field will be overwritten if it is in the mask. If the + // user does not provide a mask then all fields will be overwritten. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Required. The connection profile to update. + ConnectionProfile connection_profile = 2 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only validate the connection profile, but don't update any + // resources. The default is false. + bool validate_only = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Update the connection profile without validating it. + bool force = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for deleting a connection profile. +message DeleteConnectionProfileRequest { + // Required. The name of the connection profile resource to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/ConnectionProfile" + } + ]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for listing streams. +message ListStreamsRequest { + // Required. The parent that owns the collection of streams. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/Stream" + } + ]; + + // Maximum number of streams to return. + // If unspecified, at most 50 streams will be returned. The maximum + // value is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // Page token received from a previous `ListStreams` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListStreams` + // must match the call that provided the page token. + string page_token = 3; + + // Filter request. + string filter = 4; + + // Order by fields for the result. + string order_by = 5; +} + +// Response message for listing streams. +message ListStreamsResponse { + // List of streams + repeated Stream streams = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request message for getting a stream. +message GetStreamRequest { + // Required. The name of the stream resource to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/Stream" + } + ]; +} + +// Request message for creating a stream. +message CreateStreamRequest { + // Required. The parent that owns the collection of streams. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/Stream" + } + ]; + + // Required. The stream identifier. + string stream_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The stream resource to create. + Stream stream = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only validate the stream, but don't create any resources. + // The default is false. + bool validate_only = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Create the stream without validating it. + bool force = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for updating a stream. +message UpdateStreamRequest { + // Optional. Field mask is used to specify the fields to be overwritten in the + // stream resource by the update. + // The fields specified in the update_mask are relative to the resource, not + // the full request. A field will be overwritten if it is in the mask. If the + // user does not provide a mask then all fields will be overwritten. + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = OPTIONAL]; + + // Required. The stream resource to update. + Stream stream = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only validate the stream with the changes, without actually + // updating it. The default is false. + bool validate_only = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Update the stream without validating it. + bool force = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for deleting a stream. +message DeleteStreamRequest { + // Required. The name of the stream resource to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/Stream" + } + ]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for fetching a specific stream object. +message GetStreamObjectRequest { + // Required. The name of the stream object resource to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/StreamObject" + } + ]; +} + +// Request for looking up a specific stream object by its source object +// identifier. +message LookupStreamObjectRequest { + // Required. The parent stream that owns the collection of objects. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/Stream" + } + ]; + + // Required. The source object identifier which maps to the stream object. + SourceObjectIdentifier source_object_identifier = 2 + [(google.api.field_behavior) = REQUIRED]; +} + +// Request for manually initiating a backfill job for a specific stream object. +message StartBackfillJobRequest { + // Required. The name of the stream object resource to start a backfill job + // for. + string object = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/StreamObject" + } + ]; +} + +// Response for manually initiating a backfill job for a specific stream object. +message StartBackfillJobResponse { + // The stream object resource a backfill job was started for. + StreamObject object = 1; +} + +// Request for manually stopping a running backfill job for a specific stream +// object. +message StopBackfillJobRequest { + // Required. The name of the stream object resource to stop the backfill job + // for. + string object = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/StreamObject" + } + ]; +} + +// Response for manually stop a backfill job for a specific stream object. +message StopBackfillJobResponse { + // The stream object resource the backfill job was stopped for. + StreamObject object = 1; +} + +// Request for listing all objects for a specific stream. +message ListStreamObjectsRequest { + // Required. The parent stream that owns the collection of objects. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/StreamObject" + } + ]; + + // Maximum number of objects to return. Default is 50. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // Page token received from a previous `ListStreamObjectsRequest` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // `ListStreamObjectsRequest` must match the call that provided the page + // token. + string page_token = 3; +} + +// Response containing the objects for a stream. +message ListStreamObjectsResponse { + // List of stream objects. + repeated StreamObject stream_objects = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + string next_page_token = 2; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a + // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + // `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Results of executed validations if there are any. + ValidationResult validation_result = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request for creating a private connection. +message CreatePrivateConnectionRequest { + // Required. The parent that owns the collection of PrivateConnections. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/PrivateConnection" + } + ]; + + // Required. The private connectivity identifier. + string private_connection_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Private Connectivity resource to create. + PrivateConnection private_connection = 3 + [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set to true, will skip validations. + bool force = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request for listing private connections. +message ListPrivateConnectionsRequest { + // Required. The parent that owns the collection of private connectivity + // configurations. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/PrivateConnection" + } + ]; + + // Maximum number of private connectivity configurations to return. + // If unspecified, at most 50 private connectivity configurations that will be + // returned. The maximum value is 1000; values above 1000 will be coerced to + // 1000. + int32 page_size = 2; + + // Page token received from a previous `ListPrivateConnections` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // `ListPrivateConnections` must match the call that provided the page + // token. + string page_token = 3; + + // Filter request. + string filter = 4; + + // Order by fields for the result. + string order_by = 5; +} + +// Response containing a list of private connection configurations. +message ListPrivateConnectionsResponse { + // List of private connectivity configurations. + repeated PrivateConnection private_connections = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request to delete a private connection. +message DeletePrivateConnectionRequest { + // Required. The name of the private connectivity configuration to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/PrivateConnection" + } + ]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set to true, any child routes that belong to this + // PrivateConnection will also be deleted. + bool force = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request to get a private connection configuration. +message GetPrivateConnectionRequest { + // Required. The name of the private connectivity configuration to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/PrivateConnection" + } + ]; +} + +// Route creation request. +message CreateRouteRequest { + // Required. The parent that owns the collection of Routes. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/Route" + } + ]; + + // Required. The Route identifier. + string route_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Route resource to create. + Route route = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Route list request. +message ListRoutesRequest { + // Required. The parent that owns the collection of Routess. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/Route" + } + ]; + + // Maximum number of Routes to return. The service may return + // fewer than this value. If unspecified, at most 50 Routes + // will be returned. The maximum value is 1000; values above 1000 will be + // coerced to 1000. + int32 page_size = 2; + + // Page token received from a previous `ListRoutes` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // `ListRoutes` must match the call that provided the page + // token. + string page_token = 3; + + // Filter request. + string filter = 4; + + // Order by fields for the result. + string order_by = 5; +} + +// Route list response. +message ListRoutesResponse { + // List of Routes. + repeated Route routes = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Route deletion request. +message DeleteRouteRequest { + // Required. The name of the Route resource to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/Route" + } + ]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Route get request. +message GetRouteRequest { + // Required. The name of the Route resource to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/Route" + } + ]; +} diff --git a/owl-bot-staging/google-cloud-datastream/v1/protos/google/cloud/datastream/v1/datastream_resources.proto b/owl-bot-staging/google-cloud-datastream/v1/protos/google/cloud/datastream/v1/datastream_resources.proto new file mode 100644 index 00000000000..1007939dc8b --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/protos/google/cloud/datastream/v1/datastream_resources.proto @@ -0,0 +1,1049 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.datastream.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Datastream.V1"; +option go_package = "cloud.google.com/go/datastream/apiv1/datastreampb;datastreampb"; +option java_multiple_files = true; +option java_outer_classname = "DatastreamResourcesProto"; +option java_package = "com.google.cloud.datastream.v1"; +option php_namespace = "Google\\Cloud\\Datastream\\V1"; +option ruby_package = "Google::Cloud::Datastream::V1"; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Networks" + pattern: "projects/{project}/global/networks/{network}" +}; + +// Oracle database profile. +message OracleProfile { + // Required. Hostname for the Oracle connection. + string hostname = 1 [(google.api.field_behavior) = REQUIRED]; + + // Port for the Oracle connection, default value is 1521. + int32 port = 2; + + // Required. Username for the Oracle connection. + string username = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Password for the Oracle connection. + string password = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. Database for the Oracle connection. + string database_service = 5 [(google.api.field_behavior) = REQUIRED]; + + // Connection string attributes + map connection_attributes = 6; +} + +// MySQL database profile. +message MysqlProfile { + // Required. Hostname for the MySQL connection. + string hostname = 1 [(google.api.field_behavior) = REQUIRED]; + + // Port for the MySQL connection, default value is 3306. + int32 port = 2; + + // Required. Username for the MySQL connection. + string username = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Input only. Password for the MySQL connection. + string password = 4 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = INPUT_ONLY + ]; + + // SSL configuration for the MySQL connection. + MysqlSslConfig ssl_config = 5; +} + +// PostgreSQL database profile. +message PostgresqlProfile { + // Required. Hostname for the PostgreSQL connection. + string hostname = 1 [(google.api.field_behavior) = REQUIRED]; + + // Port for the PostgreSQL connection, default value is 5432. + int32 port = 2; + + // Required. Username for the PostgreSQL connection. + string username = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Password for the PostgreSQL connection. + string password = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. Database for the PostgreSQL connection. + string database = 5 [(google.api.field_behavior) = REQUIRED]; +} + +// Cloud Storage bucket profile. +message GcsProfile { + // Required. The Cloud Storage bucket name. + string bucket = 1 [(google.api.field_behavior) = REQUIRED]; + + // The root path inside the Cloud Storage bucket. + string root_path = 2; +} + +// BigQuery warehouse profile. +message BigQueryProfile {} + +// Static IP address connectivity. Used when the source database is configured +// to allow incoming connections from the Datastream public IP addresses +// for the region specified in the connection profile. +message StaticServiceIpConnectivity {} + +// Forward SSH Tunnel connectivity. +message ForwardSshTunnelConnectivity { + // Required. Hostname for the SSH tunnel. + string hostname = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Username for the SSH tunnel. + string username = 2 [(google.api.field_behavior) = REQUIRED]; + + // Port for the SSH tunnel, default value is 22. + int32 port = 3; + + oneof authentication_method { + // Input only. SSH password. + string password = 100 [(google.api.field_behavior) = INPUT_ONLY]; + + // Input only. SSH private key. + string private_key = 101 [(google.api.field_behavior) = INPUT_ONLY]; + } +} + +// The VPC Peering configuration is used to create VPC peering between +// Datastream and the consumer's VPC. +message VpcPeeringConfig { + // Required. Fully qualified name of the VPC that Datastream will peer to. + // Format: `projects/{project}/global/{networks}/{name}` + string vpc = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "compute.googleapis.com/Networks" + } + ]; + + // Required. A free subnet for peering. (CIDR of /29) + string subnet = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The PrivateConnection resource is used to establish private connectivity +// between Datastream and a customer's network. +message PrivateConnection { + option (google.api.resource) = { + type: "datastream.googleapis.com/PrivateConnection" + pattern: "projects/{project}/locations/{location}/privateConnections/{private_connection}" + }; + + // Private Connection state. + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // The private connection is in creation state - creating resources. + CREATING = 1; + + // The private connection has been created with all of its resources. + CREATED = 2; + + // The private connection creation has failed. + FAILED = 3; + + // The private connection is being deleted. + DELETING = 4; + + // Delete request has failed, resource is in invalid state. + FAILED_TO_DELETE = 5; + } + + // Output only. The resource's name. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The create time of the resource. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The update time of the resource. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels. + map labels = 4; + + // Required. Display name. + string display_name = 5 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The state of the Private Connection. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. In case of error, the details of the error in a user-friendly + // format. + Error error = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // VPC Peering Config. + VpcPeeringConfig vpc_peering_config = 100; +} + +// Private Connectivity +message PrivateConnectivity { + // Required. A reference to a private connection resource. + // Format: `projects/{project}/locations/{location}/privateConnections/{name}` + string private_connection = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/PrivateConnection" + } + ]; +} + +// The route resource is the child of the private connection resource, +// used for defining a route for a private connection. +message Route { + option (google.api.resource) = { + type: "datastream.googleapis.com/Route" + pattern: "projects/{project}/locations/{location}/privateConnections/{private_connection}/routes/{route}" + }; + + // Output only. The resource's name. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The create time of the resource. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The update time of the resource. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels. + map labels = 4; + + // Required. Display name. + string display_name = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. Destination address for connection + string destination_address = 6 [(google.api.field_behavior) = REQUIRED]; + + // Destination port for connection + int32 destination_port = 7; +} + +// MySQL SSL configuration information. +message MysqlSslConfig { + // Input only. PEM-encoded private key associated with the Client Certificate. + // If this field is used then the 'client_certificate' and the + // 'ca_certificate' fields are mandatory. + string client_key = 1 [(google.api.field_behavior) = INPUT_ONLY]; + + // Output only. Indicates whether the client_key field is set. + bool client_key_set = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Input only. PEM-encoded certificate that will be used by the replica to + // authenticate against the source database server. If this field is used + // then the 'client_key' and the 'ca_certificate' fields are mandatory. + string client_certificate = 3 [(google.api.field_behavior) = INPUT_ONLY]; + + // Output only. Indicates whether the client_certificate field is set. + bool client_certificate_set = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Input only. PEM-encoded certificate of the CA that signed the source + // database server's certificate. + string ca_certificate = 5 [(google.api.field_behavior) = INPUT_ONLY]; + + // Output only. Indicates whether the ca_certificate field is set. + bool ca_certificate_set = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A set of reusable connection configurations to be used as a source or +// destination for a stream. +message ConnectionProfile { + option (google.api.resource) = { + type: "datastream.googleapis.com/ConnectionProfile" + pattern: "projects/{project}/locations/{location}/connectionProfiles/{connection_profile}" + }; + + // Output only. The resource's name. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The create time of the resource. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The update time of the resource. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels. + map labels = 4; + + // Required. Display name. + string display_name = 5 [(google.api.field_behavior) = REQUIRED]; + + // Connection configuration for the ConnectionProfile. + oneof profile { + // Oracle ConnectionProfile configuration. + OracleProfile oracle_profile = 100; + + // Cloud Storage ConnectionProfile configuration. + GcsProfile gcs_profile = 101; + + // MySQL ConnectionProfile configuration. + MysqlProfile mysql_profile = 102; + + // BigQuery Connection Profile configuration. + BigQueryProfile bigquery_profile = 103; + + // PostgreSQL Connection Profile configuration. + PostgresqlProfile postgresql_profile = 104; + } + + // Connectivity options used to establish a connection to the profile. + oneof connectivity { + // Static Service IP connectivity. + StaticServiceIpConnectivity static_service_ip_connectivity = 200; + + // Forward SSH tunnel connectivity. + ForwardSshTunnelConnectivity forward_ssh_connectivity = 201; + + // Private connectivity. + PrivateConnectivity private_connectivity = 202; + } +} + +// Oracle Column. +message OracleColumn { + // Column name. + string column = 1; + + // The Oracle data type. + string data_type = 2; + + // Column length. + int32 length = 3; + + // Column precision. + int32 precision = 4; + + // Column scale. + int32 scale = 5; + + // Column encoding. + string encoding = 6; + + // Whether or not the column represents a primary key. + bool primary_key = 7; + + // Whether or not the column can accept a null value. + bool nullable = 8; + + // The ordinal position of the column in the table. + int32 ordinal_position = 9; +} + +// Oracle table. +message OracleTable { + // Table name. + string table = 1; + + // Oracle columns in the schema. + // When unspecified as part of include/exclude objects, includes/excludes + // everything. + repeated OracleColumn oracle_columns = 2; +} + +// Oracle schema. +message OracleSchema { + // Schema name. + string schema = 1; + + // Tables in the schema. + repeated OracleTable oracle_tables = 2; +} + +// Oracle database structure. +message OracleRdbms { + // Oracle schemas/databases in the database server. + repeated OracleSchema oracle_schemas = 1; +} + +// Oracle data source configuration +message OracleSourceConfig { + // Configuration to drop large object values. + message DropLargeObjects {} + + // Configuration to stream large object values. + message StreamLargeObjects {} + + // Oracle objects to include in the stream. + OracleRdbms include_objects = 1; + + // Oracle objects to exclude from the stream. + OracleRdbms exclude_objects = 2; + + // Maximum number of concurrent CDC tasks. The number should be non-negative. + // If not set (or set to 0), the system's default value is used. + int32 max_concurrent_cdc_tasks = 3; + + // Maximum number of concurrent backfill tasks. The number should be + // non-negative. If not set (or set to 0), the system's default value is used. + int32 max_concurrent_backfill_tasks = 4; + + // The configuration for handle Oracle large objects. + oneof large_objects_handling { + // Drop large object values. + DropLargeObjects drop_large_objects = 100; + + // Stream large object values. NOTE: This feature is currently experimental. + StreamLargeObjects stream_large_objects = 102; + } +} + +// PostgreSQL Column. +message PostgresqlColumn { + // Column name. + string column = 1; + + // The PostgreSQL data type. + string data_type = 2; + + // Column length. + int32 length = 3; + + // Column precision. + int32 precision = 4; + + // Column scale. + int32 scale = 5; + + // Whether or not the column represents a primary key. + bool primary_key = 7; + + // Whether or not the column can accept a null value. + bool nullable = 8; + + // The ordinal position of the column in the table. + int32 ordinal_position = 9; +} + +// PostgreSQL table. +message PostgresqlTable { + // Table name. + string table = 1; + + // PostgreSQL columns in the schema. + // When unspecified as part of include/exclude objects, + // includes/excludes everything. + repeated PostgresqlColumn postgresql_columns = 2; +} + +// PostgreSQL schema. +message PostgresqlSchema { + // Schema name. + string schema = 1; + + // Tables in the schema. + repeated PostgresqlTable postgresql_tables = 2; +} + +// PostgreSQL database structure. +message PostgresqlRdbms { + // PostgreSQL schemas in the database server. + repeated PostgresqlSchema postgresql_schemas = 1; +} + +// PostgreSQL data source configuration +message PostgresqlSourceConfig { + // PostgreSQL objects to include in the stream. + PostgresqlRdbms include_objects = 1; + + // PostgreSQL objects to exclude from the stream. + PostgresqlRdbms exclude_objects = 2; + + // Required. Immutable. The name of the logical replication slot that's + // configured with the pgoutput plugin. + string replication_slot = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; + + // Required. The name of the publication that includes the set of all tables + // that are defined in the stream's include_objects. + string publication = 4 [(google.api.field_behavior) = REQUIRED]; + + // Maximum number of concurrent backfill tasks. The number should be non + // negative. If not set (or set to 0), the system's default value will be + // used. + int32 max_concurrent_backfill_tasks = 5; +} + +// MySQL Column. +message MysqlColumn { + // Column name. + string column = 1; + + // The MySQL data type. Full data types list can be found here: + // https://dev.mysql.com/doc/refman/8.0/en/data-types.html + string data_type = 2; + + // Column length. + int32 length = 3; + + // Column collation. + string collation = 4; + + // Whether or not the column represents a primary key. + bool primary_key = 5; + + // Whether or not the column can accept a null value. + bool nullable = 6; + + // The ordinal position of the column in the table. + int32 ordinal_position = 7; +} + +// MySQL table. +message MysqlTable { + // Table name. + string table = 1; + + // MySQL columns in the database. + // When unspecified as part of include/exclude objects, includes/excludes + // everything. + repeated MysqlColumn mysql_columns = 2; +} + +// MySQL database. +message MysqlDatabase { + // Database name. + string database = 1; + + // Tables in the database. + repeated MysqlTable mysql_tables = 2; +} + +// MySQL database structure +message MysqlRdbms { + // Mysql databases on the server + repeated MysqlDatabase mysql_databases = 1; +} + +// MySQL source configuration +message MysqlSourceConfig { + // MySQL objects to retrieve from the source. + MysqlRdbms include_objects = 1; + + // MySQL objects to exclude from the stream. + MysqlRdbms exclude_objects = 2; + + // Maximum number of concurrent CDC tasks. The number should be non negative. + // If not set (or set to 0), the system's default value will be used. + int32 max_concurrent_cdc_tasks = 3; + + // Maximum number of concurrent backfill tasks. The number should be non + // negative. If not set (or set to 0), the system's default value will be + // used. + int32 max_concurrent_backfill_tasks = 4; +} + +// The configuration of the stream source. +message SourceConfig { + // Required. Source connection profile resoource. + // Format: `projects/{project}/locations/{location}/connectionProfiles/{name}` + string source_connection_profile = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/ConnectionProfile" + } + ]; + + // Stream configuration that is specific to the data source type. + oneof source_stream_config { + // Oracle data source configuration. + OracleSourceConfig oracle_source_config = 100; + + // MySQL data source configuration. + MysqlSourceConfig mysql_source_config = 101; + + // PostgreSQL data source configuration. + PostgresqlSourceConfig postgresql_source_config = 102; + } +} + +// AVRO file format configuration. +message AvroFileFormat {} + +// JSON file format configuration. +message JsonFileFormat { + // Schema file format. + enum SchemaFileFormat { + // Unspecified schema file format. + SCHEMA_FILE_FORMAT_UNSPECIFIED = 0; + + // Do not attach schema file. + NO_SCHEMA_FILE = 1; + + // Avro schema format. + AVRO_SCHEMA_FILE = 2; + } + + // Json file compression. + enum JsonCompression { + // Unspecified json file compression. + JSON_COMPRESSION_UNSPECIFIED = 0; + + // Do not compress JSON file. + NO_COMPRESSION = 1; + + // Gzip compression. + GZIP = 2; + } + + // The schema file format along JSON data files. + SchemaFileFormat schema_file_format = 1; + + // Compression of the loaded JSON file. + JsonCompression compression = 2; +} + +// Google Cloud Storage destination configuration +message GcsDestinationConfig { + // Path inside the Cloud Storage bucket to write data to. + string path = 1; + + // The maximum file size to be saved in the bucket. + int32 file_rotation_mb = 2; + + // The maximum duration for which new events are added before a file is + // closed and a new file is created. Values within the range of 15-60 seconds + // are allowed. + google.protobuf.Duration file_rotation_interval = 3; + + // File Format that the data should be written in. + oneof file_format { + // AVRO file format configuration. + AvroFileFormat avro_file_format = 100; + + // JSON file format configuration. + JsonFileFormat json_file_format = 101; + } +} + +// BigQuery destination configuration +message BigQueryDestinationConfig { + // A single target dataset to which all data will be streamed. + message SingleTargetDataset { + // The dataset ID of the target dataset. + string dataset_id = 1; + } + + // Destination datasets are created so that hierarchy of the destination data + // objects matches the source hierarchy. + message SourceHierarchyDatasets { + // Dataset template used for dynamic dataset creation. + message DatasetTemplate { + // Required. The geographic location where the dataset should reside. See + // https://cloud.google.com/bigquery/docs/locations for supported + // locations. + string location = 1 [(google.api.field_behavior) = REQUIRED]; + + // If supplied, every created dataset will have its name prefixed by the + // provided value. The prefix and name will be separated by an underscore. + // i.e. _. + string dataset_id_prefix = 2; + + // Describes the Cloud KMS encryption key that will be used to + // protect destination BigQuery table. The BigQuery Service Account + // associated with your project requires access to this encryption key. + // i.e. + // projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{cryptoKey}. + // See https://cloud.google.com/bigquery/docs/customer-managed-encryption + // for more information. + string kms_key_name = 3; + } + + // The dataset template to use for dynamic dataset creation. + DatasetTemplate dataset_template = 2; + } + + // Target dataset(s) configuration. + oneof dataset_config { + // Single destination dataset. + SingleTargetDataset single_target_dataset = 201; + + // Source hierarchy datasets. + SourceHierarchyDatasets source_hierarchy_datasets = 202; + } + + // The guaranteed data freshness (in seconds) when querying tables created by + // the stream. Editing this field will only affect new tables created in the + // future, but existing tables will not be impacted. Lower values mean that + // queries will return fresher data, but may result in higher cost. + google.protobuf.Duration data_freshness = 300; +} + +// The configuration of the stream destination. +message DestinationConfig { + // Required. Destination connection profile resource. + // Format: `projects/{project}/locations/{location}/connectionProfiles/{name}` + string destination_connection_profile = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/ConnectionProfile" + } + ]; + + // Stream configuration that is specific to the data destination type. + oneof destination_stream_config { + // A configuration for how data should be loaded to Cloud Storage. + GcsDestinationConfig gcs_destination_config = 100; + + // BigQuery destination configuration. + BigQueryDestinationConfig bigquery_destination_config = 101; + } +} + +// A resource representing streaming data from a source to a destination. +message Stream { + option (google.api.resource) = { + type: "datastream.googleapis.com/Stream" + pattern: "projects/{project}/locations/{location}/streams/{stream}" + }; + + // Stream state. + enum State { + // Unspecified stream state. + STATE_UNSPECIFIED = 0; + + // The stream has been created but has not yet started streaming data. + NOT_STARTED = 1; + + // The stream is running. + RUNNING = 2; + + // The stream is paused. + PAUSED = 3; + + // The stream is in maintenance mode. + // + // Updates are rejected on the resource in this state. + MAINTENANCE = 4; + + // The stream is experiencing an error that is preventing data from being + // streamed. + FAILED = 5; + + // The stream has experienced a terminal failure. + FAILED_PERMANENTLY = 6; + + // The stream is starting, but not yet running. + STARTING = 7; + + // The Stream is no longer reading new events, but still writing events in + // the buffer. + DRAINING = 8; + } + + // Backfill strategy to automatically backfill the Stream's objects. + // Specific objects can be excluded. + message BackfillAllStrategy { + // List of objects to exclude. + oneof excluded_objects { + // Oracle data source objects to avoid backfilling. + OracleRdbms oracle_excluded_objects = 1; + + // MySQL data source objects to avoid backfilling. + MysqlRdbms mysql_excluded_objects = 2; + + // PostgreSQL data source objects to avoid backfilling. + PostgresqlRdbms postgresql_excluded_objects = 3; + } + } + + // Backfill strategy to disable automatic backfill for the Stream's objects. + message BackfillNoneStrategy {} + + // Output only. The stream's name. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The creation time of the stream. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update time of the stream. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels. + map labels = 4; + + // Required. Display name. + string display_name = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. Source connection profile configuration. + SourceConfig source_config = 6 [(google.api.field_behavior) = REQUIRED]; + + // Required. Destination connection profile configuration. + DestinationConfig destination_config = 7 + [(google.api.field_behavior) = REQUIRED]; + + // The state of the stream. + State state = 8; + + // Stream backfill strategy. + oneof backfill_strategy { + // Automatically backfill objects included in the stream source + // configuration. Specific objects can be excluded. + BackfillAllStrategy backfill_all = 101; + + // Do not automatically backfill any objects. + BackfillNoneStrategy backfill_none = 102; + } + + // Output only. Errors on the Stream. + repeated Error errors = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. A reference to a KMS encryption key. + // If provided, it will be used to encrypt the data. + // If left blank, data will be encrypted using an internal Stream-specific + // encryption key provisioned through KMS. + optional string customer_managed_encryption_key = 10 + [(google.api.field_behavior) = IMMUTABLE]; +} + +// A specific stream object (e.g a specific DB table). +message StreamObject { + option (google.api.resource) = { + type: "datastream.googleapis.com/StreamObject" + pattern: "projects/{project}/locations/{location}/streams/{stream}/objects/{object}" + }; + + // Output only. The object resource's name. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The creation time of the object. + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update time of the object. + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Display name. + string display_name = 5 [(google.api.field_behavior) = REQUIRED]; + + // Output only. Active errors on the object. + repeated Error errors = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The latest backfill job that was initiated for the stream object. + BackfillJob backfill_job = 7; + + // The object identifier in the data source. + SourceObjectIdentifier source_object = 8; +} + +// Represents an identifier of an object in the data source. +message SourceObjectIdentifier { + // Oracle data source object identifier. + message OracleObjectIdentifier { + // Required. The schema name. + string schema = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The table name. + string table = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // PostgreSQL data source object identifier. + message PostgresqlObjectIdentifier { + // Required. The schema name. + string schema = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The table name. + string table = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // Mysql data source object identifier. + message MysqlObjectIdentifier { + // Required. The database name. + string database = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The table name. + string table = 2 [(google.api.field_behavior) = REQUIRED]; + } + + // The identifier for an object in the data source. + oneof source_identifier { + // Oracle data source object identifier. + OracleObjectIdentifier oracle_identifier = 1; + + // Mysql data source object identifier. + MysqlObjectIdentifier mysql_identifier = 2; + + // PostgreSQL data source object identifier. + PostgresqlObjectIdentifier postgresql_identifier = 3; + } +} + +// Represents a backfill job on a specific stream object. +message BackfillJob { + // State of the stream object's backfill job. + enum State { + // Default value. + STATE_UNSPECIFIED = 0; + + // Backfill job was never started for the stream object (stream has backfill + // strategy defined as manual or object was explicitly excluded from + // automatic backfill). + NOT_STARTED = 1; + + // Backfill job will start pending available resources. + PENDING = 2; + + // Backfill job is running. + ACTIVE = 3; + + // Backfill job stopped (next job run will start from beginning). + STOPPED = 4; + + // Backfill job failed (due to an error). + FAILED = 5; + + // Backfill completed successfully. + COMPLETED = 6; + + // Backfill job failed since the table structure is currently unsupported + // for backfill. + UNSUPPORTED = 7; + } + + // Triggering reason for a backfill job. + enum Trigger { + // Default value. + TRIGGER_UNSPECIFIED = 0; + + // Object backfill job was triggered automatically according to the stream's + // backfill strategy. + AUTOMATIC = 1; + + // Object backfill job was triggered manually using the dedicated API. + MANUAL = 2; + } + + // Backfill job state. + State state = 1; + + // Backfill job's triggering reason. + Trigger trigger = 2; + + // Output only. Backfill job's start time. + google.protobuf.Timestamp last_start_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Backfill job's end time. + google.protobuf.Timestamp last_end_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Errors which caused the backfill job to fail. + repeated Error errors = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represent a user-facing Error. +message Error { + // A title that explains the reason for the error. + string reason = 1; + + // A unique identifier for this specific error, + // allowing it to be traced throughout the system in logs and API responses. + string error_uuid = 2; + + // A message containing more information about the error that occurred. + string message = 3; + + // The time when the error occurred. + google.protobuf.Timestamp error_time = 4; + + // Additional information about the error. + map details = 5; +} + +// Contains the current validation results. +message ValidationResult { + // A list of validations (includes both executed as well as not executed + // validations). + repeated Validation validations = 1; +} + +// A validation to perform on a stream. +message Validation { + // Validation execution state. + enum State { + // Unspecified state. + STATE_UNSPECIFIED = 0; + + // Validation did not execute. + NOT_EXECUTED = 1; + + // Validation failed. + FAILED = 2; + + // Validation passed. + PASSED = 3; + } + + // A short description of the validation. + string description = 1; + + // Validation execution status. + State state = 2; + + // Messages reflecting the validation results. + repeated ValidationMessage message = 3; + + // A custom code identifying this validation. + string code = 4; +} + +// Represent user-facing validation result message. +message ValidationMessage { + // Validation message level. + enum Level { + // Unspecified level. + LEVEL_UNSPECIFIED = 0; + + // Potentially cause issues with the Stream. + WARNING = 1; + + // Definitely cause issues with the Stream. + ERROR = 2; + } + + // The result of the validation. + string message = 1; + + // Message severity level (warning or error). + Level level = 2; + + // Additional metadata related to the result. + map metadata = 3; + + // A custom code identifying this specific message. + string code = 4; +} diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_connection_profile.js new file mode 100644 index 00000000000..34ad81ed63b --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_connection_profile.js @@ -0,0 +1,95 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, connectionProfileId, connectionProfile) { + // [START datastream_v1_generated_Datastream_CreateConnectionProfile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent that owns the collection of ConnectionProfiles. + */ + // const parent = 'abc123' + /** + * Required. The connection profile identifier. + */ + // const connectionProfileId = 'abc123' + /** + * Required. The connection profile resource to create. + */ + // const connectionProfile = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + /** + * Optional. Only validate the connection profile, but don't create any + * resources. The default is false. + */ + // const validateOnly = true + /** + * Optional. Create the connection profile without validating it. + */ + // const force = true + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callCreateConnectionProfile() { + // Construct request + const request = { + parent, + connectionProfileId, + connectionProfile, + }; + + // Run request + const [operation] = await datastreamClient.createConnectionProfile(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateConnectionProfile(); + // [END datastream_v1_generated_Datastream_CreateConnectionProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_private_connection.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_private_connection.js new file mode 100644 index 00000000000..15cbea3137f --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_private_connection.js @@ -0,0 +1,90 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, privateConnectionId, privateConnection) { + // [START datastream_v1_generated_Datastream_CreatePrivateConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent that owns the collection of PrivateConnections. + */ + // const parent = 'abc123' + /** + * Required. The private connectivity identifier. + */ + // const privateConnectionId = 'abc123' + /** + * Required. The Private Connectivity resource to create. + */ + // const privateConnection = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + /** + * Optional. If set to true, will skip validations. + */ + // const force = true + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callCreatePrivateConnection() { + // Construct request + const request = { + parent, + privateConnectionId, + privateConnection, + }; + + // Run request + const [operation] = await datastreamClient.createPrivateConnection(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreatePrivateConnection(); + // [END datastream_v1_generated_Datastream_CreatePrivateConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_route.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_route.js new file mode 100644 index 00000000000..cd04e6cd822 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_route.js @@ -0,0 +1,86 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, routeId, route) { + // [START datastream_v1_generated_Datastream_CreateRoute_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent that owns the collection of Routes. + */ + // const parent = 'abc123' + /** + * Required. The Route identifier. + */ + // const routeId = 'abc123' + /** + * Required. The Route resource to create. + */ + // const route = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callCreateRoute() { + // Construct request + const request = { + parent, + routeId, + route, + }; + + // Run request + const [operation] = await datastreamClient.createRoute(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateRoute(); + // [END datastream_v1_generated_Datastream_CreateRoute_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_stream.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_stream.js new file mode 100644 index 00000000000..db7c0107ffc --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_stream.js @@ -0,0 +1,95 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, streamId, stream) { + // [START datastream_v1_generated_Datastream_CreateStream_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent that owns the collection of streams. + */ + // const parent = 'abc123' + /** + * Required. The stream identifier. + */ + // const streamId = 'abc123' + /** + * Required. The stream resource to create. + */ + // const stream = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + /** + * Optional. Only validate the stream, but don't create any resources. + * The default is false. + */ + // const validateOnly = true + /** + * Optional. Create the stream without validating it. + */ + // const force = true + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callCreateStream() { + // Construct request + const request = { + parent, + streamId, + stream, + }; + + // Run request + const [operation] = await datastreamClient.createStream(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateStream(); + // [END datastream_v1_generated_Datastream_CreateStream_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_connection_profile.js new file mode 100644 index 00000000000..0b5811358e1 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_connection_profile.js @@ -0,0 +1,76 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1_generated_Datastream_DeleteConnectionProfile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the connection profile resource to delete. + */ + // const name = 'abc123' + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callDeleteConnectionProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await datastreamClient.deleteConnectionProfile(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteConnectionProfile(); + // [END datastream_v1_generated_Datastream_DeleteConnectionProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_private_connection.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_private_connection.js new file mode 100644 index 00000000000..5ca12d1ac7f --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_private_connection.js @@ -0,0 +1,81 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1_generated_Datastream_DeletePrivateConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the private connectivity configuration to delete. + */ + // const name = 'abc123' + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + /** + * Optional. If set to true, any child routes that belong to this + * PrivateConnection will also be deleted. + */ + // const force = true + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callDeletePrivateConnection() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await datastreamClient.deletePrivateConnection(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeletePrivateConnection(); + // [END datastream_v1_generated_Datastream_DeletePrivateConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_route.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_route.js new file mode 100644 index 00000000000..803e9f600ad --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_route.js @@ -0,0 +1,76 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1_generated_Datastream_DeleteRoute_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Route resource to delete. + */ + // const name = 'abc123' + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callDeleteRoute() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await datastreamClient.deleteRoute(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteRoute(); + // [END datastream_v1_generated_Datastream_DeleteRoute_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_stream.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_stream.js new file mode 100644 index 00000000000..4febc027f8c --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_stream.js @@ -0,0 +1,76 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1_generated_Datastream_DeleteStream_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the stream resource to delete. + */ + // const name = 'abc123' + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callDeleteStream() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await datastreamClient.deleteStream(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteStream(); + // [END datastream_v1_generated_Datastream_DeleteStream_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.discover_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.discover_connection_profile.js new file mode 100644 index 00000000000..3627ae02f73 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.discover_connection_profile.js @@ -0,0 +1,91 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START datastream_v1_generated_Datastream_DiscoverConnectionProfile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource of the connection profile type. Must be in + * the format `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * An ad-hoc connection profile configuration. + */ + // const connectionProfile = {} + /** + * A reference to an existing connection profile. + */ + // const connectionProfileName = 'abc123' + /** + * Whether to retrieve the full hierarchy of data objects (TRUE) or only the + * current level (FALSE). + */ + // const fullHierarchy = true + /** + * The number of hierarchy levels below the current level to be retrieved. + */ + // const hierarchyDepth = 1234 + /** + * Oracle RDBMS to enrich with child data objects and metadata. + */ + // const oracleRdbms = {} + /** + * MySQL RDBMS to enrich with child data objects and metadata. + */ + // const mysqlRdbms = {} + /** + * PostgreSQL RDBMS to enrich with child data objects and metadata. + */ + // const postgresqlRdbms = {} + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callDiscoverConnectionProfile() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await datastreamClient.discoverConnectionProfile(request); + console.log(response); + } + + callDiscoverConnectionProfile(); + // [END datastream_v1_generated_Datastream_DiscoverConnectionProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.fetch_static_ips.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.fetch_static_ips.js new file mode 100644 index 00000000000..fb209ac613b --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.fetch_static_ips.js @@ -0,0 +1,73 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1_generated_Datastream_FetchStaticIps_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name for the location for which static IPs should be + * returned. Must be in the format `projects/* /locations/*`. + */ + // const name = 'abc123' + /** + * Maximum number of Ips to return, will likely not be specified. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListStaticIps` call. + * will likely not be specified. + */ + // const pageToken = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callFetchStaticIps() { + // Construct request + const request = { + name, + }; + + // Run request + const iterable = await datastreamClient.fetchStaticIpsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callFetchStaticIps(); + // [END datastream_v1_generated_Datastream_FetchStaticIps_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_connection_profile.js new file mode 100644 index 00000000000..c6ad977d673 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_connection_profile.js @@ -0,0 +1,61 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1_generated_Datastream_GetConnectionProfile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the connection profile resource to get. + */ + // const name = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callGetConnectionProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await datastreamClient.getConnectionProfile(request); + console.log(response); + } + + callGetConnectionProfile(); + // [END datastream_v1_generated_Datastream_GetConnectionProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_private_connection.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_private_connection.js new file mode 100644 index 00000000000..b1a85f7f53c --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_private_connection.js @@ -0,0 +1,61 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1_generated_Datastream_GetPrivateConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the private connectivity configuration to get. + */ + // const name = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callGetPrivateConnection() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await datastreamClient.getPrivateConnection(request); + console.log(response); + } + + callGetPrivateConnection(); + // [END datastream_v1_generated_Datastream_GetPrivateConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_route.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_route.js new file mode 100644 index 00000000000..f9782c6f3b8 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_route.js @@ -0,0 +1,61 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1_generated_Datastream_GetRoute_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Route resource to get. + */ + // const name = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callGetRoute() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await datastreamClient.getRoute(request); + console.log(response); + } + + callGetRoute(); + // [END datastream_v1_generated_Datastream_GetRoute_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_stream.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_stream.js new file mode 100644 index 00000000000..43f5bf98513 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_stream.js @@ -0,0 +1,61 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1_generated_Datastream_GetStream_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the stream resource to get. + */ + // const name = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callGetStream() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await datastreamClient.getStream(request); + console.log(response); + } + + callGetStream(); + // [END datastream_v1_generated_Datastream_GetStream_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_stream_object.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_stream_object.js new file mode 100644 index 00000000000..532cd55313f --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_stream_object.js @@ -0,0 +1,61 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1_generated_Datastream_GetStreamObject_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the stream object resource to get. + */ + // const name = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callGetStreamObject() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await datastreamClient.getStreamObject(request); + console.log(response); + } + + callGetStreamObject(); + // [END datastream_v1_generated_Datastream_GetStreamObject_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_connection_profiles.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_connection_profiles.js new file mode 100644 index 00000000000..7d5a0f9f037 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_connection_profiles.js @@ -0,0 +1,84 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START datastream_v1_generated_Datastream_ListConnectionProfiles_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent that owns the collection of connection profiles. + */ + // const parent = 'abc123' + /** + * Maximum number of connection profiles to return. + * If unspecified, at most 50 connection profiles will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * Page token received from a previous `ListConnectionProfiles` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListConnectionProfiles` + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Filter request. + */ + // const filter = 'abc123' + /** + * Order by fields for the result. + */ + // const orderBy = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callListConnectionProfiles() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await datastreamClient.listConnectionProfilesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConnectionProfiles(); + // [END datastream_v1_generated_Datastream_ListConnectionProfiles_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_private_connections.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_private_connections.js new file mode 100644 index 00000000000..417b8d77b75 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_private_connections.js @@ -0,0 +1,87 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START datastream_v1_generated_Datastream_ListPrivateConnections_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent that owns the collection of private connectivity + * configurations. + */ + // const parent = 'abc123' + /** + * Maximum number of private connectivity configurations to return. + * If unspecified, at most 50 private connectivity configurations that will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + */ + // const pageSize = 1234 + /** + * Page token received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + */ + // const pageToken = 'abc123' + /** + * Filter request. + */ + // const filter = 'abc123' + /** + * Order by fields for the result. + */ + // const orderBy = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callListPrivateConnections() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await datastreamClient.listPrivateConnectionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListPrivateConnections(); + // [END datastream_v1_generated_Datastream_ListPrivateConnections_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_routes.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_routes.js new file mode 100644 index 00000000000..8919ccee0b9 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_routes.js @@ -0,0 +1,86 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START datastream_v1_generated_Datastream_ListRoutes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent that owns the collection of Routess. + */ + // const parent = 'abc123' + /** + * Maximum number of Routes to return. The service may return + * fewer than this value. If unspecified, at most 50 Routes + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + */ + // const pageSize = 1234 + /** + * Page token received from a previous `ListRoutes` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListRoutes` must match the call that provided the page + * token. + */ + // const pageToken = 'abc123' + /** + * Filter request. + */ + // const filter = 'abc123' + /** + * Order by fields for the result. + */ + // const orderBy = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callListRoutes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await datastreamClient.listRoutesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListRoutes(); + // [END datastream_v1_generated_Datastream_ListRoutes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_stream_objects.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_stream_objects.js new file mode 100644 index 00000000000..c235a73bb99 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_stream_objects.js @@ -0,0 +1,76 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START datastream_v1_generated_Datastream_ListStreamObjects_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent stream that owns the collection of objects. + */ + // const parent = 'abc123' + /** + * Maximum number of objects to return. Default is 50. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * Page token received from a previous `ListStreamObjectsRequest` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListStreamObjectsRequest` must match the call that provided the page + * token. + */ + // const pageToken = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callListStreamObjects() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await datastreamClient.listStreamObjectsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListStreamObjects(); + // [END datastream_v1_generated_Datastream_ListStreamObjects_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_streams.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_streams.js new file mode 100644 index 00000000000..1e0316308b3 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_streams.js @@ -0,0 +1,84 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START datastream_v1_generated_Datastream_ListStreams_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent that owns the collection of streams. + */ + // const parent = 'abc123' + /** + * Maximum number of streams to return. + * If unspecified, at most 50 streams will be returned. The maximum + * value is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * Page token received from a previous `ListStreams` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListStreams` + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Filter request. + */ + // const filter = 'abc123' + /** + * Order by fields for the result. + */ + // const orderBy = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callListStreams() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await datastreamClient.listStreamsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListStreams(); + // [END datastream_v1_generated_Datastream_ListStreams_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.lookup_stream_object.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.lookup_stream_object.js new file mode 100644 index 00000000000..e526dd600d5 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.lookup_stream_object.js @@ -0,0 +1,66 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, sourceObjectIdentifier) { + // [START datastream_v1_generated_Datastream_LookupStreamObject_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent stream that owns the collection of objects. + */ + // const parent = 'abc123' + /** + * Required. The source object identifier which maps to the stream object. + */ + // const sourceObjectIdentifier = {} + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callLookupStreamObject() { + // Construct request + const request = { + parent, + sourceObjectIdentifier, + }; + + // Run request + const response = await datastreamClient.lookupStreamObject(request); + console.log(response); + } + + callLookupStreamObject(); + // [END datastream_v1_generated_Datastream_LookupStreamObject_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.start_backfill_job.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.start_backfill_job.js new file mode 100644 index 00000000000..8143825d24d --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.start_backfill_job.js @@ -0,0 +1,62 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(object) { + // [START datastream_v1_generated_Datastream_StartBackfillJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the stream object resource to start a backfill job + * for. + */ + // const object = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callStartBackfillJob() { + // Construct request + const request = { + object, + }; + + // Run request + const response = await datastreamClient.startBackfillJob(request); + console.log(response); + } + + callStartBackfillJob(); + // [END datastream_v1_generated_Datastream_StartBackfillJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.stop_backfill_job.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.stop_backfill_job.js new file mode 100644 index 00000000000..d5d41bf6f0c --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.stop_backfill_job.js @@ -0,0 +1,62 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(object) { + // [START datastream_v1_generated_Datastream_StopBackfillJob_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the stream object resource to stop the backfill job + * for. + */ + // const object = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callStopBackfillJob() { + // Construct request + const request = { + object, + }; + + // Run request + const response = await datastreamClient.stopBackfillJob(request); + console.log(response); + } + + callStopBackfillJob(); + // [END datastream_v1_generated_Datastream_StopBackfillJob_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.update_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.update_connection_profile.js new file mode 100644 index 00000000000..1c82f487811 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.update_connection_profile.js @@ -0,0 +1,93 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(connectionProfile) { + // [START datastream_v1_generated_Datastream_UpdateConnectionProfile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * ConnectionProfile resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + */ + // const updateMask = {} + /** + * Required. The connection profile to update. + */ + // const connectionProfile = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + /** + * Optional. Only validate the connection profile, but don't update any + * resources. The default is false. + */ + // const validateOnly = true + /** + * Optional. Update the connection profile without validating it. + */ + // const force = true + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callUpdateConnectionProfile() { + // Construct request + const request = { + connectionProfile, + }; + + // Run request + const [operation] = await datastreamClient.updateConnectionProfile(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateConnectionProfile(); + // [END datastream_v1_generated_Datastream_UpdateConnectionProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.update_stream.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.update_stream.js new file mode 100644 index 00000000000..dd42264aa24 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.update_stream.js @@ -0,0 +1,93 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(stream) { + // [START datastream_v1_generated_Datastream_UpdateStream_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * stream resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + */ + // const updateMask = {} + /** + * Required. The stream resource to update. + */ + // const stream = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + /** + * Optional. Only validate the stream with the changes, without actually + * updating it. The default is false. + */ + // const validateOnly = true + /** + * Optional. Update the stream without validating it. + */ + // const force = true + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callUpdateStream() { + // Construct request + const request = { + stream, + }; + + // Run request + const [operation] = await datastreamClient.updateStream(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateStream(); + // [END datastream_v1_generated_Datastream_UpdateStream_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/snippet_metadata.google.cloud.datastream.v1.json b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/snippet_metadata.google.cloud.datastream.v1.json new file mode 100644 index 00000000000..99df4be42e2 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/snippet_metadata.google.cloud.datastream.v1.json @@ -0,0 +1,1247 @@ +{ + "clientLibrary": { + "name": "nodejs-datastream", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.datastream.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "datastream_v1_generated_Datastream_ListConnectionProfiles_async", + "title": "Datastream listConnectionProfiles Sample", + "origin": "API_DEFINITION", + "description": " Use this method to list connection profiles created in a project and location.", + "canonical": true, + "file": "datastream.list_connection_profiles.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConnectionProfiles", + "fullName": "google.cloud.datastream.v1.Datastream.ListConnectionProfiles", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1.ListConnectionProfilesResponse", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "ListConnectionProfiles", + "fullName": "google.cloud.datastream.v1.Datastream.ListConnectionProfiles", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_GetConnectionProfile_async", + "title": "Datastream getConnectionProfile Sample", + "origin": "API_DEFINITION", + "description": " Use this method to get details about a connection profile.", + "canonical": true, + "file": "datastream.get_connection_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConnectionProfile", + "fullName": "google.cloud.datastream.v1.Datastream.GetConnectionProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1.ConnectionProfile", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "GetConnectionProfile", + "fullName": "google.cloud.datastream.v1.Datastream.GetConnectionProfile", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_CreateConnectionProfile_async", + "title": "Datastream createConnectionProfile Sample", + "origin": "API_DEFINITION", + "description": " Use this method to create a connection profile in a project and location.", + "canonical": true, + "file": "datastream.create_connection_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConnectionProfile", + "fullName": "google.cloud.datastream.v1.Datastream.CreateConnectionProfile", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "connection_profile_id", + "type": "TYPE_STRING" + }, + { + "name": "connection_profile", + "type": ".google.cloud.datastream.v1.ConnectionProfile" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "CreateConnectionProfile", + "fullName": "google.cloud.datastream.v1.Datastream.CreateConnectionProfile", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_UpdateConnectionProfile_async", + "title": "Datastream updateConnectionProfile Sample", + "origin": "API_DEFINITION", + "description": " Use this method to update the parameters of a connection profile.", + "canonical": true, + "file": "datastream.update_connection_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateConnectionProfile", + "fullName": "google.cloud.datastream.v1.Datastream.UpdateConnectionProfile", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "connection_profile", + "type": ".google.cloud.datastream.v1.ConnectionProfile" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "UpdateConnectionProfile", + "fullName": "google.cloud.datastream.v1.Datastream.UpdateConnectionProfile", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_DeleteConnectionProfile_async", + "title": "Datastream deleteConnectionProfile Sample", + "origin": "API_DEFINITION", + "description": " Use this method to delete a connection profile.", + "canonical": true, + "file": "datastream.delete_connection_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteConnectionProfile", + "fullName": "google.cloud.datastream.v1.Datastream.DeleteConnectionProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "DeleteConnectionProfile", + "fullName": "google.cloud.datastream.v1.Datastream.DeleteConnectionProfile", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_DiscoverConnectionProfile_async", + "title": "Datastream discoverConnectionProfile Sample", + "origin": "API_DEFINITION", + "description": " Use this method to discover a connection profile. The discover API call exposes the data objects and metadata belonging to the profile. Typically, a request returns children data objects of a parent data object that's optionally supplied in the request.", + "canonical": true, + "file": "datastream.discover_connection_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 83, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DiscoverConnectionProfile", + "fullName": "google.cloud.datastream.v1.Datastream.DiscoverConnectionProfile", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "connection_profile", + "type": ".google.cloud.datastream.v1.ConnectionProfile" + }, + { + "name": "connection_profile_name", + "type": "TYPE_STRING" + }, + { + "name": "full_hierarchy", + "type": "TYPE_BOOL" + }, + { + "name": "hierarchy_depth", + "type": "TYPE_INT32" + }, + { + "name": "oracle_rdbms", + "type": ".google.cloud.datastream.v1.OracleRdbms" + }, + { + "name": "mysql_rdbms", + "type": ".google.cloud.datastream.v1.MysqlRdbms" + }, + { + "name": "postgresql_rdbms", + "type": ".google.cloud.datastream.v1.PostgresqlRdbms" + } + ], + "resultType": ".google.cloud.datastream.v1.DiscoverConnectionProfileResponse", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "DiscoverConnectionProfile", + "fullName": "google.cloud.datastream.v1.Datastream.DiscoverConnectionProfile", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_ListStreams_async", + "title": "Datastream listStreams Sample", + "origin": "API_DEFINITION", + "description": " Use this method to list streams in a project and location.", + "canonical": true, + "file": "datastream.list_streams.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListStreams", + "fullName": "google.cloud.datastream.v1.Datastream.ListStreams", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1.ListStreamsResponse", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "ListStreams", + "fullName": "google.cloud.datastream.v1.Datastream.ListStreams", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_GetStream_async", + "title": "Datastream getStream Sample", + "origin": "API_DEFINITION", + "description": " Use this method to get details about a stream.", + "canonical": true, + "file": "datastream.get_stream.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetStream", + "fullName": "google.cloud.datastream.v1.Datastream.GetStream", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1.Stream", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "GetStream", + "fullName": "google.cloud.datastream.v1.Datastream.GetStream", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_CreateStream_async", + "title": "Datastream createStream Sample", + "origin": "API_DEFINITION", + "description": " Use this method to create a stream.", + "canonical": true, + "file": "datastream.create_stream.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateStream", + "fullName": "google.cloud.datastream.v1.Datastream.CreateStream", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "stream_id", + "type": "TYPE_STRING" + }, + { + "name": "stream", + "type": ".google.cloud.datastream.v1.Stream" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "CreateStream", + "fullName": "google.cloud.datastream.v1.Datastream.CreateStream", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_UpdateStream_async", + "title": "Datastream updateStream Sample", + "origin": "API_DEFINITION", + "description": " Use this method to update the configuration of a stream.", + "canonical": true, + "file": "datastream.update_stream.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateStream", + "fullName": "google.cloud.datastream.v1.Datastream.UpdateStream", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "stream", + "type": ".google.cloud.datastream.v1.Stream" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "UpdateStream", + "fullName": "google.cloud.datastream.v1.Datastream.UpdateStream", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_DeleteStream_async", + "title": "Datastream deleteStream Sample", + "origin": "API_DEFINITION", + "description": " Use this method to delete a stream.", + "canonical": true, + "file": "datastream.delete_stream.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteStream", + "fullName": "google.cloud.datastream.v1.Datastream.DeleteStream", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "DeleteStream", + "fullName": "google.cloud.datastream.v1.Datastream.DeleteStream", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_GetStreamObject_async", + "title": "Datastream getStreamObject Sample", + "origin": "API_DEFINITION", + "description": " Use this method to get details about a stream object.", + "canonical": true, + "file": "datastream.get_stream_object.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetStreamObject", + "fullName": "google.cloud.datastream.v1.Datastream.GetStreamObject", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1.StreamObject", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "GetStreamObject", + "fullName": "google.cloud.datastream.v1.Datastream.GetStreamObject", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_LookupStreamObject_async", + "title": "Datastream lookupStreamObject Sample", + "origin": "API_DEFINITION", + "description": " Use this method to look up a stream object by its source object identifier.", + "canonical": true, + "file": "datastream.lookup_stream_object.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 58, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "LookupStreamObject", + "fullName": "google.cloud.datastream.v1.Datastream.LookupStreamObject", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "source_object_identifier", + "type": ".google.cloud.datastream.v1.SourceObjectIdentifier" + } + ], + "resultType": ".google.cloud.datastream.v1.StreamObject", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "LookupStreamObject", + "fullName": "google.cloud.datastream.v1.Datastream.LookupStreamObject", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_ListStreamObjects_async", + "title": "Datastream listStreamObjects Sample", + "origin": "API_DEFINITION", + "description": " Use this method to list the objects of a specific stream.", + "canonical": true, + "file": "datastream.list_stream_objects.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListStreamObjects", + "fullName": "google.cloud.datastream.v1.Datastream.ListStreamObjects", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1.ListStreamObjectsResponse", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "ListStreamObjects", + "fullName": "google.cloud.datastream.v1.Datastream.ListStreamObjects", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_StartBackfillJob_async", + "title": "Datastream startBackfillJob Sample", + "origin": "API_DEFINITION", + "description": " Use this method to start a backfill job for the specified stream object.", + "canonical": true, + "file": "datastream.start_backfill_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StartBackfillJob", + "fullName": "google.cloud.datastream.v1.Datastream.StartBackfillJob", + "async": true, + "parameters": [ + { + "name": "object", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1.StartBackfillJobResponse", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "StartBackfillJob", + "fullName": "google.cloud.datastream.v1.Datastream.StartBackfillJob", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_StopBackfillJob_async", + "title": "Datastream stopBackfillJob Sample", + "origin": "API_DEFINITION", + "description": " Use this method to stop a backfill job for the specified stream object.", + "canonical": true, + "file": "datastream.stop_backfill_job.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 54, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "StopBackfillJob", + "fullName": "google.cloud.datastream.v1.Datastream.StopBackfillJob", + "async": true, + "parameters": [ + { + "name": "object", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1.StopBackfillJobResponse", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "StopBackfillJob", + "fullName": "google.cloud.datastream.v1.Datastream.StopBackfillJob", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_FetchStaticIps_async", + "title": "Datastream fetchStaticIps Sample", + "origin": "API_DEFINITION", + "description": " The FetchStaticIps API call exposes the static IP addresses used by Datastream.", + "canonical": true, + "file": "datastream.fetch_static_ips.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchStaticIps", + "fullName": "google.cloud.datastream.v1.Datastream.FetchStaticIps", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1.FetchStaticIpsResponse", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "FetchStaticIps", + "fullName": "google.cloud.datastream.v1.Datastream.FetchStaticIps", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_CreatePrivateConnection_async", + "title": "Datastream createPrivateConnection Sample", + "origin": "API_DEFINITION", + "description": " Use this method to create a private connectivity configuration.", + "canonical": true, + "file": "datastream.create_private_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 82, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreatePrivateConnection", + "fullName": "google.cloud.datastream.v1.Datastream.CreatePrivateConnection", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "private_connection_id", + "type": "TYPE_STRING" + }, + { + "name": "private_connection", + "type": ".google.cloud.datastream.v1.PrivateConnection" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "CreatePrivateConnection", + "fullName": "google.cloud.datastream.v1.Datastream.CreatePrivateConnection", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_GetPrivateConnection_async", + "title": "Datastream getPrivateConnection Sample", + "origin": "API_DEFINITION", + "description": " Use this method to get details about a private connectivity configuration.", + "canonical": true, + "file": "datastream.get_private_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetPrivateConnection", + "fullName": "google.cloud.datastream.v1.Datastream.GetPrivateConnection", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1.PrivateConnection", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "GetPrivateConnection", + "fullName": "google.cloud.datastream.v1.Datastream.GetPrivateConnection", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_ListPrivateConnections_async", + "title": "Datastream listPrivateConnections Sample", + "origin": "API_DEFINITION", + "description": " Use this method to list private connectivity configurations in a project and location.", + "canonical": true, + "file": "datastream.list_private_connections.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListPrivateConnections", + "fullName": "google.cloud.datastream.v1.Datastream.ListPrivateConnections", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1.ListPrivateConnectionsResponse", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "ListPrivateConnections", + "fullName": "google.cloud.datastream.v1.Datastream.ListPrivateConnections", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_DeletePrivateConnection_async", + "title": "Datastream deletePrivateConnection Sample", + "origin": "API_DEFINITION", + "description": " Use this method to delete a private connectivity configuration.", + "canonical": true, + "file": "datastream.delete_private_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeletePrivateConnection", + "fullName": "google.cloud.datastream.v1.Datastream.DeletePrivateConnection", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "DeletePrivateConnection", + "fullName": "google.cloud.datastream.v1.Datastream.DeletePrivateConnection", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_CreateRoute_async", + "title": "Datastream createRoute Sample", + "origin": "API_DEFINITION", + "description": " Use this method to create a route for a private connectivity configuration in a project and location.", + "canonical": true, + "file": "datastream.create_route.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateRoute", + "fullName": "google.cloud.datastream.v1.Datastream.CreateRoute", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "route_id", + "type": "TYPE_STRING" + }, + { + "name": "route", + "type": ".google.cloud.datastream.v1.Route" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "CreateRoute", + "fullName": "google.cloud.datastream.v1.Datastream.CreateRoute", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_GetRoute_async", + "title": "Datastream getRoute Sample", + "origin": "API_DEFINITION", + "description": " Use this method to get details about a route.", + "canonical": true, + "file": "datastream.get_route.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetRoute", + "fullName": "google.cloud.datastream.v1.Datastream.GetRoute", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1.Route", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "GetRoute", + "fullName": "google.cloud.datastream.v1.Datastream.GetRoute", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_ListRoutes_async", + "title": "Datastream listRoutes Sample", + "origin": "API_DEFINITION", + "description": " Use this method to list routes created for a private connectivity configuration in a project and location.", + "canonical": true, + "file": "datastream.list_routes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRoutes", + "fullName": "google.cloud.datastream.v1.Datastream.ListRoutes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1.ListRoutesResponse", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "ListRoutes", + "fullName": "google.cloud.datastream.v1.Datastream.ListRoutes", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1_generated_Datastream_DeleteRoute_async", + "title": "Datastream deleteRoute Sample", + "origin": "API_DEFINITION", + "description": " Use this method to delete a route.", + "canonical": true, + "file": "datastream.delete_route.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteRoute", + "fullName": "google.cloud.datastream.v1.Datastream.DeleteRoute", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1.DatastreamClient" + }, + "method": { + "shortName": "DeleteRoute", + "fullName": "google.cloud.datastream.v1.Datastream.DeleteRoute", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1.Datastream" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-datastream/v1/src/index.ts b/owl-bot-staging/google-cloud-datastream/v1/src/index.ts new file mode 100644 index 00000000000..4d2bd52e2a2 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; +const DatastreamClient = v1.DatastreamClient; +type DatastreamClient = v1.DatastreamClient; +export {v1, DatastreamClient}; +export default {v1, DatastreamClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_client.ts b/owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_client.ts new file mode 100644 index 00000000000..5ecdcaa5794 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_client.ts @@ -0,0 +1,4160 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/datastream_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './datastream_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Datastream service + * @class + * @memberof v1 + */ +export class DatastreamClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + iamClient: IamClient; + locationsClient: LocationsClient; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + datastreamStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DatastreamClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new DatastreamClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof DatastreamClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); + + this.locationsClient = new this._gaxModule.LocationsClient( + this._gaxGrpc, + opts + ); + + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + connectionProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/connectionProfiles/{connection_profile}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + privateConnectionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/privateConnections/{private_connection}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + routePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/privateConnections/{private_connection}/routes/{route}' + ), + streamPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/streams/{stream}' + ), + streamObjectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/streams/{stream}/objects/{object}' + ), + }; + + // 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 = { + listConnectionProfiles: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'connectionProfiles'), + listStreams: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'streams'), + listStreamObjects: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'streamObjects'), + fetchStaticIps: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'staticIps'), + listPrivateConnections: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'privateConnections'), + listRoutes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'routes') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createConnectionProfileResponse = protoFilesRoot.lookup( + '.google.cloud.datastream.v1.ConnectionProfile') as gax.protobuf.Type; + const createConnectionProfileMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; + const updateConnectionProfileResponse = protoFilesRoot.lookup( + '.google.cloud.datastream.v1.ConnectionProfile') as gax.protobuf.Type; + const updateConnectionProfileMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; + const deleteConnectionProfileResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteConnectionProfileMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; + const createStreamResponse = protoFilesRoot.lookup( + '.google.cloud.datastream.v1.Stream') as gax.protobuf.Type; + const createStreamMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; + const updateStreamResponse = protoFilesRoot.lookup( + '.google.cloud.datastream.v1.Stream') as gax.protobuf.Type; + const updateStreamMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; + const deleteStreamResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteStreamMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; + const createPrivateConnectionResponse = protoFilesRoot.lookup( + '.google.cloud.datastream.v1.PrivateConnection') as gax.protobuf.Type; + const createPrivateConnectionMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; + const deletePrivateConnectionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deletePrivateConnectionMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; + const createRouteResponse = protoFilesRoot.lookup( + '.google.cloud.datastream.v1.Route') as gax.protobuf.Type; + const createRouteMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; + const deleteRouteResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteRouteMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createConnectionProfile: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createConnectionProfileResponse.decode.bind(createConnectionProfileResponse), + createConnectionProfileMetadata.decode.bind(createConnectionProfileMetadata)), + updateConnectionProfile: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateConnectionProfileResponse.decode.bind(updateConnectionProfileResponse), + updateConnectionProfileMetadata.decode.bind(updateConnectionProfileMetadata)), + deleteConnectionProfile: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteConnectionProfileResponse.decode.bind(deleteConnectionProfileResponse), + deleteConnectionProfileMetadata.decode.bind(deleteConnectionProfileMetadata)), + createStream: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createStreamResponse.decode.bind(createStreamResponse), + createStreamMetadata.decode.bind(createStreamMetadata)), + updateStream: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateStreamResponse.decode.bind(updateStreamResponse), + updateStreamMetadata.decode.bind(updateStreamMetadata)), + deleteStream: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteStreamResponse.decode.bind(deleteStreamResponse), + deleteStreamMetadata.decode.bind(deleteStreamMetadata)), + createPrivateConnection: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createPrivateConnectionResponse.decode.bind(createPrivateConnectionResponse), + createPrivateConnectionMetadata.decode.bind(createPrivateConnectionMetadata)), + deletePrivateConnection: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deletePrivateConnectionResponse.decode.bind(deletePrivateConnectionResponse), + deletePrivateConnectionMetadata.decode.bind(deletePrivateConnectionMetadata)), + createRoute: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createRouteResponse.decode.bind(createRouteResponse), + createRouteMetadata.decode.bind(createRouteMetadata)), + deleteRoute: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteRouteResponse.decode.bind(deleteRouteResponse), + deleteRouteMetadata.decode.bind(deleteRouteMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.datastream.v1.Datastream', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.datastreamStub) { + return this.datastreamStub; + } + + // Put together the "service stub" for + // google.cloud.datastream.v1.Datastream. + this.datastreamStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.datastream.v1.Datastream') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.datastream.v1.Datastream, + 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 datastreamStubMethods = + ['listConnectionProfiles', 'getConnectionProfile', 'createConnectionProfile', 'updateConnectionProfile', 'deleteConnectionProfile', 'discoverConnectionProfile', 'listStreams', 'getStream', 'createStream', 'updateStream', 'deleteStream', 'getStreamObject', 'lookupStreamObject', 'listStreamObjects', 'startBackfillJob', 'stopBackfillJob', 'fetchStaticIps', 'createPrivateConnection', 'getPrivateConnection', 'listPrivateConnections', 'deletePrivateConnection', 'createRoute', 'getRoute', 'listRoutes', 'deleteRoute']; + for (const methodName of datastreamStubMethods) { + const callPromise = this.datastreamStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.datastreamStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'datastream.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 'datastream.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Use this method to get details about a connection profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the connection profile resource to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.datastream.v1.ConnectionProfile | ConnectionProfile}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/datastream.get_connection_profile.js + * region_tag:datastream_v1_generated_Datastream_GetConnectionProfile_async + */ + getConnectionProfile( + request?: protos.google.cloud.datastream.v1.IGetConnectionProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1.IConnectionProfile, + protos.google.cloud.datastream.v1.IGetConnectionProfileRequest|undefined, {}|undefined + ]>; + getConnectionProfile( + request: protos.google.cloud.datastream.v1.IGetConnectionProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.datastream.v1.IConnectionProfile, + protos.google.cloud.datastream.v1.IGetConnectionProfileRequest|null|undefined, + {}|null|undefined>): void; + getConnectionProfile( + request: protos.google.cloud.datastream.v1.IGetConnectionProfileRequest, + callback: Callback< + protos.google.cloud.datastream.v1.IConnectionProfile, + protos.google.cloud.datastream.v1.IGetConnectionProfileRequest|null|undefined, + {}|null|undefined>): void; + getConnectionProfile( + request?: protos.google.cloud.datastream.v1.IGetConnectionProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.datastream.v1.IConnectionProfile, + protos.google.cloud.datastream.v1.IGetConnectionProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.datastream.v1.IConnectionProfile, + protos.google.cloud.datastream.v1.IGetConnectionProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.datastream.v1.IConnectionProfile, + protos.google.cloud.datastream.v1.IGetConnectionProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getConnectionProfile(request, options, callback); + } +/** + * Use this method to discover a connection profile. + * The discover API call exposes the data objects and metadata belonging to + * the profile. Typically, a request returns children data objects of a + * parent data object that's optionally supplied in the request. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the connection profile type. Must be in + * the format `projects/* /locations/*`. + * @param {google.cloud.datastream.v1.ConnectionProfile} request.connectionProfile + * An ad-hoc connection profile configuration. + * @param {string} request.connectionProfileName + * A reference to an existing connection profile. + * @param {boolean} request.fullHierarchy + * Whether to retrieve the full hierarchy of data objects (TRUE) or only the + * current level (FALSE). + * @param {number} request.hierarchyDepth + * The number of hierarchy levels below the current level to be retrieved. + * @param {google.cloud.datastream.v1.OracleRdbms} request.oracleRdbms + * Oracle RDBMS to enrich with child data objects and metadata. + * @param {google.cloud.datastream.v1.MysqlRdbms} request.mysqlRdbms + * MySQL RDBMS to enrich with child data objects and metadata. + * @param {google.cloud.datastream.v1.PostgresqlRdbms} request.postgresqlRdbms + * PostgreSQL RDBMS to enrich with child data objects and metadata. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.datastream.v1.DiscoverConnectionProfileResponse | DiscoverConnectionProfileResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/datastream.discover_connection_profile.js + * region_tag:datastream_v1_generated_Datastream_DiscoverConnectionProfile_async + */ + discoverConnectionProfile( + request?: protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1.IDiscoverConnectionProfileResponse, + protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest|undefined, {}|undefined + ]>; + discoverConnectionProfile( + request: protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.datastream.v1.IDiscoverConnectionProfileResponse, + protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest|null|undefined, + {}|null|undefined>): void; + discoverConnectionProfile( + request: protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest, + callback: Callback< + protos.google.cloud.datastream.v1.IDiscoverConnectionProfileResponse, + protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest|null|undefined, + {}|null|undefined>): void; + discoverConnectionProfile( + request?: protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.datastream.v1.IDiscoverConnectionProfileResponse, + protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.datastream.v1.IDiscoverConnectionProfileResponse, + protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.datastream.v1.IDiscoverConnectionProfileResponse, + protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.discoverConnectionProfile(request, options, callback); + } +/** + * Use this method to get details about a stream. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the stream resource to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.datastream.v1.Stream | Stream}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/datastream.get_stream.js + * region_tag:datastream_v1_generated_Datastream_GetStream_async + */ + getStream( + request?: protos.google.cloud.datastream.v1.IGetStreamRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1.IStream, + protos.google.cloud.datastream.v1.IGetStreamRequest|undefined, {}|undefined + ]>; + getStream( + request: protos.google.cloud.datastream.v1.IGetStreamRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.datastream.v1.IStream, + protos.google.cloud.datastream.v1.IGetStreamRequest|null|undefined, + {}|null|undefined>): void; + getStream( + request: protos.google.cloud.datastream.v1.IGetStreamRequest, + callback: Callback< + protos.google.cloud.datastream.v1.IStream, + protos.google.cloud.datastream.v1.IGetStreamRequest|null|undefined, + {}|null|undefined>): void; + getStream( + request?: protos.google.cloud.datastream.v1.IGetStreamRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.datastream.v1.IStream, + protos.google.cloud.datastream.v1.IGetStreamRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.datastream.v1.IStream, + protos.google.cloud.datastream.v1.IGetStreamRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.datastream.v1.IStream, + protos.google.cloud.datastream.v1.IGetStreamRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getStream(request, options, callback); + } +/** + * Use this method to get details about a stream object. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the stream object resource to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.datastream.v1.StreamObject | StreamObject}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/datastream.get_stream_object.js + * region_tag:datastream_v1_generated_Datastream_GetStreamObject_async + */ + getStreamObject( + request?: protos.google.cloud.datastream.v1.IGetStreamObjectRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1.IStreamObject, + protos.google.cloud.datastream.v1.IGetStreamObjectRequest|undefined, {}|undefined + ]>; + getStreamObject( + request: protos.google.cloud.datastream.v1.IGetStreamObjectRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.datastream.v1.IStreamObject, + protos.google.cloud.datastream.v1.IGetStreamObjectRequest|null|undefined, + {}|null|undefined>): void; + getStreamObject( + request: protos.google.cloud.datastream.v1.IGetStreamObjectRequest, + callback: Callback< + protos.google.cloud.datastream.v1.IStreamObject, + protos.google.cloud.datastream.v1.IGetStreamObjectRequest|null|undefined, + {}|null|undefined>): void; + getStreamObject( + request?: protos.google.cloud.datastream.v1.IGetStreamObjectRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.datastream.v1.IStreamObject, + protos.google.cloud.datastream.v1.IGetStreamObjectRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.datastream.v1.IStreamObject, + protos.google.cloud.datastream.v1.IGetStreamObjectRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.datastream.v1.IStreamObject, + protos.google.cloud.datastream.v1.IGetStreamObjectRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getStreamObject(request, options, callback); + } +/** + * Use this method to look up a stream object by its source object identifier. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent stream that owns the collection of objects. + * @param {google.cloud.datastream.v1.SourceObjectIdentifier} request.sourceObjectIdentifier + * Required. The source object identifier which maps to the stream object. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.datastream.v1.StreamObject | StreamObject}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/datastream.lookup_stream_object.js + * region_tag:datastream_v1_generated_Datastream_LookupStreamObject_async + */ + lookupStreamObject( + request?: protos.google.cloud.datastream.v1.ILookupStreamObjectRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1.IStreamObject, + protos.google.cloud.datastream.v1.ILookupStreamObjectRequest|undefined, {}|undefined + ]>; + lookupStreamObject( + request: protos.google.cloud.datastream.v1.ILookupStreamObjectRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.datastream.v1.IStreamObject, + protos.google.cloud.datastream.v1.ILookupStreamObjectRequest|null|undefined, + {}|null|undefined>): void; + lookupStreamObject( + request: protos.google.cloud.datastream.v1.ILookupStreamObjectRequest, + callback: Callback< + protos.google.cloud.datastream.v1.IStreamObject, + protos.google.cloud.datastream.v1.ILookupStreamObjectRequest|null|undefined, + {}|null|undefined>): void; + lookupStreamObject( + request?: protos.google.cloud.datastream.v1.ILookupStreamObjectRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.datastream.v1.IStreamObject, + protos.google.cloud.datastream.v1.ILookupStreamObjectRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.datastream.v1.IStreamObject, + protos.google.cloud.datastream.v1.ILookupStreamObjectRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.datastream.v1.IStreamObject, + protos.google.cloud.datastream.v1.ILookupStreamObjectRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.lookupStreamObject(request, options, callback); + } +/** + * Use this method to start a backfill job for the specified stream object. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.object + * Required. The name of the stream object resource to start a backfill job + * for. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.datastream.v1.StartBackfillJobResponse | StartBackfillJobResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/datastream.start_backfill_job.js + * region_tag:datastream_v1_generated_Datastream_StartBackfillJob_async + */ + startBackfillJob( + request?: protos.google.cloud.datastream.v1.IStartBackfillJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1.IStartBackfillJobResponse, + protos.google.cloud.datastream.v1.IStartBackfillJobRequest|undefined, {}|undefined + ]>; + startBackfillJob( + request: protos.google.cloud.datastream.v1.IStartBackfillJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.datastream.v1.IStartBackfillJobResponse, + protos.google.cloud.datastream.v1.IStartBackfillJobRequest|null|undefined, + {}|null|undefined>): void; + startBackfillJob( + request: protos.google.cloud.datastream.v1.IStartBackfillJobRequest, + callback: Callback< + protos.google.cloud.datastream.v1.IStartBackfillJobResponse, + protos.google.cloud.datastream.v1.IStartBackfillJobRequest|null|undefined, + {}|null|undefined>): void; + startBackfillJob( + request?: protos.google.cloud.datastream.v1.IStartBackfillJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.datastream.v1.IStartBackfillJobResponse, + protos.google.cloud.datastream.v1.IStartBackfillJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.datastream.v1.IStartBackfillJobResponse, + protos.google.cloud.datastream.v1.IStartBackfillJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.datastream.v1.IStartBackfillJobResponse, + protos.google.cloud.datastream.v1.IStartBackfillJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'object': request.object ?? '', + }); + this.initialize(); + return this.innerApiCalls.startBackfillJob(request, options, callback); + } +/** + * Use this method to stop a backfill job for the specified stream object. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.object + * Required. The name of the stream object resource to stop the backfill job + * for. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.datastream.v1.StopBackfillJobResponse | StopBackfillJobResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/datastream.stop_backfill_job.js + * region_tag:datastream_v1_generated_Datastream_StopBackfillJob_async + */ + stopBackfillJob( + request?: protos.google.cloud.datastream.v1.IStopBackfillJobRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1.IStopBackfillJobResponse, + protos.google.cloud.datastream.v1.IStopBackfillJobRequest|undefined, {}|undefined + ]>; + stopBackfillJob( + request: protos.google.cloud.datastream.v1.IStopBackfillJobRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.datastream.v1.IStopBackfillJobResponse, + protos.google.cloud.datastream.v1.IStopBackfillJobRequest|null|undefined, + {}|null|undefined>): void; + stopBackfillJob( + request: protos.google.cloud.datastream.v1.IStopBackfillJobRequest, + callback: Callback< + protos.google.cloud.datastream.v1.IStopBackfillJobResponse, + protos.google.cloud.datastream.v1.IStopBackfillJobRequest|null|undefined, + {}|null|undefined>): void; + stopBackfillJob( + request?: protos.google.cloud.datastream.v1.IStopBackfillJobRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.datastream.v1.IStopBackfillJobResponse, + protos.google.cloud.datastream.v1.IStopBackfillJobRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.datastream.v1.IStopBackfillJobResponse, + protos.google.cloud.datastream.v1.IStopBackfillJobRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.datastream.v1.IStopBackfillJobResponse, + protos.google.cloud.datastream.v1.IStopBackfillJobRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'object': request.object ?? '', + }); + this.initialize(); + return this.innerApiCalls.stopBackfillJob(request, options, callback); + } +/** + * Use this method to get details about a private connectivity configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the private connectivity configuration to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.datastream.v1.PrivateConnection | PrivateConnection}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/datastream.get_private_connection.js + * region_tag:datastream_v1_generated_Datastream_GetPrivateConnection_async + */ + getPrivateConnection( + request?: protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1.IPrivateConnection, + protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest|undefined, {}|undefined + ]>; + getPrivateConnection( + request: protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.datastream.v1.IPrivateConnection, + protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest|null|undefined, + {}|null|undefined>): void; + getPrivateConnection( + request: protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest, + callback: Callback< + protos.google.cloud.datastream.v1.IPrivateConnection, + protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest|null|undefined, + {}|null|undefined>): void; + getPrivateConnection( + request?: protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.datastream.v1.IPrivateConnection, + protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.datastream.v1.IPrivateConnection, + protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.datastream.v1.IPrivateConnection, + protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getPrivateConnection(request, options, callback); + } +/** + * Use this method to get details about a route. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Route resource to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.datastream.v1.Route | Route}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/datastream.get_route.js + * region_tag:datastream_v1_generated_Datastream_GetRoute_async + */ + getRoute( + request?: protos.google.cloud.datastream.v1.IGetRouteRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1.IRoute, + protos.google.cloud.datastream.v1.IGetRouteRequest|undefined, {}|undefined + ]>; + getRoute( + request: protos.google.cloud.datastream.v1.IGetRouteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.datastream.v1.IRoute, + protos.google.cloud.datastream.v1.IGetRouteRequest|null|undefined, + {}|null|undefined>): void; + getRoute( + request: protos.google.cloud.datastream.v1.IGetRouteRequest, + callback: Callback< + protos.google.cloud.datastream.v1.IRoute, + protos.google.cloud.datastream.v1.IGetRouteRequest|null|undefined, + {}|null|undefined>): void; + getRoute( + request?: protos.google.cloud.datastream.v1.IGetRouteRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.datastream.v1.IRoute, + protos.google.cloud.datastream.v1.IGetRouteRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.datastream.v1.IRoute, + protos.google.cloud.datastream.v1.IGetRouteRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.datastream.v1.IRoute, + protos.google.cloud.datastream.v1.IGetRouteRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getRoute(request, options, callback); + } + +/** + * Use this method to create a connection profile in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of ConnectionProfiles. + * @param {string} request.connectionProfileId + * Required. The connection profile identifier. + * @param {google.cloud.datastream.v1.ConnectionProfile} request.connectionProfile + * Required. The connection profile resource to create. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.validateOnly] + * Optional. Only validate the connection profile, but don't create any + * resources. The default is false. + * @param {boolean} [request.force] + * Optional. Create the connection profile without validating it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.create_connection_profile.js + * region_tag:datastream_v1_generated_Datastream_CreateConnectionProfile_async + */ + createConnectionProfile( + request?: protos.google.cloud.datastream.v1.ICreateConnectionProfileRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createConnectionProfile( + request: protos.google.cloud.datastream.v1.ICreateConnectionProfileRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConnectionProfile( + request: protos.google.cloud.datastream.v1.ICreateConnectionProfileRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConnectionProfile( + request?: protos.google.cloud.datastream.v1.ICreateConnectionProfileRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createConnectionProfile(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createConnectionProfile()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.create_connection_profile.js + * region_tag:datastream_v1_generated_Datastream_CreateConnectionProfile_async + */ + async checkCreateConnectionProfileProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConnectionProfile, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to update the parameters of a connection profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * ConnectionProfile resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.datastream.v1.ConnectionProfile} request.connectionProfile + * Required. The connection profile to update. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.validateOnly] + * Optional. Only validate the connection profile, but don't update any + * resources. The default is false. + * @param {boolean} [request.force] + * Optional. Update the connection profile without validating it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.update_connection_profile.js + * region_tag:datastream_v1_generated_Datastream_UpdateConnectionProfile_async + */ + updateConnectionProfile( + request?: protos.google.cloud.datastream.v1.IUpdateConnectionProfileRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateConnectionProfile( + request: protos.google.cloud.datastream.v1.IUpdateConnectionProfileRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateConnectionProfile( + request: protos.google.cloud.datastream.v1.IUpdateConnectionProfileRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateConnectionProfile( + request?: protos.google.cloud.datastream.v1.IUpdateConnectionProfileRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'connection_profile.name': request.connectionProfile!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateConnectionProfile(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateConnectionProfile()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.update_connection_profile.js + * region_tag:datastream_v1_generated_Datastream_UpdateConnectionProfile_async + */ + async checkUpdateConnectionProfileProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateConnectionProfile, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to delete a connection profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the connection profile resource to delete. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.delete_connection_profile.js + * region_tag:datastream_v1_generated_Datastream_DeleteConnectionProfile_async + */ + deleteConnectionProfile( + request?: protos.google.cloud.datastream.v1.IDeleteConnectionProfileRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteConnectionProfile( + request: protos.google.cloud.datastream.v1.IDeleteConnectionProfileRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteConnectionProfile( + request: protos.google.cloud.datastream.v1.IDeleteConnectionProfileRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteConnectionProfile( + request?: protos.google.cloud.datastream.v1.IDeleteConnectionProfileRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteConnectionProfile(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteConnectionProfile()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.delete_connection_profile.js + * region_tag:datastream_v1_generated_Datastream_DeleteConnectionProfile_async + */ + async checkDeleteConnectionProfileProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConnectionProfile, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to create a stream. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of streams. + * @param {string} request.streamId + * Required. The stream identifier. + * @param {google.cloud.datastream.v1.Stream} request.stream + * Required. The stream resource to create. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.validateOnly] + * Optional. Only validate the stream, but don't create any resources. + * The default is false. + * @param {boolean} [request.force] + * Optional. Create the stream without validating it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.create_stream.js + * region_tag:datastream_v1_generated_Datastream_CreateStream_async + */ + createStream( + request?: protos.google.cloud.datastream.v1.ICreateStreamRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createStream( + request: protos.google.cloud.datastream.v1.ICreateStreamRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createStream( + request: protos.google.cloud.datastream.v1.ICreateStreamRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createStream( + request?: protos.google.cloud.datastream.v1.ICreateStreamRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createStream(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createStream()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.create_stream.js + * region_tag:datastream_v1_generated_Datastream_CreateStream_async + */ + async checkCreateStreamProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createStream, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to update the configuration of a stream. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * stream resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.datastream.v1.Stream} request.stream + * Required. The stream resource to update. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.validateOnly] + * Optional. Only validate the stream with the changes, without actually + * updating it. The default is false. + * @param {boolean} [request.force] + * Optional. Update the stream without validating it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.update_stream.js + * region_tag:datastream_v1_generated_Datastream_UpdateStream_async + */ + updateStream( + request?: protos.google.cloud.datastream.v1.IUpdateStreamRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateStream( + request: protos.google.cloud.datastream.v1.IUpdateStreamRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateStream( + request: protos.google.cloud.datastream.v1.IUpdateStreamRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateStream( + request?: protos.google.cloud.datastream.v1.IUpdateStreamRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'stream.name': request.stream!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateStream(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateStream()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.update_stream.js + * region_tag:datastream_v1_generated_Datastream_UpdateStream_async + */ + async checkUpdateStreamProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateStream, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to delete a stream. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the stream resource to delete. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.delete_stream.js + * region_tag:datastream_v1_generated_Datastream_DeleteStream_async + */ + deleteStream( + request?: protos.google.cloud.datastream.v1.IDeleteStreamRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteStream( + request: protos.google.cloud.datastream.v1.IDeleteStreamRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteStream( + request: protos.google.cloud.datastream.v1.IDeleteStreamRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteStream( + request?: protos.google.cloud.datastream.v1.IDeleteStreamRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteStream(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteStream()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.delete_stream.js + * region_tag:datastream_v1_generated_Datastream_DeleteStream_async + */ + async checkDeleteStreamProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteStream, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to create a private connectivity configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of PrivateConnections. + * @param {string} request.privateConnectionId + * Required. The private connectivity identifier. + * @param {google.cloud.datastream.v1.PrivateConnection} request.privateConnection + * Required. The Private Connectivity resource to create. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.force] + * Optional. If set to true, will skip validations. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.create_private_connection.js + * region_tag:datastream_v1_generated_Datastream_CreatePrivateConnection_async + */ + createPrivateConnection( + request?: protos.google.cloud.datastream.v1.ICreatePrivateConnectionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createPrivateConnection( + request: protos.google.cloud.datastream.v1.ICreatePrivateConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createPrivateConnection( + request: protos.google.cloud.datastream.v1.ICreatePrivateConnectionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createPrivateConnection( + request?: protos.google.cloud.datastream.v1.ICreatePrivateConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createPrivateConnection(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createPrivateConnection()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.create_private_connection.js + * region_tag:datastream_v1_generated_Datastream_CreatePrivateConnection_async + */ + async checkCreatePrivateConnectionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createPrivateConnection, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to delete a private connectivity configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the private connectivity configuration to delete. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.force] + * Optional. If set to true, any child routes that belong to this + * PrivateConnection will also be deleted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.delete_private_connection.js + * region_tag:datastream_v1_generated_Datastream_DeletePrivateConnection_async + */ + deletePrivateConnection( + request?: protos.google.cloud.datastream.v1.IDeletePrivateConnectionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deletePrivateConnection( + request: protos.google.cloud.datastream.v1.IDeletePrivateConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deletePrivateConnection( + request: protos.google.cloud.datastream.v1.IDeletePrivateConnectionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deletePrivateConnection( + request?: protos.google.cloud.datastream.v1.IDeletePrivateConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deletePrivateConnection(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deletePrivateConnection()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.delete_private_connection.js + * region_tag:datastream_v1_generated_Datastream_DeletePrivateConnection_async + */ + async checkDeletePrivateConnectionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deletePrivateConnection, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to create a route for a private connectivity configuration + * in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of Routes. + * @param {string} request.routeId + * Required. The Route identifier. + * @param {google.cloud.datastream.v1.Route} request.route + * Required. The Route resource to create. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.create_route.js + * region_tag:datastream_v1_generated_Datastream_CreateRoute_async + */ + createRoute( + request?: protos.google.cloud.datastream.v1.ICreateRouteRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createRoute( + request: protos.google.cloud.datastream.v1.ICreateRouteRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createRoute( + request: protos.google.cloud.datastream.v1.ICreateRouteRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createRoute( + request?: protos.google.cloud.datastream.v1.ICreateRouteRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createRoute(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createRoute()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.create_route.js + * region_tag:datastream_v1_generated_Datastream_CreateRoute_async + */ + async checkCreateRouteProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createRoute, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to delete a route. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Route resource to delete. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.delete_route.js + * region_tag:datastream_v1_generated_Datastream_DeleteRoute_async + */ + deleteRoute( + request?: protos.google.cloud.datastream.v1.IDeleteRouteRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteRoute( + request: protos.google.cloud.datastream.v1.IDeleteRouteRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteRoute( + request: protos.google.cloud.datastream.v1.IDeleteRouteRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteRoute( + request?: protos.google.cloud.datastream.v1.IDeleteRouteRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteRoute(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteRoute()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/datastream.delete_route.js + * region_tag:datastream_v1_generated_Datastream_DeleteRoute_async + */ + async checkDeleteRouteProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteRoute, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Use this method to list connection profiles created in a project and + * location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of connection profiles. + * @param {number} request.pageSize + * Maximum number of connection profiles to return. + * If unspecified, at most 50 connection profiles will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListConnectionProfiles` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListConnectionProfiles` + * must match the call that provided the page token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.datastream.v1.ConnectionProfile | ConnectionProfile}. + * 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 `listConnectionProfilesAsync()` + * 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. + */ + listConnectionProfiles( + request?: protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1.IConnectionProfile[], + protos.google.cloud.datastream.v1.IListConnectionProfilesRequest|null, + protos.google.cloud.datastream.v1.IListConnectionProfilesResponse + ]>; + listConnectionProfiles( + request: protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, + protos.google.cloud.datastream.v1.IListConnectionProfilesResponse|null|undefined, + protos.google.cloud.datastream.v1.IConnectionProfile>): void; + listConnectionProfiles( + request: protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, + callback: PaginationCallback< + protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, + protos.google.cloud.datastream.v1.IListConnectionProfilesResponse|null|undefined, + protos.google.cloud.datastream.v1.IConnectionProfile>): void; + listConnectionProfiles( + request?: protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, + protos.google.cloud.datastream.v1.IListConnectionProfilesResponse|null|undefined, + protos.google.cloud.datastream.v1.IConnectionProfile>, + callback?: PaginationCallback< + protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, + protos.google.cloud.datastream.v1.IListConnectionProfilesResponse|null|undefined, + protos.google.cloud.datastream.v1.IConnectionProfile>): + Promise<[ + protos.google.cloud.datastream.v1.IConnectionProfile[], + protos.google.cloud.datastream.v1.IListConnectionProfilesRequest|null, + protos.google.cloud.datastream.v1.IListConnectionProfilesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listConnectionProfiles(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of connection profiles. + * @param {number} request.pageSize + * Maximum number of connection profiles to return. + * If unspecified, at most 50 connection profiles will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListConnectionProfiles` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListConnectionProfiles` + * must match the call that provided the page token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.datastream.v1.ConnectionProfile | ConnectionProfile} 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 `listConnectionProfilesAsync()` + * 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. + */ + listConnectionProfilesStream( + request?: protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConnectionProfiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConnectionProfiles.createStream( + this.innerApiCalls.listConnectionProfiles as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listConnectionProfiles`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of connection profiles. + * @param {number} request.pageSize + * Maximum number of connection profiles to return. + * If unspecified, at most 50 connection profiles will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListConnectionProfiles` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListConnectionProfiles` + * must match the call that provided the page token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.datastream.v1.ConnectionProfile | ConnectionProfile}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/datastream.list_connection_profiles.js + * region_tag:datastream_v1_generated_Datastream_ListConnectionProfiles_async + */ + listConnectionProfilesAsync( + request?: protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConnectionProfiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConnectionProfiles.asyncIterate( + this.innerApiCalls['listConnectionProfiles'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Use this method to list streams in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of streams. + * @param {number} request.pageSize + * Maximum number of streams to return. + * If unspecified, at most 50 streams will be returned. The maximum + * value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListStreams` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListStreams` + * must match the call that provided the page token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.datastream.v1.Stream | Stream}. + * 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 `listStreamsAsync()` + * 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. + */ + listStreams( + request?: protos.google.cloud.datastream.v1.IListStreamsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1.IStream[], + protos.google.cloud.datastream.v1.IListStreamsRequest|null, + protos.google.cloud.datastream.v1.IListStreamsResponse + ]>; + listStreams( + request: protos.google.cloud.datastream.v1.IListStreamsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.datastream.v1.IListStreamsRequest, + protos.google.cloud.datastream.v1.IListStreamsResponse|null|undefined, + protos.google.cloud.datastream.v1.IStream>): void; + listStreams( + request: protos.google.cloud.datastream.v1.IListStreamsRequest, + callback: PaginationCallback< + protos.google.cloud.datastream.v1.IListStreamsRequest, + protos.google.cloud.datastream.v1.IListStreamsResponse|null|undefined, + protos.google.cloud.datastream.v1.IStream>): void; + listStreams( + request?: protos.google.cloud.datastream.v1.IListStreamsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.datastream.v1.IListStreamsRequest, + protos.google.cloud.datastream.v1.IListStreamsResponse|null|undefined, + protos.google.cloud.datastream.v1.IStream>, + callback?: PaginationCallback< + protos.google.cloud.datastream.v1.IListStreamsRequest, + protos.google.cloud.datastream.v1.IListStreamsResponse|null|undefined, + protos.google.cloud.datastream.v1.IStream>): + Promise<[ + protos.google.cloud.datastream.v1.IStream[], + protos.google.cloud.datastream.v1.IListStreamsRequest|null, + protos.google.cloud.datastream.v1.IListStreamsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listStreams(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of streams. + * @param {number} request.pageSize + * Maximum number of streams to return. + * If unspecified, at most 50 streams will be returned. The maximum + * value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListStreams` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListStreams` + * must match the call that provided the page token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.datastream.v1.Stream | Stream} 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 `listStreamsAsync()` + * 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. + */ + listStreamsStream( + request?: protos.google.cloud.datastream.v1.IListStreamsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listStreams']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listStreams.createStream( + this.innerApiCalls.listStreams as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listStreams`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of streams. + * @param {number} request.pageSize + * Maximum number of streams to return. + * If unspecified, at most 50 streams will be returned. The maximum + * value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListStreams` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListStreams` + * must match the call that provided the page token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.datastream.v1.Stream | Stream}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/datastream.list_streams.js + * region_tag:datastream_v1_generated_Datastream_ListStreams_async + */ + listStreamsAsync( + request?: protos.google.cloud.datastream.v1.IListStreamsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listStreams']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listStreams.asyncIterate( + this.innerApiCalls['listStreams'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Use this method to list the objects of a specific stream. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent stream that owns the collection of objects. + * @param {number} request.pageSize + * Maximum number of objects to return. Default is 50. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListStreamObjectsRequest` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListStreamObjectsRequest` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.datastream.v1.StreamObject | StreamObject}. + * 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 `listStreamObjectsAsync()` + * 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. + */ + listStreamObjects( + request?: protos.google.cloud.datastream.v1.IListStreamObjectsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1.IStreamObject[], + protos.google.cloud.datastream.v1.IListStreamObjectsRequest|null, + protos.google.cloud.datastream.v1.IListStreamObjectsResponse + ]>; + listStreamObjects( + request: protos.google.cloud.datastream.v1.IListStreamObjectsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.datastream.v1.IListStreamObjectsRequest, + protos.google.cloud.datastream.v1.IListStreamObjectsResponse|null|undefined, + protos.google.cloud.datastream.v1.IStreamObject>): void; + listStreamObjects( + request: protos.google.cloud.datastream.v1.IListStreamObjectsRequest, + callback: PaginationCallback< + protos.google.cloud.datastream.v1.IListStreamObjectsRequest, + protos.google.cloud.datastream.v1.IListStreamObjectsResponse|null|undefined, + protos.google.cloud.datastream.v1.IStreamObject>): void; + listStreamObjects( + request?: protos.google.cloud.datastream.v1.IListStreamObjectsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.datastream.v1.IListStreamObjectsRequest, + protos.google.cloud.datastream.v1.IListStreamObjectsResponse|null|undefined, + protos.google.cloud.datastream.v1.IStreamObject>, + callback?: PaginationCallback< + protos.google.cloud.datastream.v1.IListStreamObjectsRequest, + protos.google.cloud.datastream.v1.IListStreamObjectsResponse|null|undefined, + protos.google.cloud.datastream.v1.IStreamObject>): + Promise<[ + protos.google.cloud.datastream.v1.IStreamObject[], + protos.google.cloud.datastream.v1.IListStreamObjectsRequest|null, + protos.google.cloud.datastream.v1.IListStreamObjectsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listStreamObjects(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent stream that owns the collection of objects. + * @param {number} request.pageSize + * Maximum number of objects to return. Default is 50. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListStreamObjectsRequest` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListStreamObjectsRequest` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.datastream.v1.StreamObject | StreamObject} 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 `listStreamObjectsAsync()` + * 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. + */ + listStreamObjectsStream( + request?: protos.google.cloud.datastream.v1.IListStreamObjectsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listStreamObjects']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listStreamObjects.createStream( + this.innerApiCalls.listStreamObjects as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listStreamObjects`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent stream that owns the collection of objects. + * @param {number} request.pageSize + * Maximum number of objects to return. Default is 50. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListStreamObjectsRequest` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListStreamObjectsRequest` must match the call that provided the page + * token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.datastream.v1.StreamObject | StreamObject}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/datastream.list_stream_objects.js + * region_tag:datastream_v1_generated_Datastream_ListStreamObjects_async + */ + listStreamObjectsAsync( + request?: protos.google.cloud.datastream.v1.IListStreamObjectsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listStreamObjects']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listStreamObjects.asyncIterate( + this.innerApiCalls['listStreamObjects'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * The FetchStaticIps API call exposes the static IP addresses used by + * Datastream. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name for the location for which static IPs should be + * returned. Must be in the format `projects/* /locations/*`. + * @param {number} request.pageSize + * Maximum number of Ips to return, will likely not be specified. + * @param {string} request.pageToken + * A page token, received from a previous `ListStaticIps` call. + * will likely not 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 Array of string. + * 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 `fetchStaticIpsAsync()` + * 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. + */ + fetchStaticIps( + request?: protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, + options?: CallOptions): + Promise<[ + string[], + protos.google.cloud.datastream.v1.IFetchStaticIpsRequest|null, + protos.google.cloud.datastream.v1.IFetchStaticIpsResponse + ]>; + fetchStaticIps( + request: protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, + protos.google.cloud.datastream.v1.IFetchStaticIpsResponse|null|undefined, + string>): void; + fetchStaticIps( + request: protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, + callback: PaginationCallback< + protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, + protos.google.cloud.datastream.v1.IFetchStaticIpsResponse|null|undefined, + string>): void; + fetchStaticIps( + request?: protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, + protos.google.cloud.datastream.v1.IFetchStaticIpsResponse|null|undefined, + string>, + callback?: PaginationCallback< + protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, + protos.google.cloud.datastream.v1.IFetchStaticIpsResponse|null|undefined, + string>): + Promise<[ + string[], + protos.google.cloud.datastream.v1.IFetchStaticIpsRequest|null, + protos.google.cloud.datastream.v1.IFetchStaticIpsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.fetchStaticIps(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.name + * Required. The resource name for the location for which static IPs should be + * returned. Must be in the format `projects/* /locations/*`. + * @param {number} request.pageSize + * Maximum number of Ips to return, will likely not be specified. + * @param {string} request.pageToken + * A page token, received from a previous `ListStaticIps` call. + * will likely not be specified. + * @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 string 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 `fetchStaticIpsAsync()` + * 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. + */ + fetchStaticIpsStream( + request?: protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + const defaultCallSettings = this._defaults['fetchStaticIps']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.fetchStaticIps.createStream( + this.innerApiCalls.fetchStaticIps as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `fetchStaticIps`, 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.name + * Required. The resource name for the location for which static IPs should be + * returned. Must be in the format `projects/* /locations/*`. + * @param {number} request.pageSize + * Maximum number of Ips to return, will likely not be specified. + * @param {string} request.pageToken + * A page token, received from a previous `ListStaticIps` call. + * will likely not be specified. + * @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 + * string. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/datastream.fetch_static_ips.js + * region_tag:datastream_v1_generated_Datastream_FetchStaticIps_async + */ + fetchStaticIpsAsync( + request?: protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + const defaultCallSettings = this._defaults['fetchStaticIps']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.fetchStaticIps.asyncIterate( + this.innerApiCalls['fetchStaticIps'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Use this method to list private connectivity configurations in a project + * and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of private connectivity + * configurations. + * @param {number} request.pageSize + * Maximum number of private connectivity configurations to return. + * If unspecified, at most 50 private connectivity configurations that will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.datastream.v1.PrivateConnection | PrivateConnection}. + * 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 `listPrivateConnectionsAsync()` + * 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. + */ + listPrivateConnections( + request?: protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1.IPrivateConnection[], + protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest|null, + protos.google.cloud.datastream.v1.IListPrivateConnectionsResponse + ]>; + listPrivateConnections( + request: protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, + protos.google.cloud.datastream.v1.IListPrivateConnectionsResponse|null|undefined, + protos.google.cloud.datastream.v1.IPrivateConnection>): void; + listPrivateConnections( + request: protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, + callback: PaginationCallback< + protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, + protos.google.cloud.datastream.v1.IListPrivateConnectionsResponse|null|undefined, + protos.google.cloud.datastream.v1.IPrivateConnection>): void; + listPrivateConnections( + request?: protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, + protos.google.cloud.datastream.v1.IListPrivateConnectionsResponse|null|undefined, + protos.google.cloud.datastream.v1.IPrivateConnection>, + callback?: PaginationCallback< + protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, + protos.google.cloud.datastream.v1.IListPrivateConnectionsResponse|null|undefined, + protos.google.cloud.datastream.v1.IPrivateConnection>): + Promise<[ + protos.google.cloud.datastream.v1.IPrivateConnection[], + protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest|null, + protos.google.cloud.datastream.v1.IListPrivateConnectionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listPrivateConnections(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of private connectivity + * configurations. + * @param {number} request.pageSize + * Maximum number of private connectivity configurations to return. + * If unspecified, at most 50 private connectivity configurations that will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.datastream.v1.PrivateConnection | PrivateConnection} 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 `listPrivateConnectionsAsync()` + * 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. + */ + listPrivateConnectionsStream( + request?: protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listPrivateConnections']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPrivateConnections.createStream( + this.innerApiCalls.listPrivateConnections as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listPrivateConnections`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of private connectivity + * configurations. + * @param {number} request.pageSize + * Maximum number of private connectivity configurations to return. + * If unspecified, at most 50 private connectivity configurations that will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.datastream.v1.PrivateConnection | PrivateConnection}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/datastream.list_private_connections.js + * region_tag:datastream_v1_generated_Datastream_ListPrivateConnections_async + */ + listPrivateConnectionsAsync( + request?: protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listPrivateConnections']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPrivateConnections.asyncIterate( + this.innerApiCalls['listPrivateConnections'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Use this method to list routes created for a private connectivity + * configuration in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of Routess. + * @param {number} request.pageSize + * Maximum number of Routes to return. The service may return + * fewer than this value. If unspecified, at most 50 Routes + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListRoutes` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListRoutes` must match the call that provided the page + * token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.datastream.v1.Route | Route}. + * 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 `listRoutesAsync()` + * 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. + */ + listRoutes( + request?: protos.google.cloud.datastream.v1.IListRoutesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1.IRoute[], + protos.google.cloud.datastream.v1.IListRoutesRequest|null, + protos.google.cloud.datastream.v1.IListRoutesResponse + ]>; + listRoutes( + request: protos.google.cloud.datastream.v1.IListRoutesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.datastream.v1.IListRoutesRequest, + protos.google.cloud.datastream.v1.IListRoutesResponse|null|undefined, + protos.google.cloud.datastream.v1.IRoute>): void; + listRoutes( + request: protos.google.cloud.datastream.v1.IListRoutesRequest, + callback: PaginationCallback< + protos.google.cloud.datastream.v1.IListRoutesRequest, + protos.google.cloud.datastream.v1.IListRoutesResponse|null|undefined, + protos.google.cloud.datastream.v1.IRoute>): void; + listRoutes( + request?: protos.google.cloud.datastream.v1.IListRoutesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.datastream.v1.IListRoutesRequest, + protos.google.cloud.datastream.v1.IListRoutesResponse|null|undefined, + protos.google.cloud.datastream.v1.IRoute>, + callback?: PaginationCallback< + protos.google.cloud.datastream.v1.IListRoutesRequest, + protos.google.cloud.datastream.v1.IListRoutesResponse|null|undefined, + protos.google.cloud.datastream.v1.IRoute>): + Promise<[ + protos.google.cloud.datastream.v1.IRoute[], + protos.google.cloud.datastream.v1.IListRoutesRequest|null, + protos.google.cloud.datastream.v1.IListRoutesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listRoutes(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of Routess. + * @param {number} request.pageSize + * Maximum number of Routes to return. The service may return + * fewer than this value. If unspecified, at most 50 Routes + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListRoutes` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListRoutes` must match the call that provided the page + * token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.datastream.v1.Route | Route} 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 `listRoutesAsync()` + * 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. + */ + listRoutesStream( + request?: protos.google.cloud.datastream.v1.IListRoutesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listRoutes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRoutes.createStream( + this.innerApiCalls.listRoutes as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listRoutes`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of Routess. + * @param {number} request.pageSize + * Maximum number of Routes to return. The service may return + * fewer than this value. If unspecified, at most 50 Routes + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListRoutes` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListRoutes` must match the call that provided the page + * token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.datastream.v1.Route | Route}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/datastream.list_routes.js + * region_tag:datastream_v1_generated_Datastream_ListRoutes_async + */ + listRoutesAsync( + request?: protos.google.cloud.datastream.v1.IListRoutesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listRoutes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRoutes.asyncIterate( + this.innerApiCalls['listRoutes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } +/** + * Gets the access control policy for a resource. Returns an empty policy + * if the resource exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {Object} [request.options] + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. This field is only used by Cloud IAM. + * + * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + getIamPolicy( + request: IamProtos.google.iam.v1.GetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.getIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + */ + setIamPolicy( + request: IamProtos.google.iam.v1.SetIamPolicyRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.Policy, + IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.setIamPolicy(request, options, callback); + } + +/** + * Returns permissions that a caller has on the specified resource. If the + * resource does not exist, this will return an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building + * permission-aware UIs and command-line tools, not for authorization + * checking. This operation may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {Object} [options] + * Optional parameters. You can override the default settings for this call, e.g, timeout, + * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. + * @param {function(?Error, ?Object)} [callback] + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + */ + testIamPermissions( + request: IamProtos.google.iam.v1.TestIamPermissionsRequest, + options?: + | gax.CallOptions + | Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + >, + callback?: Callback< + IamProtos.google.iam.v1.TestIamPermissionsResponse, + IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, + {} | null | undefined + > + ):Promise { + return this.iamClient.testIamPermissions(request, options, callback); + } + +/** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * ``` + * const [response] = await client.getLocation(request); + * ``` + */ + getLocation( + request: LocationProtos.google.cloud.location.IGetLocationRequest, + options?: + | gax.CallOptions + | Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + >, + callback?: Callback< + LocationProtos.google.cloud.location.ILocation, + | LocationProtos.google.cloud.location.IGetLocationRequest + | null + | undefined, + {} | null | undefined + > + ): Promise { + return this.locationsClient.getLocation(request, options, callback); + } + +/** + * Lists information about the supported locations for this service. Returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * ``` + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + * ``` + */ + listLocationsAsync( + request: LocationProtos.google.cloud.location.IListLocationsRequest, + options?: CallOptions + ): AsyncIterable { + return this.locationsClient.listLocationsAsync(request, options); + } + +/** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation( + request: protos.google.longrunning.GetOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.longrunning.Operation, + protos.google.longrunning.GetOperationRequest, + {} | null | undefined + > + ): Promise<[protos.google.longrunning.Operation]> { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync( + request: protos.google.longrunning.ListOperationsRequest, + options?: gax.CallOptions + ): AsyncIterable { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation( + request: protos.google.longrunning.CancelOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.CancelOperationRequest, + {} | undefined | null + >, + callback?: Callback< + protos.google.longrunning.CancelOperationRequest, + protos.google.protobuf.Empty, + {} | undefined | null + > + ): Promise { + return this.operationsClient.cancelOperation(request, options, callback); + } + + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation( + request: protos.google.longrunning.DeleteOperationRequest, + options?: + | gax.CallOptions + | Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + >, + callback?: Callback< + protos.google.protobuf.Empty, + protos.google.longrunning.DeleteOperationRequest, + {} | null | undefined + > + ): Promise { + return this.operationsClient.deleteOperation(request, options, callback); + } + + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified connectionProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} connection_profile + * @returns {string} Resource name string. + */ + connectionProfilePath(project:string,location:string,connectionProfile:string) { + return this.pathTemplates.connectionProfilePathTemplate.render({ + project: project, + location: location, + connection_profile: connectionProfile, + }); + } + + /** + * Parse the project from ConnectionProfile resource. + * + * @param {string} connectionProfileName + * A fully-qualified path representing ConnectionProfile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConnectionProfileName(connectionProfileName: string) { + return this.pathTemplates.connectionProfilePathTemplate.match(connectionProfileName).project; + } + + /** + * Parse the location from ConnectionProfile resource. + * + * @param {string} connectionProfileName + * A fully-qualified path representing ConnectionProfile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConnectionProfileName(connectionProfileName: string) { + return this.pathTemplates.connectionProfilePathTemplate.match(connectionProfileName).location; + } + + /** + * Parse the connection_profile from ConnectionProfile resource. + * + * @param {string} connectionProfileName + * A fully-qualified path representing ConnectionProfile resource. + * @returns {string} A string representing the connection_profile. + */ + matchConnectionProfileFromConnectionProfileName(connectionProfileName: string) { + return this.pathTemplates.connectionProfilePathTemplate.match(connectionProfileName).connection_profile; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified privateConnection resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} private_connection + * @returns {string} Resource name string. + */ + privateConnectionPath(project:string,location:string,privateConnection:string) { + return this.pathTemplates.privateConnectionPathTemplate.render({ + project: project, + location: location, + private_connection: privateConnection, + }); + } + + /** + * Parse the project from PrivateConnection resource. + * + * @param {string} privateConnectionName + * A fully-qualified path representing PrivateConnection resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPrivateConnectionName(privateConnectionName: string) { + return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).project; + } + + /** + * Parse the location from PrivateConnection resource. + * + * @param {string} privateConnectionName + * A fully-qualified path representing PrivateConnection resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPrivateConnectionName(privateConnectionName: string) { + return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).location; + } + + /** + * Parse the private_connection from PrivateConnection resource. + * + * @param {string} privateConnectionName + * A fully-qualified path representing PrivateConnection resource. + * @returns {string} A string representing the private_connection. + */ + matchPrivateConnectionFromPrivateConnectionName(privateConnectionName: string) { + return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).private_connection; + } + + /** + * 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 route resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} private_connection + * @param {string} route + * @returns {string} Resource name string. + */ + routePath(project:string,location:string,privateConnection:string,route:string) { + return this.pathTemplates.routePathTemplate.render({ + project: project, + location: location, + private_connection: privateConnection, + route: route, + }); + } + + /** + * Parse the project from Route resource. + * + * @param {string} routeName + * A fully-qualified path representing Route resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRouteName(routeName: string) { + return this.pathTemplates.routePathTemplate.match(routeName).project; + } + + /** + * Parse the location from Route resource. + * + * @param {string} routeName + * A fully-qualified path representing Route resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRouteName(routeName: string) { + return this.pathTemplates.routePathTemplate.match(routeName).location; + } + + /** + * Parse the private_connection from Route resource. + * + * @param {string} routeName + * A fully-qualified path representing Route resource. + * @returns {string} A string representing the private_connection. + */ + matchPrivateConnectionFromRouteName(routeName: string) { + return this.pathTemplates.routePathTemplate.match(routeName).private_connection; + } + + /** + * Parse the route from Route resource. + * + * @param {string} routeName + * A fully-qualified path representing Route resource. + * @returns {string} A string representing the route. + */ + matchRouteFromRouteName(routeName: string) { + return this.pathTemplates.routePathTemplate.match(routeName).route; + } + + /** + * Return a fully-qualified stream resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} stream + * @returns {string} Resource name string. + */ + streamPath(project:string,location:string,stream:string) { + return this.pathTemplates.streamPathTemplate.render({ + project: project, + location: location, + stream: stream, + }); + } + + /** + * Parse the project from Stream resource. + * + * @param {string} streamName + * A fully-qualified path representing Stream resource. + * @returns {string} A string representing the project. + */ + matchProjectFromStreamName(streamName: string) { + return this.pathTemplates.streamPathTemplate.match(streamName).project; + } + + /** + * Parse the location from Stream resource. + * + * @param {string} streamName + * A fully-qualified path representing Stream resource. + * @returns {string} A string representing the location. + */ + matchLocationFromStreamName(streamName: string) { + return this.pathTemplates.streamPathTemplate.match(streamName).location; + } + + /** + * Parse the stream from Stream resource. + * + * @param {string} streamName + * A fully-qualified path representing Stream resource. + * @returns {string} A string representing the stream. + */ + matchStreamFromStreamName(streamName: string) { + return this.pathTemplates.streamPathTemplate.match(streamName).stream; + } + + /** + * Return a fully-qualified streamObject resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} stream + * @param {string} object + * @returns {string} Resource name string. + */ + streamObjectPath(project:string,location:string,stream:string,object:string) { + return this.pathTemplates.streamObjectPathTemplate.render({ + project: project, + location: location, + stream: stream, + object: object, + }); + } + + /** + * Parse the project from StreamObject resource. + * + * @param {string} streamObjectName + * A fully-qualified path representing StreamObject resource. + * @returns {string} A string representing the project. + */ + matchProjectFromStreamObjectName(streamObjectName: string) { + return this.pathTemplates.streamObjectPathTemplate.match(streamObjectName).project; + } + + /** + * Parse the location from StreamObject resource. + * + * @param {string} streamObjectName + * A fully-qualified path representing StreamObject resource. + * @returns {string} A string representing the location. + */ + matchLocationFromStreamObjectName(streamObjectName: string) { + return this.pathTemplates.streamObjectPathTemplate.match(streamObjectName).location; + } + + /** + * Parse the stream from StreamObject resource. + * + * @param {string} streamObjectName + * A fully-qualified path representing StreamObject resource. + * @returns {string} A string representing the stream. + */ + matchStreamFromStreamObjectName(streamObjectName: string) { + return this.pathTemplates.streamObjectPathTemplate.match(streamObjectName).stream; + } + + /** + * Parse the object from StreamObject resource. + * + * @param {string} streamObjectName + * A fully-qualified path representing StreamObject resource. + * @returns {string} A string representing the object. + */ + matchObjectFromStreamObjectName(streamObjectName: string) { + return this.pathTemplates.streamObjectPathTemplate.match(streamObjectName).object; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.datastreamStub && !this._terminated) { + return this.datastreamStub.then(stub => { + this._terminated = true; + stub.close(); + this.iamClient.close(); + this.locationsClient.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_client_config.json b/owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_client_config.json new file mode 100644 index 00000000000..5b8f034a874 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_client_config.json @@ -0,0 +1,163 @@ +{ + "interfaces": { + "google.cloud.datastream.v1.Datastream": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListConnectionProfiles": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetConnectionProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateConnectionProfile": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateConnectionProfile": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteConnectionProfile": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DiscoverConnectionProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListStreams": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetStream": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateStream": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateStream": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteStream": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetStreamObject": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "LookupStreamObject": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListStreamObjects": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "StartBackfillJob": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "StopBackfillJob": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "FetchStaticIps": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreatePrivateConnection": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetPrivateConnection": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListPrivateConnections": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeletePrivateConnection": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateRoute": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetRoute": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListRoutes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteRoute": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_proto_list.json b/owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_proto_list.json new file mode 100644 index 00000000000..43d04578f4a --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/datastream/v1/datastream.proto", + "../../protos/google/cloud/datastream/v1/datastream_resources.proto" +] diff --git a/owl-bot-staging/google-cloud-datastream/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-datastream/v1/src/v1/gapic_metadata.json new file mode 100644 index 00000000000..35e86aa3e21 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/src/v1/gapic_metadata.json @@ -0,0 +1,297 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.datastream.v1", + "libraryPackage": "@google-cloud/datastream", + "services": { + "Datastream": { + "clients": { + "grpc": { + "libraryClient": "DatastreamClient", + "rpcs": { + "GetConnectionProfile": { + "methods": [ + "getConnectionProfile" + ] + }, + "DiscoverConnectionProfile": { + "methods": [ + "discoverConnectionProfile" + ] + }, + "GetStream": { + "methods": [ + "getStream" + ] + }, + "GetStreamObject": { + "methods": [ + "getStreamObject" + ] + }, + "LookupStreamObject": { + "methods": [ + "lookupStreamObject" + ] + }, + "StartBackfillJob": { + "methods": [ + "startBackfillJob" + ] + }, + "StopBackfillJob": { + "methods": [ + "stopBackfillJob" + ] + }, + "GetPrivateConnection": { + "methods": [ + "getPrivateConnection" + ] + }, + "GetRoute": { + "methods": [ + "getRoute" + ] + }, + "CreateConnectionProfile": { + "methods": [ + "createConnectionProfile" + ] + }, + "UpdateConnectionProfile": { + "methods": [ + "updateConnectionProfile" + ] + }, + "DeleteConnectionProfile": { + "methods": [ + "deleteConnectionProfile" + ] + }, + "CreateStream": { + "methods": [ + "createStream" + ] + }, + "UpdateStream": { + "methods": [ + "updateStream" + ] + }, + "DeleteStream": { + "methods": [ + "deleteStream" + ] + }, + "CreatePrivateConnection": { + "methods": [ + "createPrivateConnection" + ] + }, + "DeletePrivateConnection": { + "methods": [ + "deletePrivateConnection" + ] + }, + "CreateRoute": { + "methods": [ + "createRoute" + ] + }, + "DeleteRoute": { + "methods": [ + "deleteRoute" + ] + }, + "ListConnectionProfiles": { + "methods": [ + "listConnectionProfiles", + "listConnectionProfilesStream", + "listConnectionProfilesAsync" + ] + }, + "ListStreams": { + "methods": [ + "listStreams", + "listStreamsStream", + "listStreamsAsync" + ] + }, + "ListStreamObjects": { + "methods": [ + "listStreamObjects", + "listStreamObjectsStream", + "listStreamObjectsAsync" + ] + }, + "FetchStaticIps": { + "methods": [ + "fetchStaticIps", + "fetchStaticIpsStream", + "fetchStaticIpsAsync" + ] + }, + "ListPrivateConnections": { + "methods": [ + "listPrivateConnections", + "listPrivateConnectionsStream", + "listPrivateConnectionsAsync" + ] + }, + "ListRoutes": { + "methods": [ + "listRoutes", + "listRoutesStream", + "listRoutesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DatastreamClient", + "rpcs": { + "GetConnectionProfile": { + "methods": [ + "getConnectionProfile" + ] + }, + "DiscoverConnectionProfile": { + "methods": [ + "discoverConnectionProfile" + ] + }, + "GetStream": { + "methods": [ + "getStream" + ] + }, + "GetStreamObject": { + "methods": [ + "getStreamObject" + ] + }, + "LookupStreamObject": { + "methods": [ + "lookupStreamObject" + ] + }, + "StartBackfillJob": { + "methods": [ + "startBackfillJob" + ] + }, + "StopBackfillJob": { + "methods": [ + "stopBackfillJob" + ] + }, + "GetPrivateConnection": { + "methods": [ + "getPrivateConnection" + ] + }, + "GetRoute": { + "methods": [ + "getRoute" + ] + }, + "CreateConnectionProfile": { + "methods": [ + "createConnectionProfile" + ] + }, + "UpdateConnectionProfile": { + "methods": [ + "updateConnectionProfile" + ] + }, + "DeleteConnectionProfile": { + "methods": [ + "deleteConnectionProfile" + ] + }, + "CreateStream": { + "methods": [ + "createStream" + ] + }, + "UpdateStream": { + "methods": [ + "updateStream" + ] + }, + "DeleteStream": { + "methods": [ + "deleteStream" + ] + }, + "CreatePrivateConnection": { + "methods": [ + "createPrivateConnection" + ] + }, + "DeletePrivateConnection": { + "methods": [ + "deletePrivateConnection" + ] + }, + "CreateRoute": { + "methods": [ + "createRoute" + ] + }, + "DeleteRoute": { + "methods": [ + "deleteRoute" + ] + }, + "ListConnectionProfiles": { + "methods": [ + "listConnectionProfiles", + "listConnectionProfilesStream", + "listConnectionProfilesAsync" + ] + }, + "ListStreams": { + "methods": [ + "listStreams", + "listStreamsStream", + "listStreamsAsync" + ] + }, + "ListStreamObjects": { + "methods": [ + "listStreamObjects", + "listStreamObjectsStream", + "listStreamObjectsAsync" + ] + }, + "FetchStaticIps": { + "methods": [ + "fetchStaticIps", + "fetchStaticIpsStream", + "fetchStaticIpsAsync" + ] + }, + "ListPrivateConnections": { + "methods": [ + "listPrivateConnections", + "listPrivateConnectionsStream", + "listPrivateConnectionsAsync" + ] + }, + "ListRoutes": { + "methods": [ + "listRoutes", + "listRoutesStream", + "listRoutesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-datastream/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-datastream/v1/src/v1/index.ts new file mode 100644 index 00000000000..37416a69a13 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/src/v1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {DatastreamClient} from './datastream_client'; diff --git a/owl-bot-staging/google-cloud-datastream/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-datastream/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..0c39f11d9bc --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const datastream = require('@google-cloud/datastream'); + +function main() { + const datastreamClient = new datastream.DatastreamClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-datastream/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-datastream/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..9dd67114647 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {DatastreamClient} from '@google-cloud/datastream'; + +// check that the client class type name can be used +function doStuffWithDatastreamClient(client: DatastreamClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const datastreamClient = new DatastreamClient(); + doStuffWithDatastreamClient(datastreamClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-datastream/v1/system-test/install.ts b/owl-bot-staging/google-cloud-datastream/v1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/google-cloud-datastream/v1/test/gapic_datastream_v1.ts b/owl-bot-staging/google-cloud-datastream/v1/test/gapic_datastream_v1.ts new file mode 100644 index 00000000000..c8fa53e2ffc --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/test/gapic_datastream_v1.ts @@ -0,0 +1,5201 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as datastreamModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.DatastreamClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = datastreamModule.v1.DatastreamClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = datastreamModule.v1.DatastreamClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = datastreamModule.v1.DatastreamClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new datastreamModule.v1.DatastreamClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new datastreamModule.v1.DatastreamClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.datastreamStub, undefined); + await client.initialize(); + assert(client.datastreamStub); + }); + + it('has close method for the initialized client', done => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.datastreamStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.datastreamStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new datastreamModule.v1.DatastreamClient({ + 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 datastreamModule.v1.DatastreamClient({ + 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('getConnectionProfile', () => { + it('invokes getConnectionProfile without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetConnectionProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1.ConnectionProfile() + ); + client.innerApiCalls.getConnectionProfile = stubSimpleCall(expectedResponse); + const [response] = await client.getConnectionProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnectionProfile without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetConnectionProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1.ConnectionProfile() + ); + client.innerApiCalls.getConnectionProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConnectionProfile( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1.IConnectionProfile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnectionProfile with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetConnectionProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConnectionProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConnectionProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.getConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnectionProfile with closed client', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetConnectionProfileRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getConnectionProfile(request), expectedError); + }); + }); + + describe('discoverConnectionProfile', () => { + it('invokes discoverConnectionProfile without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DiscoverConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DiscoverConnectionProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1.DiscoverConnectionProfileResponse() + ); + client.innerApiCalls.discoverConnectionProfile = stubSimpleCall(expectedResponse); + const [response] = await client.discoverConnectionProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.discoverConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.discoverConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes discoverConnectionProfile without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DiscoverConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DiscoverConnectionProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1.DiscoverConnectionProfileResponse() + ); + client.innerApiCalls.discoverConnectionProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.discoverConnectionProfile( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1.IDiscoverConnectionProfileResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.discoverConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.discoverConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes discoverConnectionProfile with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DiscoverConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DiscoverConnectionProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.discoverConnectionProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.discoverConnectionProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.discoverConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.discoverConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes discoverConnectionProfile with closed client', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DiscoverConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DiscoverConnectionProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.discoverConnectionProfile(request), expectedError); + }); + }); + + describe('getStream', () => { + it('invokes getStream without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetStreamRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1.Stream() + ); + client.innerApiCalls.getStream = stubSimpleCall(expectedResponse); + const [response] = await client.getStream(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getStream without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetStreamRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1.Stream() + ); + client.innerApiCalls.getStream = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getStream( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1.IStream|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getStream with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetStreamRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getStream = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getStream(request), expectedError); + const actualRequest = (client.innerApiCalls.getStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getStream with closed client', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetStreamRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getStream(request), expectedError); + }); + }); + + describe('getStreamObject', () => { + it('invokes getStreamObject without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetStreamObjectRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetStreamObjectRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1.StreamObject() + ); + client.innerApiCalls.getStreamObject = stubSimpleCall(expectedResponse); + const [response] = await client.getStreamObject(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getStreamObject as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getStreamObject as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getStreamObject without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetStreamObjectRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetStreamObjectRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1.StreamObject() + ); + client.innerApiCalls.getStreamObject = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getStreamObject( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1.IStreamObject|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getStreamObject as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getStreamObject as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getStreamObject with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetStreamObjectRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetStreamObjectRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getStreamObject = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getStreamObject(request), expectedError); + const actualRequest = (client.innerApiCalls.getStreamObject as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getStreamObject as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getStreamObject with closed client', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetStreamObjectRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetStreamObjectRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getStreamObject(request), expectedError); + }); + }); + + describe('lookupStreamObject', () => { + it('invokes lookupStreamObject without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.LookupStreamObjectRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.LookupStreamObjectRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1.StreamObject() + ); + client.innerApiCalls.lookupStreamObject = stubSimpleCall(expectedResponse); + const [response] = await client.lookupStreamObject(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.lookupStreamObject as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.lookupStreamObject as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes lookupStreamObject without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.LookupStreamObjectRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.LookupStreamObjectRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1.StreamObject() + ); + client.innerApiCalls.lookupStreamObject = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.lookupStreamObject( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1.IStreamObject|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.lookupStreamObject as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.lookupStreamObject as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes lookupStreamObject with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.LookupStreamObjectRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.LookupStreamObjectRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.lookupStreamObject = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.lookupStreamObject(request), expectedError); + const actualRequest = (client.innerApiCalls.lookupStreamObject as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.lookupStreamObject as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes lookupStreamObject with closed client', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.LookupStreamObjectRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.LookupStreamObjectRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.lookupStreamObject(request), expectedError); + }); + }); + + describe('startBackfillJob', () => { + it('invokes startBackfillJob without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.StartBackfillJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.StartBackfillJobRequest', ['object']); + request.object = defaultValue1; + const expectedHeaderRequestParams = `object=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1.StartBackfillJobResponse() + ); + client.innerApiCalls.startBackfillJob = stubSimpleCall(expectedResponse); + const [response] = await client.startBackfillJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startBackfillJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startBackfillJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startBackfillJob without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.StartBackfillJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.StartBackfillJobRequest', ['object']); + request.object = defaultValue1; + const expectedHeaderRequestParams = `object=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1.StartBackfillJobResponse() + ); + client.innerApiCalls.startBackfillJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.startBackfillJob( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1.IStartBackfillJobResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.startBackfillJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startBackfillJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startBackfillJob with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.StartBackfillJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.StartBackfillJobRequest', ['object']); + request.object = defaultValue1; + const expectedHeaderRequestParams = `object=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.startBackfillJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.startBackfillJob(request), expectedError); + const actualRequest = (client.innerApiCalls.startBackfillJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.startBackfillJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes startBackfillJob with closed client', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.StartBackfillJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.StartBackfillJobRequest', ['object']); + request.object = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.startBackfillJob(request), expectedError); + }); + }); + + describe('stopBackfillJob', () => { + it('invokes stopBackfillJob without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.StopBackfillJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.StopBackfillJobRequest', ['object']); + request.object = defaultValue1; + const expectedHeaderRequestParams = `object=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1.StopBackfillJobResponse() + ); + client.innerApiCalls.stopBackfillJob = stubSimpleCall(expectedResponse); + const [response] = await client.stopBackfillJob(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.stopBackfillJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopBackfillJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopBackfillJob without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.StopBackfillJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.StopBackfillJobRequest', ['object']); + request.object = defaultValue1; + const expectedHeaderRequestParams = `object=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1.StopBackfillJobResponse() + ); + client.innerApiCalls.stopBackfillJob = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.stopBackfillJob( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1.IStopBackfillJobResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.stopBackfillJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopBackfillJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopBackfillJob with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.StopBackfillJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.StopBackfillJobRequest', ['object']); + request.object = defaultValue1; + const expectedHeaderRequestParams = `object=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.stopBackfillJob = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.stopBackfillJob(request), expectedError); + const actualRequest = (client.innerApiCalls.stopBackfillJob as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.stopBackfillJob as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes stopBackfillJob with closed client', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.StopBackfillJobRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.StopBackfillJobRequest', ['object']); + request.object = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.stopBackfillJob(request), expectedError); + }); + }); + + describe('getPrivateConnection', () => { + it('invokes getPrivateConnection without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetPrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetPrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1.PrivateConnection() + ); + client.innerApiCalls.getPrivateConnection = stubSimpleCall(expectedResponse); + const [response] = await client.getPrivateConnection(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPrivateConnection without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetPrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetPrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1.PrivateConnection() + ); + client.innerApiCalls.getPrivateConnection = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getPrivateConnection( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1.IPrivateConnection|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPrivateConnection with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetPrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetPrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getPrivateConnection = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getPrivateConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPrivateConnection with closed client', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetPrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetPrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getPrivateConnection(request), expectedError); + }); + }); + + describe('getRoute', () => { + it('invokes getRoute without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetRouteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1.Route() + ); + client.innerApiCalls.getRoute = stubSimpleCall(expectedResponse); + const [response] = await client.getRoute(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRoute without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetRouteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1.Route() + ); + client.innerApiCalls.getRoute = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getRoute( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1.IRoute|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRoute with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetRouteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getRoute = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getRoute(request), expectedError); + const actualRequest = (client.innerApiCalls.getRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRoute with closed client', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.GetRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.GetRouteRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getRoute(request), expectedError); + }); + }); + + describe('createConnectionProfile', () => { + it('invokes createConnectionProfile without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.CreateConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.CreateConnectionProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConnectionProfile = stubLongRunningCall(expectedResponse); + const [operation] = await client.createConnectionProfile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnectionProfile without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.CreateConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.CreateConnectionProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConnectionProfile = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConnectionProfile( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnectionProfile with call error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.CreateConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.CreateConnectionProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConnectionProfile = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createConnectionProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.createConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnectionProfile with LRO error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.CreateConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.CreateConnectionProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConnectionProfile = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createConnectionProfile(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateConnectionProfileProgress without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkCreateConnectionProfileProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateConnectionProfileProgress with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkCreateConnectionProfileProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateConnectionProfile', () => { + it('invokes updateConnectionProfile without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.UpdateConnectionProfileRequest() + ); + request.connectionProfile ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.UpdateConnectionProfileRequest', ['connectionProfile', 'name']); + request.connectionProfile.name = defaultValue1; + const expectedHeaderRequestParams = `connection_profile.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateConnectionProfile = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateConnectionProfile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConnectionProfile without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.UpdateConnectionProfileRequest() + ); + request.connectionProfile ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.UpdateConnectionProfileRequest', ['connectionProfile', 'name']); + request.connectionProfile.name = defaultValue1; + const expectedHeaderRequestParams = `connection_profile.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateConnectionProfile = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateConnectionProfile( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConnectionProfile with call error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.UpdateConnectionProfileRequest() + ); + request.connectionProfile ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.UpdateConnectionProfileRequest', ['connectionProfile', 'name']); + request.connectionProfile.name = defaultValue1; + const expectedHeaderRequestParams = `connection_profile.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConnectionProfile = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateConnectionProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.updateConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConnectionProfile with LRO error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.UpdateConnectionProfileRequest() + ); + request.connectionProfile ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.UpdateConnectionProfileRequest', ['connectionProfile', 'name']); + request.connectionProfile.name = defaultValue1; + const expectedHeaderRequestParams = `connection_profile.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConnectionProfile = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateConnectionProfile(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateConnectionProfileProgress without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkUpdateConnectionProfileProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateConnectionProfileProgress with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkUpdateConnectionProfileProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteConnectionProfile', () => { + it('invokes deleteConnectionProfile without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DeleteConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DeleteConnectionProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConnectionProfile = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteConnectionProfile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnectionProfile without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DeleteConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DeleteConnectionProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConnectionProfile = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteConnectionProfile( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnectionProfile with call error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DeleteConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DeleteConnectionProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConnectionProfile = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteConnectionProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnectionProfile with LRO error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DeleteConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DeleteConnectionProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConnectionProfile = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteConnectionProfile(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteConnectionProfileProgress without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkDeleteConnectionProfileProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteConnectionProfileProgress with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkDeleteConnectionProfileProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createStream', () => { + it('invokes createStream without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.CreateStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.CreateStreamRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createStream = stubLongRunningCall(expectedResponse); + const [operation] = await client.createStream(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createStream without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.CreateStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.CreateStreamRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createStream = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createStream( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createStream with call error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.CreateStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.CreateStreamRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createStream = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createStream(request), expectedError); + const actualRequest = (client.innerApiCalls.createStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createStream with LRO error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.CreateStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.CreateStreamRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createStream = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createStream(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateStreamProgress without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkCreateStreamProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateStreamProgress with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkCreateStreamProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateStream', () => { + it('invokes updateStream without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.UpdateStreamRequest() + ); + request.stream ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.UpdateStreamRequest', ['stream', 'name']); + request.stream.name = defaultValue1; + const expectedHeaderRequestParams = `stream.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateStream = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateStream(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateStream without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.UpdateStreamRequest() + ); + request.stream ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.UpdateStreamRequest', ['stream', 'name']); + request.stream.name = defaultValue1; + const expectedHeaderRequestParams = `stream.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateStream = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateStream( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateStream with call error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.UpdateStreamRequest() + ); + request.stream ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.UpdateStreamRequest', ['stream', 'name']); + request.stream.name = defaultValue1; + const expectedHeaderRequestParams = `stream.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateStream = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateStream(request), expectedError); + const actualRequest = (client.innerApiCalls.updateStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateStream with LRO error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.UpdateStreamRequest() + ); + request.stream ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.UpdateStreamRequest', ['stream', 'name']); + request.stream.name = defaultValue1; + const expectedHeaderRequestParams = `stream.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateStream = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateStream(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateStreamProgress without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkUpdateStreamProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateStreamProgress with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkUpdateStreamProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteStream', () => { + it('invokes deleteStream without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DeleteStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DeleteStreamRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteStream = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteStream(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteStream without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DeleteStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DeleteStreamRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteStream = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteStream( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteStream with call error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DeleteStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DeleteStreamRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteStream = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteStream(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteStream with LRO error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DeleteStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DeleteStreamRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteStream = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteStream(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteStreamProgress without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkDeleteStreamProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteStreamProgress with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkDeleteStreamProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createPrivateConnection', () => { + it('invokes createPrivateConnection without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.CreatePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.CreatePrivateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createPrivateConnection = stubLongRunningCall(expectedResponse); + const [operation] = await client.createPrivateConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createPrivateConnection without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.CreatePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.CreatePrivateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createPrivateConnection = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createPrivateConnection( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createPrivateConnection with call error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.CreatePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.CreatePrivateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPrivateConnection = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createPrivateConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createPrivateConnection with LRO error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.CreatePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.CreatePrivateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPrivateConnection = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createPrivateConnection(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreatePrivateConnectionProgress without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkCreatePrivateConnectionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreatePrivateConnectionProgress with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkCreatePrivateConnectionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deletePrivateConnection', () => { + it('invokes deletePrivateConnection without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DeletePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DeletePrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(expectedResponse); + const [operation] = await client.deletePrivateConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePrivateConnection without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DeletePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DeletePrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deletePrivateConnection = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deletePrivateConnection( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePrivateConnection with call error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DeletePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DeletePrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deletePrivateConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePrivateConnection with LRO error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DeletePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DeletePrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deletePrivateConnection(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeletePrivateConnectionProgress without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkDeletePrivateConnectionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeletePrivateConnectionProgress with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkDeletePrivateConnectionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createRoute', () => { + it('invokes createRoute without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.CreateRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.CreateRouteRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createRoute = stubLongRunningCall(expectedResponse); + const [operation] = await client.createRoute(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRoute without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.CreateRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.CreateRouteRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createRoute = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createRoute( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRoute with call error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.CreateRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.CreateRouteRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createRoute = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createRoute(request), expectedError); + const actualRequest = (client.innerApiCalls.createRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRoute with LRO error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.CreateRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.CreateRouteRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createRoute = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createRoute(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateRouteProgress without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkCreateRouteProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateRouteProgress with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkCreateRouteProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteRoute', () => { + it('invokes deleteRoute without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DeleteRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DeleteRouteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteRoute = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteRoute(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRoute without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DeleteRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DeleteRouteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteRoute = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteRoute( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRoute with call error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DeleteRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DeleteRouteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteRoute = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteRoute(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRoute with LRO error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.DeleteRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.DeleteRouteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteRoute = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteRoute(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteRouteProgress without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkDeleteRouteProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteRouteProgress with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + 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.checkDeleteRouteProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listConnectionProfiles', () => { + it('invokes listConnectionProfiles without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListConnectionProfilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListConnectionProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), + generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), + generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), + ]; + client.innerApiCalls.listConnectionProfiles = stubSimpleCall(expectedResponse); + const [response] = await client.listConnectionProfiles(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConnectionProfiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnectionProfiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnectionProfiles without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListConnectionProfilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListConnectionProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), + generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), + generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), + ]; + client.innerApiCalls.listConnectionProfiles = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConnectionProfiles( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1.IConnectionProfile[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConnectionProfiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnectionProfiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnectionProfiles with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListConnectionProfilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListConnectionProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConnectionProfiles = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConnectionProfiles(request), expectedError); + const actualRequest = (client.innerApiCalls.listConnectionProfiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnectionProfiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnectionProfilesStream without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListConnectionProfilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListConnectionProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), + generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), + generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), + ]; + client.descriptors.page.listConnectionProfiles.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listConnectionProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.datastream.v1.ConnectionProfile[] = []; + stream.on('data', (response: protos.google.cloud.datastream.v1.ConnectionProfile) => { + 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.listConnectionProfiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConnectionProfiles, request)); + assert( + (client.descriptors.page.listConnectionProfiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listConnectionProfilesStream with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListConnectionProfilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListConnectionProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConnectionProfiles.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listConnectionProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.datastream.v1.ConnectionProfile[] = []; + stream.on('data', (response: protos.google.cloud.datastream.v1.ConnectionProfile) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listConnectionProfiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConnectionProfiles, request)); + assert( + (client.descriptors.page.listConnectionProfiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConnectionProfiles without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListConnectionProfilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListConnectionProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), + generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), + generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), + ]; + client.descriptors.page.listConnectionProfiles.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.datastream.v1.IConnectionProfile[] = []; + const iterable = client.listConnectionProfilesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listConnectionProfiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConnectionProfiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConnectionProfiles with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListConnectionProfilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListConnectionProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConnectionProfiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConnectionProfilesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.datastream.v1.IConnectionProfile[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listConnectionProfiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConnectionProfiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listStreams', () => { + it('invokes listStreams without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListStreamsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), + generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), + generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), + ]; + client.innerApiCalls.listStreams = stubSimpleCall(expectedResponse); + const [response] = await client.listStreams(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listStreams as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listStreams as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listStreams without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListStreamsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), + generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), + generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), + ]; + client.innerApiCalls.listStreams = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listStreams( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1.IStream[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listStreams as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listStreams as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listStreams with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListStreamsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listStreams = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listStreams(request), expectedError); + const actualRequest = (client.innerApiCalls.listStreams as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listStreams as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listStreamsStream without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListStreamsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), + generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), + generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), + ]; + client.descriptors.page.listStreams.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listStreamsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.datastream.v1.Stream[] = []; + stream.on('data', (response: protos.google.cloud.datastream.v1.Stream) => { + 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.listStreams.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listStreams, request)); + assert( + (client.descriptors.page.listStreams.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listStreamsStream with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListStreamsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listStreams.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listStreamsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.datastream.v1.Stream[] = []; + stream.on('data', (response: protos.google.cloud.datastream.v1.Stream) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listStreams.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listStreams, request)); + assert( + (client.descriptors.page.listStreams.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listStreams without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListStreamsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), + generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), + generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), + ]; + client.descriptors.page.listStreams.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.datastream.v1.IStream[] = []; + const iterable = client.listStreamsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listStreams.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listStreams.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listStreams with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListStreamsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listStreams.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listStreamsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.datastream.v1.IStream[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listStreams.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listStreams.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listStreamObjects', () => { + it('invokes listStreamObjects without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListStreamObjectsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamObjectsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), + generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), + generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), + ]; + client.innerApiCalls.listStreamObjects = stubSimpleCall(expectedResponse); + const [response] = await client.listStreamObjects(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listStreamObjects as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listStreamObjects as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listStreamObjects without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListStreamObjectsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamObjectsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), + generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), + generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), + ]; + client.innerApiCalls.listStreamObjects = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listStreamObjects( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1.IStreamObject[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listStreamObjects as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listStreamObjects as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listStreamObjects with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListStreamObjectsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamObjectsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listStreamObjects = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listStreamObjects(request), expectedError); + const actualRequest = (client.innerApiCalls.listStreamObjects as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listStreamObjects as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listStreamObjectsStream without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListStreamObjectsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamObjectsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), + generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), + generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), + ]; + client.descriptors.page.listStreamObjects.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listStreamObjectsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.datastream.v1.StreamObject[] = []; + stream.on('data', (response: protos.google.cloud.datastream.v1.StreamObject) => { + 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.listStreamObjects.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listStreamObjects, request)); + assert( + (client.descriptors.page.listStreamObjects.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listStreamObjectsStream with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListStreamObjectsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamObjectsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listStreamObjects.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listStreamObjectsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.datastream.v1.StreamObject[] = []; + stream.on('data', (response: protos.google.cloud.datastream.v1.StreamObject) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listStreamObjects.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listStreamObjects, request)); + assert( + (client.descriptors.page.listStreamObjects.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listStreamObjects without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListStreamObjectsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamObjectsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), + generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), + generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), + ]; + client.descriptors.page.listStreamObjects.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.datastream.v1.IStreamObject[] = []; + const iterable = client.listStreamObjectsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listStreamObjects.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listStreamObjects.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listStreamObjects with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListStreamObjectsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamObjectsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listStreamObjects.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listStreamObjectsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.datastream.v1.IStreamObject[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listStreamObjects.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listStreamObjects.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('fetchStaticIps', () => { + it('invokes fetchStaticIps without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.FetchStaticIpsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.FetchStaticIpsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [new String(), new String(), new String()]; + client.innerApiCalls.fetchStaticIps = stubSimpleCall(expectedResponse); + const [response] = await client.fetchStaticIps(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchStaticIps as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchStaticIps as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchStaticIps without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.FetchStaticIpsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.FetchStaticIpsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [new String(), new String(), new String()]; + client.innerApiCalls.fetchStaticIps = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchStaticIps( + request, + (err?: Error|null, result?: string[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchStaticIps as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchStaticIps as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchStaticIps with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.FetchStaticIpsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.FetchStaticIpsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchStaticIps = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.fetchStaticIps(request), expectedError); + const actualRequest = (client.innerApiCalls.fetchStaticIps as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchStaticIps as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchStaticIpsStream without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.FetchStaticIpsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.FetchStaticIpsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = [new String(), new String(), new String()]; + client.descriptors.page.fetchStaticIps.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.fetchStaticIpsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: string[] = []; + stream.on('data', (response: string) => { + 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.fetchStaticIps.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.fetchStaticIps, request)); + assert( + (client.descriptors.page.fetchStaticIps.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes fetchStaticIpsStream with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.FetchStaticIpsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.FetchStaticIpsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.fetchStaticIps.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.fetchStaticIpsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: string[] = []; + stream.on('data', (response: string) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.fetchStaticIps.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.fetchStaticIps, request)); + assert( + (client.descriptors.page.fetchStaticIps.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with fetchStaticIps without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.FetchStaticIpsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.FetchStaticIpsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = [new String(), new String(), new String()]; + client.descriptors.page.fetchStaticIps.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: string[] = []; + const iterable = client.fetchStaticIpsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.fetchStaticIps.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.fetchStaticIps.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with fetchStaticIps with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.FetchStaticIpsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.FetchStaticIpsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.fetchStaticIps.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.fetchStaticIpsAsync(request); + await assert.rejects(async () => { + const responses: string[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.fetchStaticIps.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.fetchStaticIps.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listPrivateConnections', () => { + it('invokes listPrivateConnections without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), + ]; + client.innerApiCalls.listPrivateConnections = stubSimpleCall(expectedResponse); + const [response] = await client.listPrivateConnections(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPrivateConnections without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), + ]; + client.innerApiCalls.listPrivateConnections = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPrivateConnections( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1.IPrivateConnection[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPrivateConnections with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listPrivateConnections = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listPrivateConnections(request), expectedError); + const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPrivateConnectionsStream without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), + ]; + client.descriptors.page.listPrivateConnections.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listPrivateConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.datastream.v1.PrivateConnection[] = []; + stream.on('data', (response: protos.google.cloud.datastream.v1.PrivateConnection) => { + 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.listPrivateConnections.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPrivateConnections, request)); + assert( + (client.descriptors.page.listPrivateConnections.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listPrivateConnectionsStream with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPrivateConnections.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listPrivateConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.datastream.v1.PrivateConnection[] = []; + stream.on('data', (response: protos.google.cloud.datastream.v1.PrivateConnection) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listPrivateConnections.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPrivateConnections, request)); + assert( + (client.descriptors.page.listPrivateConnections.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPrivateConnections without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), + ]; + client.descriptors.page.listPrivateConnections.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.datastream.v1.IPrivateConnection[] = []; + const iterable = client.listPrivateConnectionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPrivateConnections with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPrivateConnections.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPrivateConnectionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.datastream.v1.IPrivateConnection[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listRoutes', () => { + it('invokes listRoutes without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), + generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), + generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), + ]; + client.innerApiCalls.listRoutes = stubSimpleCall(expectedResponse); + const [response] = await client.listRoutes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRoutes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRoutes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRoutes without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), + generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), + generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), + ]; + client.innerApiCalls.listRoutes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRoutes( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1.IRoute[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRoutes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRoutes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRoutes with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listRoutes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listRoutes(request), expectedError); + const actualRequest = (client.innerApiCalls.listRoutes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRoutes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRoutesStream without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), + generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), + generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), + ]; + client.descriptors.page.listRoutes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listRoutesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.datastream.v1.Route[] = []; + stream.on('data', (response: protos.google.cloud.datastream.v1.Route) => { + 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.listRoutes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRoutes, request)); + assert( + (client.descriptors.page.listRoutes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listRoutesStream with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRoutes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listRoutesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.datastream.v1.Route[] = []; + stream.on('data', (response: protos.google.cloud.datastream.v1.Route) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listRoutes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRoutes, request)); + assert( + (client.descriptors.page.listRoutes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRoutes without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), + generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), + generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), + ]; + client.descriptors.page.listRoutes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.datastream.v1.IRoute[] = []; + const iterable = client.listRoutesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listRoutes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRoutes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRoutes with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1.ListRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1.ListRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRoutes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listRoutesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.datastream.v1.IRoute[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listRoutes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRoutes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.getIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getIamPolicy without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes getIamPolicy with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.GetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); + const response = await client.setIamPolicy(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes setIamPolicy without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.Policy() + ); + client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0)); + }); + it('invokes setIamPolicy with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.SetIamPolicyRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); + assert((client.iamClient.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); + const response = await client.testIamPermissions(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes testIamPermissions without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsResponse() + ); + client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + expectedOptions, + (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0)); + }); + it('invokes testIamPermissions with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new IamProtos.google.iam.v1.TestIamPermissionsRequest() + ); + request.resource = ''; + const expectedHeaderRequestParams = 'resource='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); + assert((client.iamClient.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('getLocation', () => { + it('invokes getLocation without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = stubSimpleCall(expectedResponse); + const response = await client.getLocation(request, expectedOptions); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + it('invokes getLocation without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ); + client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getLocation( + request, + expectedOptions, + ( + err?: Error | null, + result?: LocationProtos.google.cloud.location.ILocation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0)); + }); + it('invokes getLocation with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.GetLocationRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getLocation(request, expectedOptions), expectedError); + assert((client.locationsClient.getLocation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + describe('listLocationsAsync', () => { + it('uses async iteration with listLocations without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedResponse = [ + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + generateSampleMessage( + new LocationProtos.google.cloud.location.Location() + ), + ]; + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + const iterable = client.listLocationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + it('uses async iteration with listLocations with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new LocationProtos.google.cloud.location.ListLocationsRequest() + ); + request.name = ''; + const expectedHeaderRequestParams = 'name='; + const expectedError = new Error('expected'); + client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listLocationsAsync(request); + await assert.rejects(async () => { + const responses: LocationProtos.google.cloud.location.ILocation[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + describe('getOperation', () => { + it('invokes getOperation without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = stubSimpleCall(expectedResponse); + const response = await client.getOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes getOperation without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new operationsProtos.google.longrunning.Operation() + ); + client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.getOperation( + request, + undefined, + ( + err?: Error | null, + result?: operationsProtos.google.longrunning.Operation | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + it('invokes getOperation with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.GetOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.getOperation(request)}, expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('cancelOperation', () => { + it('invokes cancelOperation without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); + const response = await client.cancelOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes cancelOperation without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.cancelOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0)); + }); + it('invokes cancelOperation with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.CancelOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); + assert((client.operationsClient.cancelOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('deleteOperation', () => { + it('invokes deleteOperation without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); + const response = await client.deleteOperation(request); + assert.deepStrictEqual(response, [expectedResponse]); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request) + ); + }); + it('invokes deleteOperation without error using callback', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedResponse = generateSampleMessage( + new protos.google.protobuf.Empty() + ); + client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); + const promise = new Promise((resolve, reject) => { + client.operationsClient.deleteOperation( + request, + undefined, + ( + err?: Error | null, + result?: protos.google.protobuf.Empty | null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0)); + }); + it('invokes deleteOperation with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.DeleteOperationRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); + await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); + assert((client.operationsClient.deleteOperation as SinonStub) + .getCall(0).calledWith(request)); + }); + }); + describe('listOperationsAsync', () => { + it('uses async iteration with listOperations without error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedResponse = [ + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsResponse() + ), + ]; + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + const iterable = client.operationsClient.listOperationsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + it('uses async iteration with listOperations with error', async () => { + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new operationsProtos.google.longrunning.ListOperationsRequest() + ); + const expectedError = new Error('expected'); + client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.operationsClient.listOperationsAsync(request); + await assert.rejects(async () => { + const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) + .getCall(0).args[1], request); + }); + }); + + describe('Path templates', () => { + + describe('connectionProfile', () => { + const fakePath = "/rendered/path/connectionProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + connection_profile: "connectionProfileValue", + }; + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.connectionProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.connectionProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('connectionProfilePath', () => { + const result = client.connectionProfilePath("projectValue", "locationValue", "connectionProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.connectionProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConnectionProfileName', () => { + const result = client.matchProjectFromConnectionProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.connectionProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConnectionProfileName', () => { + const result = client.matchLocationFromConnectionProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.connectionProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConnectionProfileFromConnectionProfileName', () => { + const result = client.matchConnectionProfileFromConnectionProfileName(fakePath); + assert.strictEqual(result, "connectionProfileValue"); + assert((client.pathTemplates.connectionProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('privateConnection', () => { + const fakePath = "/rendered/path/privateConnection"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + private_connection: "privateConnectionValue", + }; + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.privateConnectionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.privateConnectionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('privateConnectionPath', () => { + const result = client.privateConnectionPath("projectValue", "locationValue", "privateConnectionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.privateConnectionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromPrivateConnectionName', () => { + const result = client.matchProjectFromPrivateConnectionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromPrivateConnectionName', () => { + const result = client.matchLocationFromPrivateConnectionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchPrivateConnectionFromPrivateConnectionName', () => { + const result = client.matchPrivateConnectionFromPrivateConnectionName(fakePath); + assert.strictEqual(result, "privateConnectionValue"); + assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new datastreamModule.v1.DatastreamClient({ + 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('route', () => { + const fakePath = "/rendered/path/route"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + private_connection: "privateConnectionValue", + route: "routeValue", + }; + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.routePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.routePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('routePath', () => { + const result = client.routePath("projectValue", "locationValue", "privateConnectionValue", "routeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.routePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromRouteName', () => { + const result = client.matchProjectFromRouteName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.routePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromRouteName', () => { + const result = client.matchLocationFromRouteName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.routePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchPrivateConnectionFromRouteName', () => { + const result = client.matchPrivateConnectionFromRouteName(fakePath); + assert.strictEqual(result, "privateConnectionValue"); + assert((client.pathTemplates.routePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRouteFromRouteName', () => { + const result = client.matchRouteFromRouteName(fakePath); + assert.strictEqual(result, "routeValue"); + assert((client.pathTemplates.routePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('stream', () => { + const fakePath = "/rendered/path/stream"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + stream: "streamValue", + }; + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.streamPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.streamPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('streamPath', () => { + const result = client.streamPath("projectValue", "locationValue", "streamValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.streamPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromStreamName', () => { + const result = client.matchProjectFromStreamName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromStreamName', () => { + const result = client.matchLocationFromStreamName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchStreamFromStreamName', () => { + const result = client.matchStreamFromStreamName(fakePath); + assert.strictEqual(result, "streamValue"); + assert((client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('streamObject', () => { + const fakePath = "/rendered/path/streamObject"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + stream: "streamValue", + object: "objectValue", + }; + const client = new datastreamModule.v1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.streamObjectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.streamObjectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('streamObjectPath', () => { + const result = client.streamObjectPath("projectValue", "locationValue", "streamValue", "objectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.streamObjectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromStreamObjectName', () => { + const result = client.matchProjectFromStreamObjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.streamObjectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromStreamObjectName', () => { + const result = client.matchLocationFromStreamObjectName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.streamObjectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchStreamFromStreamObjectName', () => { + const result = client.matchStreamFromStreamObjectName(fakePath); + assert.strictEqual(result, "streamValue"); + assert((client.pathTemplates.streamObjectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchObjectFromStreamObjectName', () => { + const result = client.matchObjectFromStreamObjectName(fakePath); + assert.strictEqual(result, "objectValue"); + assert((client.pathTemplates.streamObjectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-datastream/v1/tsconfig.json b/owl-bot-staging/google-cloud-datastream/v1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/google-cloud-datastream/v1/webpack.config.js b/owl-bot-staging/google-cloud-datastream/v1/webpack.config.js new file mode 100644 index 00000000000..ce71b478c09 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1/webpack.config.js @@ -0,0 +1,64 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +const path = require('path'); + +module.exports = { + entry: './src/index.ts', + output: { + library: 'Datastream', + filename: './datastream.js', + }, + node: { + child_process: 'empty', + fs: 'empty', + crypto: 'empty', + }, + resolve: { + alias: { + '../../../package.json': path.resolve(__dirname, 'package.json'), + }, + extensions: ['.js', '.json', '.ts'], + }, + module: { + rules: [ + { + test: /\.tsx?$/, + use: 'ts-loader', + exclude: /node_modules/ + }, + { + test: /node_modules[\\/]@grpc[\\/]grpc-js/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]grpc/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]retry-request/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]https?-proxy-agent/, + use: 'null-loader' + }, + { + test: /node_modules[\\/]gtoken/, + use: 'null-loader' + }, + ], + }, + mode: 'production', +}; diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/.eslintignore b/owl-bot-staging/google-cloud-datastream/v1alpha1/.eslintignore new file mode 100644 index 00000000000..cfc348ec4d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/.eslintrc.json b/owl-bot-staging/google-cloud-datastream/v1alpha1/.eslintrc.json new file mode 100644 index 00000000000..78215349546 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/.gitignore b/owl-bot-staging/google-cloud-datastream/v1alpha1/.gitignore new file mode 100644 index 00000000000..d4f03a0df2e --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/.gitignore @@ -0,0 +1,14 @@ +**/*.log +**/node_modules +/.coverage +/coverage +/.nyc_output +/docs/ +/out/ +/build/ +system-test/secrets.js +system-test/*key.json +*.lock +.DS_Store +package-lock.json +__pycache__ diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/.jsdoc.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/.jsdoc.js new file mode 100644 index 00000000000..cb79c804665 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2023 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/datastream', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/.mocharc.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/.mocharc.js new file mode 100644 index 00000000000..1a38f257db7 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/.prettierrc.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/.prettierrc.js new file mode 100644 index 00000000000..55639e70f9e --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/README.md b/owl-bot-staging/google-cloud-datastream/v1alpha1/README.md new file mode 100644 index 00000000000..a7903c0b77c --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/README.md @@ -0,0 +1 @@ +Datastream: Nodejs Client diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/linkinator.config.json b/owl-bot-staging/google-cloud-datastream/v1alpha1/linkinator.config.json new file mode 100644 index 00000000000..befd23c8633 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/linkinator.config.json @@ -0,0 +1,16 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io", + "https://console.cloud.google.com/cloudshell", + "https://support.google.com" + ], + "silent": true, + "concurrency": 5, + "retry": true, + "retryErrors": true, + "retryErrorsCount": 5, + "retryErrorsJitter": 3000 +} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/package.json b/owl-bot-staging/google-cloud-datastream/v1alpha1/package.json new file mode 100644 index 00000000000..fbd522f5bde --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/datastream", + "version": "0.1.0", + "description": "Datastream client for Node.js", + "repository": "googleapis/nodejs-datastream", + "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 datastream", + "datastream", + "datastream" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.5.7" + }, + "devDependencies": { + "@types/mocha": "^10.0.1", + "@types/node": "^18.11.18", + "@types/sinon": "^10.0.13", + "c8": "^7.12.0", + "gts": "^3.1.1", + "jsdoc": "^4.0.0", + "jsdoc-fresh": "^2.0.1", + "jsdoc-region-tag": "^2.0.1", + "linkinator": "^4.1.2", + "mocha": "^10.2.0", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^15.0.1", + "ts-loader": "^8.4.0", + "typescript": "^4.8.4", + "webpack": "^4.46.0", + "webpack-cli": "^4.10.0" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/protos/google/cloud/datastream/v1alpha1/datastream.proto b/owl-bot-staging/google-cloud-datastream/v1alpha1/protos/google/cloud/datastream/v1alpha1/datastream.proto new file mode 100644 index 00000000000..14dac8fe5b5 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/protos/google/cloud/datastream/v1alpha1/datastream.proto @@ -0,0 +1,895 @@ +// 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.cloud.datastream.v1alpha1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/datastream/v1alpha1/datastream_resources.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.Datastream.V1Alpha1"; +option go_package = "cloud.google.com/go/datastream/apiv1alpha1/datastreampb;datastreampb"; +option java_multiple_files = true; +option java_outer_classname = "CloudDatastreamServiceProto"; +option java_package = "com.google.cloud.datastream.v1alpha1"; +option php_namespace = "Google\\Cloud\\Datastream\\V1alpha1"; +option ruby_package = "Google::Cloud::Datastream::V1alpha1"; + +// Datastream service +service Datastream { + option (google.api.default_host) = "datastream.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Use this method to list connection profiles created in a project and + // location. + rpc ListConnectionProfiles(ListConnectionProfilesRequest) returns (ListConnectionProfilesResponse) { + option (google.api.http) = { + get: "/v1alpha1/{parent=projects/*/locations/*}/connectionProfiles" + }; + option (google.api.method_signature) = "parent"; + } + + // Use this method to get details about a connection profile. + rpc GetConnectionProfile(GetConnectionProfileRequest) returns (ConnectionProfile) { + option (google.api.http) = { + get: "/v1alpha1/{name=projects/*/locations/*/connectionProfiles/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Use this method to create a connection profile in a project and location. + rpc CreateConnectionProfile(CreateConnectionProfileRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha1/{parent=projects/*/locations/*}/connectionProfiles" + body: "connection_profile" + }; + option (google.api.method_signature) = "parent,connection_profile,connection_profile_id"; + option (google.longrunning.operation_info) = { + response_type: "ConnectionProfile" + metadata_type: "OperationMetadata" + }; + } + + // Use this method to update the parameters of a connection profile. + rpc UpdateConnectionProfile(UpdateConnectionProfileRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1alpha1/{connection_profile.name=projects/*/locations/*/connectionProfiles/*}" + body: "connection_profile" + }; + option (google.api.method_signature) = "connection_profile,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "ConnectionProfile" + metadata_type: "OperationMetadata" + }; + } + + // Use this method to delete a connection profile.. + rpc DeleteConnectionProfile(DeleteConnectionProfileRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1alpha1/{name=projects/*/locations/*/connectionProfiles/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Use this method to discover a connection profile. + // The discover API call exposes the data objects and metadata belonging to + // the profile. Typically, a request returns children data objects under a + // parent data object that's optionally supplied in the request. + rpc DiscoverConnectionProfile(DiscoverConnectionProfileRequest) returns (DiscoverConnectionProfileResponse) { + option (google.api.http) = { + post: "/v1alpha1/{parent=projects/*/locations/*}/connectionProfiles:discover" + body: "*" + }; + } + + // Use this method to list streams in a project and location. + rpc ListStreams(ListStreamsRequest) returns (ListStreamsResponse) { + option (google.api.http) = { + get: "/v1alpha1/{parent=projects/*/locations/*}/streams" + }; + option (google.api.method_signature) = "parent"; + } + + // Use this method to get details about a stream. + rpc GetStream(GetStreamRequest) returns (Stream) { + option (google.api.http) = { + get: "/v1alpha1/{name=projects/*/locations/*/streams/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Use this method to create a stream. + rpc CreateStream(CreateStreamRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha1/{parent=projects/*/locations/*}/streams" + body: "stream" + }; + option (google.api.method_signature) = "parent,stream,stream_id"; + option (google.longrunning.operation_info) = { + response_type: "Stream" + metadata_type: "OperationMetadata" + }; + } + + // Use this method to update the configuration of a stream. + rpc UpdateStream(UpdateStreamRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1alpha1/{stream.name=projects/*/locations/*/streams/*}" + body: "stream" + }; + option (google.api.method_signature) = "stream,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Stream" + metadata_type: "OperationMetadata" + }; + } + + // Use this method to delete a stream. + rpc DeleteStream(DeleteStreamRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1alpha1/{name=projects/*/locations/*/streams/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Use this method to fetch any errors associated with a stream. + rpc FetchErrors(FetchErrorsRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha1/{stream=projects/*/locations/*/streams/*}:fetchErrors" + body: "*" + }; + option (google.longrunning.operation_info) = { + response_type: "FetchErrorsResponse" + metadata_type: "OperationMetadata" + }; + } + + // The FetchStaticIps API call exposes the static ips used by Datastream. + // Typically, a request returns children data objects under + // a parent data object that's optionally supplied in the request. + rpc FetchStaticIps(FetchStaticIpsRequest) returns (FetchStaticIpsResponse) { + option (google.api.http) = { + get: "/v1alpha1/{name=projects/*/locations/*}:fetchStaticIps" + }; + option (google.api.method_signature) = "name"; + } + + // Use this method to create a private connectivity configuration. + rpc CreatePrivateConnection(CreatePrivateConnectionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha1/{parent=projects/*/locations/*}/privateConnections" + body: "private_connection" + }; + option (google.api.method_signature) = "parent,private_connection,private_connection_id"; + option (google.longrunning.operation_info) = { + response_type: "PrivateConnection" + metadata_type: "OperationMetadata" + }; + } + + // Use this method to get details about a private connectivity configuration. + rpc GetPrivateConnection(GetPrivateConnectionRequest) returns (PrivateConnection) { + option (google.api.http) = { + get: "/v1alpha1/{name=projects/*/locations/*/privateConnections/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Use this method to list private connectivity configurations in a project + // and location. + rpc ListPrivateConnections(ListPrivateConnectionsRequest) returns (ListPrivateConnectionsResponse) { + option (google.api.http) = { + get: "/v1alpha1/{parent=projects/*/locations/*}/privateConnections" + }; + option (google.api.method_signature) = "parent"; + } + + // Use this method to delete a private connectivity configuration. + rpc DeletePrivateConnection(DeletePrivateConnectionRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1alpha1/{name=projects/*/locations/*/privateConnections/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Use this method to create a route for a private connectivity in a project + // and location. + rpc CreateRoute(CreateRouteRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha1/{parent=projects/*/locations/*/privateConnections/*}/routes" + body: "route" + }; + option (google.api.method_signature) = "parent,route,route_id"; + option (google.longrunning.operation_info) = { + response_type: "Route" + metadata_type: "OperationMetadata" + }; + } + + // Use this method to get details about a route. + rpc GetRoute(GetRouteRequest) returns (Route) { + option (google.api.http) = { + get: "/v1alpha1/{name=projects/*/locations/*/privateConnections/*/routes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Use this method to list routes created for a private connectivity in a + // project and location. + rpc ListRoutes(ListRoutesRequest) returns (ListRoutesResponse) { + option (google.api.http) = { + get: "/v1alpha1/{parent=projects/*/locations/*/privateConnections/*}/routes" + }; + option (google.api.method_signature) = "parent"; + } + + // Use this method to delete a route. + rpc DeleteRoute(DeleteRouteRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1alpha1/{name=projects/*/locations/*/privateConnections/*/routes/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } +} + +// Request message for 'discover' ConnectionProfile request. +message DiscoverConnectionProfileRequest { + // Required. The parent resource of the ConnectionProfile type. Must be in the + // format `projects/*/locations/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/ConnectionProfile" + } + ]; + + // The connection profile on which to run discover. + oneof target { + // An ad-hoc ConnectionProfile configuration. + ConnectionProfile connection_profile = 200; + + // A reference to an existing ConnectionProfile. + string connection_profile_name = 201; + } + + oneof depth { + // Whether to retrieve the full hierarchy of data objects (TRUE) or only the + // current level (FALSE). + bool recursive = 3; + + // The number of hierarchy levels below the current level to be retrieved. + int32 recursion_depth = 4; + } + + // The data object to enrich with child data objects and metadata. + oneof data_object { + // Oracle RDBMS to enrich with child data objects and metadata. + OracleRdbms oracle_rdbms = 100; + + // MySQL RDBMS to enrich with child data objects and metadata. + MysqlRdbms mysql_rdbms = 101; + } +} + +message DiscoverConnectionProfileResponse { + // The data object that has been enriched by the discover API call. + oneof data_object { + // Enriched Oracle RDBMS object. + OracleRdbms oracle_rdbms = 100; + + // Enriched MySQL RDBMS object. + MysqlRdbms mysql_rdbms = 101; + } +} + +// Request message for 'FetchStaticIps' request. +message FetchStaticIpsRequest { + // Required. The name resource of the Response type. Must be in the + // format `projects/*/locations/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Maximum number of Ips to return, will likely not be specified. + int32 page_size = 2; + + // A page token, received from a previous `ListStaticIps` call. + // will likely not be specified. + string page_token = 3; +} + +// Response message for a 'FetchStaticIps' response. +message FetchStaticIpsResponse { + // list of static ips by account + repeated string static_ips = 1; + + // A token that can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// Request message for 'FetchErrors' request. +message FetchErrorsRequest { + // Name of the Stream resource for which to fetch any errors. + string stream = 1 [(google.api.resource_reference) = { + type: "datastream.googleapis.com/Stream" + }]; +} + +// Response message for a 'FetchErrors' response. +message FetchErrorsResponse { + // The list of errors on the Stream. + repeated Error errors = 1; +} + +message ListConnectionProfilesRequest { + // Required. The parent that owns the collection of connection profiles. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/ConnectionProfile" + } + ]; + + // Maximum number of connection profiles to return. + // If unspecified, at most 50 connection profiles will be returned. + // The maximum value is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // Page token received from a previous `ListConnectionProfiles` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListConnectionProfiles` + // must match the call that provided the page token. + string page_token = 3; + + // Filter request. + string filter = 4; + + // Order by fields for the result. + string order_by = 5; +} + +message ListConnectionProfilesResponse { + // List of connection profiles. + repeated ConnectionProfile connection_profiles = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +message GetConnectionProfileRequest { + // Required. The name of the connection profile resource to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/ConnectionProfile" + } + ]; +} + +message CreateConnectionProfileRequest { + // Required. The parent that owns the collection of ConnectionProfiles. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/ConnectionProfile" + } + ]; + + // Required. The connection profile identifier. + string connection_profile_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The connection profile resource to create. + ConnectionProfile connection_profile = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +message UpdateConnectionProfileRequest { + // Optional. Field mask is used to specify the fields to be overwritten in the + // ConnectionProfile resource by the update. + // The fields specified in the update_mask are relative to the resource, not + // the full request. A field will be overwritten if it is in the mask. If the + // user does not provide a mask then all fields will be overwritten. + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The ConnectionProfile to update. + ConnectionProfile connection_profile = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +message DeleteConnectionProfileRequest { + // Required. The name of the connection profile resource to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/ConnectionProfile" + } + ]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +message ListStreamsRequest { + // Required. The parent that owns the collection of streams. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/Stream" + } + ]; + + // Maximum number of streams to return. + // If unspecified, at most 50 streams will be returned. The maximum + // value is 1000; values above 1000 will be coerced to 1000. + int32 page_size = 2; + + // Page token received from a previous `ListStreams` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to `ListStreams` + // must match the call that provided the page token. + string page_token = 3; + + // Filter request. + string filter = 4; + + // Order by fields for the result. + string order_by = 5; +} + +message ListStreamsResponse { + // List of streams + repeated Stream streams = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +message GetStreamRequest { + // Required. The name of the stream resource to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/Stream" + } + ]; +} + +message CreateStreamRequest { + // Required. The parent that owns the collection of streams. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/Stream" + } + ]; + + // Required. The stream identifier. + string stream_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The stream resource to create. + Stream stream = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only validate the stream, but do not create any resources. + // The default is false. + bool validate_only = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Create the stream without validating it. + bool force = 6 [(google.api.field_behavior) = OPTIONAL]; +} + +message UpdateStreamRequest { + // Optional. Field mask is used to specify the fields to be overwritten in the + // stream resource by the update. + // The fields specified in the update_mask are relative to the resource, not + // the full request. A field will be overwritten if it is in the mask. If the + // user does not provide a mask then all fields will be overwritten. + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The stream resource to update. + Stream stream = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Only validate the stream with the changes, without actually updating it. + // The default is false. + bool validate_only = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Execute the update without validating it. + bool force = 5 [(google.api.field_behavior) = OPTIONAL]; +} + +message DeleteStreamRequest { + // Required. The name of the stream resource to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/Stream" + } + ]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Represents the metadata of the long-running operation. +message OperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Server-defined resource path for the target of the operation. + string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Name of the verb executed by the operation. + string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Human-readable status of the operation, if any. + string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Identifies whether the user has requested cancellation + // of the operation. Operations that have successfully been cancelled + // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, + // corresponding to `Code.CANCELLED`. + bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. API version used to start the operation. + string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. Results of executed validations if there are any. + ValidationResult validation_result = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +message CreatePrivateConnectionRequest { + // Required. The parent that owns the collection of PrivateConnections. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/PrivateConnection" + } + ]; + + // Required. The private connectivity identifier. + string private_connection_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Private Connectivity resource to create. + PrivateConnection private_connection = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +message ListPrivateConnectionsRequest { + // Required. The parent that owns the collection of private connectivity configurations. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/PrivateConnection" + } + ]; + + // Maximum number of private connectivity configurations to return. + // If unspecified, at most 50 private connectivity configurations that will be + // returned. The maximum value is 1000; values above 1000 will be coerced to + // 1000. + int32 page_size = 2; + + // Page token received from a previous `ListPrivateConnections` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // `ListPrivateConnections` must match the call that provided the page + // token. + string page_token = 3; + + // Filter request. + string filter = 4; + + // Order by fields for the result. + string order_by = 5; +} + +message ListPrivateConnectionsResponse { + // List of private connectivity configurations. + repeated PrivateConnection private_connections = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +message DeletePrivateConnectionRequest { + // Required. The name of the private connectivity configuration to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/PrivateConnection" + } + ]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set to true, any child routes that belong to this PrivateConnection will + // also be deleted. + bool force = 3 [(google.api.field_behavior) = OPTIONAL]; +} + +message GetPrivateConnectionRequest { + // Required. The name of the private connectivity configuration to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/PrivateConnection" + } + ]; +} + +// route creation request +message CreateRouteRequest { + // Required. The parent that owns the collection of Routes. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/Route" + } + ]; + + // Required. The Route identifier. + string route_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The Route resource to create. + Route route = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes since the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// route list request +message ListRoutesRequest { + // Required. The parent that owns the collection of Routess. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + child_type: "datastream.googleapis.com/Route" + } + ]; + + // Maximum number of Routes to return. The service may return + // fewer than this value. If unspecified, at most 50 Routes + // will be returned. The maximum value is 1000; values above 1000 will be + // coerced to 1000. + int32 page_size = 2; + + // Page token received from a previous `ListRoutes` call. + // Provide this to retrieve the subsequent page. + // + // When paginating, all other parameters provided to + // `ListRoutes` must match the call that provided the page + // token. + string page_token = 3; + + // Filter request. + string filter = 4; + + // Order by fields for the result. + string order_by = 5; +} + +// route list response +message ListRoutesResponse { + // List of Routes. + repeated Route routes = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// route deletion request +message DeleteRouteRequest { + // Required. The name of the Route resource to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/Route" + } + ]; + + // Optional. A request ID to identify requests. Specify a unique request ID + // so that if you must retry your request, the server will know to ignore + // the request if it has already been completed. The server will guarantee + // that for at least 60 minutes after the first request. + // + // For example, consider a situation where you make an initial request and the + // request times out. If you make the request again with the same request ID, + // the server can check if original operation with the same request ID was + // received, and if so, will ignore the second request. This prevents clients + // from accidentally creating duplicate commitments. + // + // The request ID must be a valid UUID with the exception that zero UUID is + // not supported (00000000-0000-0000-0000-000000000000). + string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// route get request +message GetRouteRequest { + // Required. The name of the Route resource to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "datastream.googleapis.com/Route" + } + ]; +} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/protos/google/cloud/datastream/v1alpha1/datastream_resources.proto b/owl-bot-staging/google-cloud-datastream/v1alpha1/protos/google/cloud/datastream/v1alpha1/datastream_resources.proto new file mode 100644 index 00000000000..59111d92a7e --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/protos/google/cloud/datastream/v1alpha1/datastream_resources.proto @@ -0,0 +1,683 @@ +// 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.cloud.datastream.v1alpha1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "cloud.google.com/go/datastream/apiv1alpha1/datastreampb;datastreampb"; +option java_multiple_files = true; +option java_outer_classname = "CloudDatastreamResourcesProto"; +option java_package = "com.google.cloud.datastream.v1alpha1"; +option csharp_namespace = "Google.Cloud.Datastream.V1Alpha1"; +option php_namespace = "Google\\Cloud\\Datastream\\V1alpha1"; +option ruby_package = "Google::Cloud::Datastream::V1alpha1"; + +// Oracle database profile. +message OracleProfile { + // Required. Hostname for the Oracle connection. + string hostname = 1 [(google.api.field_behavior) = REQUIRED]; + + // Port for the Oracle connection, default value is 1521. + int32 port = 2; + + // Required. Username for the Oracle connection. + string username = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Password for the Oracle connection. + string password = 4 [(google.api.field_behavior) = REQUIRED]; + + // Required. Database for the Oracle connection. + string database_service = 5 [(google.api.field_behavior) = REQUIRED]; + + // Connection string attributes + map connection_attributes = 6; +} + +// MySQL database profile. +message MysqlProfile { + // Required. Hostname for the MySQL connection. + string hostname = 1 [(google.api.field_behavior) = REQUIRED]; + + // Port for the MySQL connection, default value is 3306. + int32 port = 2; + + // Required. Username for the MySQL connection. + string username = 3 [(google.api.field_behavior) = REQUIRED]; + + // Required. Input only. Password for the MySQL connection. + string password = 4 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = INPUT_ONLY + ]; + + // SSL configuration for the MySQL connection. + MysqlSslConfig ssl_config = 5; +} + +// Cloud Storage bucket profile. +message GcsProfile { + // Required. The full project and resource path for Cloud Storage bucket including the + // name. + string bucket_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // The root path inside the Cloud Storage bucket. + string root_path = 2; +} + +// No connectivity settings. +message NoConnectivitySettings { + +} + +// Static IP address connectivity. +message StaticServiceIpConnectivity { + +} + +// Forward SSH Tunnel connectivity. +message ForwardSshTunnelConnectivity { + // Required. Hostname for the SSH tunnel. + string hostname = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Username for the SSH tunnel. + string username = 2 [(google.api.field_behavior) = REQUIRED]; + + // Port for the SSH tunnel, default value is 22. + int32 port = 3; + + oneof authentication_method { + // Input only. SSH password. + string password = 100 [(google.api.field_behavior) = INPUT_ONLY]; + + // Input only. SSH private key. + string private_key = 101 [(google.api.field_behavior) = INPUT_ONLY]; + } +} + +// The VPC Peering configuration is used to create VPC peering between +// Datastream and the consumer's VPC. +message VpcPeeringConfig { + // Required. fully qualified name of the VPC Datastream will peer to. + string vpc_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. A free subnet for peering. (CIDR of /29) + string subnet = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The PrivateConnection resource is used to establish private connectivity +// between Datastream and a customer's network. +message PrivateConnection { + option (google.api.resource) = { + type: "datastream.googleapis.com/PrivateConnection" + pattern: "projects/{project}/locations/{location}/privateConnections/{private_connection}" + }; + + // Private Connection state. + enum State { + STATE_UNSPECIFIED = 0; + + // The private connection is in creation state - creating resources. + CREATING = 1; + + // The private connection has been created with all of it's resources. + CREATED = 2; + + // The private connection creation has failed. + FAILED = 3; + } + + // Output only. The resource's name. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The create time of the resource. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The update time of the resource. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels. + map labels = 4; + + // Required. Display name. + string display_name = 5 [(google.api.field_behavior) = REQUIRED]; + + // Output only. The state of the Private Connection. + State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. In case of error, the details of the error in a user-friendly format. + Error error = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // VPC Peering Config + VpcPeeringConfig vpc_peering_config = 100; +} + +// Private Connectivity +message PrivateConnectivity { + string private_connection_name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The Route resource is the child of the PrivateConnection resource. +// It used to define a route for a PrivateConnection setup. +message Route { + option (google.api.resource) = { + type: "datastream.googleapis.com/Route" + pattern: "projects/{project}/locations/{location}/privateConnections/{private_connection}/routes/{route}" + }; + + // Output only. The resource's name. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The create time of the resource. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The update time of the resource. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels. + map labels = 4; + + // Required. Display name. + string display_name = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. Destination address for connection + string destination_address = 6 [(google.api.field_behavior) = REQUIRED]; + + // Destination port for connection + int32 destination_port = 7; +} + +// MySQL SSL configuration information. +message MysqlSslConfig { + // Input only. PEM-encoded private key associated with the Client Certificate. + // If this field is used then the 'client_certificate' and the + // 'ca_certificate' fields are mandatory. + string client_key = 11 [(google.api.field_behavior) = INPUT_ONLY]; + + // Output only. Indicates whether the client_key field is set. + bool client_key_set = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Input only. PEM-encoded certificate that will be used by the replica to + // authenticate against the source database server. If this field is used + // then the 'client_key' and the 'ca_certificate' fields are mandatory. + string client_certificate = 13 [(google.api.field_behavior) = INPUT_ONLY]; + + // Output only. Indicates whether the client_certificate field is set. + bool client_certificate_set = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Input only. PEM-encoded certificate of the CA that signed the source database + // server's certificate. + string ca_certificate = 15 [(google.api.field_behavior) = INPUT_ONLY]; + + // Output only. Indicates whether the ca_certificate field is set. + bool ca_certificate_set = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +message ConnectionProfile { + option (google.api.resource) = { + type: "datastream.googleapis.com/ConnectionProfile" + pattern: "projects/{project}/locations/{location}/connectionProfiles/{connection_profile}" + }; + + // Output only. The resource's name. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The create time of the resource. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The update time of the resource. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels. + map labels = 4; + + // Required. Display name. + string display_name = 5 [(google.api.field_behavior) = REQUIRED]; + + // Connection configuration for the ConnectionProfile. + oneof profile { + // Oracle ConnectionProfile configuration. + OracleProfile oracle_profile = 100; + + // Cloud Storage ConnectionProfile configuration. + GcsProfile gcs_profile = 101; + + // MySQL ConnectionProfile configuration. + MysqlProfile mysql_profile = 102; + } + + // Connectivity options used to establish a connection to the profile. + oneof connectivity { + // No connectivity option chosen. + NoConnectivitySettings no_connectivity = 200; + + // Static Service IP connectivity. + StaticServiceIpConnectivity static_service_ip_connectivity = 201; + + // Forward SSH tunnel connectivity. + ForwardSshTunnelConnectivity forward_ssh_connectivity = 202; + + // Private connectivity. + PrivateConnectivity private_connectivity = 203; + } +} + +// Oracle Column. +message OracleColumn { + // Column name. + string column_name = 1; + + // The Oracle data type. + string data_type = 2; + + // Column length. + int32 length = 3; + + // Column precision. + int32 precision = 4; + + // Column scale. + int32 scale = 5; + + // Column encoding. + string encoding = 6; + + // Whether or not the column represents a primary key. + bool primary_key = 7; + + // Whether or not the column can accept a null value. + bool nullable = 8; + + // The ordinal position of the column in the table. + int32 ordinal_position = 9; +} + +// Oracle table. +message OracleTable { + // Table name. + string table_name = 1; + + // Oracle columns in the schema. + // When unspecified as part of inclue/exclude lists, includes/excludes + // everything. + repeated OracleColumn oracle_columns = 2; +} + +// Oracle schema. +message OracleSchema { + // Schema name. + string schema_name = 1; + + // Tables in the schema. + repeated OracleTable oracle_tables = 2; +} + +// Oracle database structure. +message OracleRdbms { + // Oracle schemas/databases in the database server. + repeated OracleSchema oracle_schemas = 1; +} + +// Oracle data source configuration +message OracleSourceConfig { + // Oracle objects to include in the stream. + OracleRdbms allowlist = 1; + + // Oracle objects to exclude from the stream. + OracleRdbms rejectlist = 2; +} + +// MySQL Column. +message MysqlColumn { + // Column name. + string column_name = 1; + + // The MySQL data type. Full data types list can be found here: + // https://dev.mysql.com/doc/refman/8.0/en/data-types.html + string data_type = 2; + + // Column length. + int32 length = 3; + + // Column collation. + string collation = 4; + + // Whether or not the column represents a primary key. + bool primary_key = 5; + + // Whether or not the column can accept a null value. + bool nullable = 6; + + // The ordinal position of the column in the table. + int32 ordinal_position = 7; +} + +// MySQL table. +message MysqlTable { + // Table name. + string table_name = 1; + + // MySQL columns in the database. + // When unspecified as part of include/exclude lists, includes/excludes + // everything. + repeated MysqlColumn mysql_columns = 2; +} + +// MySQL database. +message MysqlDatabase { + // Database name. + string database_name = 1; + + // Tables in the database. + repeated MysqlTable mysql_tables = 2; +} + +// MySQL database structure +message MysqlRdbms { + // Mysql databases on the server + repeated MysqlDatabase mysql_databases = 1; +} + +// MySQL source configuration +message MysqlSourceConfig { + // MySQL objects to retrieve from the source. + MysqlRdbms allowlist = 1; + + // MySQL objects to exclude from the stream. + MysqlRdbms rejectlist = 2; +} + +// The configuration of the stream source. +message SourceConfig { + // Required. Source connection profile identifier. + string source_connection_profile_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Stream configuration that is specific to the data source type. + oneof source_stream_config { + // Oracle data source configuration + OracleSourceConfig oracle_source_config = 100; + + // MySQL data source configuration + MysqlSourceConfig mysql_source_config = 101; + } +} + +// AVRO file format configuration. +message AvroFileFormat { + +} + +// File format in Cloud Storage. +enum GcsFileFormat { + option deprecated = true; + + // Unspecified Cloud Storage file format. + GCS_FILE_FORMAT_UNSPECIFIED = 0; + + // Avro file format + AVRO = 1; +} + +// Schema file format. +enum SchemaFileFormat { + // Unspecified schema file format. + SCHEMA_FILE_FORMAT_UNSPECIFIED = 0; + + // Do not attach schema file. + NO_SCHEMA_FILE = 1; + + // Avro schema format. + AVRO_SCHEMA_FILE = 2; +} + +// JSON file format configuration. +message JsonFileFormat { + // Json file compression. + enum JsonCompression { + // Unspecified json file compression. + JSON_COMPRESSION_UNSPECIFIED = 0; + + // Do not compress JSON file. + NO_COMPRESSION = 1; + + // Gzip compression. + GZIP = 2; + } + + // The schema file format along JSON data files. + SchemaFileFormat schema_file_format = 1; + + // Compression of the loaded JSON file. + JsonCompression compression = 2; +} + +// Google Cloud Storage destination configuration +message GcsDestinationConfig { + // Path inside the Cloud Storage bucket to write data to. + string path = 1; + + // File format that data should be written in. + // Deprecated field - use file_format instead. + GcsFileFormat gcs_file_format = 2 [deprecated = true]; + + // The maximum file size to be saved in the bucket. + int32 file_rotation_mb = 3; + + // The maximum duration for which new events are added before a file is + // closed and a new file is created. + google.protobuf.Duration file_rotation_interval = 4; + + // File Format that the data should be written in. + oneof file_format { + // AVRO file format configuration. + AvroFileFormat avro_file_format = 100; + + // JSON file format configuration. + JsonFileFormat json_file_format = 101; + } +} + +// The configuration of the stream destination. +message DestinationConfig { + // Required. Destination connection profile identifier. + string destination_connection_profile_name = 1 [(google.api.field_behavior) = REQUIRED]; + + // Stream configuration that is specific to the data destination type. + oneof destination_stream_config { + GcsDestinationConfig gcs_destination_config = 100; + } +} + +message Stream { + option (google.api.resource) = { + type: "datastream.googleapis.com/Stream" + pattern: "projects/{project}/locations/{location}/streams/{stream}" + }; + + // Backfill strategy to automatically backfill the Stream's objects. + // Specific objects can be excluded. + message BackfillAllStrategy { + // List of objects to exclude. + oneof excluded_objects { + // Oracle data source objects to avoid backfilling. + OracleRdbms oracle_excluded_objects = 1; + + // MySQL data source objects to avoid backfilling. + MysqlRdbms mysql_excluded_objects = 2; + } + } + + // Backfill strategy to disable automatic backfill for the Stream's objects. + message BackfillNoneStrategy { + + } + + // Stream state. + enum State { + // Unspecified stream state. + STATE_UNSPECIFIED = 0; + + // The stream has been created. + CREATED = 1; + + // The stream is running. + RUNNING = 2; + + // The stream is paused. + PAUSED = 3; + + // The stream is in maintenance mode. + // + // Updates are rejected on the resource in this state. + MAINTENANCE = 4; + + // The stream is experiencing an error that is preventing data from being + // streamed. + FAILED = 5; + + // The stream has experienced a terminal failure. + FAILED_PERMANENTLY = 6; + + // The stream is starting, but not yet running. + STARTING = 7; + + // The Stream is no longer reading new events, but still writing events in + // the buffer. + DRAINING = 8; + } + + // Output only. The stream's name. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The creation time of the stream. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The last update time of the stream. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Labels. + map labels = 4; + + // Required. Display name. + string display_name = 5 [(google.api.field_behavior) = REQUIRED]; + + // Required. Source connection profile configuration. + SourceConfig source_config = 6 [(google.api.field_behavior) = REQUIRED]; + + // Required. Destination connection profile configuration. + DestinationConfig destination_config = 7 [(google.api.field_behavior) = REQUIRED]; + + // The state of the stream. + State state = 8; + + // Stream backfill strategy. + oneof backfill_strategy { + // Automatically backfill objects included in the stream source + // configuration. Specific objects can be excluded. + BackfillAllStrategy backfill_all = 101; + + // Do not automatically backfill any objects. + BackfillNoneStrategy backfill_none = 102; + } + + // Output only. Errors on the Stream. + repeated Error errors = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Represent a user-facing Error. +message Error { + // A title that explains the reason for the error. + string reason = 1; + + // A unique identifier for this specific error, + // allowing it to be traced throughout the system in logs and API responses. + string error_uuid = 2; + + // A message containing more information about the error that occurred. + string message = 3; + + // The time when the error occurred. + google.protobuf.Timestamp error_time = 4; + + // Additional information about the error. + map details = 5; +} + +// Contains the current validation results. +message ValidationResult { + // A list of validations (includes both executed as well as not executed + // validations). + repeated Validation validations = 1; +} + +message Validation { + // Validation execution status. + enum Status { + // Unspecified status. + STATUS_UNSPECIFIED = 0; + + // Validation did not execute. + NOT_EXECUTED = 1; + + // Validation failed. + FAILED = 2; + + // Validation passed. + PASSED = 3; + } + + // A short description of the validation. + string description = 1; + + // Validation execution status. + Status status = 2; + + // Messages reflecting the validation results. + repeated ValidationMessage message = 3; + + // A custom code identifying this validation. + string code = 4; +} + +// Represent user-facing validation result message. +message ValidationMessage { + // Validation message level. + enum Level { + // Unspecified level. + LEVEL_UNSPECIFIED = 0; + + // Potentially cause issues with the Stream. + WARNING = 1; + + // Definitely cause issues with the Stream. + ERROR = 2; + } + + // The result of the validation. + string message = 1; + + // Message severity level (warning or error). + Level level = 2; + + // Additional metadata related to the result. + map metadata = 3; + + // A custom code identifying this specific message. + string code = 4; +} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_connection_profile.js new file mode 100644 index 00000000000..0693192ed3c --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_connection_profile.js @@ -0,0 +1,86 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, connectionProfileId, connectionProfile) { + // [START datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent that owns the collection of ConnectionProfiles. + */ + // const parent = 'abc123' + /** + * Required. The connection profile identifier. + */ + // const connectionProfileId = 'abc123' + /** + * Required. The connection profile resource to create. + */ + // const connectionProfile = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callCreateConnectionProfile() { + // Construct request + const request = { + parent, + connectionProfileId, + connectionProfile, + }; + + // Run request + const [operation] = await datastreamClient.createConnectionProfile(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateConnectionProfile(); + // [END datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_private_connection.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_private_connection.js new file mode 100644 index 00000000000..ac7f5453c86 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_private_connection.js @@ -0,0 +1,86 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, privateConnectionId, privateConnection) { + // [START datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent that owns the collection of PrivateConnections. + */ + // const parent = 'abc123' + /** + * Required. The private connectivity identifier. + */ + // const privateConnectionId = 'abc123' + /** + * Required. The Private Connectivity resource to create. + */ + // const privateConnection = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callCreatePrivateConnection() { + // Construct request + const request = { + parent, + privateConnectionId, + privateConnection, + }; + + // Run request + const [operation] = await datastreamClient.createPrivateConnection(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreatePrivateConnection(); + // [END datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_route.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_route.js new file mode 100644 index 00000000000..8a2ecb97050 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_route.js @@ -0,0 +1,86 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, routeId, route) { + // [START datastream_v1alpha1_generated_Datastream_CreateRoute_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent that owns the collection of Routes. + */ + // const parent = 'abc123' + /** + * Required. The Route identifier. + */ + // const routeId = 'abc123' + /** + * Required. The Route resource to create. + */ + // const route = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callCreateRoute() { + // Construct request + const request = { + parent, + routeId, + route, + }; + + // Run request + const [operation] = await datastreamClient.createRoute(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateRoute(); + // [END datastream_v1alpha1_generated_Datastream_CreateRoute_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_stream.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_stream.js new file mode 100644 index 00000000000..8386d87ba33 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_stream.js @@ -0,0 +1,95 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, streamId, stream) { + // [START datastream_v1alpha1_generated_Datastream_CreateStream_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent that owns the collection of streams. + */ + // const parent = 'abc123' + /** + * Required. The stream identifier. + */ + // const streamId = 'abc123' + /** + * Required. The stream resource to create. + */ + // const stream = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + /** + * Optional. Only validate the stream, but do not create any resources. + * The default is false. + */ + // const validateOnly = true + /** + * Optional. Create the stream without validating it. + */ + // const force = true + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callCreateStream() { + // Construct request + const request = { + parent, + streamId, + stream, + }; + + // Run request + const [operation] = await datastreamClient.createStream(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateStream(); + // [END datastream_v1alpha1_generated_Datastream_CreateStream_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_connection_profile.js new file mode 100644 index 00000000000..7e2b4d09e18 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_connection_profile.js @@ -0,0 +1,76 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the connection profile resource to delete. + */ + // const name = 'abc123' + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callDeleteConnectionProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await datastreamClient.deleteConnectionProfile(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteConnectionProfile(); + // [END datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_private_connection.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_private_connection.js new file mode 100644 index 00000000000..6d924f69778 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_private_connection.js @@ -0,0 +1,81 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the private connectivity configuration to delete. + */ + // const name = 'abc123' + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + /** + * Optional. If set to true, any child routes that belong to this PrivateConnection will + * also be deleted. + */ + // const force = true + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callDeletePrivateConnection() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await datastreamClient.deletePrivateConnection(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeletePrivateConnection(); + // [END datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_route.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_route.js new file mode 100644 index 00000000000..6fb1e854751 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_route.js @@ -0,0 +1,76 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1alpha1_generated_Datastream_DeleteRoute_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Route resource to delete. + */ + // const name = 'abc123' + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callDeleteRoute() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await datastreamClient.deleteRoute(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteRoute(); + // [END datastream_v1alpha1_generated_Datastream_DeleteRoute_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_stream.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_stream.js new file mode 100644 index 00000000000..707f5f3ef7a --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_stream.js @@ -0,0 +1,76 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1alpha1_generated_Datastream_DeleteStream_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the stream resource to delete. + */ + // const name = 'abc123' + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callDeleteStream() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await datastreamClient.deleteStream(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteStream(); + // [END datastream_v1alpha1_generated_Datastream_DeleteStream_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.discover_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.discover_connection_profile.js new file mode 100644 index 00000000000..20e71dcd71f --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.discover_connection_profile.js @@ -0,0 +1,87 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource of the ConnectionProfile type. Must be in the + * format `projects/* /locations/*`. + */ + // const parent = 'abc123' + /** + * An ad-hoc ConnectionProfile configuration. + */ + // const connectionProfile = {} + /** + * A reference to an existing ConnectionProfile. + */ + // const connectionProfileName = 'abc123' + /** + * Whether to retrieve the full hierarchy of data objects (TRUE) or only the + * current level (FALSE). + */ + // const recursive = true + /** + * The number of hierarchy levels below the current level to be retrieved. + */ + // const recursionDepth = 1234 + /** + * Oracle RDBMS to enrich with child data objects and metadata. + */ + // const oracleRdbms = {} + /** + * MySQL RDBMS to enrich with child data objects and metadata. + */ + // const mysqlRdbms = {} + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callDiscoverConnectionProfile() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await datastreamClient.discoverConnectionProfile(request); + console.log(response); + } + + callDiscoverConnectionProfile(); + // [END datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.fetch_errors.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.fetch_errors.js new file mode 100644 index 00000000000..757fa7d5bac --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.fetch_errors.js @@ -0,0 +1,61 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main() { + // [START datastream_v1alpha1_generated_Datastream_FetchErrors_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Name of the Stream resource for which to fetch any errors. + */ + // const stream = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callFetchErrors() { + // Construct request + const request = { + }; + + // Run request + const [operation] = await datastreamClient.fetchErrors(request); + const [response] = await operation.promise(); + console.log(response); + } + + callFetchErrors(); + // [END datastream_v1alpha1_generated_Datastream_FetchErrors_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.fetch_static_ips.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.fetch_static_ips.js new file mode 100644 index 00000000000..3a24a473112 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.fetch_static_ips.js @@ -0,0 +1,73 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1alpha1_generated_Datastream_FetchStaticIps_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name resource of the Response type. Must be in the + * format `projects/* /locations/*`. + */ + // const name = 'abc123' + /** + * Maximum number of Ips to return, will likely not be specified. + */ + // const pageSize = 1234 + /** + * A page token, received from a previous `ListStaticIps` call. + * will likely not be specified. + */ + // const pageToken = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callFetchStaticIps() { + // Construct request + const request = { + name, + }; + + // Run request + const iterable = await datastreamClient.fetchStaticIpsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callFetchStaticIps(); + // [END datastream_v1alpha1_generated_Datastream_FetchStaticIps_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_connection_profile.js new file mode 100644 index 00000000000..3d858121316 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_connection_profile.js @@ -0,0 +1,61 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1alpha1_generated_Datastream_GetConnectionProfile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the connection profile resource to get. + */ + // const name = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callGetConnectionProfile() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await datastreamClient.getConnectionProfile(request); + console.log(response); + } + + callGetConnectionProfile(); + // [END datastream_v1alpha1_generated_Datastream_GetConnectionProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_private_connection.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_private_connection.js new file mode 100644 index 00000000000..14317cda9a1 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_private_connection.js @@ -0,0 +1,61 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1alpha1_generated_Datastream_GetPrivateConnection_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the private connectivity configuration to get. + */ + // const name = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callGetPrivateConnection() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await datastreamClient.getPrivateConnection(request); + console.log(response); + } + + callGetPrivateConnection(); + // [END datastream_v1alpha1_generated_Datastream_GetPrivateConnection_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_route.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_route.js new file mode 100644 index 00000000000..def7158c41f --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_route.js @@ -0,0 +1,61 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1alpha1_generated_Datastream_GetRoute_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Route resource to get. + */ + // const name = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callGetRoute() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await datastreamClient.getRoute(request); + console.log(response); + } + + callGetRoute(); + // [END datastream_v1alpha1_generated_Datastream_GetRoute_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_stream.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_stream.js new file mode 100644 index 00000000000..2a797874df9 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_stream.js @@ -0,0 +1,61 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START datastream_v1alpha1_generated_Datastream_GetStream_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the stream resource to get. + */ + // const name = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callGetStream() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await datastreamClient.getStream(request); + console.log(response); + } + + callGetStream(); + // [END datastream_v1alpha1_generated_Datastream_GetStream_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_connection_profiles.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_connection_profiles.js new file mode 100644 index 00000000000..d8a093a9bff --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_connection_profiles.js @@ -0,0 +1,84 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent that owns the collection of connection profiles. + */ + // const parent = 'abc123' + /** + * Maximum number of connection profiles to return. + * If unspecified, at most 50 connection profiles will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * Page token received from a previous `ListConnectionProfiles` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListConnectionProfiles` + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Filter request. + */ + // const filter = 'abc123' + /** + * Order by fields for the result. + */ + // const orderBy = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callListConnectionProfiles() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await datastreamClient.listConnectionProfilesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConnectionProfiles(); + // [END datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_private_connections.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_private_connections.js new file mode 100644 index 00000000000..ae52a772e05 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_private_connections.js @@ -0,0 +1,86 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START datastream_v1alpha1_generated_Datastream_ListPrivateConnections_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent that owns the collection of private connectivity configurations. + */ + // const parent = 'abc123' + /** + * Maximum number of private connectivity configurations to return. + * If unspecified, at most 50 private connectivity configurations that will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + */ + // const pageSize = 1234 + /** + * Page token received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + */ + // const pageToken = 'abc123' + /** + * Filter request. + */ + // const filter = 'abc123' + /** + * Order by fields for the result. + */ + // const orderBy = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callListPrivateConnections() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await datastreamClient.listPrivateConnectionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListPrivateConnections(); + // [END datastream_v1alpha1_generated_Datastream_ListPrivateConnections_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_routes.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_routes.js new file mode 100644 index 00000000000..3e28c388062 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_routes.js @@ -0,0 +1,86 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START datastream_v1alpha1_generated_Datastream_ListRoutes_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent that owns the collection of Routess. + */ + // const parent = 'abc123' + /** + * Maximum number of Routes to return. The service may return + * fewer than this value. If unspecified, at most 50 Routes + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + */ + // const pageSize = 1234 + /** + * Page token received from a previous `ListRoutes` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to + * `ListRoutes` must match the call that provided the page + * token. + */ + // const pageToken = 'abc123' + /** + * Filter request. + */ + // const filter = 'abc123' + /** + * Order by fields for the result. + */ + // const orderBy = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callListRoutes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await datastreamClient.listRoutesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListRoutes(); + // [END datastream_v1alpha1_generated_Datastream_ListRoutes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_streams.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_streams.js new file mode 100644 index 00000000000..b995a0942c7 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_streams.js @@ -0,0 +1,84 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START datastream_v1alpha1_generated_Datastream_ListStreams_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent that owns the collection of streams. + */ + // const parent = 'abc123' + /** + * Maximum number of streams to return. + * If unspecified, at most 50 streams will be returned. The maximum + * value is 1000; values above 1000 will be coerced to 1000. + */ + // const pageSize = 1234 + /** + * Page token received from a previous `ListStreams` call. + * Provide this to retrieve the subsequent page. + * When paginating, all other parameters provided to `ListStreams` + * must match the call that provided the page token. + */ + // const pageToken = 'abc123' + /** + * Filter request. + */ + // const filter = 'abc123' + /** + * Order by fields for the result. + */ + // const orderBy = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callListStreams() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await datastreamClient.listStreamsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListStreams(); + // [END datastream_v1alpha1_generated_Datastream_ListStreams_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.update_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.update_connection_profile.js new file mode 100644 index 00000000000..18e47143e25 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.update_connection_profile.js @@ -0,0 +1,84 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(connectionProfile) { + // [START datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * ConnectionProfile resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + */ + // const updateMask = {} + /** + * Required. The ConnectionProfile to update. + */ + // const connectionProfile = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callUpdateConnectionProfile() { + // Construct request + const request = { + connectionProfile, + }; + + // Run request + const [operation] = await datastreamClient.updateConnectionProfile(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateConnectionProfile(); + // [END datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.update_stream.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.update_stream.js new file mode 100644 index 00000000000..274a8e722d1 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.update_stream.js @@ -0,0 +1,93 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(stream) { + // [START datastream_v1alpha1_generated_Datastream_UpdateStream_async] + /** + * This snippet has been automatically generated and should be regarded as a code template only. + * It will require modifications to work. + * It may require correct/in-range values for request initialization. + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * stream resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + */ + // const updateMask = {} + /** + * Required. The stream resource to update. + */ + // const stream = {} + /** + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + */ + // const requestId = 'abc123' + /** + * Optional. Only validate the stream with the changes, without actually updating it. + * The default is false. + */ + // const validateOnly = true + /** + * Optional. Execute the update without validating it. + */ + // const force = true + + // Imports the Datastream library + const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; + + // Instantiates a client + const datastreamClient = new DatastreamClient(); + + async function callUpdateStream() { + // Construct request + const request = { + stream, + }; + + // Run request + const [operation] = await datastreamClient.updateStream(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateStream(); + // [END datastream_v1alpha1_generated_Datastream_UpdateStream_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/snippet_metadata.google.cloud.datastream.v1alpha1.json b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/snippet_metadata.google.cloud.datastream.v1alpha1.json new file mode 100644 index 00000000000..60024d25853 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/snippet_metadata.google.cloud.datastream.v1alpha1.json @@ -0,0 +1,1051 @@ +{ + "clientLibrary": { + "name": "nodejs-datastream", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.datastream.v1alpha1", + "version": "v1alpha1" + } + ] + }, + "snippets": [ + { + "regionTag": "datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_async", + "title": "Datastream listConnectionProfiles Sample", + "origin": "API_DEFINITION", + "description": " Use this method to list connection profiles created in a project and location.", + "canonical": true, + "file": "datastream.list_connection_profiles.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListConnectionProfiles", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListConnectionProfiles", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1alpha1.ListConnectionProfilesResponse", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "ListConnectionProfiles", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListConnectionProfiles", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_GetConnectionProfile_async", + "title": "Datastream getConnectionProfile Sample", + "origin": "API_DEFINITION", + "description": " Use this method to get details about a connection profile.", + "canonical": true, + "file": "datastream.get_connection_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetConnectionProfile", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetConnectionProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1alpha1.ConnectionProfile", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "GetConnectionProfile", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetConnectionProfile", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_async", + "title": "Datastream createConnectionProfile Sample", + "origin": "API_DEFINITION", + "description": " Use this method to create a connection profile in a project and location.", + "canonical": true, + "file": "datastream.create_connection_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateConnectionProfile", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreateConnectionProfile", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "connection_profile_id", + "type": "TYPE_STRING" + }, + { + "name": "connection_profile", + "type": ".google.cloud.datastream.v1alpha1.ConnectionProfile" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "CreateConnectionProfile", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreateConnectionProfile", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_async", + "title": "Datastream updateConnectionProfile Sample", + "origin": "API_DEFINITION", + "description": " Use this method to update the parameters of a connection profile.", + "canonical": true, + "file": "datastream.update_connection_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateConnectionProfile", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.UpdateConnectionProfile", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "connection_profile", + "type": ".google.cloud.datastream.v1alpha1.ConnectionProfile" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "UpdateConnectionProfile", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.UpdateConnectionProfile", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_async", + "title": "Datastream deleteConnectionProfile Sample", + "origin": "API_DEFINITION", + "description": " Use this method to delete a connection profile..", + "canonical": true, + "file": "datastream.delete_connection_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteConnectionProfile", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeleteConnectionProfile", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "DeleteConnectionProfile", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeleteConnectionProfile", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_async", + "title": "Datastream discoverConnectionProfile Sample", + "origin": "API_DEFINITION", + "description": " Use this method to discover a connection profile. The discover API call exposes the data objects and metadata belonging to the profile. Typically, a request returns children data objects under a parent data object that's optionally supplied in the request.", + "canonical": true, + "file": "datastream.discover_connection_profile.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 79, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DiscoverConnectionProfile", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DiscoverConnectionProfile", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "connection_profile", + "type": ".google.cloud.datastream.v1alpha1.ConnectionProfile" + }, + { + "name": "connection_profile_name", + "type": "TYPE_STRING" + }, + { + "name": "recursive", + "type": "TYPE_BOOL" + }, + { + "name": "recursion_depth", + "type": "TYPE_INT32" + }, + { + "name": "oracle_rdbms", + "type": ".google.cloud.datastream.v1alpha1.OracleRdbms" + }, + { + "name": "mysql_rdbms", + "type": ".google.cloud.datastream.v1alpha1.MysqlRdbms" + } + ], + "resultType": ".google.cloud.datastream.v1alpha1.DiscoverConnectionProfileResponse", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "DiscoverConnectionProfile", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DiscoverConnectionProfile", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_ListStreams_async", + "title": "Datastream listStreams Sample", + "origin": "API_DEFINITION", + "description": " Use this method to list streams in a project and location.", + "canonical": true, + "file": "datastream.list_streams.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListStreams", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListStreams", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1alpha1.ListStreamsResponse", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "ListStreams", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListStreams", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_GetStream_async", + "title": "Datastream getStream Sample", + "origin": "API_DEFINITION", + "description": " Use this method to get details about a stream.", + "canonical": true, + "file": "datastream.get_stream.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetStream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetStream", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1alpha1.Stream", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "GetStream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetStream", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_CreateStream_async", + "title": "Datastream createStream Sample", + "origin": "API_DEFINITION", + "description": " Use this method to create a stream.", + "canonical": true, + "file": "datastream.create_stream.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 87, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateStream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreateStream", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "stream_id", + "type": "TYPE_STRING" + }, + { + "name": "stream", + "type": ".google.cloud.datastream.v1alpha1.Stream" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "CreateStream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreateStream", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_UpdateStream_async", + "title": "Datastream updateStream Sample", + "origin": "API_DEFINITION", + "description": " Use this method to update the configuration of a stream.", + "canonical": true, + "file": "datastream.update_stream.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 85, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateStream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.UpdateStream", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "stream", + "type": ".google.cloud.datastream.v1alpha1.Stream" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "validate_only", + "type": "TYPE_BOOL" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "UpdateStream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.UpdateStream", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_DeleteStream_async", + "title": "Datastream deleteStream Sample", + "origin": "API_DEFINITION", + "description": " Use this method to delete a stream.", + "canonical": true, + "file": "datastream.delete_stream.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteStream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeleteStream", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "DeleteStream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeleteStream", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_FetchErrors_async", + "title": "Datastream fetchErrors Sample", + "origin": "API_DEFINITION", + "description": " Use this method to fetch any errors associated with a stream.", + "canonical": true, + "file": "datastream.fetch_errors.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchErrors", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.FetchErrors", + "async": true, + "parameters": [ + { + "name": "stream", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "FetchErrors", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.FetchErrors", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_FetchStaticIps_async", + "title": "Datastream fetchStaticIps Sample", + "origin": "API_DEFINITION", + "description": " The FetchStaticIps API call exposes the static ips used by Datastream. Typically, a request returns children data objects under a parent data object that's optionally supplied in the request.", + "canonical": true, + "file": "datastream.fetch_static_ips.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "FetchStaticIps", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.FetchStaticIps", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1alpha1.FetchStaticIpsResponse", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "FetchStaticIps", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.FetchStaticIps", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_async", + "title": "Datastream createPrivateConnection Sample", + "origin": "API_DEFINITION", + "description": " Use this method to create a private connectivity configuration.", + "canonical": true, + "file": "datastream.create_private_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreatePrivateConnection", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreatePrivateConnection", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "private_connection_id", + "type": "TYPE_STRING" + }, + { + "name": "private_connection", + "type": ".google.cloud.datastream.v1alpha1.PrivateConnection" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "CreatePrivateConnection", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreatePrivateConnection", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_GetPrivateConnection_async", + "title": "Datastream getPrivateConnection Sample", + "origin": "API_DEFINITION", + "description": " Use this method to get details about a private connectivity configuration.", + "canonical": true, + "file": "datastream.get_private_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetPrivateConnection", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetPrivateConnection", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1alpha1.PrivateConnection", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "GetPrivateConnection", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetPrivateConnection", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_ListPrivateConnections_async", + "title": "Datastream listPrivateConnections Sample", + "origin": "API_DEFINITION", + "description": " Use this method to list private connectivity configurations in a project and location.", + "canonical": true, + "file": "datastream.list_private_connections.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListPrivateConnections", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListPrivateConnections", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1alpha1.ListPrivateConnectionsResponse", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "ListPrivateConnections", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListPrivateConnections", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_async", + "title": "Datastream deletePrivateConnection Sample", + "origin": "API_DEFINITION", + "description": " Use this method to delete a private connectivity configuration.", + "canonical": true, + "file": "datastream.delete_private_connection.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeletePrivateConnection", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeletePrivateConnection", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "DeletePrivateConnection", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeletePrivateConnection", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_CreateRoute_async", + "title": "Datastream createRoute Sample", + "origin": "API_DEFINITION", + "description": " Use this method to create a route for a private connectivity in a project and location.", + "canonical": true, + "file": "datastream.create_route.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateRoute", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreateRoute", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "route_id", + "type": "TYPE_STRING" + }, + { + "name": "route", + "type": ".google.cloud.datastream.v1alpha1.Route" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "CreateRoute", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreateRoute", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_GetRoute_async", + "title": "Datastream getRoute Sample", + "origin": "API_DEFINITION", + "description": " Use this method to get details about a route.", + "canonical": true, + "file": "datastream.get_route.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetRoute", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetRoute", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1alpha1.Route", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "GetRoute", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetRoute", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_ListRoutes_async", + "title": "Datastream listRoutes Sample", + "origin": "API_DEFINITION", + "description": " Use this method to list routes created for a private connectivity in a project and location.", + "canonical": true, + "file": "datastream.list_routes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 78, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListRoutes", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListRoutes", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "page_size", + "type": "TYPE_INT32" + }, + { + "name": "page_token", + "type": "TYPE_STRING" + }, + { + "name": "filter", + "type": "TYPE_STRING" + }, + { + "name": "order_by", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.datastream.v1alpha1.ListRoutesResponse", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "ListRoutes", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListRoutes", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + }, + { + "regionTag": "datastream_v1alpha1_generated_Datastream_DeleteRoute_async", + "title": "Datastream deleteRoute Sample", + "origin": "API_DEFINITION", + "description": " Use this method to delete a route.", + "canonical": true, + "file": "datastream.delete_route.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteRoute", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeleteRoute", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "DatastreamClient", + "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" + }, + "method": { + "shortName": "DeleteRoute", + "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeleteRoute", + "service": { + "shortName": "Datastream", + "fullName": "google.cloud.datastream.v1alpha1.Datastream" + } + } + } + } + ] +} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/src/index.ts b/owl-bot-staging/google-cloud-datastream/v1alpha1/src/index.ts new file mode 100644 index 00000000000..67f6be0bba3 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1alpha1 from './v1alpha1'; +const DatastreamClient = v1alpha1.DatastreamClient; +type DatastreamClient = v1alpha1.DatastreamClient; +export {v1alpha1, DatastreamClient}; +export default {v1alpha1, DatastreamClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_client.ts b/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_client.ts new file mode 100644 index 00000000000..c4a9dc5f40f --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_client.ts @@ -0,0 +1,3291 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import type * as gax from 'google-gax'; +import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; +import {Transform} from 'stream'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1alpha1/datastream_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './datastream_client_config.json'; +const version = require('../../../package.json').version; + +/** + * Datastream service + * @class + * @memberof v1alpha1 + */ +export class DatastreamClient { + 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; + datastreamStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of DatastreamClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. + * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new DatastreamClient({fallback: 'rest'}, gax); + * ``` + */ + constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof DatastreamClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = require('google-gax') as typeof gax; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + connectionProfilePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/connectionProfiles/{connection_profile}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + privateConnectionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/privateConnections/{private_connection}' + ), + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + routePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/privateConnections/{private_connection}/routes/{route}' + ), + streamPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/streams/{stream}' + ), + }; + + // 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 = { + listConnectionProfiles: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'connectionProfiles'), + listStreams: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'streams'), + fetchStaticIps: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'staticIps'), + listPrivateConnections: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'privateConnections'), + listRoutes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'routes') + }; + + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions: GrpcClientOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }; + if (opts.fallback === 'rest') { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha1/{name=projects/*/locations/*}/operations',}]; + } + this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); + const createConnectionProfileResponse = protoFilesRoot.lookup( + '.google.cloud.datastream.v1alpha1.ConnectionProfile') as gax.protobuf.Type; + const createConnectionProfileMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const updateConnectionProfileResponse = protoFilesRoot.lookup( + '.google.cloud.datastream.v1alpha1.ConnectionProfile') as gax.protobuf.Type; + const updateConnectionProfileMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const deleteConnectionProfileResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteConnectionProfileMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const createStreamResponse = protoFilesRoot.lookup( + '.google.cloud.datastream.v1alpha1.Stream') as gax.protobuf.Type; + const createStreamMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const updateStreamResponse = protoFilesRoot.lookup( + '.google.cloud.datastream.v1alpha1.Stream') as gax.protobuf.Type; + const updateStreamMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const deleteStreamResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteStreamMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const fetchErrorsResponse = protoFilesRoot.lookup( + '.google.cloud.datastream.v1alpha1.FetchErrorsResponse') as gax.protobuf.Type; + const fetchErrorsMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const createPrivateConnectionResponse = protoFilesRoot.lookup( + '.google.cloud.datastream.v1alpha1.PrivateConnection') as gax.protobuf.Type; + const createPrivateConnectionMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const deletePrivateConnectionResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deletePrivateConnectionMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const createRouteResponse = protoFilesRoot.lookup( + '.google.cloud.datastream.v1alpha1.Route') as gax.protobuf.Type; + const createRouteMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const deleteRouteResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteRouteMetadata = protoFilesRoot.lookup( + '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createConnectionProfile: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createConnectionProfileResponse.decode.bind(createConnectionProfileResponse), + createConnectionProfileMetadata.decode.bind(createConnectionProfileMetadata)), + updateConnectionProfile: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateConnectionProfileResponse.decode.bind(updateConnectionProfileResponse), + updateConnectionProfileMetadata.decode.bind(updateConnectionProfileMetadata)), + deleteConnectionProfile: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteConnectionProfileResponse.decode.bind(deleteConnectionProfileResponse), + deleteConnectionProfileMetadata.decode.bind(deleteConnectionProfileMetadata)), + createStream: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createStreamResponse.decode.bind(createStreamResponse), + createStreamMetadata.decode.bind(createStreamMetadata)), + updateStream: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateStreamResponse.decode.bind(updateStreamResponse), + updateStreamMetadata.decode.bind(updateStreamMetadata)), + deleteStream: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteStreamResponse.decode.bind(deleteStreamResponse), + deleteStreamMetadata.decode.bind(deleteStreamMetadata)), + fetchErrors: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + fetchErrorsResponse.decode.bind(fetchErrorsResponse), + fetchErrorsMetadata.decode.bind(fetchErrorsMetadata)), + createPrivateConnection: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createPrivateConnectionResponse.decode.bind(createPrivateConnectionResponse), + createPrivateConnectionMetadata.decode.bind(createPrivateConnectionMetadata)), + deletePrivateConnection: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deletePrivateConnectionResponse.decode.bind(deletePrivateConnectionResponse), + deletePrivateConnectionMetadata.decode.bind(deletePrivateConnectionMetadata)), + createRoute: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createRouteResponse.decode.bind(createRouteResponse), + createRouteMetadata.decode.bind(createRouteMetadata)), + deleteRoute: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteRouteResponse.decode.bind(deleteRouteResponse), + deleteRouteMetadata.decode.bind(deleteRouteMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.datastream.v1alpha1.Datastream', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.datastreamStub) { + return this.datastreamStub; + } + + // Put together the "service stub" for + // google.cloud.datastream.v1alpha1.Datastream. + this.datastreamStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.datastream.v1alpha1.Datastream') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.datastream.v1alpha1.Datastream, + 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 datastreamStubMethods = + ['listConnectionProfiles', 'getConnectionProfile', 'createConnectionProfile', 'updateConnectionProfile', 'deleteConnectionProfile', 'discoverConnectionProfile', 'listStreams', 'getStream', 'createStream', 'updateStream', 'deleteStream', 'fetchErrors', 'fetchStaticIps', 'createPrivateConnection', 'getPrivateConnection', 'listPrivateConnections', 'deletePrivateConnection', 'createRoute', 'getRoute', 'listRoutes', 'deleteRoute']; + for (const methodName of datastreamStubMethods) { + const callPromise = this.datastreamStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor, + this._opts.fallback + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.datastreamStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'datastream.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 'datastream.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Use this method to get details about a connection profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the connection profile resource to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.datastream.v1alpha1.ConnectionProfile | ConnectionProfile}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.get_connection_profile.js + * region_tag:datastream_v1alpha1_generated_Datastream_GetConnectionProfile_async + */ + getConnectionProfile( + request?: protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1alpha1.IConnectionProfile, + protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest|undefined, {}|undefined + ]>; + getConnectionProfile( + request: protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.datastream.v1alpha1.IConnectionProfile, + protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest|null|undefined, + {}|null|undefined>): void; + getConnectionProfile( + request: protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest, + callback: Callback< + protos.google.cloud.datastream.v1alpha1.IConnectionProfile, + protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest|null|undefined, + {}|null|undefined>): void; + getConnectionProfile( + request?: protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.datastream.v1alpha1.IConnectionProfile, + protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.datastream.v1alpha1.IConnectionProfile, + protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.datastream.v1alpha1.IConnectionProfile, + protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getConnectionProfile(request, options, callback); + } +/** + * Use this method to discover a connection profile. + * The discover API call exposes the data objects and metadata belonging to + * the profile. Typically, a request returns children data objects under a + * parent data object that's optionally supplied in the request. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the ConnectionProfile type. Must be in the + * format `projects/* /locations/*`. + * @param {google.cloud.datastream.v1alpha1.ConnectionProfile} request.connectionProfile + * An ad-hoc ConnectionProfile configuration. + * @param {string} request.connectionProfileName + * A reference to an existing ConnectionProfile. + * @param {boolean} request.recursive + * Whether to retrieve the full hierarchy of data objects (TRUE) or only the + * current level (FALSE). + * @param {number} request.recursionDepth + * The number of hierarchy levels below the current level to be retrieved. + * @param {google.cloud.datastream.v1alpha1.OracleRdbms} request.oracleRdbms + * Oracle RDBMS to enrich with child data objects and metadata. + * @param {google.cloud.datastream.v1alpha1.MysqlRdbms} request.mysqlRdbms + * MySQL RDBMS to enrich with child data objects and metadata. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.datastream.v1alpha1.DiscoverConnectionProfileResponse | DiscoverConnectionProfileResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.discover_connection_profile.js + * region_tag:datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_async + */ + discoverConnectionProfile( + request?: protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileResponse, + protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest|undefined, {}|undefined + ]>; + discoverConnectionProfile( + request: protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileResponse, + protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest|null|undefined, + {}|null|undefined>): void; + discoverConnectionProfile( + request: protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest, + callback: Callback< + protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileResponse, + protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest|null|undefined, + {}|null|undefined>): void; + discoverConnectionProfile( + request?: protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileResponse, + protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileResponse, + protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileResponse, + protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.discoverConnectionProfile(request, options, callback); + } +/** + * Use this method to get details about a stream. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the stream resource to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.datastream.v1alpha1.Stream | Stream}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.get_stream.js + * region_tag:datastream_v1alpha1_generated_Datastream_GetStream_async + */ + getStream( + request?: protos.google.cloud.datastream.v1alpha1.IGetStreamRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1alpha1.IStream, + protos.google.cloud.datastream.v1alpha1.IGetStreamRequest|undefined, {}|undefined + ]>; + getStream( + request: protos.google.cloud.datastream.v1alpha1.IGetStreamRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.datastream.v1alpha1.IStream, + protos.google.cloud.datastream.v1alpha1.IGetStreamRequest|null|undefined, + {}|null|undefined>): void; + getStream( + request: protos.google.cloud.datastream.v1alpha1.IGetStreamRequest, + callback: Callback< + protos.google.cloud.datastream.v1alpha1.IStream, + protos.google.cloud.datastream.v1alpha1.IGetStreamRequest|null|undefined, + {}|null|undefined>): void; + getStream( + request?: protos.google.cloud.datastream.v1alpha1.IGetStreamRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.datastream.v1alpha1.IStream, + protos.google.cloud.datastream.v1alpha1.IGetStreamRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.datastream.v1alpha1.IStream, + protos.google.cloud.datastream.v1alpha1.IGetStreamRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.datastream.v1alpha1.IStream, + protos.google.cloud.datastream.v1alpha1.IGetStreamRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getStream(request, options, callback); + } +/** + * Use this method to get details about a private connectivity configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the private connectivity configuration to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.datastream.v1alpha1.PrivateConnection | PrivateConnection}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.get_private_connection.js + * region_tag:datastream_v1alpha1_generated_Datastream_GetPrivateConnection_async + */ + getPrivateConnection( + request?: protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1alpha1.IPrivateConnection, + protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest|undefined, {}|undefined + ]>; + getPrivateConnection( + request: protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.datastream.v1alpha1.IPrivateConnection, + protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest|null|undefined, + {}|null|undefined>): void; + getPrivateConnection( + request: protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest, + callback: Callback< + protos.google.cloud.datastream.v1alpha1.IPrivateConnection, + protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest|null|undefined, + {}|null|undefined>): void; + getPrivateConnection( + request?: protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.datastream.v1alpha1.IPrivateConnection, + protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.datastream.v1alpha1.IPrivateConnection, + protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.datastream.v1alpha1.IPrivateConnection, + protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getPrivateConnection(request, options, callback); + } +/** + * Use this method to get details about a route. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Route resource to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing {@link google.cloud.datastream.v1alpha1.Route | Route}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.get_route.js + * region_tag:datastream_v1alpha1_generated_Datastream_GetRoute_async + */ + getRoute( + request?: protos.google.cloud.datastream.v1alpha1.IGetRouteRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1alpha1.IRoute, + protos.google.cloud.datastream.v1alpha1.IGetRouteRequest|undefined, {}|undefined + ]>; + getRoute( + request: protos.google.cloud.datastream.v1alpha1.IGetRouteRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.datastream.v1alpha1.IRoute, + protos.google.cloud.datastream.v1alpha1.IGetRouteRequest|null|undefined, + {}|null|undefined>): void; + getRoute( + request: protos.google.cloud.datastream.v1alpha1.IGetRouteRequest, + callback: Callback< + protos.google.cloud.datastream.v1alpha1.IRoute, + protos.google.cloud.datastream.v1alpha1.IGetRouteRequest|null|undefined, + {}|null|undefined>): void; + getRoute( + request?: protos.google.cloud.datastream.v1alpha1.IGetRouteRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.datastream.v1alpha1.IRoute, + protos.google.cloud.datastream.v1alpha1.IGetRouteRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.datastream.v1alpha1.IRoute, + protos.google.cloud.datastream.v1alpha1.IGetRouteRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.datastream.v1alpha1.IRoute, + protos.google.cloud.datastream.v1alpha1.IGetRouteRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.getRoute(request, options, callback); + } + +/** + * Use this method to create a connection profile in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of ConnectionProfiles. + * @param {string} request.connectionProfileId + * Required. The connection profile identifier. + * @param {google.cloud.datastream.v1alpha1.ConnectionProfile} request.connectionProfile + * Required. The connection profile resource to create. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.create_connection_profile.js + * region_tag:datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_async + */ + createConnectionProfile( + request?: protos.google.cloud.datastream.v1alpha1.ICreateConnectionProfileRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createConnectionProfile( + request: protos.google.cloud.datastream.v1alpha1.ICreateConnectionProfileRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConnectionProfile( + request: protos.google.cloud.datastream.v1alpha1.ICreateConnectionProfileRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createConnectionProfile( + request?: protos.google.cloud.datastream.v1alpha1.ICreateConnectionProfileRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createConnectionProfile(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createConnectionProfile()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.create_connection_profile.js + * region_tag:datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_async + */ + async checkCreateConnectionProfileProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConnectionProfile, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to update the parameters of a connection profile. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * ConnectionProfile resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.datastream.v1alpha1.ConnectionProfile} request.connectionProfile + * Required. The ConnectionProfile to update. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.update_connection_profile.js + * region_tag:datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_async + */ + updateConnectionProfile( + request?: protos.google.cloud.datastream.v1alpha1.IUpdateConnectionProfileRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateConnectionProfile( + request: protos.google.cloud.datastream.v1alpha1.IUpdateConnectionProfileRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateConnectionProfile( + request: protos.google.cloud.datastream.v1alpha1.IUpdateConnectionProfileRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateConnectionProfile( + request?: protos.google.cloud.datastream.v1alpha1.IUpdateConnectionProfileRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'connection_profile.name': request.connectionProfile!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateConnectionProfile(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateConnectionProfile()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.update_connection_profile.js + * region_tag:datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_async + */ + async checkUpdateConnectionProfileProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateConnectionProfile, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to delete a connection profile.. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the connection profile resource to delete. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.delete_connection_profile.js + * region_tag:datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_async + */ + deleteConnectionProfile( + request?: protos.google.cloud.datastream.v1alpha1.IDeleteConnectionProfileRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteConnectionProfile( + request: protos.google.cloud.datastream.v1alpha1.IDeleteConnectionProfileRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteConnectionProfile( + request: protos.google.cloud.datastream.v1alpha1.IDeleteConnectionProfileRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteConnectionProfile( + request?: protos.google.cloud.datastream.v1alpha1.IDeleteConnectionProfileRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteConnectionProfile(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteConnectionProfile()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.delete_connection_profile.js + * region_tag:datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_async + */ + async checkDeleteConnectionProfileProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConnectionProfile, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to create a stream. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of streams. + * @param {string} request.streamId + * Required. The stream identifier. + * @param {google.cloud.datastream.v1alpha1.Stream} request.stream + * Required. The stream resource to create. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.validateOnly] + * Optional. Only validate the stream, but do not create any resources. + * The default is false. + * @param {boolean} [request.force] + * Optional. Create the stream without validating it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.create_stream.js + * region_tag:datastream_v1alpha1_generated_Datastream_CreateStream_async + */ + createStream( + request?: protos.google.cloud.datastream.v1alpha1.ICreateStreamRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createStream( + request: protos.google.cloud.datastream.v1alpha1.ICreateStreamRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createStream( + request: protos.google.cloud.datastream.v1alpha1.ICreateStreamRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createStream( + request?: protos.google.cloud.datastream.v1alpha1.ICreateStreamRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createStream(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createStream()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.create_stream.js + * region_tag:datastream_v1alpha1_generated_Datastream_CreateStream_async + */ + async checkCreateStreamProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createStream, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to update the configuration of a stream. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. Field mask is used to specify the fields to be overwritten in the + * stream resource by the update. + * The fields specified in the update_mask are relative to the resource, not + * the full request. A field will be overwritten if it is in the mask. If the + * user does not provide a mask then all fields will be overwritten. + * @param {google.cloud.datastream.v1alpha1.Stream} request.stream + * Required. The stream resource to update. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.validateOnly] + * Optional. Only validate the stream with the changes, without actually updating it. + * The default is false. + * @param {boolean} [request.force] + * Optional. Execute the update without validating it. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.update_stream.js + * region_tag:datastream_v1alpha1_generated_Datastream_UpdateStream_async + */ + updateStream( + request?: protos.google.cloud.datastream.v1alpha1.IUpdateStreamRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateStream( + request: protos.google.cloud.datastream.v1alpha1.IUpdateStreamRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateStream( + request: protos.google.cloud.datastream.v1alpha1.IUpdateStreamRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateStream( + request?: protos.google.cloud.datastream.v1alpha1.IUpdateStreamRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'stream.name': request.stream!.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.updateStream(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateStream()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.update_stream.js + * region_tag:datastream_v1alpha1_generated_Datastream_UpdateStream_async + */ + async checkUpdateStreamProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateStream, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to delete a stream. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the stream resource to delete. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.delete_stream.js + * region_tag:datastream_v1alpha1_generated_Datastream_DeleteStream_async + */ + deleteStream( + request?: protos.google.cloud.datastream.v1alpha1.IDeleteStreamRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteStream( + request: protos.google.cloud.datastream.v1alpha1.IDeleteStreamRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteStream( + request: protos.google.cloud.datastream.v1alpha1.IDeleteStreamRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteStream( + request?: protos.google.cloud.datastream.v1alpha1.IDeleteStreamRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteStream(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteStream()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.delete_stream.js + * region_tag:datastream_v1alpha1_generated_Datastream_DeleteStream_async + */ + async checkDeleteStreamProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteStream, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to fetch any errors associated with a stream. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.stream + * Name of the Stream resource for which to fetch any errors. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.fetch_errors.js + * region_tag:datastream_v1alpha1_generated_Datastream_FetchErrors_async + */ + fetchErrors( + request?: protos.google.cloud.datastream.v1alpha1.IFetchErrorsRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + fetchErrors( + request: protos.google.cloud.datastream.v1alpha1.IFetchErrorsRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + fetchErrors( + request: protos.google.cloud.datastream.v1alpha1.IFetchErrorsRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + fetchErrors( + request?: protos.google.cloud.datastream.v1alpha1.IFetchErrorsRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'stream': request.stream ?? '', + }); + this.initialize(); + return this.innerApiCalls.fetchErrors(request, options, callback); + } +/** + * Check the status of the long running operation returned by `fetchErrors()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.fetch_errors.js + * region_tag:datastream_v1alpha1_generated_Datastream_FetchErrors_async + */ + async checkFetchErrorsProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.fetchErrors, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to create a private connectivity configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of PrivateConnections. + * @param {string} request.privateConnectionId + * Required. The private connectivity identifier. + * @param {google.cloud.datastream.v1alpha1.PrivateConnection} request.privateConnection + * Required. The Private Connectivity resource to create. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.create_private_connection.js + * region_tag:datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_async + */ + createPrivateConnection( + request?: protos.google.cloud.datastream.v1alpha1.ICreatePrivateConnectionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createPrivateConnection( + request: protos.google.cloud.datastream.v1alpha1.ICreatePrivateConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createPrivateConnection( + request: protos.google.cloud.datastream.v1alpha1.ICreatePrivateConnectionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createPrivateConnection( + request?: protos.google.cloud.datastream.v1alpha1.ICreatePrivateConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createPrivateConnection(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createPrivateConnection()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.create_private_connection.js + * region_tag:datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_async + */ + async checkCreatePrivateConnectionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createPrivateConnection, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to delete a private connectivity configuration. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the private connectivity configuration to delete. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.force] + * Optional. If set to true, any child routes that belong to this PrivateConnection will + * also be deleted. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.delete_private_connection.js + * region_tag:datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_async + */ + deletePrivateConnection( + request?: protos.google.cloud.datastream.v1alpha1.IDeletePrivateConnectionRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deletePrivateConnection( + request: protos.google.cloud.datastream.v1alpha1.IDeletePrivateConnectionRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deletePrivateConnection( + request: protos.google.cloud.datastream.v1alpha1.IDeletePrivateConnectionRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deletePrivateConnection( + request?: protos.google.cloud.datastream.v1alpha1.IDeletePrivateConnectionRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deletePrivateConnection(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deletePrivateConnection()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.delete_private_connection.js + * region_tag:datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_async + */ + async checkDeletePrivateConnectionProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deletePrivateConnection, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to create a route for a private connectivity in a project + * and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of Routes. + * @param {string} request.routeId + * Required. The Route identifier. + * @param {google.cloud.datastream.v1alpha1.Route} request.route + * Required. The Route resource to create. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes since the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.create_route.js + * region_tag:datastream_v1alpha1_generated_Datastream_CreateRoute_async + */ + createRoute( + request?: protos.google.cloud.datastream.v1alpha1.ICreateRouteRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createRoute( + request: protos.google.cloud.datastream.v1alpha1.ICreateRouteRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createRoute( + request: protos.google.cloud.datastream.v1alpha1.ICreateRouteRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createRoute( + request?: protos.google.cloud.datastream.v1alpha1.ICreateRouteRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.createRoute(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createRoute()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.create_route.js + * region_tag:datastream_v1alpha1_generated_Datastream_CreateRoute_async + */ + async checkCreateRouteProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createRoute, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Use this method to delete a route. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Route resource to delete. + * @param {string} [request.requestId] + * Optional. A request ID to identify requests. Specify a unique request ID + * so that if you must retry your request, the server will know to ignore + * the request if it has already been completed. The server will guarantee + * that for at least 60 minutes after the first request. + * + * For example, consider a situation where you make an initial request and the + * request times out. If you make the request again with the same request ID, + * the server can check if original operation with the same request ID was + * received, and if so, will ignore the second request. This prevents clients + * from accidentally creating duplicate commitments. + * + * The request ID must be a valid UUID with the exception that zero UUID is + * not supported (00000000-0000-0000-0000-000000000000). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.delete_route.js + * region_tag:datastream_v1alpha1_generated_Datastream_DeleteRoute_async + */ + deleteRoute( + request?: protos.google.cloud.datastream.v1alpha1.IDeleteRouteRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteRoute( + request: protos.google.cloud.datastream.v1alpha1.IDeleteRouteRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteRoute( + request: protos.google.cloud.datastream.v1alpha1.IDeleteRouteRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteRoute( + request?: protos.google.cloud.datastream.v1alpha1.IDeleteRouteRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.deleteRoute(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteRoute()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.delete_route.js + * region_tag:datastream_v1alpha1_generated_Datastream_DeleteRoute_async + */ + async checkDeleteRouteProgress(name: string): Promise>{ + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteRoute, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Use this method to list connection profiles created in a project and + * location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of connection profiles. + * @param {number} request.pageSize + * Maximum number of connection profiles to return. + * If unspecified, at most 50 connection profiles will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListConnectionProfiles` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListConnectionProfiles` + * must match the call that provided the page token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.datastream.v1alpha1.ConnectionProfile | ConnectionProfile}. + * 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 `listConnectionProfilesAsync()` + * 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. + */ + listConnectionProfiles( + request?: protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1alpha1.IConnectionProfile[], + protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest|null, + protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesResponse + ]>; + listConnectionProfiles( + request: protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, + protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesResponse|null|undefined, + protos.google.cloud.datastream.v1alpha1.IConnectionProfile>): void; + listConnectionProfiles( + request: protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, + callback: PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, + protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesResponse|null|undefined, + protos.google.cloud.datastream.v1alpha1.IConnectionProfile>): void; + listConnectionProfiles( + request?: protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, + protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesResponse|null|undefined, + protos.google.cloud.datastream.v1alpha1.IConnectionProfile>, + callback?: PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, + protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesResponse|null|undefined, + protos.google.cloud.datastream.v1alpha1.IConnectionProfile>): + Promise<[ + protos.google.cloud.datastream.v1alpha1.IConnectionProfile[], + protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest|null, + protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listConnectionProfiles(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of connection profiles. + * @param {number} request.pageSize + * Maximum number of connection profiles to return. + * If unspecified, at most 50 connection profiles will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListConnectionProfiles` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListConnectionProfiles` + * must match the call that provided the page token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.datastream.v1alpha1.ConnectionProfile | ConnectionProfile} 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 `listConnectionProfilesAsync()` + * 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. + */ + listConnectionProfilesStream( + request?: protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConnectionProfiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConnectionProfiles.createStream( + this.innerApiCalls.listConnectionProfiles as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listConnectionProfiles`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of connection profiles. + * @param {number} request.pageSize + * Maximum number of connection profiles to return. + * If unspecified, at most 50 connection profiles will be returned. + * The maximum value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListConnectionProfiles` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListConnectionProfiles` + * must match the call that provided the page token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.datastream.v1alpha1.ConnectionProfile | ConnectionProfile}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.list_connection_profiles.js + * region_tag:datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_async + */ + listConnectionProfilesAsync( + request?: protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listConnectionProfiles']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listConnectionProfiles.asyncIterate( + this.innerApiCalls['listConnectionProfiles'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Use this method to list streams in a project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of streams. + * @param {number} request.pageSize + * Maximum number of streams to return. + * If unspecified, at most 50 streams will be returned. The maximum + * value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListStreams` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListStreams` + * must match the call that provided the page token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.datastream.v1alpha1.Stream | Stream}. + * 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 `listStreamsAsync()` + * 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. + */ + listStreams( + request?: protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1alpha1.IStream[], + protos.google.cloud.datastream.v1alpha1.IListStreamsRequest|null, + protos.google.cloud.datastream.v1alpha1.IListStreamsResponse + ]>; + listStreams( + request: protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, + protos.google.cloud.datastream.v1alpha1.IListStreamsResponse|null|undefined, + protos.google.cloud.datastream.v1alpha1.IStream>): void; + listStreams( + request: protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, + callback: PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, + protos.google.cloud.datastream.v1alpha1.IListStreamsResponse|null|undefined, + protos.google.cloud.datastream.v1alpha1.IStream>): void; + listStreams( + request?: protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, + protos.google.cloud.datastream.v1alpha1.IListStreamsResponse|null|undefined, + protos.google.cloud.datastream.v1alpha1.IStream>, + callback?: PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, + protos.google.cloud.datastream.v1alpha1.IListStreamsResponse|null|undefined, + protos.google.cloud.datastream.v1alpha1.IStream>): + Promise<[ + protos.google.cloud.datastream.v1alpha1.IStream[], + protos.google.cloud.datastream.v1alpha1.IListStreamsRequest|null, + protos.google.cloud.datastream.v1alpha1.IListStreamsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listStreams(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of streams. + * @param {number} request.pageSize + * Maximum number of streams to return. + * If unspecified, at most 50 streams will be returned. The maximum + * value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListStreams` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListStreams` + * must match the call that provided the page token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.datastream.v1alpha1.Stream | Stream} 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 `listStreamsAsync()` + * 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. + */ + listStreamsStream( + request?: protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listStreams']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listStreams.createStream( + this.innerApiCalls.listStreams as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listStreams`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of streams. + * @param {number} request.pageSize + * Maximum number of streams to return. + * If unspecified, at most 50 streams will be returned. The maximum + * value is 1000; values above 1000 will be coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListStreams` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to `ListStreams` + * must match the call that provided the page token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.datastream.v1alpha1.Stream | Stream}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.list_streams.js + * region_tag:datastream_v1alpha1_generated_Datastream_ListStreams_async + */ + listStreamsAsync( + request?: protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listStreams']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listStreams.asyncIterate( + this.innerApiCalls['listStreams'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * The FetchStaticIps API call exposes the static ips used by Datastream. + * Typically, a request returns children data objects under + * a parent data object that's optionally supplied in the request. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name resource of the Response type. Must be in the + * format `projects/* /locations/*`. + * @param {number} request.pageSize + * Maximum number of Ips to return, will likely not be specified. + * @param {string} request.pageToken + * A page token, received from a previous `ListStaticIps` call. + * will likely not 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 Array of string. + * 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 `fetchStaticIpsAsync()` + * 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. + */ + fetchStaticIps( + request?: protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, + options?: CallOptions): + Promise<[ + string[], + protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest|null, + protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsResponse + ]>; + fetchStaticIps( + request: protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, + protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsResponse|null|undefined, + string>): void; + fetchStaticIps( + request: protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, + callback: PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, + protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsResponse|null|undefined, + string>): void; + fetchStaticIps( + request?: protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, + protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsResponse|null|undefined, + string>, + callback?: PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, + protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsResponse|null|undefined, + string>): + Promise<[ + string[], + protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest|null, + protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + this.initialize(); + return this.innerApiCalls.fetchStaticIps(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.name + * Required. The name resource of the Response type. Must be in the + * format `projects/* /locations/*`. + * @param {number} request.pageSize + * Maximum number of Ips to return, will likely not be specified. + * @param {string} request.pageToken + * A page token, received from a previous `ListStaticIps` call. + * will likely not be specified. + * @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 string 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 `fetchStaticIpsAsync()` + * 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. + */ + fetchStaticIpsStream( + request?: protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + const defaultCallSettings = this._defaults['fetchStaticIps']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.fetchStaticIps.createStream( + this.innerApiCalls.fetchStaticIps as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `fetchStaticIps`, 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.name + * Required. The name resource of the Response type. Must be in the + * format `projects/* /locations/*`. + * @param {number} request.pageSize + * Maximum number of Ips to return, will likely not be specified. + * @param {string} request.pageToken + * A page token, received from a previous `ListStaticIps` call. + * will likely not be specified. + * @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 + * string. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.fetch_static_ips.js + * region_tag:datastream_v1alpha1_generated_Datastream_FetchStaticIps_async + */ + fetchStaticIpsAsync( + request?: protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'name': request.name ?? '', + }); + const defaultCallSettings = this._defaults['fetchStaticIps']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.fetchStaticIps.asyncIterate( + this.innerApiCalls['fetchStaticIps'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Use this method to list private connectivity configurations in a project + * and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of private connectivity configurations. + * @param {number} request.pageSize + * Maximum number of private connectivity configurations to return. + * If unspecified, at most 50 private connectivity configurations that will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.datastream.v1alpha1.PrivateConnection | PrivateConnection}. + * 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 `listPrivateConnectionsAsync()` + * 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. + */ + listPrivateConnections( + request?: protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1alpha1.IPrivateConnection[], + protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest|null, + protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsResponse + ]>; + listPrivateConnections( + request: protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, + protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsResponse|null|undefined, + protos.google.cloud.datastream.v1alpha1.IPrivateConnection>): void; + listPrivateConnections( + request: protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, + callback: PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, + protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsResponse|null|undefined, + protos.google.cloud.datastream.v1alpha1.IPrivateConnection>): void; + listPrivateConnections( + request?: protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, + protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsResponse|null|undefined, + protos.google.cloud.datastream.v1alpha1.IPrivateConnection>, + callback?: PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, + protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsResponse|null|undefined, + protos.google.cloud.datastream.v1alpha1.IPrivateConnection>): + Promise<[ + protos.google.cloud.datastream.v1alpha1.IPrivateConnection[], + protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest|null, + protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listPrivateConnections(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of private connectivity configurations. + * @param {number} request.pageSize + * Maximum number of private connectivity configurations to return. + * If unspecified, at most 50 private connectivity configurations that will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.datastream.v1alpha1.PrivateConnection | PrivateConnection} 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 `listPrivateConnectionsAsync()` + * 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. + */ + listPrivateConnectionsStream( + request?: protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listPrivateConnections']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPrivateConnections.createStream( + this.innerApiCalls.listPrivateConnections as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listPrivateConnections`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of private connectivity configurations. + * @param {number} request.pageSize + * Maximum number of private connectivity configurations to return. + * If unspecified, at most 50 private connectivity configurations that will be + * returned. The maximum value is 1000; values above 1000 will be coerced to + * 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListPrivateConnections` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListPrivateConnections` must match the call that provided the page + * token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.datastream.v1alpha1.PrivateConnection | PrivateConnection}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.list_private_connections.js + * region_tag:datastream_v1alpha1_generated_Datastream_ListPrivateConnections_async + */ + listPrivateConnectionsAsync( + request?: protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listPrivateConnections']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPrivateConnections.asyncIterate( + this.innerApiCalls['listPrivateConnections'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + /** + * Use this method to list routes created for a private connectivity in a + * project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of Routess. + * @param {number} request.pageSize + * Maximum number of Routes to return. The service may return + * fewer than this value. If unspecified, at most 50 Routes + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListRoutes` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListRoutes` must match the call that provided the page + * token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of {@link google.cloud.datastream.v1alpha1.Route | Route}. + * 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 `listRoutesAsync()` + * 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. + */ + listRoutes( + request?: protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.datastream.v1alpha1.IRoute[], + protos.google.cloud.datastream.v1alpha1.IListRoutesRequest|null, + protos.google.cloud.datastream.v1alpha1.IListRoutesResponse + ]>; + listRoutes( + request: protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, + protos.google.cloud.datastream.v1alpha1.IListRoutesResponse|null|undefined, + protos.google.cloud.datastream.v1alpha1.IRoute>): void; + listRoutes( + request: protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, + callback: PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, + protos.google.cloud.datastream.v1alpha1.IListRoutesResponse|null|undefined, + protos.google.cloud.datastream.v1alpha1.IRoute>): void; + listRoutes( + request?: protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, + protos.google.cloud.datastream.v1alpha1.IListRoutesResponse|null|undefined, + protos.google.cloud.datastream.v1alpha1.IRoute>, + callback?: PaginationCallback< + protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, + protos.google.cloud.datastream.v1alpha1.IListRoutesResponse|null|undefined, + protos.google.cloud.datastream.v1alpha1.IRoute>): + Promise<[ + protos.google.cloud.datastream.v1alpha1.IRoute[], + protos.google.cloud.datastream.v1alpha1.IListRoutesRequest|null, + protos.google.cloud.datastream.v1alpha1.IListRoutesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + this.initialize(); + return this.innerApiCalls.listRoutes(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of Routess. + * @param {number} request.pageSize + * Maximum number of Routes to return. The service may return + * fewer than this value. If unspecified, at most 50 Routes + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListRoutes` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListRoutes` must match the call that provided the page + * token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link google.cloud.datastream.v1alpha1.Route | Route} 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 `listRoutesAsync()` + * 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. + */ + listRoutesStream( + request?: protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listRoutes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRoutes.createStream( + this.innerApiCalls.listRoutes as GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listRoutes`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent that owns the collection of Routess. + * @param {number} request.pageSize + * Maximum number of Routes to return. The service may return + * fewer than this value. If unspecified, at most 50 Routes + * will be returned. The maximum value is 1000; values above 1000 will be + * coerced to 1000. + * @param {string} request.pageToken + * Page token received from a previous `ListRoutes` call. + * Provide this to retrieve the subsequent page. + * + * When paginating, all other parameters provided to + * `ListRoutes` must match the call that provided the page + * token. + * @param {string} request.filter + * Filter request. + * @param {string} request.orderBy + * Order by fields for the result. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * {@link google.cloud.datastream.v1alpha1.Route | Route}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1alpha1/datastream.list_routes.js + * region_tag:datastream_v1alpha1_generated_Datastream_ListRoutes_async + */ + listRoutesAsync( + request?: protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = this._gaxModule.routingHeader.fromParams({ + 'parent': request.parent ?? '', + }); + const defaultCallSettings = this._defaults['listRoutes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listRoutes.asyncIterate( + this.innerApiCalls['listRoutes'] as GaxCall, + request as {}, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified connectionProfile resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} connection_profile + * @returns {string} Resource name string. + */ + connectionProfilePath(project:string,location:string,connectionProfile:string) { + return this.pathTemplates.connectionProfilePathTemplate.render({ + project: project, + location: location, + connection_profile: connectionProfile, + }); + } + + /** + * Parse the project from ConnectionProfile resource. + * + * @param {string} connectionProfileName + * A fully-qualified path representing ConnectionProfile resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConnectionProfileName(connectionProfileName: string) { + return this.pathTemplates.connectionProfilePathTemplate.match(connectionProfileName).project; + } + + /** + * Parse the location from ConnectionProfile resource. + * + * @param {string} connectionProfileName + * A fully-qualified path representing ConnectionProfile resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConnectionProfileName(connectionProfileName: string) { + return this.pathTemplates.connectionProfilePathTemplate.match(connectionProfileName).location; + } + + /** + * Parse the connection_profile from ConnectionProfile resource. + * + * @param {string} connectionProfileName + * A fully-qualified path representing ConnectionProfile resource. + * @returns {string} A string representing the connection_profile. + */ + matchConnectionProfileFromConnectionProfileName(connectionProfileName: string) { + return this.pathTemplates.connectionProfilePathTemplate.match(connectionProfileName).connection_profile; + } + + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project:string,location:string) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName: string) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + + /** + * Return a fully-qualified privateConnection resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} private_connection + * @returns {string} Resource name string. + */ + privateConnectionPath(project:string,location:string,privateConnection:string) { + return this.pathTemplates.privateConnectionPathTemplate.render({ + project: project, + location: location, + private_connection: privateConnection, + }); + } + + /** + * Parse the project from PrivateConnection resource. + * + * @param {string} privateConnectionName + * A fully-qualified path representing PrivateConnection resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPrivateConnectionName(privateConnectionName: string) { + return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).project; + } + + /** + * Parse the location from PrivateConnection resource. + * + * @param {string} privateConnectionName + * A fully-qualified path representing PrivateConnection resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPrivateConnectionName(privateConnectionName: string) { + return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).location; + } + + /** + * Parse the private_connection from PrivateConnection resource. + * + * @param {string} privateConnectionName + * A fully-qualified path representing PrivateConnection resource. + * @returns {string} A string representing the private_connection. + */ + matchPrivateConnectionFromPrivateConnectionName(privateConnectionName: string) { + return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).private_connection; + } + + /** + * 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 route resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} private_connection + * @param {string} route + * @returns {string} Resource name string. + */ + routePath(project:string,location:string,privateConnection:string,route:string) { + return this.pathTemplates.routePathTemplate.render({ + project: project, + location: location, + private_connection: privateConnection, + route: route, + }); + } + + /** + * Parse the project from Route resource. + * + * @param {string} routeName + * A fully-qualified path representing Route resource. + * @returns {string} A string representing the project. + */ + matchProjectFromRouteName(routeName: string) { + return this.pathTemplates.routePathTemplate.match(routeName).project; + } + + /** + * Parse the location from Route resource. + * + * @param {string} routeName + * A fully-qualified path representing Route resource. + * @returns {string} A string representing the location. + */ + matchLocationFromRouteName(routeName: string) { + return this.pathTemplates.routePathTemplate.match(routeName).location; + } + + /** + * Parse the private_connection from Route resource. + * + * @param {string} routeName + * A fully-qualified path representing Route resource. + * @returns {string} A string representing the private_connection. + */ + matchPrivateConnectionFromRouteName(routeName: string) { + return this.pathTemplates.routePathTemplate.match(routeName).private_connection; + } + + /** + * Parse the route from Route resource. + * + * @param {string} routeName + * A fully-qualified path representing Route resource. + * @returns {string} A string representing the route. + */ + matchRouteFromRouteName(routeName: string) { + return this.pathTemplates.routePathTemplate.match(routeName).route; + } + + /** + * Return a fully-qualified stream resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} stream + * @returns {string} Resource name string. + */ + streamPath(project:string,location:string,stream:string) { + return this.pathTemplates.streamPathTemplate.render({ + project: project, + location: location, + stream: stream, + }); + } + + /** + * Parse the project from Stream resource. + * + * @param {string} streamName + * A fully-qualified path representing Stream resource. + * @returns {string} A string representing the project. + */ + matchProjectFromStreamName(streamName: string) { + return this.pathTemplates.streamPathTemplate.match(streamName).project; + } + + /** + * Parse the location from Stream resource. + * + * @param {string} streamName + * A fully-qualified path representing Stream resource. + * @returns {string} A string representing the location. + */ + matchLocationFromStreamName(streamName: string) { + return this.pathTemplates.streamPathTemplate.match(streamName).location; + } + + /** + * Parse the stream from Stream resource. + * + * @param {string} streamName + * A fully-qualified path representing Stream resource. + * @returns {string} A string representing the stream. + */ + matchStreamFromStreamName(streamName: string) { + return this.pathTemplates.streamPathTemplate.match(streamName).stream; + } + + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close(): Promise { + if (this.datastreamStub && !this._terminated) { + return this.datastreamStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_client_config.json b/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_client_config.json new file mode 100644 index 00000000000..0eeb5ffdfe9 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_client_config.json @@ -0,0 +1,143 @@ +{ + "interfaces": { + "google.cloud.datastream.v1alpha1.Datastream": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "unavailable": [ + "UNAVAILABLE" + ] + }, + "retry_params": { + "default": { + "initial_retry_delay_millis": 100, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListConnectionProfiles": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetConnectionProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateConnectionProfile": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateConnectionProfile": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteConnectionProfile": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DiscoverConnectionProfile": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListStreams": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetStream": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateStream": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateStream": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteStream": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "FetchErrors": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "FetchStaticIps": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreatePrivateConnection": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetPrivateConnection": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListPrivateConnections": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeletePrivateConnection": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateRoute": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetRoute": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListRoutes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteRoute": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_proto_list.json b/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_proto_list.json new file mode 100644 index 00000000000..baaa8482b91 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/datastream/v1alpha1/datastream.proto", + "../../protos/google/cloud/datastream/v1alpha1/datastream_resources.proto" +] diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/gapic_metadata.json b/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/gapic_metadata.json new file mode 100644 index 00000000000..57db1ad343f --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/gapic_metadata.json @@ -0,0 +1,253 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.datastream.v1alpha1", + "libraryPackage": "@google-cloud/datastream", + "services": { + "Datastream": { + "clients": { + "grpc": { + "libraryClient": "DatastreamClient", + "rpcs": { + "GetConnectionProfile": { + "methods": [ + "getConnectionProfile" + ] + }, + "DiscoverConnectionProfile": { + "methods": [ + "discoverConnectionProfile" + ] + }, + "GetStream": { + "methods": [ + "getStream" + ] + }, + "GetPrivateConnection": { + "methods": [ + "getPrivateConnection" + ] + }, + "GetRoute": { + "methods": [ + "getRoute" + ] + }, + "CreateConnectionProfile": { + "methods": [ + "createConnectionProfile" + ] + }, + "UpdateConnectionProfile": { + "methods": [ + "updateConnectionProfile" + ] + }, + "DeleteConnectionProfile": { + "methods": [ + "deleteConnectionProfile" + ] + }, + "CreateStream": { + "methods": [ + "createStream" + ] + }, + "UpdateStream": { + "methods": [ + "updateStream" + ] + }, + "DeleteStream": { + "methods": [ + "deleteStream" + ] + }, + "FetchErrors": { + "methods": [ + "fetchErrors" + ] + }, + "CreatePrivateConnection": { + "methods": [ + "createPrivateConnection" + ] + }, + "DeletePrivateConnection": { + "methods": [ + "deletePrivateConnection" + ] + }, + "CreateRoute": { + "methods": [ + "createRoute" + ] + }, + "DeleteRoute": { + "methods": [ + "deleteRoute" + ] + }, + "ListConnectionProfiles": { + "methods": [ + "listConnectionProfiles", + "listConnectionProfilesStream", + "listConnectionProfilesAsync" + ] + }, + "ListStreams": { + "methods": [ + "listStreams", + "listStreamsStream", + "listStreamsAsync" + ] + }, + "FetchStaticIps": { + "methods": [ + "fetchStaticIps", + "fetchStaticIpsStream", + "fetchStaticIpsAsync" + ] + }, + "ListPrivateConnections": { + "methods": [ + "listPrivateConnections", + "listPrivateConnectionsStream", + "listPrivateConnectionsAsync" + ] + }, + "ListRoutes": { + "methods": [ + "listRoutes", + "listRoutesStream", + "listRoutesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "DatastreamClient", + "rpcs": { + "GetConnectionProfile": { + "methods": [ + "getConnectionProfile" + ] + }, + "DiscoverConnectionProfile": { + "methods": [ + "discoverConnectionProfile" + ] + }, + "GetStream": { + "methods": [ + "getStream" + ] + }, + "GetPrivateConnection": { + "methods": [ + "getPrivateConnection" + ] + }, + "GetRoute": { + "methods": [ + "getRoute" + ] + }, + "CreateConnectionProfile": { + "methods": [ + "createConnectionProfile" + ] + }, + "UpdateConnectionProfile": { + "methods": [ + "updateConnectionProfile" + ] + }, + "DeleteConnectionProfile": { + "methods": [ + "deleteConnectionProfile" + ] + }, + "CreateStream": { + "methods": [ + "createStream" + ] + }, + "UpdateStream": { + "methods": [ + "updateStream" + ] + }, + "DeleteStream": { + "methods": [ + "deleteStream" + ] + }, + "FetchErrors": { + "methods": [ + "fetchErrors" + ] + }, + "CreatePrivateConnection": { + "methods": [ + "createPrivateConnection" + ] + }, + "DeletePrivateConnection": { + "methods": [ + "deletePrivateConnection" + ] + }, + "CreateRoute": { + "methods": [ + "createRoute" + ] + }, + "DeleteRoute": { + "methods": [ + "deleteRoute" + ] + }, + "ListConnectionProfiles": { + "methods": [ + "listConnectionProfiles", + "listConnectionProfilesStream", + "listConnectionProfilesAsync" + ] + }, + "ListStreams": { + "methods": [ + "listStreams", + "listStreamsStream", + "listStreamsAsync" + ] + }, + "FetchStaticIps": { + "methods": [ + "fetchStaticIps", + "fetchStaticIpsStream", + "fetchStaticIpsAsync" + ] + }, + "ListPrivateConnections": { + "methods": [ + "listPrivateConnections", + "listPrivateConnectionsStream", + "listPrivateConnectionsAsync" + ] + }, + "ListRoutes": { + "methods": [ + "listRoutes", + "listRoutesStream", + "listRoutesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/index.ts b/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/index.ts new file mode 100644 index 00000000000..37416a69a13 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {DatastreamClient} from './datastream_client'; diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/fixtures/sample/src/index.js new file mode 100644 index 00000000000..0c39f11d9bc --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const datastream = require('@google-cloud/datastream'); + +function main() { + const datastreamClient = new datastream.DatastreamClient(); +} + +main(); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 00000000000..9dd67114647 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {DatastreamClient} from '@google-cloud/datastream'; + +// check that the client class type name can be used +function doStuffWithDatastreamClient(client: DatastreamClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const datastreamClient = new DatastreamClient(); + doStuffWithDatastreamClient(datastreamClient); +} + +main(); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/install.ts b/owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/install.ts new file mode 100644 index 00000000000..c8f81b25a86 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {packNTest} from 'pack-n-play'; +import {readFileSync} from 'fs'; +import {describe, it} from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/test/gapic_datastream_v1alpha1.ts b/owl-bot-staging/google-cloud-datastream/v1alpha1/test/gapic_datastream_v1alpha1.ts new file mode 100644 index 00000000000..ab216043ed3 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/test/gapic_datastream_v1alpha1.ts @@ -0,0 +1,3927 @@ +// Copyright 2023 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as protos from '../protos/protos'; +import * as assert from 'assert'; +import * as sinon from 'sinon'; +import {SinonStub} from 'sinon'; +import {describe, it} from 'mocha'; +import * as datastreamModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +// Dynamically loaded proto JSON is needed to get the type information +// to fill in default values for request objects +const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); + +// eslint-disable-next-line @typescript-eslint/no-unused-vars +function getTypeDefaultValue(typeName: string, fields: string[]) { + let type = root.lookupType(typeName) as protobuf.Type; + for (const field of fields.slice(0, -1)) { + type = type.fields[field]?.resolvedType as protobuf.Type; + } + return type.fields[fields[fields.length - 1]]?.defaultValue; +} + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1alpha1.DatastreamClient', () => { + describe('Common methods', () => { + it('has servicePath', () => { + const servicePath = datastreamModule.v1alpha1.DatastreamClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = datastreamModule.v1alpha1.DatastreamClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = datastreamModule.v1alpha1.DatastreamClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new datastreamModule.v1alpha1.DatastreamClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.datastreamStub, undefined); + await client.initialize(); + assert(client.datastreamStub); + }); + + it('has close method for the initialized client', done => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.datastreamStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.datastreamStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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 datastreamModule.v1alpha1.DatastreamClient({ + 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('getConnectionProfile', () => { + it('invokes getConnectionProfile without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ConnectionProfile() + ); + client.innerApiCalls.getConnectionProfile = stubSimpleCall(expectedResponse); + const [response] = await client.getConnectionProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnectionProfile without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ConnectionProfile() + ); + client.innerApiCalls.getConnectionProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConnectionProfile( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1alpha1.IConnectionProfile|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnectionProfile with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getConnectionProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConnectionProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.getConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getConnectionProfile with closed client', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getConnectionProfile(request), expectedError); + }); + }); + + describe('discoverConnectionProfile', () => { + it('invokes discoverConnectionProfile without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileResponse() + ); + client.innerApiCalls.discoverConnectionProfile = stubSimpleCall(expectedResponse); + const [response] = await client.discoverConnectionProfile(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.discoverConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.discoverConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes discoverConnectionProfile without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileResponse() + ); + client.innerApiCalls.discoverConnectionProfile = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.discoverConnectionProfile( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.discoverConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.discoverConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes discoverConnectionProfile with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.discoverConnectionProfile = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.discoverConnectionProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.discoverConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.discoverConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes discoverConnectionProfile with closed client', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.discoverConnectionProfile(request), expectedError); + }); + }); + + describe('getStream', () => { + it('invokes getStream without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.GetStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetStreamRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.Stream() + ); + client.innerApiCalls.getStream = stubSimpleCall(expectedResponse); + const [response] = await client.getStream(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getStream without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.GetStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetStreamRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.Stream() + ); + client.innerApiCalls.getStream = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getStream( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1alpha1.IStream|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getStream with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.GetStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetStreamRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getStream = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getStream(request), expectedError); + const actualRequest = (client.innerApiCalls.getStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getStream with closed client', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.GetStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetStreamRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getStream(request), expectedError); + }); + }); + + describe('getPrivateConnection', () => { + it('invokes getPrivateConnection without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.PrivateConnection() + ); + client.innerApiCalls.getPrivateConnection = stubSimpleCall(expectedResponse); + const [response] = await client.getPrivateConnection(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPrivateConnection without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.PrivateConnection() + ); + client.innerApiCalls.getPrivateConnection = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getPrivateConnection( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1alpha1.IPrivateConnection|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPrivateConnection with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getPrivateConnection = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getPrivateConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getPrivateConnection with closed client', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getPrivateConnection(request), expectedError); + }); + }); + + describe('getRoute', () => { + it('invokes getRoute without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.GetRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetRouteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.Route() + ); + client.innerApiCalls.getRoute = stubSimpleCall(expectedResponse); + const [response] = await client.getRoute(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRoute without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.GetRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetRouteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.Route() + ); + client.innerApiCalls.getRoute = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getRoute( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1alpha1.IRoute|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.getRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRoute with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.GetRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetRouteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.getRoute = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getRoute(request), expectedError); + const actualRequest = (client.innerApiCalls.getRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.getRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes getRoute with closed client', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.GetRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetRouteRequest', ['name']); + request.name = defaultValue1; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getRoute(request), expectedError); + }); + }); + + describe('createConnectionProfile', () => { + it('invokes createConnectionProfile without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConnectionProfile = stubLongRunningCall(expectedResponse); + const [operation] = await client.createConnectionProfile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnectionProfile without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createConnectionProfile = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConnectionProfile( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnectionProfile with call error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConnectionProfile = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createConnectionProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.createConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createConnectionProfile with LRO error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createConnectionProfile = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createConnectionProfile(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateConnectionProfileProgress without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkCreateConnectionProfileProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateConnectionProfileProgress with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkCreateConnectionProfileProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateConnectionProfile', () => { + it('invokes updateConnectionProfile without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest() + ); + request.connectionProfile ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest', ['connectionProfile', 'name']); + request.connectionProfile.name = defaultValue1; + const expectedHeaderRequestParams = `connection_profile.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateConnectionProfile = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateConnectionProfile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConnectionProfile without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest() + ); + request.connectionProfile ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest', ['connectionProfile', 'name']); + request.connectionProfile.name = defaultValue1; + const expectedHeaderRequestParams = `connection_profile.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateConnectionProfile = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateConnectionProfile( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConnectionProfile with call error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest() + ); + request.connectionProfile ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest', ['connectionProfile', 'name']); + request.connectionProfile.name = defaultValue1; + const expectedHeaderRequestParams = `connection_profile.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConnectionProfile = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateConnectionProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.updateConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateConnectionProfile with LRO error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest() + ); + request.connectionProfile ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest', ['connectionProfile', 'name']); + request.connectionProfile.name = defaultValue1; + const expectedHeaderRequestParams = `connection_profile.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConnectionProfile = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateConnectionProfile(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateConnectionProfileProgress without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkUpdateConnectionProfileProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateConnectionProfileProgress with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkUpdateConnectionProfileProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteConnectionProfile', () => { + it('invokes deleteConnectionProfile without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConnectionProfile = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteConnectionProfile(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnectionProfile without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteConnectionProfile = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteConnectionProfile( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnectionProfile with call error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConnectionProfile = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteConnectionProfile(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteConnectionProfile with LRO error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConnectionProfile = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteConnectionProfile(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteConnectionProfile as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectionProfile as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteConnectionProfileProgress without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkDeleteConnectionProfileProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteConnectionProfileProgress with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkDeleteConnectionProfileProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createStream', () => { + it('invokes createStream without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.CreateStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateStreamRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createStream = stubLongRunningCall(expectedResponse); + const [operation] = await client.createStream(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createStream without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.CreateStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateStreamRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createStream = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createStream( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createStream with call error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.CreateStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateStreamRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createStream = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createStream(request), expectedError); + const actualRequest = (client.innerApiCalls.createStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createStream with LRO error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.CreateStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateStreamRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createStream = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createStream(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateStreamProgress without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkCreateStreamProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateStreamProgress with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkCreateStreamProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateStream', () => { + it('invokes updateStream without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.UpdateStreamRequest() + ); + request.stream ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.UpdateStreamRequest', ['stream', 'name']); + request.stream.name = defaultValue1; + const expectedHeaderRequestParams = `stream.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateStream = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateStream(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateStream without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.UpdateStreamRequest() + ); + request.stream ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.UpdateStreamRequest', ['stream', 'name']); + request.stream.name = defaultValue1; + const expectedHeaderRequestParams = `stream.name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.updateStream = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateStream( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.updateStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateStream with call error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.UpdateStreamRequest() + ); + request.stream ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.UpdateStreamRequest', ['stream', 'name']); + request.stream.name = defaultValue1; + const expectedHeaderRequestParams = `stream.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateStream = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateStream(request), expectedError); + const actualRequest = (client.innerApiCalls.updateStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes updateStream with LRO error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.UpdateStreamRequest() + ); + request.stream ??= {}; + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.UpdateStreamRequest', ['stream', 'name']); + request.stream.name = defaultValue1; + const expectedHeaderRequestParams = `stream.name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.updateStream = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateStream(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.updateStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkUpdateStreamProgress without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkUpdateStreamProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateStreamProgress with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkUpdateStreamProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteStream', () => { + it('invokes deleteStream without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DeleteStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteStreamRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteStream = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteStream(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteStream without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DeleteStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteStreamRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteStream = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteStream( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteStream with call error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DeleteStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteStreamRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteStream = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteStream(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteStream with LRO error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DeleteStreamRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteStreamRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteStream = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteStream(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteStreamProgress without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkDeleteStreamProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteStreamProgress with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkDeleteStreamProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('fetchErrors', () => { + it('invokes fetchErrors without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.FetchErrorsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchErrorsRequest', ['stream']); + request.stream = defaultValue1; + const expectedHeaderRequestParams = `stream=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.fetchErrors = stubLongRunningCall(expectedResponse); + const [operation] = await client.fetchErrors(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchErrors as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchErrors as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchErrors without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.FetchErrorsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchErrorsRequest', ['stream']); + request.stream = defaultValue1; + const expectedHeaderRequestParams = `stream=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.fetchErrors = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchErrors( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchErrors as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchErrors as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchErrors with call error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.FetchErrorsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchErrorsRequest', ['stream']); + request.stream = defaultValue1; + const expectedHeaderRequestParams = `stream=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchErrors = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.fetchErrors(request), expectedError); + const actualRequest = (client.innerApiCalls.fetchErrors as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchErrors as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchErrors with LRO error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.FetchErrorsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchErrorsRequest', ['stream']); + request.stream = defaultValue1; + const expectedHeaderRequestParams = `stream=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchErrors = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.fetchErrors(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.fetchErrors as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchErrors as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkFetchErrorsProgress without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkFetchErrorsProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkFetchErrorsProgress with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkFetchErrorsProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createPrivateConnection', () => { + it('invokes createPrivateConnection without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createPrivateConnection = stubLongRunningCall(expectedResponse); + const [operation] = await client.createPrivateConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createPrivateConnection without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createPrivateConnection = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createPrivateConnection( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createPrivateConnection with call error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPrivateConnection = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createPrivateConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createPrivateConnection with LRO error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createPrivateConnection = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createPrivateConnection(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreatePrivateConnectionProgress without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkCreatePrivateConnectionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreatePrivateConnectionProgress with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkCreatePrivateConnectionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deletePrivateConnection', () => { + it('invokes deletePrivateConnection without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(expectedResponse); + const [operation] = await client.deletePrivateConnection(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePrivateConnection without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deletePrivateConnection = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deletePrivateConnection( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePrivateConnection with call error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deletePrivateConnection(request), expectedError); + const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deletePrivateConnection with LRO error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deletePrivateConnection(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeletePrivateConnectionProgress without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkDeletePrivateConnectionProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeletePrivateConnectionProgress with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkDeletePrivateConnectionProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createRoute', () => { + it('invokes createRoute without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.CreateRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateRouteRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createRoute = stubLongRunningCall(expectedResponse); + const [operation] = await client.createRoute(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRoute without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.CreateRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateRouteRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.createRoute = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createRoute( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.createRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRoute with call error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.CreateRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateRouteRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createRoute = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createRoute(request), expectedError); + const actualRequest = (client.innerApiCalls.createRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes createRoute with LRO error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.CreateRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateRouteRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.createRoute = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createRoute(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.createRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.createRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkCreateRouteProgress without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkCreateRouteProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateRouteProgress with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkCreateRouteProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteRoute', () => { + it('invokes deleteRoute without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DeleteRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteRouteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteRoute = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteRoute(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRoute without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DeleteRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteRouteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = generateSampleMessage( + new protos.google.longrunning.Operation() + ); + client.innerApiCalls.deleteRoute = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteRoute( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.deleteRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRoute with call error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DeleteRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteRouteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteRoute = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteRoute(request), expectedError); + const actualRequest = (client.innerApiCalls.deleteRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes deleteRoute with LRO error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.DeleteRouteRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteRouteRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteRoute = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteRoute(request); + await assert.rejects(operation.promise(), expectedError); + const actualRequest = (client.innerApiCalls.deleteRoute as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.deleteRoute as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes checkDeleteRouteProgress without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkDeleteRouteProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteRouteProgress with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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.checkDeleteRouteProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listConnectionProfiles', () => { + it('invokes listConnectionProfiles without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), + ]; + client.innerApiCalls.listConnectionProfiles = stubSimpleCall(expectedResponse); + const [response] = await client.listConnectionProfiles(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConnectionProfiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnectionProfiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnectionProfiles without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), + ]; + client.innerApiCalls.listConnectionProfiles = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConnectionProfiles( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1alpha1.IConnectionProfile[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listConnectionProfiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnectionProfiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnectionProfiles with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listConnectionProfiles = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConnectionProfiles(request), expectedError); + const actualRequest = (client.innerApiCalls.listConnectionProfiles as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listConnectionProfiles as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listConnectionProfilesStream without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), + ]; + client.descriptors.page.listConnectionProfiles.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listConnectionProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.datastream.v1alpha1.ConnectionProfile[] = []; + stream.on('data', (response: protos.google.cloud.datastream.v1alpha1.ConnectionProfile) => { + 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.listConnectionProfiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConnectionProfiles, request)); + assert( + (client.descriptors.page.listConnectionProfiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listConnectionProfilesStream with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConnectionProfiles.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listConnectionProfilesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.datastream.v1alpha1.ConnectionProfile[] = []; + stream.on('data', (response: protos.google.cloud.datastream.v1alpha1.ConnectionProfile) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listConnectionProfiles.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listConnectionProfiles, request)); + assert( + (client.descriptors.page.listConnectionProfiles.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConnectionProfiles without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), + ]; + client.descriptors.page.listConnectionProfiles.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.datastream.v1alpha1.IConnectionProfile[] = []; + const iterable = client.listConnectionProfilesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listConnectionProfiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConnectionProfiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listConnectionProfiles with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listConnectionProfiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listConnectionProfilesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.datastream.v1alpha1.IConnectionProfile[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listConnectionProfiles.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listConnectionProfiles.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listStreams', () => { + it('invokes listStreams without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListStreamsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListStreamsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), + ]; + client.innerApiCalls.listStreams = stubSimpleCall(expectedResponse); + const [response] = await client.listStreams(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listStreams as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listStreams as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listStreams without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListStreamsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListStreamsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), + ]; + client.innerApiCalls.listStreams = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listStreams( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1alpha1.IStream[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listStreams as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listStreams as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listStreams with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListStreamsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListStreamsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listStreams = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listStreams(request), expectedError); + const actualRequest = (client.innerApiCalls.listStreams as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listStreams as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listStreamsStream without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListStreamsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListStreamsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), + ]; + client.descriptors.page.listStreams.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listStreamsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.datastream.v1alpha1.Stream[] = []; + stream.on('data', (response: protos.google.cloud.datastream.v1alpha1.Stream) => { + 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.listStreams.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listStreams, request)); + assert( + (client.descriptors.page.listStreams.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listStreamsStream with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListStreamsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListStreamsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listStreams.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listStreamsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.datastream.v1alpha1.Stream[] = []; + stream.on('data', (response: protos.google.cloud.datastream.v1alpha1.Stream) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listStreams.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listStreams, request)); + assert( + (client.descriptors.page.listStreams.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listStreams without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListStreamsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListStreamsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), + ]; + client.descriptors.page.listStreams.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.datastream.v1alpha1.IStream[] = []; + const iterable = client.listStreamsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listStreams.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listStreams.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listStreams with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListStreamsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListStreamsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listStreams.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listStreamsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.datastream.v1alpha1.IStream[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listStreams.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listStreams.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('fetchStaticIps', () => { + it('invokes fetchStaticIps without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [new String(), new String(), new String()]; + client.innerApiCalls.fetchStaticIps = stubSimpleCall(expectedResponse); + const [response] = await client.fetchStaticIps(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchStaticIps as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchStaticIps as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchStaticIps without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [new String(), new String(), new String()]; + client.innerApiCalls.fetchStaticIps = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.fetchStaticIps( + request, + (err?: Error|null, result?: string[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.fetchStaticIps as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchStaticIps as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchStaticIps with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.fetchStaticIps = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.fetchStaticIps(request), expectedError); + const actualRequest = (client.innerApiCalls.fetchStaticIps as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.fetchStaticIps as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes fetchStaticIpsStream without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = [new String(), new String(), new String()]; + client.descriptors.page.fetchStaticIps.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.fetchStaticIpsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: string[] = []; + stream.on('data', (response: string) => { + 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.fetchStaticIps.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.fetchStaticIps, request)); + assert( + (client.descriptors.page.fetchStaticIps.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes fetchStaticIpsStream with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.fetchStaticIps.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.fetchStaticIpsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: string[] = []; + stream.on('data', (response: string) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.fetchStaticIps.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.fetchStaticIps, request)); + assert( + (client.descriptors.page.fetchStaticIps.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with fetchStaticIps without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedResponse = [new String(), new String(), new String()]; + client.descriptors.page.fetchStaticIps.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: string[] = []; + const iterable = client.fetchStaticIpsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.fetchStaticIps.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.fetchStaticIps.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with fetchStaticIps with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest', ['name']); + request.name = defaultValue1; + const expectedHeaderRequestParams = `name=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.fetchStaticIps.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.fetchStaticIpsAsync(request); + await assert.rejects(async () => { + const responses: string[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.fetchStaticIps.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.fetchStaticIps.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listPrivateConnections', () => { + it('invokes listPrivateConnections without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), + ]; + client.innerApiCalls.listPrivateConnections = stubSimpleCall(expectedResponse); + const [response] = await client.listPrivateConnections(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPrivateConnections without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), + ]; + client.innerApiCalls.listPrivateConnections = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPrivateConnections( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1alpha1.IPrivateConnection[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPrivateConnections with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listPrivateConnections = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listPrivateConnections(request), expectedError); + const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listPrivateConnectionsStream without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), + ]; + client.descriptors.page.listPrivateConnections.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listPrivateConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.datastream.v1alpha1.PrivateConnection[] = []; + stream.on('data', (response: protos.google.cloud.datastream.v1alpha1.PrivateConnection) => { + 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.listPrivateConnections.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPrivateConnections, request)); + assert( + (client.descriptors.page.listPrivateConnections.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listPrivateConnectionsStream with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPrivateConnections.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listPrivateConnectionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.datastream.v1alpha1.PrivateConnection[] = []; + stream.on('data', (response: protos.google.cloud.datastream.v1alpha1.PrivateConnection) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listPrivateConnections.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPrivateConnections, request)); + assert( + (client.descriptors.page.listPrivateConnections.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPrivateConnections without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), + ]; + client.descriptors.page.listPrivateConnections.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.datastream.v1alpha1.IPrivateConnection[] = []; + const iterable = client.listPrivateConnectionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listPrivateConnections with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listPrivateConnections.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPrivateConnectionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.datastream.v1alpha1.IPrivateConnection[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('listRoutes', () => { + it('invokes listRoutes without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), + ]; + client.innerApiCalls.listRoutes = stubSimpleCall(expectedResponse); + const [response] = await client.listRoutes(request); + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRoutes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRoutes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRoutes without error using callback', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), + ]; + client.innerApiCalls.listRoutes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listRoutes( + request, + (err?: Error|null, result?: protos.google.cloud.datastream.v1alpha1.IRoute[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + const actualRequest = (client.innerApiCalls.listRoutes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRoutes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRoutes with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.innerApiCalls.listRoutes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listRoutes(request), expectedError); + const actualRequest = (client.innerApiCalls.listRoutes as SinonStub) + .getCall(0).args[0]; + assert.deepStrictEqual(actualRequest, request); + const actualHeaderRequestParams = (client.innerApiCalls.listRoutes as SinonStub) + .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; + assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); + }); + + it('invokes listRoutesStream without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), + ]; + client.descriptors.page.listRoutes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listRoutesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.datastream.v1alpha1.Route[] = []; + stream.on('data', (response: protos.google.cloud.datastream.v1alpha1.Route) => { + 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.listRoutes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRoutes, request)); + assert( + (client.descriptors.page.listRoutes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('invokes listRoutesStream with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRoutes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listRoutesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.datastream.v1alpha1.Route[] = []; + stream.on('data', (response: protos.google.cloud.datastream.v1alpha1.Route) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listRoutes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listRoutes, request)); + assert( + (client.descriptors.page.listRoutes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRoutes without error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), + generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), + ]; + client.descriptors.page.listRoutes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.datastream.v1alpha1.IRoute[] = []; + const iterable = client.listRoutesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listRoutes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRoutes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + + it('uses async iteration with listRoutes with error', async () => { + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage( + new protos.google.cloud.datastream.v1alpha1.ListRoutesRequest() + ); + const defaultValue1 = + getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListRoutesRequest', ['parent']); + request.parent = defaultValue1; + const expectedHeaderRequestParams = `parent=${defaultValue1}`; + const expectedError = new Error('expected'); + client.descriptors.page.listRoutes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listRoutesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.datastream.v1alpha1.IRoute[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listRoutes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert( + (client.descriptors.page.listRoutes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( + expectedHeaderRequestParams + ) + ); + }); + }); + + describe('Path templates', () => { + + describe('connectionProfile', () => { + const fakePath = "/rendered/path/connectionProfile"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + connection_profile: "connectionProfileValue", + }; + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.connectionProfilePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.connectionProfilePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('connectionProfilePath', () => { + const result = client.connectionProfilePath("projectValue", "locationValue", "connectionProfileValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.connectionProfilePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConnectionProfileName', () => { + const result = client.matchProjectFromConnectionProfileName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.connectionProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConnectionProfileName', () => { + const result = client.matchLocationFromConnectionProfileName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.connectionProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConnectionProfileFromConnectionProfileName', () => { + const result = client.matchConnectionProfileFromConnectionProfileName(fakePath); + assert.strictEqual(result, "connectionProfileValue"); + assert((client.pathTemplates.connectionProfilePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.locationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.locationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('locationPath', () => { + const result = client.locationPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.locationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromLocationName', () => { + const result = client.matchProjectFromLocationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromLocationName', () => { + const result = client.matchLocationFromLocationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.locationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('privateConnection', () => { + const fakePath = "/rendered/path/privateConnection"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + private_connection: "privateConnectionValue", + }; + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.privateConnectionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.privateConnectionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('privateConnectionPath', () => { + const result = client.privateConnectionPath("projectValue", "locationValue", "privateConnectionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.privateConnectionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromPrivateConnectionName', () => { + const result = client.matchProjectFromPrivateConnectionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromPrivateConnectionName', () => { + const result = client.matchLocationFromPrivateConnectionName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchPrivateConnectionFromPrivateConnectionName', () => { + const result = client.matchPrivateConnectionFromPrivateConnectionName(fakePath); + assert.strictEqual(result, "privateConnectionValue"); + assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new datastreamModule.v1alpha1.DatastreamClient({ + 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('route', () => { + const fakePath = "/rendered/path/route"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + private_connection: "privateConnectionValue", + route: "routeValue", + }; + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.routePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.routePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('routePath', () => { + const result = client.routePath("projectValue", "locationValue", "privateConnectionValue", "routeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.routePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromRouteName', () => { + const result = client.matchProjectFromRouteName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.routePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromRouteName', () => { + const result = client.matchLocationFromRouteName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.routePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchPrivateConnectionFromRouteName', () => { + const result = client.matchPrivateConnectionFromRouteName(fakePath); + assert.strictEqual(result, "privateConnectionValue"); + assert((client.pathTemplates.routePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRouteFromRouteName', () => { + const result = client.matchRouteFromRouteName(fakePath); + assert.strictEqual(result, "routeValue"); + assert((client.pathTemplates.routePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('stream', () => { + const fakePath = "/rendered/path/stream"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + stream: "streamValue", + }; + const client = new datastreamModule.v1alpha1.DatastreamClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.streamPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.streamPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('streamPath', () => { + const result = client.streamPath("projectValue", "locationValue", "streamValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.streamPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromStreamName', () => { + const result = client.matchProjectFromStreamName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromStreamName', () => { + const result = client.matchLocationFromStreamName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchStreamFromStreamName', () => { + const result = client.matchStreamFromStreamName(fakePath); + assert.strictEqual(result, "streamValue"); + assert((client.pathTemplates.streamPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/tsconfig.json b/owl-bot-staging/google-cloud-datastream/v1alpha1/tsconfig.json new file mode 100644 index 00000000000..c78f1c884ef --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/tsconfig.json @@ -0,0 +1,19 @@ +{ + "extends": "./node_modules/gts/tsconfig-google.json", + "compilerOptions": { + "rootDir": ".", + "outDir": "build", + "resolveJsonModule": true, + "lib": [ + "es2018", + "dom" + ] + }, + "include": [ + "src/*.ts", + "src/**/*.ts", + "test/*.ts", + "test/**/*.ts", + "system-test/*.ts" + ] +} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/webpack.config.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/webpack.config.js new file mode 100644 index 00000000000..ce71b478c09 --- /dev/null +++ b/owl-bot-staging/google-cloud-datastream/v1alpha1/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: 'Datastream', + filename: './datastream.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 e85366d25f239737ce3062ef6ab415afe216b150 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Sun, 7 May 2023 10:11:53 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- .../google-cloud-datastream/v1/.eslintignore | 7 - .../google-cloud-datastream/v1/.eslintrc.json | 3 - .../google-cloud-datastream/v1/.gitignore | 14 - .../google-cloud-datastream/v1/.jsdoc.js | 55 - .../google-cloud-datastream/v1/.mocharc.js | 33 - .../google-cloud-datastream/v1/.prettierrc.js | 22 - .../google-cloud-datastream/v1/README.md | 1 - .../v1/linkinator.config.json | 16 - .../google-cloud-datastream/v1/package.json | 64 - .../cloud/datastream/v1/datastream.proto | 1075 ---- .../datastream/v1/datastream_resources.proto | 1049 ---- .../datastream.create_connection_profile.js | 95 - .../datastream.create_private_connection.js | 90 - .../generated/v1/datastream.create_route.js | 86 - .../generated/v1/datastream.create_stream.js | 95 - .../datastream.delete_connection_profile.js | 76 - .../datastream.delete_private_connection.js | 81 - .../generated/v1/datastream.delete_route.js | 76 - .../generated/v1/datastream.delete_stream.js | 76 - .../datastream.discover_connection_profile.js | 91 - .../v1/datastream.fetch_static_ips.js | 73 - .../v1/datastream.get_connection_profile.js | 61 - .../v1/datastream.get_private_connection.js | 61 - .../generated/v1/datastream.get_route.js | 61 - .../generated/v1/datastream.get_stream.js | 61 - .../v1/datastream.get_stream_object.js | 61 - .../v1/datastream.list_connection_profiles.js | 84 - .../v1/datastream.list_private_connections.js | 87 - .../generated/v1/datastream.list_routes.js | 86 - .../v1/datastream.list_stream_objects.js | 76 - .../generated/v1/datastream.list_streams.js | 84 - .../v1/datastream.lookup_stream_object.js | 66 - .../v1/datastream.start_backfill_job.js | 62 - .../v1/datastream.stop_backfill_job.js | 62 - .../datastream.update_connection_profile.js | 93 - .../generated/v1/datastream.update_stream.js | 93 - ...t_metadata.google.cloud.datastream.v1.json | 1247 ---- .../google-cloud-datastream/v1/src/index.ts | 25 - .../v1/src/v1/datastream_client.ts | 4160 ------------- .../v1/src/v1/datastream_client_config.json | 163 - .../v1/src/v1/datastream_proto_list.json | 4 - .../v1/src/v1/gapic_metadata.json | 297 - .../v1/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1/system-test/install.ts | 49 - .../v1/test/gapic_datastream_v1.ts | 5201 ----------------- .../google-cloud-datastream/v1/tsconfig.json | 19 - .../v1/webpack.config.js | 64 - .../v1alpha1/.eslintignore | 7 - .../v1alpha1/.eslintrc.json | 3 - .../v1alpha1/.gitignore | 14 - .../v1alpha1/.jsdoc.js | 55 - .../v1alpha1/.mocharc.js | 33 - .../v1alpha1/.prettierrc.js | 22 - .../v1alpha1/README.md | 1 - .../v1alpha1/linkinator.config.json | 16 - .../v1alpha1/package.json | 64 - .../datastream/v1alpha1/datastream.proto | 895 --- .../v1alpha1/datastream_resources.proto | 683 --- .../datastream.create_connection_profile.js | 86 - .../datastream.create_private_connection.js | 86 - .../v1alpha1/datastream.create_route.js | 86 - .../v1alpha1/datastream.create_stream.js | 95 - .../datastream.delete_connection_profile.js | 76 - .../datastream.delete_private_connection.js | 81 - .../v1alpha1/datastream.delete_route.js | 76 - .../v1alpha1/datastream.delete_stream.js | 76 - .../datastream.discover_connection_profile.js | 87 - .../v1alpha1/datastream.fetch_errors.js | 61 - .../v1alpha1/datastream.fetch_static_ips.js | 73 - .../datastream.get_connection_profile.js | 61 - .../datastream.get_private_connection.js | 61 - .../v1alpha1/datastream.get_route.js | 61 - .../v1alpha1/datastream.get_stream.js | 61 - .../datastream.list_connection_profiles.js | 84 - .../datastream.list_private_connections.js | 86 - .../v1alpha1/datastream.list_routes.js | 86 - .../v1alpha1/datastream.list_streams.js | 84 - .../datastream.update_connection_profile.js | 84 - .../v1alpha1/datastream.update_stream.js | 93 - ...data.google.cloud.datastream.v1alpha1.json | 1051 ---- .../v1alpha1/src/index.ts | 25 - .../src/v1alpha1/datastream_client.ts | 3291 ----------- .../v1alpha1/datastream_client_config.json | 143 - .../src/v1alpha1/datastream_proto_list.json | 4 - .../v1alpha1/src/v1alpha1/gapic_metadata.json | 253 - .../v1alpha1/src/v1alpha1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - .../v1alpha1/system-test/install.ts | 49 - .../test/gapic_datastream_v1alpha1.ts | 3927 ------------- .../v1alpha1/tsconfig.json | 19 - .../v1alpha1/webpack.config.js | 64 - packages/google-cloud-datastream/README.md | 99 +- .../cloud/datastream/v1/datastream.proto | 119 +- .../datastream/v1/datastream_resources.proto | 118 +- .../protos/protos.d.ts | 24 + .../google-cloud-datastream/protos/protos.js | 92 + .../protos/protos.json | 21 +- .../google-cloud-datastream/samples/README.md | 18 - .../datastream.create_connection_profile.js | 4 +- .../datastream.create_private_connection.js | 4 + .../datastream.delete_private_connection.js | 4 +- .../datastream.discover_connection_profile.js | 4 +- .../v1/datastream.fetch_static_ips.js | 4 +- .../v1/datastream.list_private_connections.js | 3 +- .../v1/datastream.start_backfill_job.js | 3 +- .../v1/datastream.stop_backfill_job.js | 3 +- .../datastream.update_connection_profile.js | 4 +- .../generated/v1/datastream.update_stream.js | 4 +- ...t_metadata.google.cloud.datastream.v1.json | 14 +- ...data.google.cloud.datastream.v1alpha1.json | 2 +- .../src/v1/datastream_client.ts | 49 +- 114 files changed, 393 insertions(+), 28124 deletions(-) delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/README.md delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/package.json delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/protos/google/cloud/datastream/v1/datastream.proto delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/protos/google/cloud/datastream/v1/datastream_resources.proto delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_connection_profile.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_private_connection.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_route.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_stream.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_connection_profile.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_private_connection.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_route.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_stream.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.discover_connection_profile.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.fetch_static_ips.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_connection_profile.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_private_connection.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_route.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_stream.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_stream_object.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_connection_profiles.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_private_connections.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_routes.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_stream_objects.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_streams.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.lookup_stream_object.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.start_backfill_job.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.stop_backfill_job.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.update_connection_profile.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.update_stream.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/snippet_metadata.google.cloud.datastream.v1.json delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_client.ts delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_client_config.json delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/test/gapic_datastream_v1.ts delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-datastream/v1/webpack.config.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/.eslintignore delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/.eslintrc.json delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/.gitignore delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/.jsdoc.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/.mocharc.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/.prettierrc.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/README.md delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/linkinator.config.json delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/package.json delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/protos/google/cloud/datastream/v1alpha1/datastream.proto delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/protos/google/cloud/datastream/v1alpha1/datastream_resources.proto delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_connection_profile.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_private_connection.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_route.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_stream.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_connection_profile.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_private_connection.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_route.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_stream.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.discover_connection_profile.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.fetch_errors.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.fetch_static_ips.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_connection_profile.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_private_connection.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_route.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_stream.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_connection_profiles.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_private_connections.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_routes.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_streams.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.update_connection_profile.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.update_stream.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/snippet_metadata.google.cloud.datastream.v1alpha1.json delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_client.ts delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_client_config.json delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_proto_list.json delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/gapic_metadata.json delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/index.ts delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/install.ts delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/test/gapic_datastream_v1alpha1.ts delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/tsconfig.json delete mode 100644 owl-bot-staging/google-cloud-datastream/v1alpha1/webpack.config.js diff --git a/owl-bot-staging/google-cloud-datastream/v1/.eslintignore b/owl-bot-staging/google-cloud-datastream/v1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-cloud-datastream/v1/.eslintrc.json b/owl-bot-staging/google-cloud-datastream/v1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-datastream/v1/.gitignore b/owl-bot-staging/google-cloud-datastream/v1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/google-cloud-datastream/v1/.jsdoc.js b/owl-bot-staging/google-cloud-datastream/v1/.jsdoc.js deleted file mode 100644 index cb79c804665..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2023 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/datastream', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-datastream/v1/.mocharc.js b/owl-bot-staging/google-cloud-datastream/v1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/google-cloud-datastream/v1/.prettierrc.js b/owl-bot-staging/google-cloud-datastream/v1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/google-cloud-datastream/v1/README.md b/owl-bot-staging/google-cloud-datastream/v1/README.md deleted file mode 100644 index a7903c0b77c..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Datastream: Nodejs Client diff --git a/owl-bot-staging/google-cloud-datastream/v1/linkinator.config.json b/owl-bot-staging/google-cloud-datastream/v1/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/google-cloud-datastream/v1/package.json b/owl-bot-staging/google-cloud-datastream/v1/package.json deleted file mode 100644 index fbd522f5bde..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/datastream", - "version": "0.1.0", - "description": "Datastream client for Node.js", - "repository": "googleapis/nodejs-datastream", - "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 datastream", - "datastream", - "datastream" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.5.7" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^4.0.0", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.1.2", - "mocha": "^10.2.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.0.1", - "ts-loader": "^8.4.0", - "typescript": "^4.8.4", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-datastream/v1/protos/google/cloud/datastream/v1/datastream.proto b/owl-bot-staging/google-cloud-datastream/v1/protos/google/cloud/datastream/v1/datastream.proto deleted file mode 100644 index bf0b13f5e2a..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/protos/google/cloud/datastream/v1/datastream.proto +++ /dev/null @@ -1,1075 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.datastream.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/datastream/v1/datastream_resources.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.Datastream.V1"; -option go_package = "cloud.google.com/go/datastream/apiv1/datastreampb;datastreampb"; -option java_multiple_files = true; -option java_outer_classname = "DatastreamProto"; -option java_package = "com.google.cloud.datastream.v1"; -option php_namespace = "Google\\Cloud\\Datastream\\V1"; -option ruby_package = "Google::Cloud::Datastream::V1"; - -// Datastream service -service Datastream { - option (google.api.default_host) = "datastream.googleapis.com"; - option (google.api.oauth_scopes) = - "https://www.googleapis.com/auth/cloud-platform"; - - // Use this method to list connection profiles created in a project and - // location. - rpc ListConnectionProfiles(ListConnectionProfilesRequest) - returns (ListConnectionProfilesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/connectionProfiles" - }; - option (google.api.method_signature) = "parent"; - } - - // Use this method to get details about a connection profile. - rpc GetConnectionProfile(GetConnectionProfileRequest) - returns (ConnectionProfile) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/connectionProfiles/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Use this method to create a connection profile in a project and location. - rpc CreateConnectionProfile(CreateConnectionProfileRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/connectionProfiles" - body: "connection_profile" - }; - option (google.api.method_signature) = - "parent,connection_profile,connection_profile_id"; - option (google.longrunning.operation_info) = { - response_type: "ConnectionProfile" - metadata_type: "OperationMetadata" - }; - } - - // Use this method to update the parameters of a connection profile. - rpc UpdateConnectionProfile(UpdateConnectionProfileRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{connection_profile.name=projects/*/locations/*/connectionProfiles/*}" - body: "connection_profile" - }; - option (google.api.method_signature) = "connection_profile,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "ConnectionProfile" - metadata_type: "OperationMetadata" - }; - } - - // Use this method to delete a connection profile. - rpc DeleteConnectionProfile(DeleteConnectionProfileRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/connectionProfiles/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Use this method to discover a connection profile. - // The discover API call exposes the data objects and metadata belonging to - // the profile. Typically, a request returns children data objects of a - // parent data object that's optionally supplied in the request. - rpc DiscoverConnectionProfile(DiscoverConnectionProfileRequest) - returns (DiscoverConnectionProfileResponse) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/connectionProfiles:discover" - body: "*" - }; - } - - // Use this method to list streams in a project and location. - rpc ListStreams(ListStreamsRequest) returns (ListStreamsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/streams" - }; - option (google.api.method_signature) = "parent"; - } - - // Use this method to get details about a stream. - rpc GetStream(GetStreamRequest) returns (Stream) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/streams/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Use this method to create a stream. - rpc CreateStream(CreateStreamRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/streams" - body: "stream" - }; - option (google.api.method_signature) = "parent,stream,stream_id"; - option (google.longrunning.operation_info) = { - response_type: "Stream" - metadata_type: "OperationMetadata" - }; - } - - // Use this method to update the configuration of a stream. - rpc UpdateStream(UpdateStreamRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{stream.name=projects/*/locations/*/streams/*}" - body: "stream" - }; - option (google.api.method_signature) = "stream,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Stream" - metadata_type: "OperationMetadata" - }; - } - - // Use this method to delete a stream. - rpc DeleteStream(DeleteStreamRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/streams/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Use this method to get details about a stream object. - rpc GetStreamObject(GetStreamObjectRequest) returns (StreamObject) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/streams/*/objects/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Use this method to look up a stream object by its source object identifier. - rpc LookupStreamObject(LookupStreamObjectRequest) returns (StreamObject) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/streams/*}/objects:lookup" - body: "*" - }; - } - - // Use this method to list the objects of a specific stream. - rpc ListStreamObjects(ListStreamObjectsRequest) - returns (ListStreamObjectsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/streams/*}/objects" - }; - option (google.api.method_signature) = "parent"; - } - - // Use this method to start a backfill job for the specified stream object. - rpc StartBackfillJob(StartBackfillJobRequest) - returns (StartBackfillJobResponse) { - option (google.api.http) = { - post: "/v1/{object=projects/*/locations/*/streams/*/objects/*}:startBackfillJob" - body: "*" - }; - option (google.api.method_signature) = "object"; - } - - // Use this method to stop a backfill job for the specified stream object. - rpc StopBackfillJob(StopBackfillJobRequest) - returns (StopBackfillJobResponse) { - option (google.api.http) = { - post: "/v1/{object=projects/*/locations/*/streams/*/objects/*}:stopBackfillJob" - body: "*" - }; - option (google.api.method_signature) = "object"; - } - - // The FetchStaticIps API call exposes the static IP addresses used by - // Datastream. - rpc FetchStaticIps(FetchStaticIpsRequest) returns (FetchStaticIpsResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*}:fetchStaticIps" - }; - option (google.api.method_signature) = "name"; - } - - // Use this method to create a private connectivity configuration. - rpc CreatePrivateConnection(CreatePrivateConnectionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/privateConnections" - body: "private_connection" - }; - option (google.api.method_signature) = - "parent,private_connection,private_connection_id"; - option (google.longrunning.operation_info) = { - response_type: "PrivateConnection" - metadata_type: "OperationMetadata" - }; - } - - // Use this method to get details about a private connectivity configuration. - rpc GetPrivateConnection(GetPrivateConnectionRequest) - returns (PrivateConnection) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/privateConnections/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Use this method to list private connectivity configurations in a project - // and location. - rpc ListPrivateConnections(ListPrivateConnectionsRequest) - returns (ListPrivateConnectionsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/privateConnections" - }; - option (google.api.method_signature) = "parent"; - } - - // Use this method to delete a private connectivity configuration. - rpc DeletePrivateConnection(DeletePrivateConnectionRequest) - returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/privateConnections/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Use this method to create a route for a private connectivity configuration - // in a project and location. - rpc CreateRoute(CreateRouteRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/privateConnections/*}/routes" - body: "route" - }; - option (google.api.method_signature) = "parent,route,route_id"; - option (google.longrunning.operation_info) = { - response_type: "Route" - metadata_type: "OperationMetadata" - }; - } - - // Use this method to get details about a route. - rpc GetRoute(GetRouteRequest) returns (Route) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/privateConnections/*/routes/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Use this method to list routes created for a private connectivity - // configuration in a project and location. - rpc ListRoutes(ListRoutesRequest) returns (ListRoutesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/privateConnections/*}/routes" - }; - option (google.api.method_signature) = "parent"; - } - - // Use this method to delete a route. - rpc DeleteRoute(DeleteRouteRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/privateConnections/*/routes/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } -} - -// Request message for 'discover' ConnectionProfile request. -message DiscoverConnectionProfileRequest { - // Required. The parent resource of the connection profile type. Must be in - // the format `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/ConnectionProfile" - } - ]; - - // The connection profile on which to run discover. - oneof target { - // An ad-hoc connection profile configuration. - ConnectionProfile connection_profile = 200; - - // A reference to an existing connection profile. - string connection_profile_name = 201; - } - - // The depth of the retrieved hierarchy of data objects. - oneof hierarchy { - // Whether to retrieve the full hierarchy of data objects (TRUE) or only the - // current level (FALSE). - bool full_hierarchy = 3; - - // The number of hierarchy levels below the current level to be retrieved. - int32 hierarchy_depth = 4; - } - - // The data object to populate with child data objects and metadata. - oneof data_object { - // Oracle RDBMS to enrich with child data objects and metadata. - OracleRdbms oracle_rdbms = 100; - - // MySQL RDBMS to enrich with child data objects and metadata. - MysqlRdbms mysql_rdbms = 101; - - // PostgreSQL RDBMS to enrich with child data objects and metadata. - PostgresqlRdbms postgresql_rdbms = 102; - } -} - -// Response from a discover request. -message DiscoverConnectionProfileResponse { - // The data object that has been enriched by the discover API call. - oneof data_object { - // Enriched Oracle RDBMS object. - OracleRdbms oracle_rdbms = 100; - - // Enriched MySQL RDBMS object. - MysqlRdbms mysql_rdbms = 101; - - // Enriched PostgreSQL RDBMS object. - PostgresqlRdbms postgresql_rdbms = 102; - } -} - -// Request message for 'FetchStaticIps' request. -message FetchStaticIpsRequest { - // Required. The resource name for the location for which static IPs should be - // returned. Must be in the format `projects/*/locations/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Maximum number of Ips to return, will likely not be specified. - int32 page_size = 2; - - // A page token, received from a previous `ListStaticIps` call. - // will likely not be specified. - string page_token = 3; -} - -// Response message for a 'FetchStaticIps' response. -message FetchStaticIpsResponse { - // list of static ips by account - repeated string static_ips = 1; - - // A token that can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for listing connection profiles. -message ListConnectionProfilesRequest { - // Required. The parent that owns the collection of connection profiles. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/ConnectionProfile" - } - ]; - - // Maximum number of connection profiles to return. - // If unspecified, at most 50 connection profiles will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // Page token received from a previous `ListConnectionProfiles` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListConnectionProfiles` - // must match the call that provided the page token. - string page_token = 3; - - // Filter request. - string filter = 4; - - // Order by fields for the result. - string order_by = 5; -} - -// Response message for listing connection profiles. -message ListConnectionProfilesResponse { - // List of connection profiles. - repeated ConnectionProfile connection_profiles = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for getting a connection profile. -message GetConnectionProfileRequest { - // Required. The name of the connection profile resource to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/ConnectionProfile" - } - ]; -} - -// Request message for creating a connection profile. -message CreateConnectionProfileRequest { - // Required. The parent that owns the collection of ConnectionProfiles. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/ConnectionProfile" - } - ]; - - // Required. The connection profile identifier. - string connection_profile_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The connection profile resource to create. - ConnectionProfile connection_profile = 3 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only validate the connection profile, but don't create any - // resources. The default is false. - bool validate_only = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Create the connection profile without validating it. - bool force = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// Connection profile update message. -message UpdateConnectionProfileRequest { - // Optional. Field mask is used to specify the fields to be overwritten in the - // ConnectionProfile resource by the update. - // The fields specified in the update_mask are relative to the resource, not - // the full request. A field will be overwritten if it is in the mask. If the - // user does not provide a mask then all fields will be overwritten. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Required. The connection profile to update. - ConnectionProfile connection_profile = 2 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only validate the connection profile, but don't update any - // resources. The default is false. - bool validate_only = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Update the connection profile without validating it. - bool force = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for deleting a connection profile. -message DeleteConnectionProfileRequest { - // Required. The name of the connection profile resource to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/ConnectionProfile" - } - ]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for listing streams. -message ListStreamsRequest { - // Required. The parent that owns the collection of streams. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/Stream" - } - ]; - - // Maximum number of streams to return. - // If unspecified, at most 50 streams will be returned. The maximum - // value is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // Page token received from a previous `ListStreams` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListStreams` - // must match the call that provided the page token. - string page_token = 3; - - // Filter request. - string filter = 4; - - // Order by fields for the result. - string order_by = 5; -} - -// Response message for listing streams. -message ListStreamsResponse { - // List of streams - repeated Stream streams = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request message for getting a stream. -message GetStreamRequest { - // Required. The name of the stream resource to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/Stream" - } - ]; -} - -// Request message for creating a stream. -message CreateStreamRequest { - // Required. The parent that owns the collection of streams. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/Stream" - } - ]; - - // Required. The stream identifier. - string stream_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The stream resource to create. - Stream stream = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only validate the stream, but don't create any resources. - // The default is false. - bool validate_only = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Create the stream without validating it. - bool force = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for updating a stream. -message UpdateStreamRequest { - // Optional. Field mask is used to specify the fields to be overwritten in the - // stream resource by the update. - // The fields specified in the update_mask are relative to the resource, not - // the full request. A field will be overwritten if it is in the mask. If the - // user does not provide a mask then all fields will be overwritten. - google.protobuf.FieldMask update_mask = 1 - [(google.api.field_behavior) = OPTIONAL]; - - // Required. The stream resource to update. - Stream stream = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only validate the stream with the changes, without actually - // updating it. The default is false. - bool validate_only = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Update the stream without validating it. - bool force = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for deleting a stream. -message DeleteStreamRequest { - // Required. The name of the stream resource to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/Stream" - } - ]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for fetching a specific stream object. -message GetStreamObjectRequest { - // Required. The name of the stream object resource to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/StreamObject" - } - ]; -} - -// Request for looking up a specific stream object by its source object -// identifier. -message LookupStreamObjectRequest { - // Required. The parent stream that owns the collection of objects. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/Stream" - } - ]; - - // Required. The source object identifier which maps to the stream object. - SourceObjectIdentifier source_object_identifier = 2 - [(google.api.field_behavior) = REQUIRED]; -} - -// Request for manually initiating a backfill job for a specific stream object. -message StartBackfillJobRequest { - // Required. The name of the stream object resource to start a backfill job - // for. - string object = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/StreamObject" - } - ]; -} - -// Response for manually initiating a backfill job for a specific stream object. -message StartBackfillJobResponse { - // The stream object resource a backfill job was started for. - StreamObject object = 1; -} - -// Request for manually stopping a running backfill job for a specific stream -// object. -message StopBackfillJobRequest { - // Required. The name of the stream object resource to stop the backfill job - // for. - string object = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/StreamObject" - } - ]; -} - -// Response for manually stop a backfill job for a specific stream object. -message StopBackfillJobResponse { - // The stream object resource the backfill job was stopped for. - StreamObject object = 1; -} - -// Request for listing all objects for a specific stream. -message ListStreamObjectsRequest { - // Required. The parent stream that owns the collection of objects. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/StreamObject" - } - ]; - - // Maximum number of objects to return. Default is 50. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // Page token received from a previous `ListStreamObjectsRequest` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // `ListStreamObjectsRequest` must match the call that provided the page - // token. - string page_token = 3; -} - -// Response containing the objects for a stream. -message ListStreamObjectsResponse { - // List of stream objects. - repeated StreamObject stream_objects = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - string next_page_token = 2; -} - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a - // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to - // `Code.CANCELLED`. - bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Results of executed validations if there are any. - ValidationResult validation_result = 8 - [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request for creating a private connection. -message CreatePrivateConnectionRequest { - // Required. The parent that owns the collection of PrivateConnections. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/PrivateConnection" - } - ]; - - // Required. The private connectivity identifier. - string private_connection_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Private Connectivity resource to create. - PrivateConnection private_connection = 3 - [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to true, will skip validations. - bool force = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request for listing private connections. -message ListPrivateConnectionsRequest { - // Required. The parent that owns the collection of private connectivity - // configurations. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/PrivateConnection" - } - ]; - - // Maximum number of private connectivity configurations to return. - // If unspecified, at most 50 private connectivity configurations that will be - // returned. The maximum value is 1000; values above 1000 will be coerced to - // 1000. - int32 page_size = 2; - - // Page token received from a previous `ListPrivateConnections` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // `ListPrivateConnections` must match the call that provided the page - // token. - string page_token = 3; - - // Filter request. - string filter = 4; - - // Order by fields for the result. - string order_by = 5; -} - -// Response containing a list of private connection configurations. -message ListPrivateConnectionsResponse { - // List of private connectivity configurations. - repeated PrivateConnection private_connections = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request to delete a private connection. -message DeletePrivateConnectionRequest { - // Required. The name of the private connectivity configuration to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/PrivateConnection" - } - ]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to true, any child routes that belong to this - // PrivateConnection will also be deleted. - bool force = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request to get a private connection configuration. -message GetPrivateConnectionRequest { - // Required. The name of the private connectivity configuration to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/PrivateConnection" - } - ]; -} - -// Route creation request. -message CreateRouteRequest { - // Required. The parent that owns the collection of Routes. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/Route" - } - ]; - - // Required. The Route identifier. - string route_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Route resource to create. - Route route = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Route list request. -message ListRoutesRequest { - // Required. The parent that owns the collection of Routess. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/Route" - } - ]; - - // Maximum number of Routes to return. The service may return - // fewer than this value. If unspecified, at most 50 Routes - // will be returned. The maximum value is 1000; values above 1000 will be - // coerced to 1000. - int32 page_size = 2; - - // Page token received from a previous `ListRoutes` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // `ListRoutes` must match the call that provided the page - // token. - string page_token = 3; - - // Filter request. - string filter = 4; - - // Order by fields for the result. - string order_by = 5; -} - -// Route list response. -message ListRoutesResponse { - // List of Routes. - repeated Route routes = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Route deletion request. -message DeleteRouteRequest { - // Required. The name of the Route resource to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/Route" - } - ]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Route get request. -message GetRouteRequest { - // Required. The name of the Route resource to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/Route" - } - ]; -} diff --git a/owl-bot-staging/google-cloud-datastream/v1/protos/google/cloud/datastream/v1/datastream_resources.proto b/owl-bot-staging/google-cloud-datastream/v1/protos/google/cloud/datastream/v1/datastream_resources.proto deleted file mode 100644 index 1007939dc8b..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/protos/google/cloud/datastream/v1/datastream_resources.proto +++ /dev/null @@ -1,1049 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.datastream.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Datastream.V1"; -option go_package = "cloud.google.com/go/datastream/apiv1/datastreampb;datastreampb"; -option java_multiple_files = true; -option java_outer_classname = "DatastreamResourcesProto"; -option java_package = "com.google.cloud.datastream.v1"; -option php_namespace = "Google\\Cloud\\Datastream\\V1"; -option ruby_package = "Google::Cloud::Datastream::V1"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Networks" - pattern: "projects/{project}/global/networks/{network}" -}; - -// Oracle database profile. -message OracleProfile { - // Required. Hostname for the Oracle connection. - string hostname = 1 [(google.api.field_behavior) = REQUIRED]; - - // Port for the Oracle connection, default value is 1521. - int32 port = 2; - - // Required. Username for the Oracle connection. - string username = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Password for the Oracle connection. - string password = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. Database for the Oracle connection. - string database_service = 5 [(google.api.field_behavior) = REQUIRED]; - - // Connection string attributes - map connection_attributes = 6; -} - -// MySQL database profile. -message MysqlProfile { - // Required. Hostname for the MySQL connection. - string hostname = 1 [(google.api.field_behavior) = REQUIRED]; - - // Port for the MySQL connection, default value is 3306. - int32 port = 2; - - // Required. Username for the MySQL connection. - string username = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Input only. Password for the MySQL connection. - string password = 4 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = INPUT_ONLY - ]; - - // SSL configuration for the MySQL connection. - MysqlSslConfig ssl_config = 5; -} - -// PostgreSQL database profile. -message PostgresqlProfile { - // Required. Hostname for the PostgreSQL connection. - string hostname = 1 [(google.api.field_behavior) = REQUIRED]; - - // Port for the PostgreSQL connection, default value is 5432. - int32 port = 2; - - // Required. Username for the PostgreSQL connection. - string username = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Password for the PostgreSQL connection. - string password = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. Database for the PostgreSQL connection. - string database = 5 [(google.api.field_behavior) = REQUIRED]; -} - -// Cloud Storage bucket profile. -message GcsProfile { - // Required. The Cloud Storage bucket name. - string bucket = 1 [(google.api.field_behavior) = REQUIRED]; - - // The root path inside the Cloud Storage bucket. - string root_path = 2; -} - -// BigQuery warehouse profile. -message BigQueryProfile {} - -// Static IP address connectivity. Used when the source database is configured -// to allow incoming connections from the Datastream public IP addresses -// for the region specified in the connection profile. -message StaticServiceIpConnectivity {} - -// Forward SSH Tunnel connectivity. -message ForwardSshTunnelConnectivity { - // Required. Hostname for the SSH tunnel. - string hostname = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Username for the SSH tunnel. - string username = 2 [(google.api.field_behavior) = REQUIRED]; - - // Port for the SSH tunnel, default value is 22. - int32 port = 3; - - oneof authentication_method { - // Input only. SSH password. - string password = 100 [(google.api.field_behavior) = INPUT_ONLY]; - - // Input only. SSH private key. - string private_key = 101 [(google.api.field_behavior) = INPUT_ONLY]; - } -} - -// The VPC Peering configuration is used to create VPC peering between -// Datastream and the consumer's VPC. -message VpcPeeringConfig { - // Required. Fully qualified name of the VPC that Datastream will peer to. - // Format: `projects/{project}/global/{networks}/{name}` - string vpc = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "compute.googleapis.com/Networks" - } - ]; - - // Required. A free subnet for peering. (CIDR of /29) - string subnet = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The PrivateConnection resource is used to establish private connectivity -// between Datastream and a customer's network. -message PrivateConnection { - option (google.api.resource) = { - type: "datastream.googleapis.com/PrivateConnection" - pattern: "projects/{project}/locations/{location}/privateConnections/{private_connection}" - }; - - // Private Connection state. - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // The private connection is in creation state - creating resources. - CREATING = 1; - - // The private connection has been created with all of its resources. - CREATED = 2; - - // The private connection creation has failed. - FAILED = 3; - - // The private connection is being deleted. - DELETING = 4; - - // Delete request has failed, resource is in invalid state. - FAILED_TO_DELETE = 5; - } - - // Output only. The resource's name. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The create time of the resource. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The update time of the resource. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels. - map labels = 4; - - // Required. Display name. - string display_name = 5 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The state of the Private Connection. - State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. In case of error, the details of the error in a user-friendly - // format. - Error error = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // VPC Peering Config. - VpcPeeringConfig vpc_peering_config = 100; -} - -// Private Connectivity -message PrivateConnectivity { - // Required. A reference to a private connection resource. - // Format: `projects/{project}/locations/{location}/privateConnections/{name}` - string private_connection = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/PrivateConnection" - } - ]; -} - -// The route resource is the child of the private connection resource, -// used for defining a route for a private connection. -message Route { - option (google.api.resource) = { - type: "datastream.googleapis.com/Route" - pattern: "projects/{project}/locations/{location}/privateConnections/{private_connection}/routes/{route}" - }; - - // Output only. The resource's name. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The create time of the resource. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The update time of the resource. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels. - map labels = 4; - - // Required. Display name. - string display_name = 5 [(google.api.field_behavior) = REQUIRED]; - - // Required. Destination address for connection - string destination_address = 6 [(google.api.field_behavior) = REQUIRED]; - - // Destination port for connection - int32 destination_port = 7; -} - -// MySQL SSL configuration information. -message MysqlSslConfig { - // Input only. PEM-encoded private key associated with the Client Certificate. - // If this field is used then the 'client_certificate' and the - // 'ca_certificate' fields are mandatory. - string client_key = 1 [(google.api.field_behavior) = INPUT_ONLY]; - - // Output only. Indicates whether the client_key field is set. - bool client_key_set = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Input only. PEM-encoded certificate that will be used by the replica to - // authenticate against the source database server. If this field is used - // then the 'client_key' and the 'ca_certificate' fields are mandatory. - string client_certificate = 3 [(google.api.field_behavior) = INPUT_ONLY]; - - // Output only. Indicates whether the client_certificate field is set. - bool client_certificate_set = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Input only. PEM-encoded certificate of the CA that signed the source - // database server's certificate. - string ca_certificate = 5 [(google.api.field_behavior) = INPUT_ONLY]; - - // Output only. Indicates whether the ca_certificate field is set. - bool ca_certificate_set = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A set of reusable connection configurations to be used as a source or -// destination for a stream. -message ConnectionProfile { - option (google.api.resource) = { - type: "datastream.googleapis.com/ConnectionProfile" - pattern: "projects/{project}/locations/{location}/connectionProfiles/{connection_profile}" - }; - - // Output only. The resource's name. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The create time of the resource. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The update time of the resource. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels. - map labels = 4; - - // Required. Display name. - string display_name = 5 [(google.api.field_behavior) = REQUIRED]; - - // Connection configuration for the ConnectionProfile. - oneof profile { - // Oracle ConnectionProfile configuration. - OracleProfile oracle_profile = 100; - - // Cloud Storage ConnectionProfile configuration. - GcsProfile gcs_profile = 101; - - // MySQL ConnectionProfile configuration. - MysqlProfile mysql_profile = 102; - - // BigQuery Connection Profile configuration. - BigQueryProfile bigquery_profile = 103; - - // PostgreSQL Connection Profile configuration. - PostgresqlProfile postgresql_profile = 104; - } - - // Connectivity options used to establish a connection to the profile. - oneof connectivity { - // Static Service IP connectivity. - StaticServiceIpConnectivity static_service_ip_connectivity = 200; - - // Forward SSH tunnel connectivity. - ForwardSshTunnelConnectivity forward_ssh_connectivity = 201; - - // Private connectivity. - PrivateConnectivity private_connectivity = 202; - } -} - -// Oracle Column. -message OracleColumn { - // Column name. - string column = 1; - - // The Oracle data type. - string data_type = 2; - - // Column length. - int32 length = 3; - - // Column precision. - int32 precision = 4; - - // Column scale. - int32 scale = 5; - - // Column encoding. - string encoding = 6; - - // Whether or not the column represents a primary key. - bool primary_key = 7; - - // Whether or not the column can accept a null value. - bool nullable = 8; - - // The ordinal position of the column in the table. - int32 ordinal_position = 9; -} - -// Oracle table. -message OracleTable { - // Table name. - string table = 1; - - // Oracle columns in the schema. - // When unspecified as part of include/exclude objects, includes/excludes - // everything. - repeated OracleColumn oracle_columns = 2; -} - -// Oracle schema. -message OracleSchema { - // Schema name. - string schema = 1; - - // Tables in the schema. - repeated OracleTable oracle_tables = 2; -} - -// Oracle database structure. -message OracleRdbms { - // Oracle schemas/databases in the database server. - repeated OracleSchema oracle_schemas = 1; -} - -// Oracle data source configuration -message OracleSourceConfig { - // Configuration to drop large object values. - message DropLargeObjects {} - - // Configuration to stream large object values. - message StreamLargeObjects {} - - // Oracle objects to include in the stream. - OracleRdbms include_objects = 1; - - // Oracle objects to exclude from the stream. - OracleRdbms exclude_objects = 2; - - // Maximum number of concurrent CDC tasks. The number should be non-negative. - // If not set (or set to 0), the system's default value is used. - int32 max_concurrent_cdc_tasks = 3; - - // Maximum number of concurrent backfill tasks. The number should be - // non-negative. If not set (or set to 0), the system's default value is used. - int32 max_concurrent_backfill_tasks = 4; - - // The configuration for handle Oracle large objects. - oneof large_objects_handling { - // Drop large object values. - DropLargeObjects drop_large_objects = 100; - - // Stream large object values. NOTE: This feature is currently experimental. - StreamLargeObjects stream_large_objects = 102; - } -} - -// PostgreSQL Column. -message PostgresqlColumn { - // Column name. - string column = 1; - - // The PostgreSQL data type. - string data_type = 2; - - // Column length. - int32 length = 3; - - // Column precision. - int32 precision = 4; - - // Column scale. - int32 scale = 5; - - // Whether or not the column represents a primary key. - bool primary_key = 7; - - // Whether or not the column can accept a null value. - bool nullable = 8; - - // The ordinal position of the column in the table. - int32 ordinal_position = 9; -} - -// PostgreSQL table. -message PostgresqlTable { - // Table name. - string table = 1; - - // PostgreSQL columns in the schema. - // When unspecified as part of include/exclude objects, - // includes/excludes everything. - repeated PostgresqlColumn postgresql_columns = 2; -} - -// PostgreSQL schema. -message PostgresqlSchema { - // Schema name. - string schema = 1; - - // Tables in the schema. - repeated PostgresqlTable postgresql_tables = 2; -} - -// PostgreSQL database structure. -message PostgresqlRdbms { - // PostgreSQL schemas in the database server. - repeated PostgresqlSchema postgresql_schemas = 1; -} - -// PostgreSQL data source configuration -message PostgresqlSourceConfig { - // PostgreSQL objects to include in the stream. - PostgresqlRdbms include_objects = 1; - - // PostgreSQL objects to exclude from the stream. - PostgresqlRdbms exclude_objects = 2; - - // Required. Immutable. The name of the logical replication slot that's - // configured with the pgoutput plugin. - string replication_slot = 3 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = IMMUTABLE - ]; - - // Required. The name of the publication that includes the set of all tables - // that are defined in the stream's include_objects. - string publication = 4 [(google.api.field_behavior) = REQUIRED]; - - // Maximum number of concurrent backfill tasks. The number should be non - // negative. If not set (or set to 0), the system's default value will be - // used. - int32 max_concurrent_backfill_tasks = 5; -} - -// MySQL Column. -message MysqlColumn { - // Column name. - string column = 1; - - // The MySQL data type. Full data types list can be found here: - // https://dev.mysql.com/doc/refman/8.0/en/data-types.html - string data_type = 2; - - // Column length. - int32 length = 3; - - // Column collation. - string collation = 4; - - // Whether or not the column represents a primary key. - bool primary_key = 5; - - // Whether or not the column can accept a null value. - bool nullable = 6; - - // The ordinal position of the column in the table. - int32 ordinal_position = 7; -} - -// MySQL table. -message MysqlTable { - // Table name. - string table = 1; - - // MySQL columns in the database. - // When unspecified as part of include/exclude objects, includes/excludes - // everything. - repeated MysqlColumn mysql_columns = 2; -} - -// MySQL database. -message MysqlDatabase { - // Database name. - string database = 1; - - // Tables in the database. - repeated MysqlTable mysql_tables = 2; -} - -// MySQL database structure -message MysqlRdbms { - // Mysql databases on the server - repeated MysqlDatabase mysql_databases = 1; -} - -// MySQL source configuration -message MysqlSourceConfig { - // MySQL objects to retrieve from the source. - MysqlRdbms include_objects = 1; - - // MySQL objects to exclude from the stream. - MysqlRdbms exclude_objects = 2; - - // Maximum number of concurrent CDC tasks. The number should be non negative. - // If not set (or set to 0), the system's default value will be used. - int32 max_concurrent_cdc_tasks = 3; - - // Maximum number of concurrent backfill tasks. The number should be non - // negative. If not set (or set to 0), the system's default value will be - // used. - int32 max_concurrent_backfill_tasks = 4; -} - -// The configuration of the stream source. -message SourceConfig { - // Required. Source connection profile resoource. - // Format: `projects/{project}/locations/{location}/connectionProfiles/{name}` - string source_connection_profile = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/ConnectionProfile" - } - ]; - - // Stream configuration that is specific to the data source type. - oneof source_stream_config { - // Oracle data source configuration. - OracleSourceConfig oracle_source_config = 100; - - // MySQL data source configuration. - MysqlSourceConfig mysql_source_config = 101; - - // PostgreSQL data source configuration. - PostgresqlSourceConfig postgresql_source_config = 102; - } -} - -// AVRO file format configuration. -message AvroFileFormat {} - -// JSON file format configuration. -message JsonFileFormat { - // Schema file format. - enum SchemaFileFormat { - // Unspecified schema file format. - SCHEMA_FILE_FORMAT_UNSPECIFIED = 0; - - // Do not attach schema file. - NO_SCHEMA_FILE = 1; - - // Avro schema format. - AVRO_SCHEMA_FILE = 2; - } - - // Json file compression. - enum JsonCompression { - // Unspecified json file compression. - JSON_COMPRESSION_UNSPECIFIED = 0; - - // Do not compress JSON file. - NO_COMPRESSION = 1; - - // Gzip compression. - GZIP = 2; - } - - // The schema file format along JSON data files. - SchemaFileFormat schema_file_format = 1; - - // Compression of the loaded JSON file. - JsonCompression compression = 2; -} - -// Google Cloud Storage destination configuration -message GcsDestinationConfig { - // Path inside the Cloud Storage bucket to write data to. - string path = 1; - - // The maximum file size to be saved in the bucket. - int32 file_rotation_mb = 2; - - // The maximum duration for which new events are added before a file is - // closed and a new file is created. Values within the range of 15-60 seconds - // are allowed. - google.protobuf.Duration file_rotation_interval = 3; - - // File Format that the data should be written in. - oneof file_format { - // AVRO file format configuration. - AvroFileFormat avro_file_format = 100; - - // JSON file format configuration. - JsonFileFormat json_file_format = 101; - } -} - -// BigQuery destination configuration -message BigQueryDestinationConfig { - // A single target dataset to which all data will be streamed. - message SingleTargetDataset { - // The dataset ID of the target dataset. - string dataset_id = 1; - } - - // Destination datasets are created so that hierarchy of the destination data - // objects matches the source hierarchy. - message SourceHierarchyDatasets { - // Dataset template used for dynamic dataset creation. - message DatasetTemplate { - // Required. The geographic location where the dataset should reside. See - // https://cloud.google.com/bigquery/docs/locations for supported - // locations. - string location = 1 [(google.api.field_behavior) = REQUIRED]; - - // If supplied, every created dataset will have its name prefixed by the - // provided value. The prefix and name will be separated by an underscore. - // i.e. _. - string dataset_id_prefix = 2; - - // Describes the Cloud KMS encryption key that will be used to - // protect destination BigQuery table. The BigQuery Service Account - // associated with your project requires access to this encryption key. - // i.e. - // projects/{project}/locations/{location}/keyRings/{key_ring}/cryptoKeys/{cryptoKey}. - // See https://cloud.google.com/bigquery/docs/customer-managed-encryption - // for more information. - string kms_key_name = 3; - } - - // The dataset template to use for dynamic dataset creation. - DatasetTemplate dataset_template = 2; - } - - // Target dataset(s) configuration. - oneof dataset_config { - // Single destination dataset. - SingleTargetDataset single_target_dataset = 201; - - // Source hierarchy datasets. - SourceHierarchyDatasets source_hierarchy_datasets = 202; - } - - // The guaranteed data freshness (in seconds) when querying tables created by - // the stream. Editing this field will only affect new tables created in the - // future, but existing tables will not be impacted. Lower values mean that - // queries will return fresher data, but may result in higher cost. - google.protobuf.Duration data_freshness = 300; -} - -// The configuration of the stream destination. -message DestinationConfig { - // Required. Destination connection profile resource. - // Format: `projects/{project}/locations/{location}/connectionProfiles/{name}` - string destination_connection_profile = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/ConnectionProfile" - } - ]; - - // Stream configuration that is specific to the data destination type. - oneof destination_stream_config { - // A configuration for how data should be loaded to Cloud Storage. - GcsDestinationConfig gcs_destination_config = 100; - - // BigQuery destination configuration. - BigQueryDestinationConfig bigquery_destination_config = 101; - } -} - -// A resource representing streaming data from a source to a destination. -message Stream { - option (google.api.resource) = { - type: "datastream.googleapis.com/Stream" - pattern: "projects/{project}/locations/{location}/streams/{stream}" - }; - - // Stream state. - enum State { - // Unspecified stream state. - STATE_UNSPECIFIED = 0; - - // The stream has been created but has not yet started streaming data. - NOT_STARTED = 1; - - // The stream is running. - RUNNING = 2; - - // The stream is paused. - PAUSED = 3; - - // The stream is in maintenance mode. - // - // Updates are rejected on the resource in this state. - MAINTENANCE = 4; - - // The stream is experiencing an error that is preventing data from being - // streamed. - FAILED = 5; - - // The stream has experienced a terminal failure. - FAILED_PERMANENTLY = 6; - - // The stream is starting, but not yet running. - STARTING = 7; - - // The Stream is no longer reading new events, but still writing events in - // the buffer. - DRAINING = 8; - } - - // Backfill strategy to automatically backfill the Stream's objects. - // Specific objects can be excluded. - message BackfillAllStrategy { - // List of objects to exclude. - oneof excluded_objects { - // Oracle data source objects to avoid backfilling. - OracleRdbms oracle_excluded_objects = 1; - - // MySQL data source objects to avoid backfilling. - MysqlRdbms mysql_excluded_objects = 2; - - // PostgreSQL data source objects to avoid backfilling. - PostgresqlRdbms postgresql_excluded_objects = 3; - } - } - - // Backfill strategy to disable automatic backfill for the Stream's objects. - message BackfillNoneStrategy {} - - // Output only. The stream's name. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The creation time of the stream. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update time of the stream. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels. - map labels = 4; - - // Required. Display name. - string display_name = 5 [(google.api.field_behavior) = REQUIRED]; - - // Required. Source connection profile configuration. - SourceConfig source_config = 6 [(google.api.field_behavior) = REQUIRED]; - - // Required. Destination connection profile configuration. - DestinationConfig destination_config = 7 - [(google.api.field_behavior) = REQUIRED]; - - // The state of the stream. - State state = 8; - - // Stream backfill strategy. - oneof backfill_strategy { - // Automatically backfill objects included in the stream source - // configuration. Specific objects can be excluded. - BackfillAllStrategy backfill_all = 101; - - // Do not automatically backfill any objects. - BackfillNoneStrategy backfill_none = 102; - } - - // Output only. Errors on the Stream. - repeated Error errors = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Immutable. A reference to a KMS encryption key. - // If provided, it will be used to encrypt the data. - // If left blank, data will be encrypted using an internal Stream-specific - // encryption key provisioned through KMS. - optional string customer_managed_encryption_key = 10 - [(google.api.field_behavior) = IMMUTABLE]; -} - -// A specific stream object (e.g a specific DB table). -message StreamObject { - option (google.api.resource) = { - type: "datastream.googleapis.com/StreamObject" - pattern: "projects/{project}/locations/{location}/streams/{stream}/objects/{object}" - }; - - // Output only. The object resource's name. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The creation time of the object. - google.protobuf.Timestamp create_time = 2 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update time of the object. - google.protobuf.Timestamp update_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Display name. - string display_name = 5 [(google.api.field_behavior) = REQUIRED]; - - // Output only. Active errors on the object. - repeated Error errors = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The latest backfill job that was initiated for the stream object. - BackfillJob backfill_job = 7; - - // The object identifier in the data source. - SourceObjectIdentifier source_object = 8; -} - -// Represents an identifier of an object in the data source. -message SourceObjectIdentifier { - // Oracle data source object identifier. - message OracleObjectIdentifier { - // Required. The schema name. - string schema = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The table name. - string table = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // PostgreSQL data source object identifier. - message PostgresqlObjectIdentifier { - // Required. The schema name. - string schema = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The table name. - string table = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // Mysql data source object identifier. - message MysqlObjectIdentifier { - // Required. The database name. - string database = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The table name. - string table = 2 [(google.api.field_behavior) = REQUIRED]; - } - - // The identifier for an object in the data source. - oneof source_identifier { - // Oracle data source object identifier. - OracleObjectIdentifier oracle_identifier = 1; - - // Mysql data source object identifier. - MysqlObjectIdentifier mysql_identifier = 2; - - // PostgreSQL data source object identifier. - PostgresqlObjectIdentifier postgresql_identifier = 3; - } -} - -// Represents a backfill job on a specific stream object. -message BackfillJob { - // State of the stream object's backfill job. - enum State { - // Default value. - STATE_UNSPECIFIED = 0; - - // Backfill job was never started for the stream object (stream has backfill - // strategy defined as manual or object was explicitly excluded from - // automatic backfill). - NOT_STARTED = 1; - - // Backfill job will start pending available resources. - PENDING = 2; - - // Backfill job is running. - ACTIVE = 3; - - // Backfill job stopped (next job run will start from beginning). - STOPPED = 4; - - // Backfill job failed (due to an error). - FAILED = 5; - - // Backfill completed successfully. - COMPLETED = 6; - - // Backfill job failed since the table structure is currently unsupported - // for backfill. - UNSUPPORTED = 7; - } - - // Triggering reason for a backfill job. - enum Trigger { - // Default value. - TRIGGER_UNSPECIFIED = 0; - - // Object backfill job was triggered automatically according to the stream's - // backfill strategy. - AUTOMATIC = 1; - - // Object backfill job was triggered manually using the dedicated API. - MANUAL = 2; - } - - // Backfill job state. - State state = 1; - - // Backfill job's triggering reason. - Trigger trigger = 2; - - // Output only. Backfill job's start time. - google.protobuf.Timestamp last_start_time = 3 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Backfill job's end time. - google.protobuf.Timestamp last_end_time = 4 - [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Errors which caused the backfill job to fail. - repeated Error errors = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represent a user-facing Error. -message Error { - // A title that explains the reason for the error. - string reason = 1; - - // A unique identifier for this specific error, - // allowing it to be traced throughout the system in logs and API responses. - string error_uuid = 2; - - // A message containing more information about the error that occurred. - string message = 3; - - // The time when the error occurred. - google.protobuf.Timestamp error_time = 4; - - // Additional information about the error. - map details = 5; -} - -// Contains the current validation results. -message ValidationResult { - // A list of validations (includes both executed as well as not executed - // validations). - repeated Validation validations = 1; -} - -// A validation to perform on a stream. -message Validation { - // Validation execution state. - enum State { - // Unspecified state. - STATE_UNSPECIFIED = 0; - - // Validation did not execute. - NOT_EXECUTED = 1; - - // Validation failed. - FAILED = 2; - - // Validation passed. - PASSED = 3; - } - - // A short description of the validation. - string description = 1; - - // Validation execution status. - State state = 2; - - // Messages reflecting the validation results. - repeated ValidationMessage message = 3; - - // A custom code identifying this validation. - string code = 4; -} - -// Represent user-facing validation result message. -message ValidationMessage { - // Validation message level. - enum Level { - // Unspecified level. - LEVEL_UNSPECIFIED = 0; - - // Potentially cause issues with the Stream. - WARNING = 1; - - // Definitely cause issues with the Stream. - ERROR = 2; - } - - // The result of the validation. - string message = 1; - - // Message severity level (warning or error). - Level level = 2; - - // Additional metadata related to the result. - map metadata = 3; - - // A custom code identifying this specific message. - string code = 4; -} diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_connection_profile.js deleted file mode 100644 index 34ad81ed63b..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_connection_profile.js +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, connectionProfileId, connectionProfile) { - // [START datastream_v1_generated_Datastream_CreateConnectionProfile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent that owns the collection of ConnectionProfiles. - */ - // const parent = 'abc123' - /** - * Required. The connection profile identifier. - */ - // const connectionProfileId = 'abc123' - /** - * Required. The connection profile resource to create. - */ - // const connectionProfile = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - /** - * Optional. Only validate the connection profile, but don't create any - * resources. The default is false. - */ - // const validateOnly = true - /** - * Optional. Create the connection profile without validating it. - */ - // const force = true - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callCreateConnectionProfile() { - // Construct request - const request = { - parent, - connectionProfileId, - connectionProfile, - }; - - // Run request - const [operation] = await datastreamClient.createConnectionProfile(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateConnectionProfile(); - // [END datastream_v1_generated_Datastream_CreateConnectionProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_private_connection.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_private_connection.js deleted file mode 100644 index 15cbea3137f..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_private_connection.js +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, privateConnectionId, privateConnection) { - // [START datastream_v1_generated_Datastream_CreatePrivateConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent that owns the collection of PrivateConnections. - */ - // const parent = 'abc123' - /** - * Required. The private connectivity identifier. - */ - // const privateConnectionId = 'abc123' - /** - * Required. The Private Connectivity resource to create. - */ - // const privateConnection = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - /** - * Optional. If set to true, will skip validations. - */ - // const force = true - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callCreatePrivateConnection() { - // Construct request - const request = { - parent, - privateConnectionId, - privateConnection, - }; - - // Run request - const [operation] = await datastreamClient.createPrivateConnection(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreatePrivateConnection(); - // [END datastream_v1_generated_Datastream_CreatePrivateConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_route.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_route.js deleted file mode 100644 index cd04e6cd822..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_route.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, routeId, route) { - // [START datastream_v1_generated_Datastream_CreateRoute_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent that owns the collection of Routes. - */ - // const parent = 'abc123' - /** - * Required. The Route identifier. - */ - // const routeId = 'abc123' - /** - * Required. The Route resource to create. - */ - // const route = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callCreateRoute() { - // Construct request - const request = { - parent, - routeId, - route, - }; - - // Run request - const [operation] = await datastreamClient.createRoute(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateRoute(); - // [END datastream_v1_generated_Datastream_CreateRoute_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_stream.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_stream.js deleted file mode 100644 index db7c0107ffc..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.create_stream.js +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, streamId, stream) { - // [START datastream_v1_generated_Datastream_CreateStream_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent that owns the collection of streams. - */ - // const parent = 'abc123' - /** - * Required. The stream identifier. - */ - // const streamId = 'abc123' - /** - * Required. The stream resource to create. - */ - // const stream = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - /** - * Optional. Only validate the stream, but don't create any resources. - * The default is false. - */ - // const validateOnly = true - /** - * Optional. Create the stream without validating it. - */ - // const force = true - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callCreateStream() { - // Construct request - const request = { - parent, - streamId, - stream, - }; - - // Run request - const [operation] = await datastreamClient.createStream(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateStream(); - // [END datastream_v1_generated_Datastream_CreateStream_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_connection_profile.js deleted file mode 100644 index 0b5811358e1..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_connection_profile.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1_generated_Datastream_DeleteConnectionProfile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the connection profile resource to delete. - */ - // const name = 'abc123' - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callDeleteConnectionProfile() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await datastreamClient.deleteConnectionProfile(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteConnectionProfile(); - // [END datastream_v1_generated_Datastream_DeleteConnectionProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_private_connection.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_private_connection.js deleted file mode 100644 index 5ca12d1ac7f..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_private_connection.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1_generated_Datastream_DeletePrivateConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the private connectivity configuration to delete. - */ - // const name = 'abc123' - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - /** - * Optional. If set to true, any child routes that belong to this - * PrivateConnection will also be deleted. - */ - // const force = true - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callDeletePrivateConnection() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await datastreamClient.deletePrivateConnection(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeletePrivateConnection(); - // [END datastream_v1_generated_Datastream_DeletePrivateConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_route.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_route.js deleted file mode 100644 index 803e9f600ad..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_route.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1_generated_Datastream_DeleteRoute_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Route resource to delete. - */ - // const name = 'abc123' - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callDeleteRoute() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await datastreamClient.deleteRoute(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteRoute(); - // [END datastream_v1_generated_Datastream_DeleteRoute_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_stream.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_stream.js deleted file mode 100644 index 4febc027f8c..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.delete_stream.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1_generated_Datastream_DeleteStream_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the stream resource to delete. - */ - // const name = 'abc123' - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callDeleteStream() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await datastreamClient.deleteStream(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteStream(); - // [END datastream_v1_generated_Datastream_DeleteStream_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.discover_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.discover_connection_profile.js deleted file mode 100644 index 3627ae02f73..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.discover_connection_profile.js +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START datastream_v1_generated_Datastream_DiscoverConnectionProfile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource of the connection profile type. Must be in - * the format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * An ad-hoc connection profile configuration. - */ - // const connectionProfile = {} - /** - * A reference to an existing connection profile. - */ - // const connectionProfileName = 'abc123' - /** - * Whether to retrieve the full hierarchy of data objects (TRUE) or only the - * current level (FALSE). - */ - // const fullHierarchy = true - /** - * The number of hierarchy levels below the current level to be retrieved. - */ - // const hierarchyDepth = 1234 - /** - * Oracle RDBMS to enrich with child data objects and metadata. - */ - // const oracleRdbms = {} - /** - * MySQL RDBMS to enrich with child data objects and metadata. - */ - // const mysqlRdbms = {} - /** - * PostgreSQL RDBMS to enrich with child data objects and metadata. - */ - // const postgresqlRdbms = {} - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callDiscoverConnectionProfile() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await datastreamClient.discoverConnectionProfile(request); - console.log(response); - } - - callDiscoverConnectionProfile(); - // [END datastream_v1_generated_Datastream_DiscoverConnectionProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.fetch_static_ips.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.fetch_static_ips.js deleted file mode 100644 index fb209ac613b..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.fetch_static_ips.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1_generated_Datastream_FetchStaticIps_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name for the location for which static IPs should be - * returned. Must be in the format `projects/* /locations/*`. - */ - // const name = 'abc123' - /** - * Maximum number of Ips to return, will likely not be specified. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListStaticIps` call. - * will likely not be specified. - */ - // const pageToken = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callFetchStaticIps() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = await datastreamClient.fetchStaticIpsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callFetchStaticIps(); - // [END datastream_v1_generated_Datastream_FetchStaticIps_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_connection_profile.js deleted file mode 100644 index c6ad977d673..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_connection_profile.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1_generated_Datastream_GetConnectionProfile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the connection profile resource to get. - */ - // const name = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callGetConnectionProfile() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await datastreamClient.getConnectionProfile(request); - console.log(response); - } - - callGetConnectionProfile(); - // [END datastream_v1_generated_Datastream_GetConnectionProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_private_connection.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_private_connection.js deleted file mode 100644 index b1a85f7f53c..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_private_connection.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1_generated_Datastream_GetPrivateConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the private connectivity configuration to get. - */ - // const name = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callGetPrivateConnection() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await datastreamClient.getPrivateConnection(request); - console.log(response); - } - - callGetPrivateConnection(); - // [END datastream_v1_generated_Datastream_GetPrivateConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_route.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_route.js deleted file mode 100644 index f9782c6f3b8..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_route.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1_generated_Datastream_GetRoute_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Route resource to get. - */ - // const name = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callGetRoute() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await datastreamClient.getRoute(request); - console.log(response); - } - - callGetRoute(); - // [END datastream_v1_generated_Datastream_GetRoute_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_stream.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_stream.js deleted file mode 100644 index 43f5bf98513..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_stream.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1_generated_Datastream_GetStream_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the stream resource to get. - */ - // const name = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callGetStream() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await datastreamClient.getStream(request); - console.log(response); - } - - callGetStream(); - // [END datastream_v1_generated_Datastream_GetStream_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_stream_object.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_stream_object.js deleted file mode 100644 index 532cd55313f..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.get_stream_object.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1_generated_Datastream_GetStreamObject_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the stream object resource to get. - */ - // const name = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callGetStreamObject() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await datastreamClient.getStreamObject(request); - console.log(response); - } - - callGetStreamObject(); - // [END datastream_v1_generated_Datastream_GetStreamObject_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_connection_profiles.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_connection_profiles.js deleted file mode 100644 index 7d5a0f9f037..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_connection_profiles.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START datastream_v1_generated_Datastream_ListConnectionProfiles_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent that owns the collection of connection profiles. - */ - // const parent = 'abc123' - /** - * Maximum number of connection profiles to return. - * If unspecified, at most 50 connection profiles will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * Page token received from a previous `ListConnectionProfiles` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListConnectionProfiles` - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Filter request. - */ - // const filter = 'abc123' - /** - * Order by fields for the result. - */ - // const orderBy = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callListConnectionProfiles() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await datastreamClient.listConnectionProfilesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListConnectionProfiles(); - // [END datastream_v1_generated_Datastream_ListConnectionProfiles_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_private_connections.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_private_connections.js deleted file mode 100644 index 417b8d77b75..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_private_connections.js +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START datastream_v1_generated_Datastream_ListPrivateConnections_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent that owns the collection of private connectivity - * configurations. - */ - // const parent = 'abc123' - /** - * Maximum number of private connectivity configurations to return. - * If unspecified, at most 50 private connectivity configurations that will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - */ - // const pageSize = 1234 - /** - * Page token received from a previous `ListPrivateConnections` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * `ListPrivateConnections` must match the call that provided the page - * token. - */ - // const pageToken = 'abc123' - /** - * Filter request. - */ - // const filter = 'abc123' - /** - * Order by fields for the result. - */ - // const orderBy = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callListPrivateConnections() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await datastreamClient.listPrivateConnectionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListPrivateConnections(); - // [END datastream_v1_generated_Datastream_ListPrivateConnections_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_routes.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_routes.js deleted file mode 100644 index 8919ccee0b9..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_routes.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START datastream_v1_generated_Datastream_ListRoutes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent that owns the collection of Routess. - */ - // const parent = 'abc123' - /** - * Maximum number of Routes to return. The service may return - * fewer than this value. If unspecified, at most 50 Routes - * will be returned. The maximum value is 1000; values above 1000 will be - * coerced to 1000. - */ - // const pageSize = 1234 - /** - * Page token received from a previous `ListRoutes` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * `ListRoutes` must match the call that provided the page - * token. - */ - // const pageToken = 'abc123' - /** - * Filter request. - */ - // const filter = 'abc123' - /** - * Order by fields for the result. - */ - // const orderBy = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callListRoutes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await datastreamClient.listRoutesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListRoutes(); - // [END datastream_v1_generated_Datastream_ListRoutes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_stream_objects.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_stream_objects.js deleted file mode 100644 index c235a73bb99..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_stream_objects.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START datastream_v1_generated_Datastream_ListStreamObjects_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent stream that owns the collection of objects. - */ - // const parent = 'abc123' - /** - * Maximum number of objects to return. Default is 50. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * Page token received from a previous `ListStreamObjectsRequest` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * `ListStreamObjectsRequest` must match the call that provided the page - * token. - */ - // const pageToken = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callListStreamObjects() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await datastreamClient.listStreamObjectsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListStreamObjects(); - // [END datastream_v1_generated_Datastream_ListStreamObjects_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_streams.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_streams.js deleted file mode 100644 index 1e0316308b3..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.list_streams.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START datastream_v1_generated_Datastream_ListStreams_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent that owns the collection of streams. - */ - // const parent = 'abc123' - /** - * Maximum number of streams to return. - * If unspecified, at most 50 streams will be returned. The maximum - * value is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * Page token received from a previous `ListStreams` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListStreams` - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Filter request. - */ - // const filter = 'abc123' - /** - * Order by fields for the result. - */ - // const orderBy = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callListStreams() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await datastreamClient.listStreamsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListStreams(); - // [END datastream_v1_generated_Datastream_ListStreams_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.lookup_stream_object.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.lookup_stream_object.js deleted file mode 100644 index e526dd600d5..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.lookup_stream_object.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, sourceObjectIdentifier) { - // [START datastream_v1_generated_Datastream_LookupStreamObject_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent stream that owns the collection of objects. - */ - // const parent = 'abc123' - /** - * Required. The source object identifier which maps to the stream object. - */ - // const sourceObjectIdentifier = {} - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callLookupStreamObject() { - // Construct request - const request = { - parent, - sourceObjectIdentifier, - }; - - // Run request - const response = await datastreamClient.lookupStreamObject(request); - console.log(response); - } - - callLookupStreamObject(); - // [END datastream_v1_generated_Datastream_LookupStreamObject_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.start_backfill_job.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.start_backfill_job.js deleted file mode 100644 index 8143825d24d..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.start_backfill_job.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(object) { - // [START datastream_v1_generated_Datastream_StartBackfillJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the stream object resource to start a backfill job - * for. - */ - // const object = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callStartBackfillJob() { - // Construct request - const request = { - object, - }; - - // Run request - const response = await datastreamClient.startBackfillJob(request); - console.log(response); - } - - callStartBackfillJob(); - // [END datastream_v1_generated_Datastream_StartBackfillJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.stop_backfill_job.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.stop_backfill_job.js deleted file mode 100644 index d5d41bf6f0c..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.stop_backfill_job.js +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(object) { - // [START datastream_v1_generated_Datastream_StopBackfillJob_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the stream object resource to stop the backfill job - * for. - */ - // const object = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callStopBackfillJob() { - // Construct request - const request = { - object, - }; - - // Run request - const response = await datastreamClient.stopBackfillJob(request); - console.log(response); - } - - callStopBackfillJob(); - // [END datastream_v1_generated_Datastream_StopBackfillJob_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.update_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.update_connection_profile.js deleted file mode 100644 index 1c82f487811..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.update_connection_profile.js +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(connectionProfile) { - // [START datastream_v1_generated_Datastream_UpdateConnectionProfile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. Field mask is used to specify the fields to be overwritten in the - * ConnectionProfile resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - */ - // const updateMask = {} - /** - * Required. The connection profile to update. - */ - // const connectionProfile = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - /** - * Optional. Only validate the connection profile, but don't update any - * resources. The default is false. - */ - // const validateOnly = true - /** - * Optional. Update the connection profile without validating it. - */ - // const force = true - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callUpdateConnectionProfile() { - // Construct request - const request = { - connectionProfile, - }; - - // Run request - const [operation] = await datastreamClient.updateConnectionProfile(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateConnectionProfile(); - // [END datastream_v1_generated_Datastream_UpdateConnectionProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.update_stream.js b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.update_stream.js deleted file mode 100644 index dd42264aa24..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/datastream.update_stream.js +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(stream) { - // [START datastream_v1_generated_Datastream_UpdateStream_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. Field mask is used to specify the fields to be overwritten in the - * stream resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - */ - // const updateMask = {} - /** - * Required. The stream resource to update. - */ - // const stream = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - /** - * Optional. Only validate the stream with the changes, without actually - * updating it. The default is false. - */ - // const validateOnly = true - /** - * Optional. Update the stream without validating it. - */ - // const force = true - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callUpdateStream() { - // Construct request - const request = { - stream, - }; - - // Run request - const [operation] = await datastreamClient.updateStream(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateStream(); - // [END datastream_v1_generated_Datastream_UpdateStream_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/snippet_metadata.google.cloud.datastream.v1.json b/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/snippet_metadata.google.cloud.datastream.v1.json deleted file mode 100644 index 99df4be42e2..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/samples/generated/v1/snippet_metadata.google.cloud.datastream.v1.json +++ /dev/null @@ -1,1247 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-datastream", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.datastream.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "datastream_v1_generated_Datastream_ListConnectionProfiles_async", - "title": "Datastream listConnectionProfiles Sample", - "origin": "API_DEFINITION", - "description": " Use this method to list connection profiles created in a project and location.", - "canonical": true, - "file": "datastream.list_connection_profiles.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListConnectionProfiles", - "fullName": "google.cloud.datastream.v1.Datastream.ListConnectionProfiles", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1.ListConnectionProfilesResponse", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "ListConnectionProfiles", - "fullName": "google.cloud.datastream.v1.Datastream.ListConnectionProfiles", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_GetConnectionProfile_async", - "title": "Datastream getConnectionProfile Sample", - "origin": "API_DEFINITION", - "description": " Use this method to get details about a connection profile.", - "canonical": true, - "file": "datastream.get_connection_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetConnectionProfile", - "fullName": "google.cloud.datastream.v1.Datastream.GetConnectionProfile", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1.ConnectionProfile", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "GetConnectionProfile", - "fullName": "google.cloud.datastream.v1.Datastream.GetConnectionProfile", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_CreateConnectionProfile_async", - "title": "Datastream createConnectionProfile Sample", - "origin": "API_DEFINITION", - "description": " Use this method to create a connection profile in a project and location.", - "canonical": true, - "file": "datastream.create_connection_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateConnectionProfile", - "fullName": "google.cloud.datastream.v1.Datastream.CreateConnectionProfile", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "connection_profile_id", - "type": "TYPE_STRING" - }, - { - "name": "connection_profile", - "type": ".google.cloud.datastream.v1.ConnectionProfile" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "CreateConnectionProfile", - "fullName": "google.cloud.datastream.v1.Datastream.CreateConnectionProfile", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_UpdateConnectionProfile_async", - "title": "Datastream updateConnectionProfile Sample", - "origin": "API_DEFINITION", - "description": " Use this method to update the parameters of a connection profile.", - "canonical": true, - "file": "datastream.update_connection_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateConnectionProfile", - "fullName": "google.cloud.datastream.v1.Datastream.UpdateConnectionProfile", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "connection_profile", - "type": ".google.cloud.datastream.v1.ConnectionProfile" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "UpdateConnectionProfile", - "fullName": "google.cloud.datastream.v1.Datastream.UpdateConnectionProfile", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_DeleteConnectionProfile_async", - "title": "Datastream deleteConnectionProfile Sample", - "origin": "API_DEFINITION", - "description": " Use this method to delete a connection profile.", - "canonical": true, - "file": "datastream.delete_connection_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteConnectionProfile", - "fullName": "google.cloud.datastream.v1.Datastream.DeleteConnectionProfile", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "DeleteConnectionProfile", - "fullName": "google.cloud.datastream.v1.Datastream.DeleteConnectionProfile", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_DiscoverConnectionProfile_async", - "title": "Datastream discoverConnectionProfile Sample", - "origin": "API_DEFINITION", - "description": " Use this method to discover a connection profile. The discover API call exposes the data objects and metadata belonging to the profile. Typically, a request returns children data objects of a parent data object that's optionally supplied in the request.", - "canonical": true, - "file": "datastream.discover_connection_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 83, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DiscoverConnectionProfile", - "fullName": "google.cloud.datastream.v1.Datastream.DiscoverConnectionProfile", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "connection_profile", - "type": ".google.cloud.datastream.v1.ConnectionProfile" - }, - { - "name": "connection_profile_name", - "type": "TYPE_STRING" - }, - { - "name": "full_hierarchy", - "type": "TYPE_BOOL" - }, - { - "name": "hierarchy_depth", - "type": "TYPE_INT32" - }, - { - "name": "oracle_rdbms", - "type": ".google.cloud.datastream.v1.OracleRdbms" - }, - { - "name": "mysql_rdbms", - "type": ".google.cloud.datastream.v1.MysqlRdbms" - }, - { - "name": "postgresql_rdbms", - "type": ".google.cloud.datastream.v1.PostgresqlRdbms" - } - ], - "resultType": ".google.cloud.datastream.v1.DiscoverConnectionProfileResponse", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "DiscoverConnectionProfile", - "fullName": "google.cloud.datastream.v1.Datastream.DiscoverConnectionProfile", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_ListStreams_async", - "title": "Datastream listStreams Sample", - "origin": "API_DEFINITION", - "description": " Use this method to list streams in a project and location.", - "canonical": true, - "file": "datastream.list_streams.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListStreams", - "fullName": "google.cloud.datastream.v1.Datastream.ListStreams", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1.ListStreamsResponse", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "ListStreams", - "fullName": "google.cloud.datastream.v1.Datastream.ListStreams", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_GetStream_async", - "title": "Datastream getStream Sample", - "origin": "API_DEFINITION", - "description": " Use this method to get details about a stream.", - "canonical": true, - "file": "datastream.get_stream.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetStream", - "fullName": "google.cloud.datastream.v1.Datastream.GetStream", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1.Stream", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "GetStream", - "fullName": "google.cloud.datastream.v1.Datastream.GetStream", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_CreateStream_async", - "title": "Datastream createStream Sample", - "origin": "API_DEFINITION", - "description": " Use this method to create a stream.", - "canonical": true, - "file": "datastream.create_stream.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateStream", - "fullName": "google.cloud.datastream.v1.Datastream.CreateStream", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "stream_id", - "type": "TYPE_STRING" - }, - { - "name": "stream", - "type": ".google.cloud.datastream.v1.Stream" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "CreateStream", - "fullName": "google.cloud.datastream.v1.Datastream.CreateStream", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_UpdateStream_async", - "title": "Datastream updateStream Sample", - "origin": "API_DEFINITION", - "description": " Use this method to update the configuration of a stream.", - "canonical": true, - "file": "datastream.update_stream.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateStream", - "fullName": "google.cloud.datastream.v1.Datastream.UpdateStream", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "stream", - "type": ".google.cloud.datastream.v1.Stream" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "UpdateStream", - "fullName": "google.cloud.datastream.v1.Datastream.UpdateStream", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_DeleteStream_async", - "title": "Datastream deleteStream Sample", - "origin": "API_DEFINITION", - "description": " Use this method to delete a stream.", - "canonical": true, - "file": "datastream.delete_stream.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteStream", - "fullName": "google.cloud.datastream.v1.Datastream.DeleteStream", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "DeleteStream", - "fullName": "google.cloud.datastream.v1.Datastream.DeleteStream", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_GetStreamObject_async", - "title": "Datastream getStreamObject Sample", - "origin": "API_DEFINITION", - "description": " Use this method to get details about a stream object.", - "canonical": true, - "file": "datastream.get_stream_object.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetStreamObject", - "fullName": "google.cloud.datastream.v1.Datastream.GetStreamObject", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1.StreamObject", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "GetStreamObject", - "fullName": "google.cloud.datastream.v1.Datastream.GetStreamObject", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_LookupStreamObject_async", - "title": "Datastream lookupStreamObject Sample", - "origin": "API_DEFINITION", - "description": " Use this method to look up a stream object by its source object identifier.", - "canonical": true, - "file": "datastream.lookup_stream_object.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 58, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "LookupStreamObject", - "fullName": "google.cloud.datastream.v1.Datastream.LookupStreamObject", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "source_object_identifier", - "type": ".google.cloud.datastream.v1.SourceObjectIdentifier" - } - ], - "resultType": ".google.cloud.datastream.v1.StreamObject", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "LookupStreamObject", - "fullName": "google.cloud.datastream.v1.Datastream.LookupStreamObject", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_ListStreamObjects_async", - "title": "Datastream listStreamObjects Sample", - "origin": "API_DEFINITION", - "description": " Use this method to list the objects of a specific stream.", - "canonical": true, - "file": "datastream.list_stream_objects.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListStreamObjects", - "fullName": "google.cloud.datastream.v1.Datastream.ListStreamObjects", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1.ListStreamObjectsResponse", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "ListStreamObjects", - "fullName": "google.cloud.datastream.v1.Datastream.ListStreamObjects", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_StartBackfillJob_async", - "title": "Datastream startBackfillJob Sample", - "origin": "API_DEFINITION", - "description": " Use this method to start a backfill job for the specified stream object.", - "canonical": true, - "file": "datastream.start_backfill_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StartBackfillJob", - "fullName": "google.cloud.datastream.v1.Datastream.StartBackfillJob", - "async": true, - "parameters": [ - { - "name": "object", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1.StartBackfillJobResponse", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "StartBackfillJob", - "fullName": "google.cloud.datastream.v1.Datastream.StartBackfillJob", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_StopBackfillJob_async", - "title": "Datastream stopBackfillJob Sample", - "origin": "API_DEFINITION", - "description": " Use this method to stop a backfill job for the specified stream object.", - "canonical": true, - "file": "datastream.stop_backfill_job.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 54, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "StopBackfillJob", - "fullName": "google.cloud.datastream.v1.Datastream.StopBackfillJob", - "async": true, - "parameters": [ - { - "name": "object", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1.StopBackfillJobResponse", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "StopBackfillJob", - "fullName": "google.cloud.datastream.v1.Datastream.StopBackfillJob", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_FetchStaticIps_async", - "title": "Datastream fetchStaticIps Sample", - "origin": "API_DEFINITION", - "description": " The FetchStaticIps API call exposes the static IP addresses used by Datastream.", - "canonical": true, - "file": "datastream.fetch_static_ips.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FetchStaticIps", - "fullName": "google.cloud.datastream.v1.Datastream.FetchStaticIps", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1.FetchStaticIpsResponse", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "FetchStaticIps", - "fullName": "google.cloud.datastream.v1.Datastream.FetchStaticIps", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_CreatePrivateConnection_async", - "title": "Datastream createPrivateConnection Sample", - "origin": "API_DEFINITION", - "description": " Use this method to create a private connectivity configuration.", - "canonical": true, - "file": "datastream.create_private_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 82, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreatePrivateConnection", - "fullName": "google.cloud.datastream.v1.Datastream.CreatePrivateConnection", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "private_connection_id", - "type": "TYPE_STRING" - }, - { - "name": "private_connection", - "type": ".google.cloud.datastream.v1.PrivateConnection" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "CreatePrivateConnection", - "fullName": "google.cloud.datastream.v1.Datastream.CreatePrivateConnection", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_GetPrivateConnection_async", - "title": "Datastream getPrivateConnection Sample", - "origin": "API_DEFINITION", - "description": " Use this method to get details about a private connectivity configuration.", - "canonical": true, - "file": "datastream.get_private_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetPrivateConnection", - "fullName": "google.cloud.datastream.v1.Datastream.GetPrivateConnection", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1.PrivateConnection", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "GetPrivateConnection", - "fullName": "google.cloud.datastream.v1.Datastream.GetPrivateConnection", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_ListPrivateConnections_async", - "title": "Datastream listPrivateConnections Sample", - "origin": "API_DEFINITION", - "description": " Use this method to list private connectivity configurations in a project and location.", - "canonical": true, - "file": "datastream.list_private_connections.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListPrivateConnections", - "fullName": "google.cloud.datastream.v1.Datastream.ListPrivateConnections", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1.ListPrivateConnectionsResponse", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "ListPrivateConnections", - "fullName": "google.cloud.datastream.v1.Datastream.ListPrivateConnections", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_DeletePrivateConnection_async", - "title": "Datastream deletePrivateConnection Sample", - "origin": "API_DEFINITION", - "description": " Use this method to delete a private connectivity configuration.", - "canonical": true, - "file": "datastream.delete_private_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeletePrivateConnection", - "fullName": "google.cloud.datastream.v1.Datastream.DeletePrivateConnection", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "DeletePrivateConnection", - "fullName": "google.cloud.datastream.v1.Datastream.DeletePrivateConnection", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_CreateRoute_async", - "title": "Datastream createRoute Sample", - "origin": "API_DEFINITION", - "description": " Use this method to create a route for a private connectivity configuration in a project and location.", - "canonical": true, - "file": "datastream.create_route.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateRoute", - "fullName": "google.cloud.datastream.v1.Datastream.CreateRoute", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "route_id", - "type": "TYPE_STRING" - }, - { - "name": "route", - "type": ".google.cloud.datastream.v1.Route" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "CreateRoute", - "fullName": "google.cloud.datastream.v1.Datastream.CreateRoute", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_GetRoute_async", - "title": "Datastream getRoute Sample", - "origin": "API_DEFINITION", - "description": " Use this method to get details about a route.", - "canonical": true, - "file": "datastream.get_route.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetRoute", - "fullName": "google.cloud.datastream.v1.Datastream.GetRoute", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1.Route", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "GetRoute", - "fullName": "google.cloud.datastream.v1.Datastream.GetRoute", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_ListRoutes_async", - "title": "Datastream listRoutes Sample", - "origin": "API_DEFINITION", - "description": " Use this method to list routes created for a private connectivity configuration in a project and location.", - "canonical": true, - "file": "datastream.list_routes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListRoutes", - "fullName": "google.cloud.datastream.v1.Datastream.ListRoutes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1.ListRoutesResponse", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "ListRoutes", - "fullName": "google.cloud.datastream.v1.Datastream.ListRoutes", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1_generated_Datastream_DeleteRoute_async", - "title": "Datastream deleteRoute Sample", - "origin": "API_DEFINITION", - "description": " Use this method to delete a route.", - "canonical": true, - "file": "datastream.delete_route.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteRoute", - "fullName": "google.cloud.datastream.v1.Datastream.DeleteRoute", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1.DatastreamClient" - }, - "method": { - "shortName": "DeleteRoute", - "fullName": "google.cloud.datastream.v1.Datastream.DeleteRoute", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1.Datastream" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-datastream/v1/src/index.ts b/owl-bot-staging/google-cloud-datastream/v1/src/index.ts deleted file mode 100644 index 4d2bd52e2a2..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1 from './v1'; -const DatastreamClient = v1.DatastreamClient; -type DatastreamClient = v1.DatastreamClient; -export {v1, DatastreamClient}; -export default {v1, DatastreamClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_client.ts b/owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_client.ts deleted file mode 100644 index 5ecdcaa5794..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_client.ts +++ /dev/null @@ -1,4160 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall, IamClient, IamProtos, LocationsClient, LocationProtos} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/datastream_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './datastream_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Datastream service - * @class - * @memberof v1 - */ -export class DatastreamClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - iamClient: IamClient; - locationsClient: LocationsClient; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - datastreamStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DatastreamClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new DatastreamClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DatastreamClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - this.iamClient = new this._gaxModule.IamClient(this._gaxGrpc, opts); - - this.locationsClient = new this._gaxModule.LocationsClient( - this._gaxGrpc, - opts - ); - - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - connectionProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/connectionProfiles/{connection_profile}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - privateConnectionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateConnections/{private_connection}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - routePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateConnections/{private_connection}/routes/{route}' - ), - streamPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/streams/{stream}' - ), - streamObjectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/streams/{stream}/objects/{object}' - ), - }; - - // 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 = { - listConnectionProfiles: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'connectionProfiles'), - listStreams: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'streams'), - listStreamObjects: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'streamObjects'), - fetchStaticIps: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'staticIps'), - listPrivateConnections: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'privateConnections'), - listRoutes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'routes') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createConnectionProfileResponse = protoFilesRoot.lookup( - '.google.cloud.datastream.v1.ConnectionProfile') as gax.protobuf.Type; - const createConnectionProfileMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; - const updateConnectionProfileResponse = protoFilesRoot.lookup( - '.google.cloud.datastream.v1.ConnectionProfile') as gax.protobuf.Type; - const updateConnectionProfileMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; - const deleteConnectionProfileResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteConnectionProfileMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; - const createStreamResponse = protoFilesRoot.lookup( - '.google.cloud.datastream.v1.Stream') as gax.protobuf.Type; - const createStreamMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; - const updateStreamResponse = protoFilesRoot.lookup( - '.google.cloud.datastream.v1.Stream') as gax.protobuf.Type; - const updateStreamMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; - const deleteStreamResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteStreamMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; - const createPrivateConnectionResponse = protoFilesRoot.lookup( - '.google.cloud.datastream.v1.PrivateConnection') as gax.protobuf.Type; - const createPrivateConnectionMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; - const deletePrivateConnectionResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deletePrivateConnectionMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; - const createRouteResponse = protoFilesRoot.lookup( - '.google.cloud.datastream.v1.Route') as gax.protobuf.Type; - const createRouteMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; - const deleteRouteResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteRouteMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createConnectionProfile: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createConnectionProfileResponse.decode.bind(createConnectionProfileResponse), - createConnectionProfileMetadata.decode.bind(createConnectionProfileMetadata)), - updateConnectionProfile: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateConnectionProfileResponse.decode.bind(updateConnectionProfileResponse), - updateConnectionProfileMetadata.decode.bind(updateConnectionProfileMetadata)), - deleteConnectionProfile: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteConnectionProfileResponse.decode.bind(deleteConnectionProfileResponse), - deleteConnectionProfileMetadata.decode.bind(deleteConnectionProfileMetadata)), - createStream: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createStreamResponse.decode.bind(createStreamResponse), - createStreamMetadata.decode.bind(createStreamMetadata)), - updateStream: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateStreamResponse.decode.bind(updateStreamResponse), - updateStreamMetadata.decode.bind(updateStreamMetadata)), - deleteStream: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteStreamResponse.decode.bind(deleteStreamResponse), - deleteStreamMetadata.decode.bind(deleteStreamMetadata)), - createPrivateConnection: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createPrivateConnectionResponse.decode.bind(createPrivateConnectionResponse), - createPrivateConnectionMetadata.decode.bind(createPrivateConnectionMetadata)), - deletePrivateConnection: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deletePrivateConnectionResponse.decode.bind(deletePrivateConnectionResponse), - deletePrivateConnectionMetadata.decode.bind(deletePrivateConnectionMetadata)), - createRoute: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createRouteResponse.decode.bind(createRouteResponse), - createRouteMetadata.decode.bind(createRouteMetadata)), - deleteRoute: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteRouteResponse.decode.bind(deleteRouteResponse), - deleteRouteMetadata.decode.bind(deleteRouteMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.datastream.v1.Datastream', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.datastreamStub) { - return this.datastreamStub; - } - - // Put together the "service stub" for - // google.cloud.datastream.v1.Datastream. - this.datastreamStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.datastream.v1.Datastream') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.datastream.v1.Datastream, - 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 datastreamStubMethods = - ['listConnectionProfiles', 'getConnectionProfile', 'createConnectionProfile', 'updateConnectionProfile', 'deleteConnectionProfile', 'discoverConnectionProfile', 'listStreams', 'getStream', 'createStream', 'updateStream', 'deleteStream', 'getStreamObject', 'lookupStreamObject', 'listStreamObjects', 'startBackfillJob', 'stopBackfillJob', 'fetchStaticIps', 'createPrivateConnection', 'getPrivateConnection', 'listPrivateConnections', 'deletePrivateConnection', 'createRoute', 'getRoute', 'listRoutes', 'deleteRoute']; - for (const methodName of datastreamStubMethods) { - const callPromise = this.datastreamStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.datastreamStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'datastream.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 'datastream.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Use this method to get details about a connection profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the connection profile resource to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.datastream.v1.ConnectionProfile | ConnectionProfile}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/datastream.get_connection_profile.js - * region_tag:datastream_v1_generated_Datastream_GetConnectionProfile_async - */ - getConnectionProfile( - request?: protos.google.cloud.datastream.v1.IGetConnectionProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1.IConnectionProfile, - protos.google.cloud.datastream.v1.IGetConnectionProfileRequest|undefined, {}|undefined - ]>; - getConnectionProfile( - request: protos.google.cloud.datastream.v1.IGetConnectionProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.datastream.v1.IConnectionProfile, - protos.google.cloud.datastream.v1.IGetConnectionProfileRequest|null|undefined, - {}|null|undefined>): void; - getConnectionProfile( - request: protos.google.cloud.datastream.v1.IGetConnectionProfileRequest, - callback: Callback< - protos.google.cloud.datastream.v1.IConnectionProfile, - protos.google.cloud.datastream.v1.IGetConnectionProfileRequest|null|undefined, - {}|null|undefined>): void; - getConnectionProfile( - request?: protos.google.cloud.datastream.v1.IGetConnectionProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.datastream.v1.IConnectionProfile, - protos.google.cloud.datastream.v1.IGetConnectionProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.datastream.v1.IConnectionProfile, - protos.google.cloud.datastream.v1.IGetConnectionProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.datastream.v1.IConnectionProfile, - protos.google.cloud.datastream.v1.IGetConnectionProfileRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getConnectionProfile(request, options, callback); - } -/** - * Use this method to discover a connection profile. - * The discover API call exposes the data objects and metadata belonging to - * the profile. Typically, a request returns children data objects of a - * parent data object that's optionally supplied in the request. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the connection profile type. Must be in - * the format `projects/* /locations/*`. - * @param {google.cloud.datastream.v1.ConnectionProfile} request.connectionProfile - * An ad-hoc connection profile configuration. - * @param {string} request.connectionProfileName - * A reference to an existing connection profile. - * @param {boolean} request.fullHierarchy - * Whether to retrieve the full hierarchy of data objects (TRUE) or only the - * current level (FALSE). - * @param {number} request.hierarchyDepth - * The number of hierarchy levels below the current level to be retrieved. - * @param {google.cloud.datastream.v1.OracleRdbms} request.oracleRdbms - * Oracle RDBMS to enrich with child data objects and metadata. - * @param {google.cloud.datastream.v1.MysqlRdbms} request.mysqlRdbms - * MySQL RDBMS to enrich with child data objects and metadata. - * @param {google.cloud.datastream.v1.PostgresqlRdbms} request.postgresqlRdbms - * PostgreSQL RDBMS to enrich with child data objects and metadata. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.datastream.v1.DiscoverConnectionProfileResponse | DiscoverConnectionProfileResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/datastream.discover_connection_profile.js - * region_tag:datastream_v1_generated_Datastream_DiscoverConnectionProfile_async - */ - discoverConnectionProfile( - request?: protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1.IDiscoverConnectionProfileResponse, - protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest|undefined, {}|undefined - ]>; - discoverConnectionProfile( - request: protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.datastream.v1.IDiscoverConnectionProfileResponse, - protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest|null|undefined, - {}|null|undefined>): void; - discoverConnectionProfile( - request: protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest, - callback: Callback< - protos.google.cloud.datastream.v1.IDiscoverConnectionProfileResponse, - protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest|null|undefined, - {}|null|undefined>): void; - discoverConnectionProfile( - request?: protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.datastream.v1.IDiscoverConnectionProfileResponse, - protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.datastream.v1.IDiscoverConnectionProfileResponse, - protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.datastream.v1.IDiscoverConnectionProfileResponse, - protos.google.cloud.datastream.v1.IDiscoverConnectionProfileRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.discoverConnectionProfile(request, options, callback); - } -/** - * Use this method to get details about a stream. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the stream resource to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.datastream.v1.Stream | Stream}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/datastream.get_stream.js - * region_tag:datastream_v1_generated_Datastream_GetStream_async - */ - getStream( - request?: protos.google.cloud.datastream.v1.IGetStreamRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1.IStream, - protos.google.cloud.datastream.v1.IGetStreamRequest|undefined, {}|undefined - ]>; - getStream( - request: protos.google.cloud.datastream.v1.IGetStreamRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.datastream.v1.IStream, - protos.google.cloud.datastream.v1.IGetStreamRequest|null|undefined, - {}|null|undefined>): void; - getStream( - request: protos.google.cloud.datastream.v1.IGetStreamRequest, - callback: Callback< - protos.google.cloud.datastream.v1.IStream, - protos.google.cloud.datastream.v1.IGetStreamRequest|null|undefined, - {}|null|undefined>): void; - getStream( - request?: protos.google.cloud.datastream.v1.IGetStreamRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.datastream.v1.IStream, - protos.google.cloud.datastream.v1.IGetStreamRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.datastream.v1.IStream, - protos.google.cloud.datastream.v1.IGetStreamRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.datastream.v1.IStream, - protos.google.cloud.datastream.v1.IGetStreamRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getStream(request, options, callback); - } -/** - * Use this method to get details about a stream object. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the stream object resource to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.datastream.v1.StreamObject | StreamObject}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/datastream.get_stream_object.js - * region_tag:datastream_v1_generated_Datastream_GetStreamObject_async - */ - getStreamObject( - request?: protos.google.cloud.datastream.v1.IGetStreamObjectRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1.IStreamObject, - protos.google.cloud.datastream.v1.IGetStreamObjectRequest|undefined, {}|undefined - ]>; - getStreamObject( - request: protos.google.cloud.datastream.v1.IGetStreamObjectRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.datastream.v1.IStreamObject, - protos.google.cloud.datastream.v1.IGetStreamObjectRequest|null|undefined, - {}|null|undefined>): void; - getStreamObject( - request: protos.google.cloud.datastream.v1.IGetStreamObjectRequest, - callback: Callback< - protos.google.cloud.datastream.v1.IStreamObject, - protos.google.cloud.datastream.v1.IGetStreamObjectRequest|null|undefined, - {}|null|undefined>): void; - getStreamObject( - request?: protos.google.cloud.datastream.v1.IGetStreamObjectRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.datastream.v1.IStreamObject, - protos.google.cloud.datastream.v1.IGetStreamObjectRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.datastream.v1.IStreamObject, - protos.google.cloud.datastream.v1.IGetStreamObjectRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.datastream.v1.IStreamObject, - protos.google.cloud.datastream.v1.IGetStreamObjectRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getStreamObject(request, options, callback); - } -/** - * Use this method to look up a stream object by its source object identifier. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent stream that owns the collection of objects. - * @param {google.cloud.datastream.v1.SourceObjectIdentifier} request.sourceObjectIdentifier - * Required. The source object identifier which maps to the stream object. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.datastream.v1.StreamObject | StreamObject}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/datastream.lookup_stream_object.js - * region_tag:datastream_v1_generated_Datastream_LookupStreamObject_async - */ - lookupStreamObject( - request?: protos.google.cloud.datastream.v1.ILookupStreamObjectRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1.IStreamObject, - protos.google.cloud.datastream.v1.ILookupStreamObjectRequest|undefined, {}|undefined - ]>; - lookupStreamObject( - request: protos.google.cloud.datastream.v1.ILookupStreamObjectRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.datastream.v1.IStreamObject, - protos.google.cloud.datastream.v1.ILookupStreamObjectRequest|null|undefined, - {}|null|undefined>): void; - lookupStreamObject( - request: protos.google.cloud.datastream.v1.ILookupStreamObjectRequest, - callback: Callback< - protos.google.cloud.datastream.v1.IStreamObject, - protos.google.cloud.datastream.v1.ILookupStreamObjectRequest|null|undefined, - {}|null|undefined>): void; - lookupStreamObject( - request?: protos.google.cloud.datastream.v1.ILookupStreamObjectRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.datastream.v1.IStreamObject, - protos.google.cloud.datastream.v1.ILookupStreamObjectRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.datastream.v1.IStreamObject, - protos.google.cloud.datastream.v1.ILookupStreamObjectRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.datastream.v1.IStreamObject, - protos.google.cloud.datastream.v1.ILookupStreamObjectRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.lookupStreamObject(request, options, callback); - } -/** - * Use this method to start a backfill job for the specified stream object. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.object - * Required. The name of the stream object resource to start a backfill job - * for. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.datastream.v1.StartBackfillJobResponse | StartBackfillJobResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/datastream.start_backfill_job.js - * region_tag:datastream_v1_generated_Datastream_StartBackfillJob_async - */ - startBackfillJob( - request?: protos.google.cloud.datastream.v1.IStartBackfillJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1.IStartBackfillJobResponse, - protos.google.cloud.datastream.v1.IStartBackfillJobRequest|undefined, {}|undefined - ]>; - startBackfillJob( - request: protos.google.cloud.datastream.v1.IStartBackfillJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.datastream.v1.IStartBackfillJobResponse, - protos.google.cloud.datastream.v1.IStartBackfillJobRequest|null|undefined, - {}|null|undefined>): void; - startBackfillJob( - request: protos.google.cloud.datastream.v1.IStartBackfillJobRequest, - callback: Callback< - protos.google.cloud.datastream.v1.IStartBackfillJobResponse, - protos.google.cloud.datastream.v1.IStartBackfillJobRequest|null|undefined, - {}|null|undefined>): void; - startBackfillJob( - request?: protos.google.cloud.datastream.v1.IStartBackfillJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.datastream.v1.IStartBackfillJobResponse, - protos.google.cloud.datastream.v1.IStartBackfillJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.datastream.v1.IStartBackfillJobResponse, - protos.google.cloud.datastream.v1.IStartBackfillJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.datastream.v1.IStartBackfillJobResponse, - protos.google.cloud.datastream.v1.IStartBackfillJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'object': request.object ?? '', - }); - this.initialize(); - return this.innerApiCalls.startBackfillJob(request, options, callback); - } -/** - * Use this method to stop a backfill job for the specified stream object. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.object - * Required. The name of the stream object resource to stop the backfill job - * for. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.datastream.v1.StopBackfillJobResponse | StopBackfillJobResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/datastream.stop_backfill_job.js - * region_tag:datastream_v1_generated_Datastream_StopBackfillJob_async - */ - stopBackfillJob( - request?: protos.google.cloud.datastream.v1.IStopBackfillJobRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1.IStopBackfillJobResponse, - protos.google.cloud.datastream.v1.IStopBackfillJobRequest|undefined, {}|undefined - ]>; - stopBackfillJob( - request: protos.google.cloud.datastream.v1.IStopBackfillJobRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.datastream.v1.IStopBackfillJobResponse, - protos.google.cloud.datastream.v1.IStopBackfillJobRequest|null|undefined, - {}|null|undefined>): void; - stopBackfillJob( - request: protos.google.cloud.datastream.v1.IStopBackfillJobRequest, - callback: Callback< - protos.google.cloud.datastream.v1.IStopBackfillJobResponse, - protos.google.cloud.datastream.v1.IStopBackfillJobRequest|null|undefined, - {}|null|undefined>): void; - stopBackfillJob( - request?: protos.google.cloud.datastream.v1.IStopBackfillJobRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.datastream.v1.IStopBackfillJobResponse, - protos.google.cloud.datastream.v1.IStopBackfillJobRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.datastream.v1.IStopBackfillJobResponse, - protos.google.cloud.datastream.v1.IStopBackfillJobRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.datastream.v1.IStopBackfillJobResponse, - protos.google.cloud.datastream.v1.IStopBackfillJobRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'object': request.object ?? '', - }); - this.initialize(); - return this.innerApiCalls.stopBackfillJob(request, options, callback); - } -/** - * Use this method to get details about a private connectivity configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the private connectivity configuration to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.datastream.v1.PrivateConnection | PrivateConnection}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/datastream.get_private_connection.js - * region_tag:datastream_v1_generated_Datastream_GetPrivateConnection_async - */ - getPrivateConnection( - request?: protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1.IPrivateConnection, - protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest|undefined, {}|undefined - ]>; - getPrivateConnection( - request: protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.datastream.v1.IPrivateConnection, - protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest|null|undefined, - {}|null|undefined>): void; - getPrivateConnection( - request: protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest, - callback: Callback< - protos.google.cloud.datastream.v1.IPrivateConnection, - protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest|null|undefined, - {}|null|undefined>): void; - getPrivateConnection( - request?: protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.datastream.v1.IPrivateConnection, - protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.datastream.v1.IPrivateConnection, - protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.datastream.v1.IPrivateConnection, - protos.google.cloud.datastream.v1.IGetPrivateConnectionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getPrivateConnection(request, options, callback); - } -/** - * Use this method to get details about a route. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Route resource to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.datastream.v1.Route | Route}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/datastream.get_route.js - * region_tag:datastream_v1_generated_Datastream_GetRoute_async - */ - getRoute( - request?: protos.google.cloud.datastream.v1.IGetRouteRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1.IRoute, - protos.google.cloud.datastream.v1.IGetRouteRequest|undefined, {}|undefined - ]>; - getRoute( - request: protos.google.cloud.datastream.v1.IGetRouteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.datastream.v1.IRoute, - protos.google.cloud.datastream.v1.IGetRouteRequest|null|undefined, - {}|null|undefined>): void; - getRoute( - request: protos.google.cloud.datastream.v1.IGetRouteRequest, - callback: Callback< - protos.google.cloud.datastream.v1.IRoute, - protos.google.cloud.datastream.v1.IGetRouteRequest|null|undefined, - {}|null|undefined>): void; - getRoute( - request?: protos.google.cloud.datastream.v1.IGetRouteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.datastream.v1.IRoute, - protos.google.cloud.datastream.v1.IGetRouteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.datastream.v1.IRoute, - protos.google.cloud.datastream.v1.IGetRouteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.datastream.v1.IRoute, - protos.google.cloud.datastream.v1.IGetRouteRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getRoute(request, options, callback); - } - -/** - * Use this method to create a connection profile in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of ConnectionProfiles. - * @param {string} request.connectionProfileId - * Required. The connection profile identifier. - * @param {google.cloud.datastream.v1.ConnectionProfile} request.connectionProfile - * Required. The connection profile resource to create. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.validateOnly] - * Optional. Only validate the connection profile, but don't create any - * resources. The default is false. - * @param {boolean} [request.force] - * Optional. Create the connection profile without validating it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.create_connection_profile.js - * region_tag:datastream_v1_generated_Datastream_CreateConnectionProfile_async - */ - createConnectionProfile( - request?: protos.google.cloud.datastream.v1.ICreateConnectionProfileRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createConnectionProfile( - request: protos.google.cloud.datastream.v1.ICreateConnectionProfileRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConnectionProfile( - request: protos.google.cloud.datastream.v1.ICreateConnectionProfileRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConnectionProfile( - request?: protos.google.cloud.datastream.v1.ICreateConnectionProfileRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createConnectionProfile(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createConnectionProfile()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.create_connection_profile.js - * region_tag:datastream_v1_generated_Datastream_CreateConnectionProfile_async - */ - async checkCreateConnectionProfileProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConnectionProfile, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to update the parameters of a connection profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * ConnectionProfile resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.datastream.v1.ConnectionProfile} request.connectionProfile - * Required. The connection profile to update. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.validateOnly] - * Optional. Only validate the connection profile, but don't update any - * resources. The default is false. - * @param {boolean} [request.force] - * Optional. Update the connection profile without validating it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.update_connection_profile.js - * region_tag:datastream_v1_generated_Datastream_UpdateConnectionProfile_async - */ - updateConnectionProfile( - request?: protos.google.cloud.datastream.v1.IUpdateConnectionProfileRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateConnectionProfile( - request: protos.google.cloud.datastream.v1.IUpdateConnectionProfileRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateConnectionProfile( - request: protos.google.cloud.datastream.v1.IUpdateConnectionProfileRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateConnectionProfile( - request?: protos.google.cloud.datastream.v1.IUpdateConnectionProfileRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'connection_profile.name': request.connectionProfile!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateConnectionProfile(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateConnectionProfile()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.update_connection_profile.js - * region_tag:datastream_v1_generated_Datastream_UpdateConnectionProfile_async - */ - async checkUpdateConnectionProfileProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateConnectionProfile, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to delete a connection profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the connection profile resource to delete. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.delete_connection_profile.js - * region_tag:datastream_v1_generated_Datastream_DeleteConnectionProfile_async - */ - deleteConnectionProfile( - request?: protos.google.cloud.datastream.v1.IDeleteConnectionProfileRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteConnectionProfile( - request: protos.google.cloud.datastream.v1.IDeleteConnectionProfileRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteConnectionProfile( - request: protos.google.cloud.datastream.v1.IDeleteConnectionProfileRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteConnectionProfile( - request?: protos.google.cloud.datastream.v1.IDeleteConnectionProfileRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteConnectionProfile(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteConnectionProfile()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.delete_connection_profile.js - * region_tag:datastream_v1_generated_Datastream_DeleteConnectionProfile_async - */ - async checkDeleteConnectionProfileProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConnectionProfile, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to create a stream. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of streams. - * @param {string} request.streamId - * Required. The stream identifier. - * @param {google.cloud.datastream.v1.Stream} request.stream - * Required. The stream resource to create. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.validateOnly] - * Optional. Only validate the stream, but don't create any resources. - * The default is false. - * @param {boolean} [request.force] - * Optional. Create the stream without validating it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.create_stream.js - * region_tag:datastream_v1_generated_Datastream_CreateStream_async - */ - createStream( - request?: protos.google.cloud.datastream.v1.ICreateStreamRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createStream( - request: protos.google.cloud.datastream.v1.ICreateStreamRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createStream( - request: protos.google.cloud.datastream.v1.ICreateStreamRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createStream( - request?: protos.google.cloud.datastream.v1.ICreateStreamRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createStream(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createStream()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.create_stream.js - * region_tag:datastream_v1_generated_Datastream_CreateStream_async - */ - async checkCreateStreamProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createStream, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to update the configuration of a stream. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * stream resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.datastream.v1.Stream} request.stream - * Required. The stream resource to update. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.validateOnly] - * Optional. Only validate the stream with the changes, without actually - * updating it. The default is false. - * @param {boolean} [request.force] - * Optional. Update the stream without validating it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.update_stream.js - * region_tag:datastream_v1_generated_Datastream_UpdateStream_async - */ - updateStream( - request?: protos.google.cloud.datastream.v1.IUpdateStreamRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateStream( - request: protos.google.cloud.datastream.v1.IUpdateStreamRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateStream( - request: protos.google.cloud.datastream.v1.IUpdateStreamRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateStream( - request?: protos.google.cloud.datastream.v1.IUpdateStreamRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'stream.name': request.stream!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateStream(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateStream()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.update_stream.js - * region_tag:datastream_v1_generated_Datastream_UpdateStream_async - */ - async checkUpdateStreamProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateStream, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to delete a stream. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the stream resource to delete. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.delete_stream.js - * region_tag:datastream_v1_generated_Datastream_DeleteStream_async - */ - deleteStream( - request?: protos.google.cloud.datastream.v1.IDeleteStreamRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteStream( - request: protos.google.cloud.datastream.v1.IDeleteStreamRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteStream( - request: protos.google.cloud.datastream.v1.IDeleteStreamRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteStream( - request?: protos.google.cloud.datastream.v1.IDeleteStreamRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteStream(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteStream()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.delete_stream.js - * region_tag:datastream_v1_generated_Datastream_DeleteStream_async - */ - async checkDeleteStreamProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteStream, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to create a private connectivity configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of PrivateConnections. - * @param {string} request.privateConnectionId - * Required. The private connectivity identifier. - * @param {google.cloud.datastream.v1.PrivateConnection} request.privateConnection - * Required. The Private Connectivity resource to create. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.force] - * Optional. If set to true, will skip validations. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.create_private_connection.js - * region_tag:datastream_v1_generated_Datastream_CreatePrivateConnection_async - */ - createPrivateConnection( - request?: protos.google.cloud.datastream.v1.ICreatePrivateConnectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createPrivateConnection( - request: protos.google.cloud.datastream.v1.ICreatePrivateConnectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createPrivateConnection( - request: protos.google.cloud.datastream.v1.ICreatePrivateConnectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createPrivateConnection( - request?: protos.google.cloud.datastream.v1.ICreatePrivateConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createPrivateConnection(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createPrivateConnection()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.create_private_connection.js - * region_tag:datastream_v1_generated_Datastream_CreatePrivateConnection_async - */ - async checkCreatePrivateConnectionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createPrivateConnection, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to delete a private connectivity configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the private connectivity configuration to delete. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.force] - * Optional. If set to true, any child routes that belong to this - * PrivateConnection will also be deleted. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.delete_private_connection.js - * region_tag:datastream_v1_generated_Datastream_DeletePrivateConnection_async - */ - deletePrivateConnection( - request?: protos.google.cloud.datastream.v1.IDeletePrivateConnectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deletePrivateConnection( - request: protos.google.cloud.datastream.v1.IDeletePrivateConnectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deletePrivateConnection( - request: protos.google.cloud.datastream.v1.IDeletePrivateConnectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deletePrivateConnection( - request?: protos.google.cloud.datastream.v1.IDeletePrivateConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deletePrivateConnection(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deletePrivateConnection()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.delete_private_connection.js - * region_tag:datastream_v1_generated_Datastream_DeletePrivateConnection_async - */ - async checkDeletePrivateConnectionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deletePrivateConnection, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to create a route for a private connectivity configuration - * in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of Routes. - * @param {string} request.routeId - * Required. The Route identifier. - * @param {google.cloud.datastream.v1.Route} request.route - * Required. The Route resource to create. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.create_route.js - * region_tag:datastream_v1_generated_Datastream_CreateRoute_async - */ - createRoute( - request?: protos.google.cloud.datastream.v1.ICreateRouteRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createRoute( - request: protos.google.cloud.datastream.v1.ICreateRouteRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createRoute( - request: protos.google.cloud.datastream.v1.ICreateRouteRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createRoute( - request?: protos.google.cloud.datastream.v1.ICreateRouteRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createRoute(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createRoute()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.create_route.js - * region_tag:datastream_v1_generated_Datastream_CreateRoute_async - */ - async checkCreateRouteProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createRoute, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to delete a route. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Route resource to delete. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.delete_route.js - * region_tag:datastream_v1_generated_Datastream_DeleteRoute_async - */ - deleteRoute( - request?: protos.google.cloud.datastream.v1.IDeleteRouteRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteRoute( - request: protos.google.cloud.datastream.v1.IDeleteRouteRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteRoute( - request: protos.google.cloud.datastream.v1.IDeleteRouteRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteRoute( - request?: protos.google.cloud.datastream.v1.IDeleteRouteRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteRoute(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteRoute()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/datastream.delete_route.js - * region_tag:datastream_v1_generated_Datastream_DeleteRoute_async - */ - async checkDeleteRouteProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteRoute, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Use this method to list connection profiles created in a project and - * location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of connection profiles. - * @param {number} request.pageSize - * Maximum number of connection profiles to return. - * If unspecified, at most 50 connection profiles will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListConnectionProfiles` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListConnectionProfiles` - * must match the call that provided the page token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.datastream.v1.ConnectionProfile | ConnectionProfile}. - * 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 `listConnectionProfilesAsync()` - * 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. - */ - listConnectionProfiles( - request?: protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1.IConnectionProfile[], - protos.google.cloud.datastream.v1.IListConnectionProfilesRequest|null, - protos.google.cloud.datastream.v1.IListConnectionProfilesResponse - ]>; - listConnectionProfiles( - request: protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, - protos.google.cloud.datastream.v1.IListConnectionProfilesResponse|null|undefined, - protos.google.cloud.datastream.v1.IConnectionProfile>): void; - listConnectionProfiles( - request: protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, - callback: PaginationCallback< - protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, - protos.google.cloud.datastream.v1.IListConnectionProfilesResponse|null|undefined, - protos.google.cloud.datastream.v1.IConnectionProfile>): void; - listConnectionProfiles( - request?: protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, - protos.google.cloud.datastream.v1.IListConnectionProfilesResponse|null|undefined, - protos.google.cloud.datastream.v1.IConnectionProfile>, - callback?: PaginationCallback< - protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, - protos.google.cloud.datastream.v1.IListConnectionProfilesResponse|null|undefined, - protos.google.cloud.datastream.v1.IConnectionProfile>): - Promise<[ - protos.google.cloud.datastream.v1.IConnectionProfile[], - protos.google.cloud.datastream.v1.IListConnectionProfilesRequest|null, - protos.google.cloud.datastream.v1.IListConnectionProfilesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listConnectionProfiles(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of connection profiles. - * @param {number} request.pageSize - * Maximum number of connection profiles to return. - * If unspecified, at most 50 connection profiles will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListConnectionProfiles` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListConnectionProfiles` - * must match the call that provided the page token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.datastream.v1.ConnectionProfile | ConnectionProfile} 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 `listConnectionProfilesAsync()` - * 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. - */ - listConnectionProfilesStream( - request?: protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConnectionProfiles']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConnectionProfiles.createStream( - this.innerApiCalls.listConnectionProfiles as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listConnectionProfiles`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of connection profiles. - * @param {number} request.pageSize - * Maximum number of connection profiles to return. - * If unspecified, at most 50 connection profiles will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListConnectionProfiles` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListConnectionProfiles` - * must match the call that provided the page token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.datastream.v1.ConnectionProfile | ConnectionProfile}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/datastream.list_connection_profiles.js - * region_tag:datastream_v1_generated_Datastream_ListConnectionProfiles_async - */ - listConnectionProfilesAsync( - request?: protos.google.cloud.datastream.v1.IListConnectionProfilesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConnectionProfiles']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConnectionProfiles.asyncIterate( - this.innerApiCalls['listConnectionProfiles'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Use this method to list streams in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of streams. - * @param {number} request.pageSize - * Maximum number of streams to return. - * If unspecified, at most 50 streams will be returned. The maximum - * value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListStreams` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListStreams` - * must match the call that provided the page token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.datastream.v1.Stream | Stream}. - * 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 `listStreamsAsync()` - * 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. - */ - listStreams( - request?: protos.google.cloud.datastream.v1.IListStreamsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1.IStream[], - protos.google.cloud.datastream.v1.IListStreamsRequest|null, - protos.google.cloud.datastream.v1.IListStreamsResponse - ]>; - listStreams( - request: protos.google.cloud.datastream.v1.IListStreamsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.datastream.v1.IListStreamsRequest, - protos.google.cloud.datastream.v1.IListStreamsResponse|null|undefined, - protos.google.cloud.datastream.v1.IStream>): void; - listStreams( - request: protos.google.cloud.datastream.v1.IListStreamsRequest, - callback: PaginationCallback< - protos.google.cloud.datastream.v1.IListStreamsRequest, - protos.google.cloud.datastream.v1.IListStreamsResponse|null|undefined, - protos.google.cloud.datastream.v1.IStream>): void; - listStreams( - request?: protos.google.cloud.datastream.v1.IListStreamsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.datastream.v1.IListStreamsRequest, - protos.google.cloud.datastream.v1.IListStreamsResponse|null|undefined, - protos.google.cloud.datastream.v1.IStream>, - callback?: PaginationCallback< - protos.google.cloud.datastream.v1.IListStreamsRequest, - protos.google.cloud.datastream.v1.IListStreamsResponse|null|undefined, - protos.google.cloud.datastream.v1.IStream>): - Promise<[ - protos.google.cloud.datastream.v1.IStream[], - protos.google.cloud.datastream.v1.IListStreamsRequest|null, - protos.google.cloud.datastream.v1.IListStreamsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listStreams(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of streams. - * @param {number} request.pageSize - * Maximum number of streams to return. - * If unspecified, at most 50 streams will be returned. The maximum - * value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListStreams` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListStreams` - * must match the call that provided the page token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.datastream.v1.Stream | Stream} 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 `listStreamsAsync()` - * 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. - */ - listStreamsStream( - request?: protos.google.cloud.datastream.v1.IListStreamsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listStreams']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listStreams.createStream( - this.innerApiCalls.listStreams as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listStreams`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of streams. - * @param {number} request.pageSize - * Maximum number of streams to return. - * If unspecified, at most 50 streams will be returned. The maximum - * value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListStreams` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListStreams` - * must match the call that provided the page token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.datastream.v1.Stream | Stream}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/datastream.list_streams.js - * region_tag:datastream_v1_generated_Datastream_ListStreams_async - */ - listStreamsAsync( - request?: protos.google.cloud.datastream.v1.IListStreamsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listStreams']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listStreams.asyncIterate( - this.innerApiCalls['listStreams'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Use this method to list the objects of a specific stream. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent stream that owns the collection of objects. - * @param {number} request.pageSize - * Maximum number of objects to return. Default is 50. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListStreamObjectsRequest` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListStreamObjectsRequest` must match the call that provided the page - * token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.datastream.v1.StreamObject | StreamObject}. - * 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 `listStreamObjectsAsync()` - * 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. - */ - listStreamObjects( - request?: protos.google.cloud.datastream.v1.IListStreamObjectsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1.IStreamObject[], - protos.google.cloud.datastream.v1.IListStreamObjectsRequest|null, - protos.google.cloud.datastream.v1.IListStreamObjectsResponse - ]>; - listStreamObjects( - request: protos.google.cloud.datastream.v1.IListStreamObjectsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.datastream.v1.IListStreamObjectsRequest, - protos.google.cloud.datastream.v1.IListStreamObjectsResponse|null|undefined, - protos.google.cloud.datastream.v1.IStreamObject>): void; - listStreamObjects( - request: protos.google.cloud.datastream.v1.IListStreamObjectsRequest, - callback: PaginationCallback< - protos.google.cloud.datastream.v1.IListStreamObjectsRequest, - protos.google.cloud.datastream.v1.IListStreamObjectsResponse|null|undefined, - protos.google.cloud.datastream.v1.IStreamObject>): void; - listStreamObjects( - request?: protos.google.cloud.datastream.v1.IListStreamObjectsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.datastream.v1.IListStreamObjectsRequest, - protos.google.cloud.datastream.v1.IListStreamObjectsResponse|null|undefined, - protos.google.cloud.datastream.v1.IStreamObject>, - callback?: PaginationCallback< - protos.google.cloud.datastream.v1.IListStreamObjectsRequest, - protos.google.cloud.datastream.v1.IListStreamObjectsResponse|null|undefined, - protos.google.cloud.datastream.v1.IStreamObject>): - Promise<[ - protos.google.cloud.datastream.v1.IStreamObject[], - protos.google.cloud.datastream.v1.IListStreamObjectsRequest|null, - protos.google.cloud.datastream.v1.IListStreamObjectsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listStreamObjects(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent stream that owns the collection of objects. - * @param {number} request.pageSize - * Maximum number of objects to return. Default is 50. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListStreamObjectsRequest` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListStreamObjectsRequest` must match the call that provided the page - * token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.datastream.v1.StreamObject | StreamObject} 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 `listStreamObjectsAsync()` - * 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. - */ - listStreamObjectsStream( - request?: protos.google.cloud.datastream.v1.IListStreamObjectsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listStreamObjects']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listStreamObjects.createStream( - this.innerApiCalls.listStreamObjects as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listStreamObjects`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent stream that owns the collection of objects. - * @param {number} request.pageSize - * Maximum number of objects to return. Default is 50. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListStreamObjectsRequest` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListStreamObjectsRequest` must match the call that provided the page - * token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.datastream.v1.StreamObject | StreamObject}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/datastream.list_stream_objects.js - * region_tag:datastream_v1_generated_Datastream_ListStreamObjects_async - */ - listStreamObjectsAsync( - request?: protos.google.cloud.datastream.v1.IListStreamObjectsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listStreamObjects']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listStreamObjects.asyncIterate( - this.innerApiCalls['listStreamObjects'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * The FetchStaticIps API call exposes the static IP addresses used by - * Datastream. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name for the location for which static IPs should be - * returned. Must be in the format `projects/* /locations/*`. - * @param {number} request.pageSize - * Maximum number of Ips to return, will likely not be specified. - * @param {string} request.pageToken - * A page token, received from a previous `ListStaticIps` call. - * will likely not 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 Array of string. - * 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 `fetchStaticIpsAsync()` - * 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. - */ - fetchStaticIps( - request?: protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, - options?: CallOptions): - Promise<[ - string[], - protos.google.cloud.datastream.v1.IFetchStaticIpsRequest|null, - protos.google.cloud.datastream.v1.IFetchStaticIpsResponse - ]>; - fetchStaticIps( - request: protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, - protos.google.cloud.datastream.v1.IFetchStaticIpsResponse|null|undefined, - string>): void; - fetchStaticIps( - request: protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, - callback: PaginationCallback< - protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, - protos.google.cloud.datastream.v1.IFetchStaticIpsResponse|null|undefined, - string>): void; - fetchStaticIps( - request?: protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, - protos.google.cloud.datastream.v1.IFetchStaticIpsResponse|null|undefined, - string>, - callback?: PaginationCallback< - protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, - protos.google.cloud.datastream.v1.IFetchStaticIpsResponse|null|undefined, - string>): - Promise<[ - string[], - protos.google.cloud.datastream.v1.IFetchStaticIpsRequest|null, - protos.google.cloud.datastream.v1.IFetchStaticIpsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.fetchStaticIps(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.name - * Required. The resource name for the location for which static IPs should be - * returned. Must be in the format `projects/* /locations/*`. - * @param {number} request.pageSize - * Maximum number of Ips to return, will likely not be specified. - * @param {string} request.pageToken - * A page token, received from a previous `ListStaticIps` call. - * will likely not be specified. - * @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 string 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 `fetchStaticIpsAsync()` - * 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. - */ - fetchStaticIpsStream( - request?: protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['fetchStaticIps']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.fetchStaticIps.createStream( - this.innerApiCalls.fetchStaticIps as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `fetchStaticIps`, 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.name - * Required. The resource name for the location for which static IPs should be - * returned. Must be in the format `projects/* /locations/*`. - * @param {number} request.pageSize - * Maximum number of Ips to return, will likely not be specified. - * @param {string} request.pageToken - * A page token, received from a previous `ListStaticIps` call. - * will likely not be specified. - * @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 - * string. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/datastream.fetch_static_ips.js - * region_tag:datastream_v1_generated_Datastream_FetchStaticIps_async - */ - fetchStaticIpsAsync( - request?: protos.google.cloud.datastream.v1.IFetchStaticIpsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['fetchStaticIps']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.fetchStaticIps.asyncIterate( - this.innerApiCalls['fetchStaticIps'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Use this method to list private connectivity configurations in a project - * and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of private connectivity - * configurations. - * @param {number} request.pageSize - * Maximum number of private connectivity configurations to return. - * If unspecified, at most 50 private connectivity configurations that will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListPrivateConnections` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListPrivateConnections` must match the call that provided the page - * token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.datastream.v1.PrivateConnection | PrivateConnection}. - * 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 `listPrivateConnectionsAsync()` - * 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. - */ - listPrivateConnections( - request?: protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1.IPrivateConnection[], - protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest|null, - protos.google.cloud.datastream.v1.IListPrivateConnectionsResponse - ]>; - listPrivateConnections( - request: protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, - protos.google.cloud.datastream.v1.IListPrivateConnectionsResponse|null|undefined, - protos.google.cloud.datastream.v1.IPrivateConnection>): void; - listPrivateConnections( - request: protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, - callback: PaginationCallback< - protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, - protos.google.cloud.datastream.v1.IListPrivateConnectionsResponse|null|undefined, - protos.google.cloud.datastream.v1.IPrivateConnection>): void; - listPrivateConnections( - request?: protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, - protos.google.cloud.datastream.v1.IListPrivateConnectionsResponse|null|undefined, - protos.google.cloud.datastream.v1.IPrivateConnection>, - callback?: PaginationCallback< - protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, - protos.google.cloud.datastream.v1.IListPrivateConnectionsResponse|null|undefined, - protos.google.cloud.datastream.v1.IPrivateConnection>): - Promise<[ - protos.google.cloud.datastream.v1.IPrivateConnection[], - protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest|null, - protos.google.cloud.datastream.v1.IListPrivateConnectionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listPrivateConnections(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of private connectivity - * configurations. - * @param {number} request.pageSize - * Maximum number of private connectivity configurations to return. - * If unspecified, at most 50 private connectivity configurations that will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListPrivateConnections` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListPrivateConnections` must match the call that provided the page - * token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.datastream.v1.PrivateConnection | PrivateConnection} 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 `listPrivateConnectionsAsync()` - * 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. - */ - listPrivateConnectionsStream( - request?: protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listPrivateConnections']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPrivateConnections.createStream( - this.innerApiCalls.listPrivateConnections as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listPrivateConnections`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of private connectivity - * configurations. - * @param {number} request.pageSize - * Maximum number of private connectivity configurations to return. - * If unspecified, at most 50 private connectivity configurations that will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListPrivateConnections` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListPrivateConnections` must match the call that provided the page - * token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.datastream.v1.PrivateConnection | PrivateConnection}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/datastream.list_private_connections.js - * region_tag:datastream_v1_generated_Datastream_ListPrivateConnections_async - */ - listPrivateConnectionsAsync( - request?: protos.google.cloud.datastream.v1.IListPrivateConnectionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listPrivateConnections']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPrivateConnections.asyncIterate( - this.innerApiCalls['listPrivateConnections'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Use this method to list routes created for a private connectivity - * configuration in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of Routess. - * @param {number} request.pageSize - * Maximum number of Routes to return. The service may return - * fewer than this value. If unspecified, at most 50 Routes - * will be returned. The maximum value is 1000; values above 1000 will be - * coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListRoutes` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListRoutes` must match the call that provided the page - * token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.datastream.v1.Route | Route}. - * 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 `listRoutesAsync()` - * 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. - */ - listRoutes( - request?: protos.google.cloud.datastream.v1.IListRoutesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1.IRoute[], - protos.google.cloud.datastream.v1.IListRoutesRequest|null, - protos.google.cloud.datastream.v1.IListRoutesResponse - ]>; - listRoutes( - request: protos.google.cloud.datastream.v1.IListRoutesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.datastream.v1.IListRoutesRequest, - protos.google.cloud.datastream.v1.IListRoutesResponse|null|undefined, - protos.google.cloud.datastream.v1.IRoute>): void; - listRoutes( - request: protos.google.cloud.datastream.v1.IListRoutesRequest, - callback: PaginationCallback< - protos.google.cloud.datastream.v1.IListRoutesRequest, - protos.google.cloud.datastream.v1.IListRoutesResponse|null|undefined, - protos.google.cloud.datastream.v1.IRoute>): void; - listRoutes( - request?: protos.google.cloud.datastream.v1.IListRoutesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.datastream.v1.IListRoutesRequest, - protos.google.cloud.datastream.v1.IListRoutesResponse|null|undefined, - protos.google.cloud.datastream.v1.IRoute>, - callback?: PaginationCallback< - protos.google.cloud.datastream.v1.IListRoutesRequest, - protos.google.cloud.datastream.v1.IListRoutesResponse|null|undefined, - protos.google.cloud.datastream.v1.IRoute>): - Promise<[ - protos.google.cloud.datastream.v1.IRoute[], - protos.google.cloud.datastream.v1.IListRoutesRequest|null, - protos.google.cloud.datastream.v1.IListRoutesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listRoutes(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of Routess. - * @param {number} request.pageSize - * Maximum number of Routes to return. The service may return - * fewer than this value. If unspecified, at most 50 Routes - * will be returned. The maximum value is 1000; values above 1000 will be - * coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListRoutes` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListRoutes` must match the call that provided the page - * token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.datastream.v1.Route | Route} 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 `listRoutesAsync()` - * 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. - */ - listRoutesStream( - request?: protos.google.cloud.datastream.v1.IListRoutesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listRoutes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRoutes.createStream( - this.innerApiCalls.listRoutes as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listRoutes`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of Routess. - * @param {number} request.pageSize - * Maximum number of Routes to return. The service may return - * fewer than this value. If unspecified, at most 50 Routes - * will be returned. The maximum value is 1000; values above 1000 will be - * coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListRoutes` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListRoutes` must match the call that provided the page - * token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.datastream.v1.Route | Route}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/datastream.list_routes.js - * region_tag:datastream_v1_generated_Datastream_ListRoutes_async - */ - listRoutesAsync( - request?: protos.google.cloud.datastream.v1.IListRoutesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listRoutes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRoutes.asyncIterate( - this.innerApiCalls['listRoutes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } -/** - * Gets the access control policy for a resource. Returns an empty policy - * if the resource exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {Object} [request.options] - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. This field is only used by Cloud IAM. - * - * This object should have the same structure as {@link google.iam.v1.GetPolicyOptions | GetPolicyOptions}. - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.Policy | Policy}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.Policy | Policy}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - getIamPolicy( - request: IamProtos.google.iam.v1.GetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.GetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.getIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - */ - setIamPolicy( - request: IamProtos.google.iam.v1.SetIamPolicyRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.Policy, - IamProtos.google.iam.v1.SetIamPolicyRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.setIamPolicy(request, options, callback); - } - -/** - * Returns permissions that a caller has on the specified resource. If the - * resource does not exist, this will return an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building - * permission-aware UIs and command-line tools, not for authorization - * checking. This operation may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {Object} [options] - * Optional parameters. You can override the default settings for this call, e.g, timeout, - * retries, paginations, etc. See {@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html | gax.CallOptions} for the details. - * @param {function(?Error, ?Object)} [callback] - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.iam.v1.TestIamPermissionsResponse | TestIamPermissionsResponse}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - */ - testIamPermissions( - request: IamProtos.google.iam.v1.TestIamPermissionsRequest, - options?: - | gax.CallOptions - | Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - >, - callback?: Callback< - IamProtos.google.iam.v1.TestIamPermissionsResponse, - IamProtos.google.iam.v1.TestIamPermissionsRequest | null | undefined, - {} | null | undefined - > - ):Promise { - return this.iamClient.testIamPermissions(request, options, callback); - } - -/** - * Gets information about a location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Resource name for the location. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html | CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.location.Location | Location}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example - * ``` - * const [response] = await client.getLocation(request); - * ``` - */ - getLocation( - request: LocationProtos.google.cloud.location.IGetLocationRequest, - options?: - | gax.CallOptions - | Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - >, - callback?: Callback< - LocationProtos.google.cloud.location.ILocation, - | LocationProtos.google.cloud.location.IGetLocationRequest - | null - | undefined, - {} | null | undefined - > - ): Promise { - return this.locationsClient.getLocation(request, options, callback); - } - -/** - * Lists information about the supported locations for this service. Returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * The resource that owns the locations collection, if applicable. - * @param {string} request.filter - * The standard list filter. - * @param {number} request.pageSize - * The standard list page size. - * @param {string} request.pageToken - * The standard list page token. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.location.Location | Location}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example - * ``` - * const iterable = client.listLocationsAsync(request); - * for await (const response of iterable) { - * // process response - * } - * ``` - */ - listLocationsAsync( - request: LocationProtos.google.cloud.location.IListLocationsRequest, - options?: CallOptions - ): AsyncIterable { - return this.locationsClient.listLocationsAsync(request, options); - } - -/** - * Gets the latest state of a long-running operation. Clients can use this - * method to poll the operation result at intervals as recommended by the API - * service. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error, ?Object)=} callback - * The function which will be called with the result of the API call. - * - * The second parameter to the callback is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * @return {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * {@link google.longrunning.Operation | google.longrunning.Operation}. - * The promise has a method named "cancel" which cancels the ongoing API call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * const name = ''; - * const [response] = await client.getOperation({name}); - * // doThingsWith(response) - * ``` - */ - getOperation( - request: protos.google.longrunning.GetOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.longrunning.Operation, - protos.google.longrunning.GetOperationRequest, - {} | null | undefined - > - ): Promise<[protos.google.longrunning.Operation]> { - return this.operationsClient.getOperation(request, options, callback); - } - /** - * Lists operations that match the specified filter in the request. If the - * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. - * - * For-await-of syntax is used with the iterable to recursively get response element on-demand. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation collection. - * @param {string} request.filter - The standard list filter. - * @param {number=} request.pageSize - - * The maximum number of resources contained in the underlying API - * response. If page streaming is performed per-resource, this - * parameter does not affect the return value. If page streaming is - * performed per-page, this determines the maximum number of - * resources in a page. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @returns {Object} - * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * for await (const response of client.listOperationsAsync(request)); - * // doThingsWith(response) - * ``` - */ - listOperationsAsync( - request: protos.google.longrunning.ListOperationsRequest, - options?: gax.CallOptions - ): AsyncIterable { - return this.operationsClient.listOperationsAsync(request, options); - } - /** - * Starts asynchronous cancellation on a long-running operation. The server - * makes a best effort to cancel the operation, but success is not - * guaranteed. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. Clients can use - * {@link Operations.GetOperation} or - * other methods to check whether the cancellation succeeded or whether the - * operation completed despite cancellation. On successful cancellation, - * the operation is not deleted; instead, it becomes an operation with - * an {@link Operation.error} value with a {@link google.rpc.Status.code} of - * 1, corresponding to `Code.CANCELLED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be cancelled. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the - * details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.cancelOperation({name: ''}); - * ``` - */ - cancelOperation( - request: protos.google.longrunning.CancelOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.CancelOperationRequest, - {} | undefined | null - >, - callback?: Callback< - protos.google.longrunning.CancelOperationRequest, - protos.google.protobuf.Empty, - {} | undefined | null - > - ): Promise { - return this.operationsClient.cancelOperation(request, options, callback); - } - - /** - * Deletes a long-running operation. This method indicates that the client is - * no longer interested in the operation result. It does not cancel the - * operation. If the server doesn't support this method, it returns - * `google.rpc.Code.UNIMPLEMENTED`. - * - * @param {Object} request - The request object that will be sent. - * @param {string} request.name - The name of the operation resource to be deleted. - * @param {Object=} options - * Optional parameters. You can override the default settings for this call, - * e.g, timeout, retries, paginations, etc. See {@link - * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} - * for the details. - * @param {function(?Error)=} callback - * The function which will be called with the result of the API call. - * @return {Promise} - The promise which resolves when API call finishes. - * The promise has a method named "cancel" which cancels the ongoing API - * call. - * - * @example - * ``` - * const client = longrunning.operationsClient(); - * await client.deleteOperation({name: ''}); - * ``` - */ - deleteOperation( - request: protos.google.longrunning.DeleteOperationRequest, - options?: - | gax.CallOptions - | Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - >, - callback?: Callback< - protos.google.protobuf.Empty, - protos.google.longrunning.DeleteOperationRequest, - {} | null | undefined - > - ): Promise { - return this.operationsClient.deleteOperation(request, options, callback); - } - - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified connectionProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} connection_profile - * @returns {string} Resource name string. - */ - connectionProfilePath(project:string,location:string,connectionProfile:string) { - return this.pathTemplates.connectionProfilePathTemplate.render({ - project: project, - location: location, - connection_profile: connectionProfile, - }); - } - - /** - * Parse the project from ConnectionProfile resource. - * - * @param {string} connectionProfileName - * A fully-qualified path representing ConnectionProfile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConnectionProfileName(connectionProfileName: string) { - return this.pathTemplates.connectionProfilePathTemplate.match(connectionProfileName).project; - } - - /** - * Parse the location from ConnectionProfile resource. - * - * @param {string} connectionProfileName - * A fully-qualified path representing ConnectionProfile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConnectionProfileName(connectionProfileName: string) { - return this.pathTemplates.connectionProfilePathTemplate.match(connectionProfileName).location; - } - - /** - * Parse the connection_profile from ConnectionProfile resource. - * - * @param {string} connectionProfileName - * A fully-qualified path representing ConnectionProfile resource. - * @returns {string} A string representing the connection_profile. - */ - matchConnectionProfileFromConnectionProfileName(connectionProfileName: string) { - return this.pathTemplates.connectionProfilePathTemplate.match(connectionProfileName).connection_profile; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified privateConnection resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} private_connection - * @returns {string} Resource name string. - */ - privateConnectionPath(project:string,location:string,privateConnection:string) { - return this.pathTemplates.privateConnectionPathTemplate.render({ - project: project, - location: location, - private_connection: privateConnection, - }); - } - - /** - * Parse the project from PrivateConnection resource. - * - * @param {string} privateConnectionName - * A fully-qualified path representing PrivateConnection resource. - * @returns {string} A string representing the project. - */ - matchProjectFromPrivateConnectionName(privateConnectionName: string) { - return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).project; - } - - /** - * Parse the location from PrivateConnection resource. - * - * @param {string} privateConnectionName - * A fully-qualified path representing PrivateConnection resource. - * @returns {string} A string representing the location. - */ - matchLocationFromPrivateConnectionName(privateConnectionName: string) { - return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).location; - } - - /** - * Parse the private_connection from PrivateConnection resource. - * - * @param {string} privateConnectionName - * A fully-qualified path representing PrivateConnection resource. - * @returns {string} A string representing the private_connection. - */ - matchPrivateConnectionFromPrivateConnectionName(privateConnectionName: string) { - return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).private_connection; - } - - /** - * 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 route resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} private_connection - * @param {string} route - * @returns {string} Resource name string. - */ - routePath(project:string,location:string,privateConnection:string,route:string) { - return this.pathTemplates.routePathTemplate.render({ - project: project, - location: location, - private_connection: privateConnection, - route: route, - }); - } - - /** - * Parse the project from Route resource. - * - * @param {string} routeName - * A fully-qualified path representing Route resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRouteName(routeName: string) { - return this.pathTemplates.routePathTemplate.match(routeName).project; - } - - /** - * Parse the location from Route resource. - * - * @param {string} routeName - * A fully-qualified path representing Route resource. - * @returns {string} A string representing the location. - */ - matchLocationFromRouteName(routeName: string) { - return this.pathTemplates.routePathTemplate.match(routeName).location; - } - - /** - * Parse the private_connection from Route resource. - * - * @param {string} routeName - * A fully-qualified path representing Route resource. - * @returns {string} A string representing the private_connection. - */ - matchPrivateConnectionFromRouteName(routeName: string) { - return this.pathTemplates.routePathTemplate.match(routeName).private_connection; - } - - /** - * Parse the route from Route resource. - * - * @param {string} routeName - * A fully-qualified path representing Route resource. - * @returns {string} A string representing the route. - */ - matchRouteFromRouteName(routeName: string) { - return this.pathTemplates.routePathTemplate.match(routeName).route; - } - - /** - * Return a fully-qualified stream resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} stream - * @returns {string} Resource name string. - */ - streamPath(project:string,location:string,stream:string) { - return this.pathTemplates.streamPathTemplate.render({ - project: project, - location: location, - stream: stream, - }); - } - - /** - * Parse the project from Stream resource. - * - * @param {string} streamName - * A fully-qualified path representing Stream resource. - * @returns {string} A string representing the project. - */ - matchProjectFromStreamName(streamName: string) { - return this.pathTemplates.streamPathTemplate.match(streamName).project; - } - - /** - * Parse the location from Stream resource. - * - * @param {string} streamName - * A fully-qualified path representing Stream resource. - * @returns {string} A string representing the location. - */ - matchLocationFromStreamName(streamName: string) { - return this.pathTemplates.streamPathTemplate.match(streamName).location; - } - - /** - * Parse the stream from Stream resource. - * - * @param {string} streamName - * A fully-qualified path representing Stream resource. - * @returns {string} A string representing the stream. - */ - matchStreamFromStreamName(streamName: string) { - return this.pathTemplates.streamPathTemplate.match(streamName).stream; - } - - /** - * Return a fully-qualified streamObject resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} stream - * @param {string} object - * @returns {string} Resource name string. - */ - streamObjectPath(project:string,location:string,stream:string,object:string) { - return this.pathTemplates.streamObjectPathTemplate.render({ - project: project, - location: location, - stream: stream, - object: object, - }); - } - - /** - * Parse the project from StreamObject resource. - * - * @param {string} streamObjectName - * A fully-qualified path representing StreamObject resource. - * @returns {string} A string representing the project. - */ - matchProjectFromStreamObjectName(streamObjectName: string) { - return this.pathTemplates.streamObjectPathTemplate.match(streamObjectName).project; - } - - /** - * Parse the location from StreamObject resource. - * - * @param {string} streamObjectName - * A fully-qualified path representing StreamObject resource. - * @returns {string} A string representing the location. - */ - matchLocationFromStreamObjectName(streamObjectName: string) { - return this.pathTemplates.streamObjectPathTemplate.match(streamObjectName).location; - } - - /** - * Parse the stream from StreamObject resource. - * - * @param {string} streamObjectName - * A fully-qualified path representing StreamObject resource. - * @returns {string} A string representing the stream. - */ - matchStreamFromStreamObjectName(streamObjectName: string) { - return this.pathTemplates.streamObjectPathTemplate.match(streamObjectName).stream; - } - - /** - * Parse the object from StreamObject resource. - * - * @param {string} streamObjectName - * A fully-qualified path representing StreamObject resource. - * @returns {string} A string representing the object. - */ - matchObjectFromStreamObjectName(streamObjectName: string) { - return this.pathTemplates.streamObjectPathTemplate.match(streamObjectName).object; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.datastreamStub && !this._terminated) { - return this.datastreamStub.then(stub => { - this._terminated = true; - stub.close(); - this.iamClient.close(); - this.locationsClient.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_client_config.json b/owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_client_config.json deleted file mode 100644 index 5b8f034a874..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_client_config.json +++ /dev/null @@ -1,163 +0,0 @@ -{ - "interfaces": { - "google.cloud.datastream.v1.Datastream": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListConnectionProfiles": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetConnectionProfile": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateConnectionProfile": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateConnectionProfile": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteConnectionProfile": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DiscoverConnectionProfile": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListStreams": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetStream": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateStream": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateStream": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteStream": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetStreamObject": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "LookupStreamObject": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListStreamObjects": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "StartBackfillJob": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "StopBackfillJob": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "FetchStaticIps": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreatePrivateConnection": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetPrivateConnection": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListPrivateConnections": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeletePrivateConnection": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateRoute": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetRoute": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListRoutes": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteRoute": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_proto_list.json b/owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_proto_list.json deleted file mode 100644 index 43d04578f4a..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/src/v1/datastream_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/datastream/v1/datastream.proto", - "../../protos/google/cloud/datastream/v1/datastream_resources.proto" -] diff --git a/owl-bot-staging/google-cloud-datastream/v1/src/v1/gapic_metadata.json b/owl-bot-staging/google-cloud-datastream/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 35e86aa3e21..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,297 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.datastream.v1", - "libraryPackage": "@google-cloud/datastream", - "services": { - "Datastream": { - "clients": { - "grpc": { - "libraryClient": "DatastreamClient", - "rpcs": { - "GetConnectionProfile": { - "methods": [ - "getConnectionProfile" - ] - }, - "DiscoverConnectionProfile": { - "methods": [ - "discoverConnectionProfile" - ] - }, - "GetStream": { - "methods": [ - "getStream" - ] - }, - "GetStreamObject": { - "methods": [ - "getStreamObject" - ] - }, - "LookupStreamObject": { - "methods": [ - "lookupStreamObject" - ] - }, - "StartBackfillJob": { - "methods": [ - "startBackfillJob" - ] - }, - "StopBackfillJob": { - "methods": [ - "stopBackfillJob" - ] - }, - "GetPrivateConnection": { - "methods": [ - "getPrivateConnection" - ] - }, - "GetRoute": { - "methods": [ - "getRoute" - ] - }, - "CreateConnectionProfile": { - "methods": [ - "createConnectionProfile" - ] - }, - "UpdateConnectionProfile": { - "methods": [ - "updateConnectionProfile" - ] - }, - "DeleteConnectionProfile": { - "methods": [ - "deleteConnectionProfile" - ] - }, - "CreateStream": { - "methods": [ - "createStream" - ] - }, - "UpdateStream": { - "methods": [ - "updateStream" - ] - }, - "DeleteStream": { - "methods": [ - "deleteStream" - ] - }, - "CreatePrivateConnection": { - "methods": [ - "createPrivateConnection" - ] - }, - "DeletePrivateConnection": { - "methods": [ - "deletePrivateConnection" - ] - }, - "CreateRoute": { - "methods": [ - "createRoute" - ] - }, - "DeleteRoute": { - "methods": [ - "deleteRoute" - ] - }, - "ListConnectionProfiles": { - "methods": [ - "listConnectionProfiles", - "listConnectionProfilesStream", - "listConnectionProfilesAsync" - ] - }, - "ListStreams": { - "methods": [ - "listStreams", - "listStreamsStream", - "listStreamsAsync" - ] - }, - "ListStreamObjects": { - "methods": [ - "listStreamObjects", - "listStreamObjectsStream", - "listStreamObjectsAsync" - ] - }, - "FetchStaticIps": { - "methods": [ - "fetchStaticIps", - "fetchStaticIpsStream", - "fetchStaticIpsAsync" - ] - }, - "ListPrivateConnections": { - "methods": [ - "listPrivateConnections", - "listPrivateConnectionsStream", - "listPrivateConnectionsAsync" - ] - }, - "ListRoutes": { - "methods": [ - "listRoutes", - "listRoutesStream", - "listRoutesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "DatastreamClient", - "rpcs": { - "GetConnectionProfile": { - "methods": [ - "getConnectionProfile" - ] - }, - "DiscoverConnectionProfile": { - "methods": [ - "discoverConnectionProfile" - ] - }, - "GetStream": { - "methods": [ - "getStream" - ] - }, - "GetStreamObject": { - "methods": [ - "getStreamObject" - ] - }, - "LookupStreamObject": { - "methods": [ - "lookupStreamObject" - ] - }, - "StartBackfillJob": { - "methods": [ - "startBackfillJob" - ] - }, - "StopBackfillJob": { - "methods": [ - "stopBackfillJob" - ] - }, - "GetPrivateConnection": { - "methods": [ - "getPrivateConnection" - ] - }, - "GetRoute": { - "methods": [ - "getRoute" - ] - }, - "CreateConnectionProfile": { - "methods": [ - "createConnectionProfile" - ] - }, - "UpdateConnectionProfile": { - "methods": [ - "updateConnectionProfile" - ] - }, - "DeleteConnectionProfile": { - "methods": [ - "deleteConnectionProfile" - ] - }, - "CreateStream": { - "methods": [ - "createStream" - ] - }, - "UpdateStream": { - "methods": [ - "updateStream" - ] - }, - "DeleteStream": { - "methods": [ - "deleteStream" - ] - }, - "CreatePrivateConnection": { - "methods": [ - "createPrivateConnection" - ] - }, - "DeletePrivateConnection": { - "methods": [ - "deletePrivateConnection" - ] - }, - "CreateRoute": { - "methods": [ - "createRoute" - ] - }, - "DeleteRoute": { - "methods": [ - "deleteRoute" - ] - }, - "ListConnectionProfiles": { - "methods": [ - "listConnectionProfiles", - "listConnectionProfilesStream", - "listConnectionProfilesAsync" - ] - }, - "ListStreams": { - "methods": [ - "listStreams", - "listStreamsStream", - "listStreamsAsync" - ] - }, - "ListStreamObjects": { - "methods": [ - "listStreamObjects", - "listStreamObjectsStream", - "listStreamObjectsAsync" - ] - }, - "FetchStaticIps": { - "methods": [ - "fetchStaticIps", - "fetchStaticIpsStream", - "fetchStaticIpsAsync" - ] - }, - "ListPrivateConnections": { - "methods": [ - "listPrivateConnections", - "listPrivateConnectionsStream", - "listPrivateConnectionsAsync" - ] - }, - "ListRoutes": { - "methods": [ - "listRoutes", - "listRoutesStream", - "listRoutesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-datastream/v1/src/v1/index.ts b/owl-bot-staging/google-cloud-datastream/v1/src/v1/index.ts deleted file mode 100644 index 37416a69a13..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/src/v1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {DatastreamClient} from './datastream_client'; diff --git a/owl-bot-staging/google-cloud-datastream/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-datastream/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 0c39f11d9bc..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const datastream = require('@google-cloud/datastream'); - -function main() { - const datastreamClient = new datastream.DatastreamClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-datastream/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-datastream/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 9dd67114647..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {DatastreamClient} from '@google-cloud/datastream'; - -// check that the client class type name can be used -function doStuffWithDatastreamClient(client: DatastreamClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const datastreamClient = new DatastreamClient(); - doStuffWithDatastreamClient(datastreamClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-datastream/v1/system-test/install.ts b/owl-bot-staging/google-cloud-datastream/v1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/google-cloud-datastream/v1/test/gapic_datastream_v1.ts b/owl-bot-staging/google-cloud-datastream/v1/test/gapic_datastream_v1.ts deleted file mode 100644 index c8fa53e2ffc..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/test/gapic_datastream_v1.ts +++ /dev/null @@ -1,5201 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as datastreamModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos, IamProtos, LocationProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.DatastreamClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = datastreamModule.v1.DatastreamClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = datastreamModule.v1.DatastreamClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = datastreamModule.v1.DatastreamClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new datastreamModule.v1.DatastreamClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new datastreamModule.v1.DatastreamClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.datastreamStub, undefined); - await client.initialize(); - assert(client.datastreamStub); - }); - - it('has close method for the initialized client', done => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.datastreamStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.datastreamStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new datastreamModule.v1.DatastreamClient({ - 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 datastreamModule.v1.DatastreamClient({ - 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('getConnectionProfile', () => { - it('invokes getConnectionProfile without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetConnectionProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1.ConnectionProfile() - ); - client.innerApiCalls.getConnectionProfile = stubSimpleCall(expectedResponse); - const [response] = await client.getConnectionProfile(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnectionProfile without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetConnectionProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1.ConnectionProfile() - ); - client.innerApiCalls.getConnectionProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConnectionProfile( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1.IConnectionProfile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnectionProfile with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetConnectionProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConnectionProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConnectionProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.getConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnectionProfile with closed client', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetConnectionProfileRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getConnectionProfile(request), expectedError); - }); - }); - - describe('discoverConnectionProfile', () => { - it('invokes discoverConnectionProfile without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DiscoverConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DiscoverConnectionProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1.DiscoverConnectionProfileResponse() - ); - client.innerApiCalls.discoverConnectionProfile = stubSimpleCall(expectedResponse); - const [response] = await client.discoverConnectionProfile(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.discoverConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.discoverConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes discoverConnectionProfile without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DiscoverConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DiscoverConnectionProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1.DiscoverConnectionProfileResponse() - ); - client.innerApiCalls.discoverConnectionProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.discoverConnectionProfile( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1.IDiscoverConnectionProfileResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.discoverConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.discoverConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes discoverConnectionProfile with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DiscoverConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DiscoverConnectionProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.discoverConnectionProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.discoverConnectionProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.discoverConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.discoverConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes discoverConnectionProfile with closed client', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DiscoverConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DiscoverConnectionProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.discoverConnectionProfile(request), expectedError); - }); - }); - - describe('getStream', () => { - it('invokes getStream without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1.Stream() - ); - client.innerApiCalls.getStream = stubSimpleCall(expectedResponse); - const [response] = await client.getStream(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStream without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1.Stream() - ); - client.innerApiCalls.getStream = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getStream( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1.IStream|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStream with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getStream = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getStream(request), expectedError); - const actualRequest = (client.innerApiCalls.getStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStream with closed client', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetStreamRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getStream(request), expectedError); - }); - }); - - describe('getStreamObject', () => { - it('invokes getStreamObject without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetStreamObjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetStreamObjectRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1.StreamObject() - ); - client.innerApiCalls.getStreamObject = stubSimpleCall(expectedResponse); - const [response] = await client.getStreamObject(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getStreamObject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStreamObject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStreamObject without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetStreamObjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetStreamObjectRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1.StreamObject() - ); - client.innerApiCalls.getStreamObject = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getStreamObject( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1.IStreamObject|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getStreamObject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStreamObject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStreamObject with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetStreamObjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetStreamObjectRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getStreamObject = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getStreamObject(request), expectedError); - const actualRequest = (client.innerApiCalls.getStreamObject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStreamObject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStreamObject with closed client', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetStreamObjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetStreamObjectRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getStreamObject(request), expectedError); - }); - }); - - describe('lookupStreamObject', () => { - it('invokes lookupStreamObject without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.LookupStreamObjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.LookupStreamObjectRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1.StreamObject() - ); - client.innerApiCalls.lookupStreamObject = stubSimpleCall(expectedResponse); - const [response] = await client.lookupStreamObject(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.lookupStreamObject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.lookupStreamObject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes lookupStreamObject without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.LookupStreamObjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.LookupStreamObjectRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1.StreamObject() - ); - client.innerApiCalls.lookupStreamObject = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.lookupStreamObject( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1.IStreamObject|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.lookupStreamObject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.lookupStreamObject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes lookupStreamObject with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.LookupStreamObjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.LookupStreamObjectRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.lookupStreamObject = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.lookupStreamObject(request), expectedError); - const actualRequest = (client.innerApiCalls.lookupStreamObject as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.lookupStreamObject as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes lookupStreamObject with closed client', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.LookupStreamObjectRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.LookupStreamObjectRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.lookupStreamObject(request), expectedError); - }); - }); - - describe('startBackfillJob', () => { - it('invokes startBackfillJob without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.StartBackfillJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.StartBackfillJobRequest', ['object']); - request.object = defaultValue1; - const expectedHeaderRequestParams = `object=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1.StartBackfillJobResponse() - ); - client.innerApiCalls.startBackfillJob = stubSimpleCall(expectedResponse); - const [response] = await client.startBackfillJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startBackfillJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startBackfillJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startBackfillJob without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.StartBackfillJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.StartBackfillJobRequest', ['object']); - request.object = defaultValue1; - const expectedHeaderRequestParams = `object=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1.StartBackfillJobResponse() - ); - client.innerApiCalls.startBackfillJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.startBackfillJob( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1.IStartBackfillJobResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.startBackfillJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startBackfillJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startBackfillJob with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.StartBackfillJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.StartBackfillJobRequest', ['object']); - request.object = defaultValue1; - const expectedHeaderRequestParams = `object=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.startBackfillJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.startBackfillJob(request), expectedError); - const actualRequest = (client.innerApiCalls.startBackfillJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.startBackfillJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes startBackfillJob with closed client', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.StartBackfillJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.StartBackfillJobRequest', ['object']); - request.object = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.startBackfillJob(request), expectedError); - }); - }); - - describe('stopBackfillJob', () => { - it('invokes stopBackfillJob without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.StopBackfillJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.StopBackfillJobRequest', ['object']); - request.object = defaultValue1; - const expectedHeaderRequestParams = `object=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1.StopBackfillJobResponse() - ); - client.innerApiCalls.stopBackfillJob = stubSimpleCall(expectedResponse); - const [response] = await client.stopBackfillJob(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopBackfillJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopBackfillJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopBackfillJob without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.StopBackfillJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.StopBackfillJobRequest', ['object']); - request.object = defaultValue1; - const expectedHeaderRequestParams = `object=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1.StopBackfillJobResponse() - ); - client.innerApiCalls.stopBackfillJob = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.stopBackfillJob( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1.IStopBackfillJobResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.stopBackfillJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopBackfillJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopBackfillJob with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.StopBackfillJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.StopBackfillJobRequest', ['object']); - request.object = defaultValue1; - const expectedHeaderRequestParams = `object=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.stopBackfillJob = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.stopBackfillJob(request), expectedError); - const actualRequest = (client.innerApiCalls.stopBackfillJob as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.stopBackfillJob as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes stopBackfillJob with closed client', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.StopBackfillJobRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.StopBackfillJobRequest', ['object']); - request.object = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.stopBackfillJob(request), expectedError); - }); - }); - - describe('getPrivateConnection', () => { - it('invokes getPrivateConnection without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetPrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetPrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1.PrivateConnection() - ); - client.innerApiCalls.getPrivateConnection = stubSimpleCall(expectedResponse); - const [response] = await client.getPrivateConnection(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPrivateConnection without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetPrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetPrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1.PrivateConnection() - ); - client.innerApiCalls.getPrivateConnection = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getPrivateConnection( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1.IPrivateConnection|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPrivateConnection with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetPrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetPrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getPrivateConnection = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getPrivateConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPrivateConnection with closed client', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetPrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetPrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getPrivateConnection(request), expectedError); - }); - }); - - describe('getRoute', () => { - it('invokes getRoute without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetRouteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1.Route() - ); - client.innerApiCalls.getRoute = stubSimpleCall(expectedResponse); - const [response] = await client.getRoute(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoute without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetRouteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1.Route() - ); - client.innerApiCalls.getRoute = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getRoute( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1.IRoute|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoute with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetRouteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getRoute = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getRoute(request), expectedError); - const actualRequest = (client.innerApiCalls.getRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoute with closed client', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.GetRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.GetRouteRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getRoute(request), expectedError); - }); - }); - - describe('createConnectionProfile', () => { - it('invokes createConnectionProfile without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.CreateConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.CreateConnectionProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConnectionProfile = stubLongRunningCall(expectedResponse); - const [operation] = await client.createConnectionProfile(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnectionProfile without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.CreateConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.CreateConnectionProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConnectionProfile = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createConnectionProfile( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnectionProfile with call error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.CreateConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.CreateConnectionProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConnectionProfile = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createConnectionProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.createConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnectionProfile with LRO error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.CreateConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.CreateConnectionProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConnectionProfile = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createConnectionProfile(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateConnectionProfileProgress without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkCreateConnectionProfileProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateConnectionProfileProgress with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkCreateConnectionProfileProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateConnectionProfile', () => { - it('invokes updateConnectionProfile without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.UpdateConnectionProfileRequest() - ); - request.connectionProfile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.UpdateConnectionProfileRequest', ['connectionProfile', 'name']); - request.connectionProfile.name = defaultValue1; - const expectedHeaderRequestParams = `connection_profile.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateConnectionProfile = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateConnectionProfile(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConnectionProfile without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.UpdateConnectionProfileRequest() - ); - request.connectionProfile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.UpdateConnectionProfileRequest', ['connectionProfile', 'name']); - request.connectionProfile.name = defaultValue1; - const expectedHeaderRequestParams = `connection_profile.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateConnectionProfile = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateConnectionProfile( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConnectionProfile with call error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.UpdateConnectionProfileRequest() - ); - request.connectionProfile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.UpdateConnectionProfileRequest', ['connectionProfile', 'name']); - request.connectionProfile.name = defaultValue1; - const expectedHeaderRequestParams = `connection_profile.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateConnectionProfile = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateConnectionProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.updateConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConnectionProfile with LRO error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.UpdateConnectionProfileRequest() - ); - request.connectionProfile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.UpdateConnectionProfileRequest', ['connectionProfile', 'name']); - request.connectionProfile.name = defaultValue1; - const expectedHeaderRequestParams = `connection_profile.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateConnectionProfile = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateConnectionProfile(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateConnectionProfileProgress without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkUpdateConnectionProfileProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateConnectionProfileProgress with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkUpdateConnectionProfileProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteConnectionProfile', () => { - it('invokes deleteConnectionProfile without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DeleteConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DeleteConnectionProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConnectionProfile = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteConnectionProfile(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnectionProfile without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DeleteConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DeleteConnectionProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConnectionProfile = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteConnectionProfile( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnectionProfile with call error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DeleteConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DeleteConnectionProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConnectionProfile = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteConnectionProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnectionProfile with LRO error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DeleteConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DeleteConnectionProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConnectionProfile = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteConnectionProfile(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteConnectionProfileProgress without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkDeleteConnectionProfileProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteConnectionProfileProgress with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkDeleteConnectionProfileProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createStream', () => { - it('invokes createStream without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.CreateStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.CreateStreamRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createStream = stubLongRunningCall(expectedResponse); - const [operation] = await client.createStream(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createStream without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.CreateStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.CreateStreamRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createStream = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createStream( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createStream with call error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.CreateStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.CreateStreamRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createStream = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createStream(request), expectedError); - const actualRequest = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createStream with LRO error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.CreateStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.CreateStreamRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createStream = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createStream(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateStreamProgress without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkCreateStreamProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateStreamProgress with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkCreateStreamProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateStream', () => { - it('invokes updateStream without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.UpdateStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.UpdateStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedHeaderRequestParams = `stream.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateStream = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateStream(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateStream without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.UpdateStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.UpdateStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedHeaderRequestParams = `stream.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateStream = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateStream( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateStream with call error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.UpdateStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.UpdateStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedHeaderRequestParams = `stream.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateStream = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateStream(request), expectedError); - const actualRequest = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateStream with LRO error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.UpdateStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.UpdateStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedHeaderRequestParams = `stream.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateStream = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateStream(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateStreamProgress without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkUpdateStreamProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateStreamProgress with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkUpdateStreamProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteStream', () => { - it('invokes deleteStream without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DeleteStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DeleteStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteStream = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteStream(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteStream without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DeleteStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DeleteStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteStream = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteStream( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteStream with call error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DeleteStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DeleteStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteStream = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteStream(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteStream with LRO error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DeleteStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DeleteStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteStream = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteStream(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteStreamProgress without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkDeleteStreamProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteStreamProgress with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkDeleteStreamProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createPrivateConnection', () => { - it('invokes createPrivateConnection without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.CreatePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.CreatePrivateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPrivateConnection = stubLongRunningCall(expectedResponse); - const [operation] = await client.createPrivateConnection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPrivateConnection without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.CreatePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.CreatePrivateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPrivateConnection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createPrivateConnection( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPrivateConnection with call error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.CreatePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.CreatePrivateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPrivateConnection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createPrivateConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPrivateConnection with LRO error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.CreatePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.CreatePrivateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPrivateConnection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createPrivateConnection(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreatePrivateConnectionProgress without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkCreatePrivateConnectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreatePrivateConnectionProgress with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkCreatePrivateConnectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deletePrivateConnection', () => { - it('invokes deletePrivateConnection without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DeletePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DeletePrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(expectedResponse); - const [operation] = await client.deletePrivateConnection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePrivateConnection without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DeletePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DeletePrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePrivateConnection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deletePrivateConnection( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePrivateConnection with call error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DeletePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DeletePrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deletePrivateConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePrivateConnection with LRO error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DeletePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DeletePrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deletePrivateConnection(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeletePrivateConnectionProgress without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkDeletePrivateConnectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeletePrivateConnectionProgress with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkDeletePrivateConnectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createRoute', () => { - it('invokes createRoute without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.CreateRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.CreateRouteRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createRoute = stubLongRunningCall(expectedResponse); - const [operation] = await client.createRoute(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRoute without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.CreateRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.CreateRouteRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createRoute = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createRoute( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRoute with call error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.CreateRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.CreateRouteRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createRoute = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createRoute(request), expectedError); - const actualRequest = (client.innerApiCalls.createRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRoute with LRO error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.CreateRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.CreateRouteRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createRoute = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createRoute(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateRouteProgress without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkCreateRouteProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateRouteProgress with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkCreateRouteProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteRoute', () => { - it('invokes deleteRoute without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DeleteRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DeleteRouteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteRoute = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteRoute(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoute without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DeleteRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DeleteRouteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteRoute = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteRoute( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoute with call error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DeleteRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DeleteRouteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRoute = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteRoute(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoute with LRO error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.DeleteRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.DeleteRouteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRoute = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteRoute(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteRouteProgress without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkDeleteRouteProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteRouteProgress with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - 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.checkDeleteRouteProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listConnectionProfiles', () => { - it('invokes listConnectionProfiles without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListConnectionProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListConnectionProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), - generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), - generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), - ]; - client.innerApiCalls.listConnectionProfiles = stubSimpleCall(expectedResponse); - const [response] = await client.listConnectionProfiles(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConnectionProfiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnectionProfiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnectionProfiles without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListConnectionProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListConnectionProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), - generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), - generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), - ]; - client.innerApiCalls.listConnectionProfiles = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listConnectionProfiles( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1.IConnectionProfile[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConnectionProfiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnectionProfiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnectionProfiles with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListConnectionProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListConnectionProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listConnectionProfiles = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConnectionProfiles(request), expectedError); - const actualRequest = (client.innerApiCalls.listConnectionProfiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnectionProfiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnectionProfilesStream without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListConnectionProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListConnectionProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), - generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), - generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), - ]; - client.descriptors.page.listConnectionProfiles.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listConnectionProfilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.datastream.v1.ConnectionProfile[] = []; - stream.on('data', (response: protos.google.cloud.datastream.v1.ConnectionProfile) => { - 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.listConnectionProfiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConnectionProfiles, request)); - assert( - (client.descriptors.page.listConnectionProfiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listConnectionProfilesStream with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListConnectionProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListConnectionProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConnectionProfiles.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listConnectionProfilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.datastream.v1.ConnectionProfile[] = []; - stream.on('data', (response: protos.google.cloud.datastream.v1.ConnectionProfile) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listConnectionProfiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConnectionProfiles, request)); - assert( - (client.descriptors.page.listConnectionProfiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConnectionProfiles without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListConnectionProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListConnectionProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), - generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), - generateSampleMessage(new protos.google.cloud.datastream.v1.ConnectionProfile()), - ]; - client.descriptors.page.listConnectionProfiles.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.datastream.v1.IConnectionProfile[] = []; - const iterable = client.listConnectionProfilesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listConnectionProfiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConnectionProfiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConnectionProfiles with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListConnectionProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListConnectionProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConnectionProfiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listConnectionProfilesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.datastream.v1.IConnectionProfile[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listConnectionProfiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConnectionProfiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listStreams', () => { - it('invokes listStreams without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), - generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), - generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), - ]; - client.innerApiCalls.listStreams = stubSimpleCall(expectedResponse); - const [response] = await client.listStreams(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listStreams as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStreams as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStreams without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), - generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), - generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), - ]; - client.innerApiCalls.listStreams = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listStreams( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1.IStream[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listStreams as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStreams as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStreams with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listStreams = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listStreams(request), expectedError); - const actualRequest = (client.innerApiCalls.listStreams as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStreams as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStreamsStream without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), - generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), - generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), - ]; - client.descriptors.page.listStreams.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listStreamsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.datastream.v1.Stream[] = []; - stream.on('data', (response: protos.google.cloud.datastream.v1.Stream) => { - 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.listStreams.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listStreams, request)); - assert( - (client.descriptors.page.listStreams.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listStreamsStream with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listStreams.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listStreamsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.datastream.v1.Stream[] = []; - stream.on('data', (response: protos.google.cloud.datastream.v1.Stream) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listStreams.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listStreams, request)); - assert( - (client.descriptors.page.listStreams.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listStreams without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), - generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), - generateSampleMessage(new protos.google.cloud.datastream.v1.Stream()), - ]; - client.descriptors.page.listStreams.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.datastream.v1.IStream[] = []; - const iterable = client.listStreamsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listStreams.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listStreams.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listStreams with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listStreams.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listStreamsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.datastream.v1.IStream[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listStreams.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listStreams.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listStreamObjects', () => { - it('invokes listStreamObjects without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListStreamObjectsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamObjectsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), - generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), - generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), - ]; - client.innerApiCalls.listStreamObjects = stubSimpleCall(expectedResponse); - const [response] = await client.listStreamObjects(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listStreamObjects as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStreamObjects as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStreamObjects without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListStreamObjectsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamObjectsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), - generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), - generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), - ]; - client.innerApiCalls.listStreamObjects = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listStreamObjects( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1.IStreamObject[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listStreamObjects as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStreamObjects as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStreamObjects with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListStreamObjectsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamObjectsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listStreamObjects = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listStreamObjects(request), expectedError); - const actualRequest = (client.innerApiCalls.listStreamObjects as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStreamObjects as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStreamObjectsStream without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListStreamObjectsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamObjectsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), - generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), - generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), - ]; - client.descriptors.page.listStreamObjects.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listStreamObjectsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.datastream.v1.StreamObject[] = []; - stream.on('data', (response: protos.google.cloud.datastream.v1.StreamObject) => { - 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.listStreamObjects.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listStreamObjects, request)); - assert( - (client.descriptors.page.listStreamObjects.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listStreamObjectsStream with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListStreamObjectsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamObjectsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listStreamObjects.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listStreamObjectsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.datastream.v1.StreamObject[] = []; - stream.on('data', (response: protos.google.cloud.datastream.v1.StreamObject) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listStreamObjects.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listStreamObjects, request)); - assert( - (client.descriptors.page.listStreamObjects.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listStreamObjects without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListStreamObjectsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamObjectsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), - generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), - generateSampleMessage(new protos.google.cloud.datastream.v1.StreamObject()), - ]; - client.descriptors.page.listStreamObjects.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.datastream.v1.IStreamObject[] = []; - const iterable = client.listStreamObjectsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listStreamObjects.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listStreamObjects.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listStreamObjects with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListStreamObjectsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListStreamObjectsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listStreamObjects.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listStreamObjectsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.datastream.v1.IStreamObject[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listStreamObjects.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listStreamObjects.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('fetchStaticIps', () => { - it('invokes fetchStaticIps without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.FetchStaticIpsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.FetchStaticIpsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [new String(), new String(), new String()]; - client.innerApiCalls.fetchStaticIps = stubSimpleCall(expectedResponse); - const [response] = await client.fetchStaticIps(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchStaticIps as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchStaticIps as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchStaticIps without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.FetchStaticIpsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.FetchStaticIpsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [new String(), new String(), new String()]; - client.innerApiCalls.fetchStaticIps = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fetchStaticIps( - request, - (err?: Error|null, result?: string[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchStaticIps as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchStaticIps as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchStaticIps with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.FetchStaticIpsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.FetchStaticIpsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.fetchStaticIps = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.fetchStaticIps(request), expectedError); - const actualRequest = (client.innerApiCalls.fetchStaticIps as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchStaticIps as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchStaticIpsStream without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.FetchStaticIpsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.FetchStaticIpsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [new String(), new String(), new String()]; - client.descriptors.page.fetchStaticIps.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.fetchStaticIpsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: string[] = []; - stream.on('data', (response: string) => { - 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.fetchStaticIps.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.fetchStaticIps, request)); - assert( - (client.descriptors.page.fetchStaticIps.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes fetchStaticIpsStream with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.FetchStaticIpsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.FetchStaticIpsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.fetchStaticIps.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.fetchStaticIpsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: string[] = []; - stream.on('data', (response: string) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.fetchStaticIps.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.fetchStaticIps, request)); - assert( - (client.descriptors.page.fetchStaticIps.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with fetchStaticIps without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.FetchStaticIpsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.FetchStaticIpsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [new String(), new String(), new String()]; - client.descriptors.page.fetchStaticIps.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: string[] = []; - const iterable = client.fetchStaticIpsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.fetchStaticIps.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.fetchStaticIps.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with fetchStaticIps with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.FetchStaticIpsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.FetchStaticIpsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.fetchStaticIps.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.fetchStaticIpsAsync(request); - await assert.rejects(async () => { - const responses: string[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.fetchStaticIps.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.fetchStaticIps.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listPrivateConnections', () => { - it('invokes listPrivateConnections without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), - ]; - client.innerApiCalls.listPrivateConnections = stubSimpleCall(expectedResponse); - const [response] = await client.listPrivateConnections(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPrivateConnections without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), - ]; - client.innerApiCalls.listPrivateConnections = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPrivateConnections( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1.IPrivateConnection[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPrivateConnections with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPrivateConnections = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPrivateConnections(request), expectedError); - const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPrivateConnectionsStream without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), - ]; - client.descriptors.page.listPrivateConnections.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listPrivateConnectionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.datastream.v1.PrivateConnection[] = []; - stream.on('data', (response: protos.google.cloud.datastream.v1.PrivateConnection) => { - 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.listPrivateConnections.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPrivateConnections, request)); - assert( - (client.descriptors.page.listPrivateConnections.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listPrivateConnectionsStream with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPrivateConnections.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listPrivateConnectionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.datastream.v1.PrivateConnection[] = []; - stream.on('data', (response: protos.google.cloud.datastream.v1.PrivateConnection) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listPrivateConnections.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPrivateConnections, request)); - assert( - (client.descriptors.page.listPrivateConnections.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPrivateConnections without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.datastream.v1.PrivateConnection()), - ]; - client.descriptors.page.listPrivateConnections.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.datastream.v1.IPrivateConnection[] = []; - const iterable = client.listPrivateConnectionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPrivateConnections with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPrivateConnections.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPrivateConnectionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.datastream.v1.IPrivateConnection[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listRoutes', () => { - it('invokes listRoutes without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), - generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), - generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), - ]; - client.innerApiCalls.listRoutes = stubSimpleCall(expectedResponse); - const [response] = await client.listRoutes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRoutes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRoutes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRoutes without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), - generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), - generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), - ]; - client.innerApiCalls.listRoutes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRoutes( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1.IRoute[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRoutes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRoutes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRoutes with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listRoutes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRoutes(request), expectedError); - const actualRequest = (client.innerApiCalls.listRoutes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRoutes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRoutesStream without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), - generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), - generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), - ]; - client.descriptors.page.listRoutes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRoutesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.datastream.v1.Route[] = []; - stream.on('data', (response: protos.google.cloud.datastream.v1.Route) => { - 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.listRoutes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRoutes, request)); - assert( - (client.descriptors.page.listRoutes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listRoutesStream with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRoutes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRoutesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.datastream.v1.Route[] = []; - stream.on('data', (response: protos.google.cloud.datastream.v1.Route) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listRoutes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRoutes, request)); - assert( - (client.descriptors.page.listRoutes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRoutes without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), - generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), - generateSampleMessage(new protos.google.cloud.datastream.v1.Route()), - ]; - client.descriptors.page.listRoutes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.datastream.v1.IRoute[] = []; - const iterable = client.listRoutesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listRoutes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRoutes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRoutes with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1.ListRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1.ListRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRoutes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRoutesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.datastream.v1.IRoute[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listRoutes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRoutes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.getIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getIamPolicy without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.getIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes getIamPolicy with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.GetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = stubSimpleCall(expectedResponse); - const response = await client.setIamPolicy(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes setIamPolicy without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.Policy() - ); - client.iamClient.setIamPolicy = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.Policy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0)); - }); - it('invokes setIamPolicy with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.SetIamPolicyRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request, expectedOptions), expectedError); - assert((client.iamClient.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = stubSimpleCall(expectedResponse); - const response = await client.testIamPermissions(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes testIamPermissions without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsResponse() - ); - client.iamClient.testIamPermissions = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - expectedOptions, - (err?: Error|null, result?: IamProtos.google.iam.v1.TestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0)); - }); - it('invokes testIamPermissions with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new IamProtos.google.iam.v1.TestIamPermissionsRequest() - ); - request.resource = ''; - const expectedHeaderRequestParams = 'resource='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.iamClient.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request, expectedOptions), expectedError); - assert((client.iamClient.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('getLocation', () => { - it('invokes getLocation without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = stubSimpleCall(expectedResponse); - const response = await client.getLocation(request, expectedOptions); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - it('invokes getLocation without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ); - client.locationsClient.getLocation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getLocation( - request, - expectedOptions, - ( - err?: Error | null, - result?: LocationProtos.google.cloud.location.ILocation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0)); - }); - it('invokes getLocation with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.GetLocationRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.locationsClient.getLocation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getLocation(request, expectedOptions), expectedError); - assert((client.locationsClient.getLocation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - describe('listLocationsAsync', () => { - it('uses async iteration with listLocations without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedResponse = [ - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - generateSampleMessage( - new LocationProtos.google.cloud.location.Location() - ), - ]; - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - const iterable = client.listLocationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - it('uses async iteration with listLocations with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new LocationProtos.google.cloud.location.ListLocationsRequest() - ); - request.name = ''; - const expectedHeaderRequestParams = 'name='; - const expectedError = new Error('expected'); - client.locationsClient.descriptors.page.listLocations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listLocationsAsync(request); - await assert.rejects(async () => { - const responses: LocationProtos.google.cloud.location.ILocation[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.locationsClient.descriptors.page.listLocations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - describe('getOperation', () => { - it('invokes getOperation without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = stubSimpleCall(expectedResponse); - const response = await client.getOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes getOperation without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new operationsProtos.google.longrunning.Operation() - ); - client.operationsClient.getOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.getOperation( - request, - undefined, - ( - err?: Error | null, - result?: operationsProtos.google.longrunning.Operation | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - it('invokes getOperation with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.GetOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.getOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.getOperation(request)}, expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('cancelOperation', () => { - it('invokes cancelOperation without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = stubSimpleCall(expectedResponse); - const response = await client.cancelOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes cancelOperation without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.cancelOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.cancelOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0)); - }); - it('invokes cancelOperation with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.CancelOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.cancelOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.cancelOperation(request)}, expectedError); - assert((client.operationsClient.cancelOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('deleteOperation', () => { - it('invokes deleteOperation without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = stubSimpleCall(expectedResponse); - const response = await client.deleteOperation(request); - assert.deepStrictEqual(response, [expectedResponse]); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request) - ); - }); - it('invokes deleteOperation without error using callback', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedResponse = generateSampleMessage( - new protos.google.protobuf.Empty() - ); - client.operationsClient.deleteOperation = sinon.stub().callsArgWith(2, null, expectedResponse); - const promise = new Promise((resolve, reject) => { - client.operationsClient.deleteOperation( - request, - undefined, - ( - err?: Error | null, - result?: protos.google.protobuf.Empty | null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0)); - }); - it('invokes deleteOperation with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.DeleteOperationRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.deleteOperation = stubSimpleCall(undefined, expectedError); - await assert.rejects(async () => {await client.deleteOperation(request)}, expectedError); - assert((client.operationsClient.deleteOperation as SinonStub) - .getCall(0).calledWith(request)); - }); - }); - describe('listOperationsAsync', () => { - it('uses async iteration with listOperations without error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedResponse = [ - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsResponse() - ), - ]; - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - const iterable = client.operationsClient.listOperationsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - it('uses async iteration with listOperations with error', async () => { - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new operationsProtos.google.longrunning.ListOperationsRequest() - ); - const expectedError = new Error('expected'); - client.operationsClient.descriptor.listOperations.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.operationsClient.listOperationsAsync(request); - await assert.rejects(async () => { - const responses: operationsProtos.google.longrunning.ListOperationsResponse[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.operationsClient.descriptor.listOperations.asyncIterate as SinonStub) - .getCall(0).args[1], request); - }); - }); - - describe('Path templates', () => { - - describe('connectionProfile', () => { - const fakePath = "/rendered/path/connectionProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - connection_profile: "connectionProfileValue", - }; - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.connectionProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.connectionProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('connectionProfilePath', () => { - const result = client.connectionProfilePath("projectValue", "locationValue", "connectionProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.connectionProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConnectionProfileName', () => { - const result = client.matchProjectFromConnectionProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.connectionProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConnectionProfileName', () => { - const result = client.matchLocationFromConnectionProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.connectionProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConnectionProfileFromConnectionProfileName', () => { - const result = client.matchConnectionProfileFromConnectionProfileName(fakePath); - assert.strictEqual(result, "connectionProfileValue"); - assert((client.pathTemplates.connectionProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('privateConnection', () => { - const fakePath = "/rendered/path/privateConnection"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_connection: "privateConnectionValue", - }; - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.privateConnectionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.privateConnectionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('privateConnectionPath', () => { - const result = client.privateConnectionPath("projectValue", "locationValue", "privateConnectionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.privateConnectionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPrivateConnectionName', () => { - const result = client.matchProjectFromPrivateConnectionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPrivateConnectionName', () => { - const result = client.matchLocationFromPrivateConnectionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateConnectionFromPrivateConnectionName', () => { - const result = client.matchPrivateConnectionFromPrivateConnectionName(fakePath); - assert.strictEqual(result, "privateConnectionValue"); - assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new datastreamModule.v1.DatastreamClient({ - 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('route', () => { - const fakePath = "/rendered/path/route"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_connection: "privateConnectionValue", - route: "routeValue", - }; - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.routePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.routePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('routePath', () => { - const result = client.routePath("projectValue", "locationValue", "privateConnectionValue", "routeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.routePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRouteName', () => { - const result = client.matchProjectFromRouteName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.routePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromRouteName', () => { - const result = client.matchLocationFromRouteName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.routePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateConnectionFromRouteName', () => { - const result = client.matchPrivateConnectionFromRouteName(fakePath); - assert.strictEqual(result, "privateConnectionValue"); - assert((client.pathTemplates.routePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRouteFromRouteName', () => { - const result = client.matchRouteFromRouteName(fakePath); - assert.strictEqual(result, "routeValue"); - assert((client.pathTemplates.routePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('stream', () => { - const fakePath = "/rendered/path/stream"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - stream: "streamValue", - }; - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.streamPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.streamPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('streamPath', () => { - const result = client.streamPath("projectValue", "locationValue", "streamValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.streamPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromStreamName', () => { - const result = client.matchProjectFromStreamName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromStreamName', () => { - const result = client.matchLocationFromStreamName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchStreamFromStreamName', () => { - const result = client.matchStreamFromStreamName(fakePath); - assert.strictEqual(result, "streamValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('streamObject', () => { - const fakePath = "/rendered/path/streamObject"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - stream: "streamValue", - object: "objectValue", - }; - const client = new datastreamModule.v1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.streamObjectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.streamObjectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('streamObjectPath', () => { - const result = client.streamObjectPath("projectValue", "locationValue", "streamValue", "objectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.streamObjectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromStreamObjectName', () => { - const result = client.matchProjectFromStreamObjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.streamObjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromStreamObjectName', () => { - const result = client.matchLocationFromStreamObjectName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.streamObjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchStreamFromStreamObjectName', () => { - const result = client.matchStreamFromStreamObjectName(fakePath); - assert.strictEqual(result, "streamValue"); - assert((client.pathTemplates.streamObjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchObjectFromStreamObjectName', () => { - const result = client.matchObjectFromStreamObjectName(fakePath); - assert.strictEqual(result, "objectValue"); - assert((client.pathTemplates.streamObjectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-datastream/v1/tsconfig.json b/owl-bot-staging/google-cloud-datastream/v1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/google-cloud-datastream/v1/webpack.config.js b/owl-bot-staging/google-cloud-datastream/v1/webpack.config.js deleted file mode 100644 index ce71b478c09..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'Datastream', - filename: './datastream.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/.eslintignore b/owl-bot-staging/google-cloud-datastream/v1alpha1/.eslintignore deleted file mode 100644 index cfc348ec4d1..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/.eslintrc.json b/owl-bot-staging/google-cloud-datastream/v1alpha1/.eslintrc.json deleted file mode 100644 index 78215349546..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/.gitignore b/owl-bot-staging/google-cloud-datastream/v1alpha1/.gitignore deleted file mode 100644 index d4f03a0df2e..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.log -**/node_modules -/.coverage -/coverage -/.nyc_output -/docs/ -/out/ -/build/ -system-test/secrets.js -system-test/*key.json -*.lock -.DS_Store -package-lock.json -__pycache__ diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/.jsdoc.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/.jsdoc.js deleted file mode 100644 index cb79c804665..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2023 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/datastream', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/.mocharc.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/.mocharc.js deleted file mode 100644 index 1a38f257db7..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/.prettierrc.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/.prettierrc.js deleted file mode 100644 index 55639e70f9e..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/README.md b/owl-bot-staging/google-cloud-datastream/v1alpha1/README.md deleted file mode 100644 index a7903c0b77c..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/README.md +++ /dev/null @@ -1 +0,0 @@ -Datastream: Nodejs Client diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/linkinator.config.json b/owl-bot-staging/google-cloud-datastream/v1alpha1/linkinator.config.json deleted file mode 100644 index befd23c8633..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/linkinator.config.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io", - "https://console.cloud.google.com/cloudshell", - "https://support.google.com" - ], - "silent": true, - "concurrency": 5, - "retry": true, - "retryErrors": true, - "retryErrorsCount": 5, - "retryErrorsJitter": 3000 -} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/package.json b/owl-bot-staging/google-cloud-datastream/v1alpha1/package.json deleted file mode 100644 index fbd522f5bde..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/datastream", - "version": "0.1.0", - "description": "Datastream client for Node.js", - "repository": "googleapis/nodejs-datastream", - "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 datastream", - "datastream", - "datastream" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/ && minifyProtoJson", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.5.7" - }, - "devDependencies": { - "@types/mocha": "^10.0.1", - "@types/node": "^18.11.18", - "@types/sinon": "^10.0.13", - "c8": "^7.12.0", - "gts": "^3.1.1", - "jsdoc": "^4.0.0", - "jsdoc-fresh": "^2.0.1", - "jsdoc-region-tag": "^2.0.1", - "linkinator": "^4.1.2", - "mocha": "^10.2.0", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^15.0.1", - "ts-loader": "^8.4.0", - "typescript": "^4.8.4", - "webpack": "^4.46.0", - "webpack-cli": "^4.10.0" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/protos/google/cloud/datastream/v1alpha1/datastream.proto b/owl-bot-staging/google-cloud-datastream/v1alpha1/protos/google/cloud/datastream/v1alpha1/datastream.proto deleted file mode 100644 index 14dac8fe5b5..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/protos/google/cloud/datastream/v1alpha1/datastream.proto +++ /dev/null @@ -1,895 +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.cloud.datastream.v1alpha1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/datastream/v1alpha1/datastream_resources.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.Datastream.V1Alpha1"; -option go_package = "cloud.google.com/go/datastream/apiv1alpha1/datastreampb;datastreampb"; -option java_multiple_files = true; -option java_outer_classname = "CloudDatastreamServiceProto"; -option java_package = "com.google.cloud.datastream.v1alpha1"; -option php_namespace = "Google\\Cloud\\Datastream\\V1alpha1"; -option ruby_package = "Google::Cloud::Datastream::V1alpha1"; - -// Datastream service -service Datastream { - option (google.api.default_host) = "datastream.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Use this method to list connection profiles created in a project and - // location. - rpc ListConnectionProfiles(ListConnectionProfilesRequest) returns (ListConnectionProfilesResponse) { - option (google.api.http) = { - get: "/v1alpha1/{parent=projects/*/locations/*}/connectionProfiles" - }; - option (google.api.method_signature) = "parent"; - } - - // Use this method to get details about a connection profile. - rpc GetConnectionProfile(GetConnectionProfileRequest) returns (ConnectionProfile) { - option (google.api.http) = { - get: "/v1alpha1/{name=projects/*/locations/*/connectionProfiles/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Use this method to create a connection profile in a project and location. - rpc CreateConnectionProfile(CreateConnectionProfileRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha1/{parent=projects/*/locations/*}/connectionProfiles" - body: "connection_profile" - }; - option (google.api.method_signature) = "parent,connection_profile,connection_profile_id"; - option (google.longrunning.operation_info) = { - response_type: "ConnectionProfile" - metadata_type: "OperationMetadata" - }; - } - - // Use this method to update the parameters of a connection profile. - rpc UpdateConnectionProfile(UpdateConnectionProfileRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1alpha1/{connection_profile.name=projects/*/locations/*/connectionProfiles/*}" - body: "connection_profile" - }; - option (google.api.method_signature) = "connection_profile,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "ConnectionProfile" - metadata_type: "OperationMetadata" - }; - } - - // Use this method to delete a connection profile.. - rpc DeleteConnectionProfile(DeleteConnectionProfileRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1alpha1/{name=projects/*/locations/*/connectionProfiles/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Use this method to discover a connection profile. - // The discover API call exposes the data objects and metadata belonging to - // the profile. Typically, a request returns children data objects under a - // parent data object that's optionally supplied in the request. - rpc DiscoverConnectionProfile(DiscoverConnectionProfileRequest) returns (DiscoverConnectionProfileResponse) { - option (google.api.http) = { - post: "/v1alpha1/{parent=projects/*/locations/*}/connectionProfiles:discover" - body: "*" - }; - } - - // Use this method to list streams in a project and location. - rpc ListStreams(ListStreamsRequest) returns (ListStreamsResponse) { - option (google.api.http) = { - get: "/v1alpha1/{parent=projects/*/locations/*}/streams" - }; - option (google.api.method_signature) = "parent"; - } - - // Use this method to get details about a stream. - rpc GetStream(GetStreamRequest) returns (Stream) { - option (google.api.http) = { - get: "/v1alpha1/{name=projects/*/locations/*/streams/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Use this method to create a stream. - rpc CreateStream(CreateStreamRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha1/{parent=projects/*/locations/*}/streams" - body: "stream" - }; - option (google.api.method_signature) = "parent,stream,stream_id"; - option (google.longrunning.operation_info) = { - response_type: "Stream" - metadata_type: "OperationMetadata" - }; - } - - // Use this method to update the configuration of a stream. - rpc UpdateStream(UpdateStreamRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1alpha1/{stream.name=projects/*/locations/*/streams/*}" - body: "stream" - }; - option (google.api.method_signature) = "stream,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Stream" - metadata_type: "OperationMetadata" - }; - } - - // Use this method to delete a stream. - rpc DeleteStream(DeleteStreamRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1alpha1/{name=projects/*/locations/*/streams/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Use this method to fetch any errors associated with a stream. - rpc FetchErrors(FetchErrorsRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha1/{stream=projects/*/locations/*/streams/*}:fetchErrors" - body: "*" - }; - option (google.longrunning.operation_info) = { - response_type: "FetchErrorsResponse" - metadata_type: "OperationMetadata" - }; - } - - // The FetchStaticIps API call exposes the static ips used by Datastream. - // Typically, a request returns children data objects under - // a parent data object that's optionally supplied in the request. - rpc FetchStaticIps(FetchStaticIpsRequest) returns (FetchStaticIpsResponse) { - option (google.api.http) = { - get: "/v1alpha1/{name=projects/*/locations/*}:fetchStaticIps" - }; - option (google.api.method_signature) = "name"; - } - - // Use this method to create a private connectivity configuration. - rpc CreatePrivateConnection(CreatePrivateConnectionRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha1/{parent=projects/*/locations/*}/privateConnections" - body: "private_connection" - }; - option (google.api.method_signature) = "parent,private_connection,private_connection_id"; - option (google.longrunning.operation_info) = { - response_type: "PrivateConnection" - metadata_type: "OperationMetadata" - }; - } - - // Use this method to get details about a private connectivity configuration. - rpc GetPrivateConnection(GetPrivateConnectionRequest) returns (PrivateConnection) { - option (google.api.http) = { - get: "/v1alpha1/{name=projects/*/locations/*/privateConnections/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Use this method to list private connectivity configurations in a project - // and location. - rpc ListPrivateConnections(ListPrivateConnectionsRequest) returns (ListPrivateConnectionsResponse) { - option (google.api.http) = { - get: "/v1alpha1/{parent=projects/*/locations/*}/privateConnections" - }; - option (google.api.method_signature) = "parent"; - } - - // Use this method to delete a private connectivity configuration. - rpc DeletePrivateConnection(DeletePrivateConnectionRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1alpha1/{name=projects/*/locations/*/privateConnections/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Use this method to create a route for a private connectivity in a project - // and location. - rpc CreateRoute(CreateRouteRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha1/{parent=projects/*/locations/*/privateConnections/*}/routes" - body: "route" - }; - option (google.api.method_signature) = "parent,route,route_id"; - option (google.longrunning.operation_info) = { - response_type: "Route" - metadata_type: "OperationMetadata" - }; - } - - // Use this method to get details about a route. - rpc GetRoute(GetRouteRequest) returns (Route) { - option (google.api.http) = { - get: "/v1alpha1/{name=projects/*/locations/*/privateConnections/*/routes/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Use this method to list routes created for a private connectivity in a - // project and location. - rpc ListRoutes(ListRoutesRequest) returns (ListRoutesResponse) { - option (google.api.http) = { - get: "/v1alpha1/{parent=projects/*/locations/*/privateConnections/*}/routes" - }; - option (google.api.method_signature) = "parent"; - } - - // Use this method to delete a route. - rpc DeleteRoute(DeleteRouteRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1alpha1/{name=projects/*/locations/*/privateConnections/*/routes/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } -} - -// Request message for 'discover' ConnectionProfile request. -message DiscoverConnectionProfileRequest { - // Required. The parent resource of the ConnectionProfile type. Must be in the - // format `projects/*/locations/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/ConnectionProfile" - } - ]; - - // The connection profile on which to run discover. - oneof target { - // An ad-hoc ConnectionProfile configuration. - ConnectionProfile connection_profile = 200; - - // A reference to an existing ConnectionProfile. - string connection_profile_name = 201; - } - - oneof depth { - // Whether to retrieve the full hierarchy of data objects (TRUE) or only the - // current level (FALSE). - bool recursive = 3; - - // The number of hierarchy levels below the current level to be retrieved. - int32 recursion_depth = 4; - } - - // The data object to enrich with child data objects and metadata. - oneof data_object { - // Oracle RDBMS to enrich with child data objects and metadata. - OracleRdbms oracle_rdbms = 100; - - // MySQL RDBMS to enrich with child data objects and metadata. - MysqlRdbms mysql_rdbms = 101; - } -} - -message DiscoverConnectionProfileResponse { - // The data object that has been enriched by the discover API call. - oneof data_object { - // Enriched Oracle RDBMS object. - OracleRdbms oracle_rdbms = 100; - - // Enriched MySQL RDBMS object. - MysqlRdbms mysql_rdbms = 101; - } -} - -// Request message for 'FetchStaticIps' request. -message FetchStaticIpsRequest { - // Required. The name resource of the Response type. Must be in the - // format `projects/*/locations/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Maximum number of Ips to return, will likely not be specified. - int32 page_size = 2; - - // A page token, received from a previous `ListStaticIps` call. - // will likely not be specified. - string page_token = 3; -} - -// Response message for a 'FetchStaticIps' response. -message FetchStaticIpsResponse { - // list of static ips by account - repeated string static_ips = 1; - - // A token that can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// Request message for 'FetchErrors' request. -message FetchErrorsRequest { - // Name of the Stream resource for which to fetch any errors. - string stream = 1 [(google.api.resource_reference) = { - type: "datastream.googleapis.com/Stream" - }]; -} - -// Response message for a 'FetchErrors' response. -message FetchErrorsResponse { - // The list of errors on the Stream. - repeated Error errors = 1; -} - -message ListConnectionProfilesRequest { - // Required. The parent that owns the collection of connection profiles. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/ConnectionProfile" - } - ]; - - // Maximum number of connection profiles to return. - // If unspecified, at most 50 connection profiles will be returned. - // The maximum value is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // Page token received from a previous `ListConnectionProfiles` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListConnectionProfiles` - // must match the call that provided the page token. - string page_token = 3; - - // Filter request. - string filter = 4; - - // Order by fields for the result. - string order_by = 5; -} - -message ListConnectionProfilesResponse { - // List of connection profiles. - repeated ConnectionProfile connection_profiles = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -message GetConnectionProfileRequest { - // Required. The name of the connection profile resource to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/ConnectionProfile" - } - ]; -} - -message CreateConnectionProfileRequest { - // Required. The parent that owns the collection of ConnectionProfiles. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/ConnectionProfile" - } - ]; - - // Required. The connection profile identifier. - string connection_profile_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The connection profile resource to create. - ConnectionProfile connection_profile = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -message UpdateConnectionProfileRequest { - // Optional. Field mask is used to specify the fields to be overwritten in the - // ConnectionProfile resource by the update. - // The fields specified in the update_mask are relative to the resource, not - // the full request. A field will be overwritten if it is in the mask. If the - // user does not provide a mask then all fields will be overwritten. - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The ConnectionProfile to update. - ConnectionProfile connection_profile = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -message DeleteConnectionProfileRequest { - // Required. The name of the connection profile resource to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/ConnectionProfile" - } - ]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -message ListStreamsRequest { - // Required. The parent that owns the collection of streams. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/Stream" - } - ]; - - // Maximum number of streams to return. - // If unspecified, at most 50 streams will be returned. The maximum - // value is 1000; values above 1000 will be coerced to 1000. - int32 page_size = 2; - - // Page token received from a previous `ListStreams` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to `ListStreams` - // must match the call that provided the page token. - string page_token = 3; - - // Filter request. - string filter = 4; - - // Order by fields for the result. - string order_by = 5; -} - -message ListStreamsResponse { - // List of streams - repeated Stream streams = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -message GetStreamRequest { - // Required. The name of the stream resource to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/Stream" - } - ]; -} - -message CreateStreamRequest { - // Required. The parent that owns the collection of streams. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/Stream" - } - ]; - - // Required. The stream identifier. - string stream_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The stream resource to create. - Stream stream = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only validate the stream, but do not create any resources. - // The default is false. - bool validate_only = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Create the stream without validating it. - bool force = 6 [(google.api.field_behavior) = OPTIONAL]; -} - -message UpdateStreamRequest { - // Optional. Field mask is used to specify the fields to be overwritten in the - // stream resource by the update. - // The fields specified in the update_mask are relative to the resource, not - // the full request. A field will be overwritten if it is in the mask. If the - // user does not provide a mask then all fields will be overwritten. - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The stream resource to update. - Stream stream = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Only validate the stream with the changes, without actually updating it. - // The default is false. - bool validate_only = 4 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Execute the update without validating it. - bool force = 5 [(google.api.field_behavior) = OPTIONAL]; -} - -message DeleteStreamRequest { - // Required. The name of the stream resource to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/Stream" - } - ]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Represents the metadata of the long-running operation. -message OperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Server-defined resource path for the target of the operation. - string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Name of the verb executed by the operation. - string verb = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Human-readable status of the operation, if any. - string status_message = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Identifies whether the user has requested cancellation - // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. - bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. API version used to start the operation. - string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. Results of executed validations if there are any. - ValidationResult validation_result = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -message CreatePrivateConnectionRequest { - // Required. The parent that owns the collection of PrivateConnections. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/PrivateConnection" - } - ]; - - // Required. The private connectivity identifier. - string private_connection_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Private Connectivity resource to create. - PrivateConnection private_connection = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -message ListPrivateConnectionsRequest { - // Required. The parent that owns the collection of private connectivity configurations. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/PrivateConnection" - } - ]; - - // Maximum number of private connectivity configurations to return. - // If unspecified, at most 50 private connectivity configurations that will be - // returned. The maximum value is 1000; values above 1000 will be coerced to - // 1000. - int32 page_size = 2; - - // Page token received from a previous `ListPrivateConnections` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // `ListPrivateConnections` must match the call that provided the page - // token. - string page_token = 3; - - // Filter request. - string filter = 4; - - // Order by fields for the result. - string order_by = 5; -} - -message ListPrivateConnectionsResponse { - // List of private connectivity configurations. - repeated PrivateConnection private_connections = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -message DeletePrivateConnectionRequest { - // Required. The name of the private connectivity configuration to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/PrivateConnection" - } - ]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. If set to true, any child routes that belong to this PrivateConnection will - // also be deleted. - bool force = 3 [(google.api.field_behavior) = OPTIONAL]; -} - -message GetPrivateConnectionRequest { - // Required. The name of the private connectivity configuration to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/PrivateConnection" - } - ]; -} - -// route creation request -message CreateRouteRequest { - // Required. The parent that owns the collection of Routes. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/Route" - } - ]; - - // Required. The Route identifier. - string route_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The Route resource to create. - Route route = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes since the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// route list request -message ListRoutesRequest { - // Required. The parent that owns the collection of Routess. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - child_type: "datastream.googleapis.com/Route" - } - ]; - - // Maximum number of Routes to return. The service may return - // fewer than this value. If unspecified, at most 50 Routes - // will be returned. The maximum value is 1000; values above 1000 will be - // coerced to 1000. - int32 page_size = 2; - - // Page token received from a previous `ListRoutes` call. - // Provide this to retrieve the subsequent page. - // - // When paginating, all other parameters provided to - // `ListRoutes` must match the call that provided the page - // token. - string page_token = 3; - - // Filter request. - string filter = 4; - - // Order by fields for the result. - string order_by = 5; -} - -// route list response -message ListRoutesResponse { - // List of Routes. - repeated Route routes = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// route deletion request -message DeleteRouteRequest { - // Required. The name of the Route resource to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/Route" - } - ]; - - // Optional. A request ID to identify requests. Specify a unique request ID - // so that if you must retry your request, the server will know to ignore - // the request if it has already been completed. The server will guarantee - // that for at least 60 minutes after the first request. - // - // For example, consider a situation where you make an initial request and the - // request times out. If you make the request again with the same request ID, - // the server can check if original operation with the same request ID was - // received, and if so, will ignore the second request. This prevents clients - // from accidentally creating duplicate commitments. - // - // The request ID must be a valid UUID with the exception that zero UUID is - // not supported (00000000-0000-0000-0000-000000000000). - string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// route get request -message GetRouteRequest { - // Required. The name of the Route resource to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "datastream.googleapis.com/Route" - } - ]; -} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/protos/google/cloud/datastream/v1alpha1/datastream_resources.proto b/owl-bot-staging/google-cloud-datastream/v1alpha1/protos/google/cloud/datastream/v1alpha1/datastream_resources.proto deleted file mode 100644 index 59111d92a7e..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/protos/google/cloud/datastream/v1alpha1/datastream_resources.proto +++ /dev/null @@ -1,683 +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.cloud.datastream.v1alpha1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - -option go_package = "cloud.google.com/go/datastream/apiv1alpha1/datastreampb;datastreampb"; -option java_multiple_files = true; -option java_outer_classname = "CloudDatastreamResourcesProto"; -option java_package = "com.google.cloud.datastream.v1alpha1"; -option csharp_namespace = "Google.Cloud.Datastream.V1Alpha1"; -option php_namespace = "Google\\Cloud\\Datastream\\V1alpha1"; -option ruby_package = "Google::Cloud::Datastream::V1alpha1"; - -// Oracle database profile. -message OracleProfile { - // Required. Hostname for the Oracle connection. - string hostname = 1 [(google.api.field_behavior) = REQUIRED]; - - // Port for the Oracle connection, default value is 1521. - int32 port = 2; - - // Required. Username for the Oracle connection. - string username = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Password for the Oracle connection. - string password = 4 [(google.api.field_behavior) = REQUIRED]; - - // Required. Database for the Oracle connection. - string database_service = 5 [(google.api.field_behavior) = REQUIRED]; - - // Connection string attributes - map connection_attributes = 6; -} - -// MySQL database profile. -message MysqlProfile { - // Required. Hostname for the MySQL connection. - string hostname = 1 [(google.api.field_behavior) = REQUIRED]; - - // Port for the MySQL connection, default value is 3306. - int32 port = 2; - - // Required. Username for the MySQL connection. - string username = 3 [(google.api.field_behavior) = REQUIRED]; - - // Required. Input only. Password for the MySQL connection. - string password = 4 [ - (google.api.field_behavior) = REQUIRED, - (google.api.field_behavior) = INPUT_ONLY - ]; - - // SSL configuration for the MySQL connection. - MysqlSslConfig ssl_config = 5; -} - -// Cloud Storage bucket profile. -message GcsProfile { - // Required. The full project and resource path for Cloud Storage bucket including the - // name. - string bucket_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // The root path inside the Cloud Storage bucket. - string root_path = 2; -} - -// No connectivity settings. -message NoConnectivitySettings { - -} - -// Static IP address connectivity. -message StaticServiceIpConnectivity { - -} - -// Forward SSH Tunnel connectivity. -message ForwardSshTunnelConnectivity { - // Required. Hostname for the SSH tunnel. - string hostname = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Username for the SSH tunnel. - string username = 2 [(google.api.field_behavior) = REQUIRED]; - - // Port for the SSH tunnel, default value is 22. - int32 port = 3; - - oneof authentication_method { - // Input only. SSH password. - string password = 100 [(google.api.field_behavior) = INPUT_ONLY]; - - // Input only. SSH private key. - string private_key = 101 [(google.api.field_behavior) = INPUT_ONLY]; - } -} - -// The VPC Peering configuration is used to create VPC peering between -// Datastream and the consumer's VPC. -message VpcPeeringConfig { - // Required. fully qualified name of the VPC Datastream will peer to. - string vpc_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. A free subnet for peering. (CIDR of /29) - string subnet = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The PrivateConnection resource is used to establish private connectivity -// between Datastream and a customer's network. -message PrivateConnection { - option (google.api.resource) = { - type: "datastream.googleapis.com/PrivateConnection" - pattern: "projects/{project}/locations/{location}/privateConnections/{private_connection}" - }; - - // Private Connection state. - enum State { - STATE_UNSPECIFIED = 0; - - // The private connection is in creation state - creating resources. - CREATING = 1; - - // The private connection has been created with all of it's resources. - CREATED = 2; - - // The private connection creation has failed. - FAILED = 3; - } - - // Output only. The resource's name. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The create time of the resource. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The update time of the resource. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels. - map labels = 4; - - // Required. Display name. - string display_name = 5 [(google.api.field_behavior) = REQUIRED]; - - // Output only. The state of the Private Connection. - State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. In case of error, the details of the error in a user-friendly format. - Error error = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // VPC Peering Config - VpcPeeringConfig vpc_peering_config = 100; -} - -// Private Connectivity -message PrivateConnectivity { - string private_connection_name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The Route resource is the child of the PrivateConnection resource. -// It used to define a route for a PrivateConnection setup. -message Route { - option (google.api.resource) = { - type: "datastream.googleapis.com/Route" - pattern: "projects/{project}/locations/{location}/privateConnections/{private_connection}/routes/{route}" - }; - - // Output only. The resource's name. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The create time of the resource. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The update time of the resource. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels. - map labels = 4; - - // Required. Display name. - string display_name = 5 [(google.api.field_behavior) = REQUIRED]; - - // Required. Destination address for connection - string destination_address = 6 [(google.api.field_behavior) = REQUIRED]; - - // Destination port for connection - int32 destination_port = 7; -} - -// MySQL SSL configuration information. -message MysqlSslConfig { - // Input only. PEM-encoded private key associated with the Client Certificate. - // If this field is used then the 'client_certificate' and the - // 'ca_certificate' fields are mandatory. - string client_key = 11 [(google.api.field_behavior) = INPUT_ONLY]; - - // Output only. Indicates whether the client_key field is set. - bool client_key_set = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Input only. PEM-encoded certificate that will be used by the replica to - // authenticate against the source database server. If this field is used - // then the 'client_key' and the 'ca_certificate' fields are mandatory. - string client_certificate = 13 [(google.api.field_behavior) = INPUT_ONLY]; - - // Output only. Indicates whether the client_certificate field is set. - bool client_certificate_set = 14 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Input only. PEM-encoded certificate of the CA that signed the source database - // server's certificate. - string ca_certificate = 15 [(google.api.field_behavior) = INPUT_ONLY]; - - // Output only. Indicates whether the ca_certificate field is set. - bool ca_certificate_set = 16 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -message ConnectionProfile { - option (google.api.resource) = { - type: "datastream.googleapis.com/ConnectionProfile" - pattern: "projects/{project}/locations/{location}/connectionProfiles/{connection_profile}" - }; - - // Output only. The resource's name. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The create time of the resource. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The update time of the resource. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels. - map labels = 4; - - // Required. Display name. - string display_name = 5 [(google.api.field_behavior) = REQUIRED]; - - // Connection configuration for the ConnectionProfile. - oneof profile { - // Oracle ConnectionProfile configuration. - OracleProfile oracle_profile = 100; - - // Cloud Storage ConnectionProfile configuration. - GcsProfile gcs_profile = 101; - - // MySQL ConnectionProfile configuration. - MysqlProfile mysql_profile = 102; - } - - // Connectivity options used to establish a connection to the profile. - oneof connectivity { - // No connectivity option chosen. - NoConnectivitySettings no_connectivity = 200; - - // Static Service IP connectivity. - StaticServiceIpConnectivity static_service_ip_connectivity = 201; - - // Forward SSH tunnel connectivity. - ForwardSshTunnelConnectivity forward_ssh_connectivity = 202; - - // Private connectivity. - PrivateConnectivity private_connectivity = 203; - } -} - -// Oracle Column. -message OracleColumn { - // Column name. - string column_name = 1; - - // The Oracle data type. - string data_type = 2; - - // Column length. - int32 length = 3; - - // Column precision. - int32 precision = 4; - - // Column scale. - int32 scale = 5; - - // Column encoding. - string encoding = 6; - - // Whether or not the column represents a primary key. - bool primary_key = 7; - - // Whether or not the column can accept a null value. - bool nullable = 8; - - // The ordinal position of the column in the table. - int32 ordinal_position = 9; -} - -// Oracle table. -message OracleTable { - // Table name. - string table_name = 1; - - // Oracle columns in the schema. - // When unspecified as part of inclue/exclude lists, includes/excludes - // everything. - repeated OracleColumn oracle_columns = 2; -} - -// Oracle schema. -message OracleSchema { - // Schema name. - string schema_name = 1; - - // Tables in the schema. - repeated OracleTable oracle_tables = 2; -} - -// Oracle database structure. -message OracleRdbms { - // Oracle schemas/databases in the database server. - repeated OracleSchema oracle_schemas = 1; -} - -// Oracle data source configuration -message OracleSourceConfig { - // Oracle objects to include in the stream. - OracleRdbms allowlist = 1; - - // Oracle objects to exclude from the stream. - OracleRdbms rejectlist = 2; -} - -// MySQL Column. -message MysqlColumn { - // Column name. - string column_name = 1; - - // The MySQL data type. Full data types list can be found here: - // https://dev.mysql.com/doc/refman/8.0/en/data-types.html - string data_type = 2; - - // Column length. - int32 length = 3; - - // Column collation. - string collation = 4; - - // Whether or not the column represents a primary key. - bool primary_key = 5; - - // Whether or not the column can accept a null value. - bool nullable = 6; - - // The ordinal position of the column in the table. - int32 ordinal_position = 7; -} - -// MySQL table. -message MysqlTable { - // Table name. - string table_name = 1; - - // MySQL columns in the database. - // When unspecified as part of include/exclude lists, includes/excludes - // everything. - repeated MysqlColumn mysql_columns = 2; -} - -// MySQL database. -message MysqlDatabase { - // Database name. - string database_name = 1; - - // Tables in the database. - repeated MysqlTable mysql_tables = 2; -} - -// MySQL database structure -message MysqlRdbms { - // Mysql databases on the server - repeated MysqlDatabase mysql_databases = 1; -} - -// MySQL source configuration -message MysqlSourceConfig { - // MySQL objects to retrieve from the source. - MysqlRdbms allowlist = 1; - - // MySQL objects to exclude from the stream. - MysqlRdbms rejectlist = 2; -} - -// The configuration of the stream source. -message SourceConfig { - // Required. Source connection profile identifier. - string source_connection_profile_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Stream configuration that is specific to the data source type. - oneof source_stream_config { - // Oracle data source configuration - OracleSourceConfig oracle_source_config = 100; - - // MySQL data source configuration - MysqlSourceConfig mysql_source_config = 101; - } -} - -// AVRO file format configuration. -message AvroFileFormat { - -} - -// File format in Cloud Storage. -enum GcsFileFormat { - option deprecated = true; - - // Unspecified Cloud Storage file format. - GCS_FILE_FORMAT_UNSPECIFIED = 0; - - // Avro file format - AVRO = 1; -} - -// Schema file format. -enum SchemaFileFormat { - // Unspecified schema file format. - SCHEMA_FILE_FORMAT_UNSPECIFIED = 0; - - // Do not attach schema file. - NO_SCHEMA_FILE = 1; - - // Avro schema format. - AVRO_SCHEMA_FILE = 2; -} - -// JSON file format configuration. -message JsonFileFormat { - // Json file compression. - enum JsonCompression { - // Unspecified json file compression. - JSON_COMPRESSION_UNSPECIFIED = 0; - - // Do not compress JSON file. - NO_COMPRESSION = 1; - - // Gzip compression. - GZIP = 2; - } - - // The schema file format along JSON data files. - SchemaFileFormat schema_file_format = 1; - - // Compression of the loaded JSON file. - JsonCompression compression = 2; -} - -// Google Cloud Storage destination configuration -message GcsDestinationConfig { - // Path inside the Cloud Storage bucket to write data to. - string path = 1; - - // File format that data should be written in. - // Deprecated field - use file_format instead. - GcsFileFormat gcs_file_format = 2 [deprecated = true]; - - // The maximum file size to be saved in the bucket. - int32 file_rotation_mb = 3; - - // The maximum duration for which new events are added before a file is - // closed and a new file is created. - google.protobuf.Duration file_rotation_interval = 4; - - // File Format that the data should be written in. - oneof file_format { - // AVRO file format configuration. - AvroFileFormat avro_file_format = 100; - - // JSON file format configuration. - JsonFileFormat json_file_format = 101; - } -} - -// The configuration of the stream destination. -message DestinationConfig { - // Required. Destination connection profile identifier. - string destination_connection_profile_name = 1 [(google.api.field_behavior) = REQUIRED]; - - // Stream configuration that is specific to the data destination type. - oneof destination_stream_config { - GcsDestinationConfig gcs_destination_config = 100; - } -} - -message Stream { - option (google.api.resource) = { - type: "datastream.googleapis.com/Stream" - pattern: "projects/{project}/locations/{location}/streams/{stream}" - }; - - // Backfill strategy to automatically backfill the Stream's objects. - // Specific objects can be excluded. - message BackfillAllStrategy { - // List of objects to exclude. - oneof excluded_objects { - // Oracle data source objects to avoid backfilling. - OracleRdbms oracle_excluded_objects = 1; - - // MySQL data source objects to avoid backfilling. - MysqlRdbms mysql_excluded_objects = 2; - } - } - - // Backfill strategy to disable automatic backfill for the Stream's objects. - message BackfillNoneStrategy { - - } - - // Stream state. - enum State { - // Unspecified stream state. - STATE_UNSPECIFIED = 0; - - // The stream has been created. - CREATED = 1; - - // The stream is running. - RUNNING = 2; - - // The stream is paused. - PAUSED = 3; - - // The stream is in maintenance mode. - // - // Updates are rejected on the resource in this state. - MAINTENANCE = 4; - - // The stream is experiencing an error that is preventing data from being - // streamed. - FAILED = 5; - - // The stream has experienced a terminal failure. - FAILED_PERMANENTLY = 6; - - // The stream is starting, but not yet running. - STARTING = 7; - - // The Stream is no longer reading new events, but still writing events in - // the buffer. - DRAINING = 8; - } - - // Output only. The stream's name. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The creation time of the stream. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The last update time of the stream. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Labels. - map labels = 4; - - // Required. Display name. - string display_name = 5 [(google.api.field_behavior) = REQUIRED]; - - // Required. Source connection profile configuration. - SourceConfig source_config = 6 [(google.api.field_behavior) = REQUIRED]; - - // Required. Destination connection profile configuration. - DestinationConfig destination_config = 7 [(google.api.field_behavior) = REQUIRED]; - - // The state of the stream. - State state = 8; - - // Stream backfill strategy. - oneof backfill_strategy { - // Automatically backfill objects included in the stream source - // configuration. Specific objects can be excluded. - BackfillAllStrategy backfill_all = 101; - - // Do not automatically backfill any objects. - BackfillNoneStrategy backfill_none = 102; - } - - // Output only. Errors on the Stream. - repeated Error errors = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Represent a user-facing Error. -message Error { - // A title that explains the reason for the error. - string reason = 1; - - // A unique identifier for this specific error, - // allowing it to be traced throughout the system in logs and API responses. - string error_uuid = 2; - - // A message containing more information about the error that occurred. - string message = 3; - - // The time when the error occurred. - google.protobuf.Timestamp error_time = 4; - - // Additional information about the error. - map details = 5; -} - -// Contains the current validation results. -message ValidationResult { - // A list of validations (includes both executed as well as not executed - // validations). - repeated Validation validations = 1; -} - -message Validation { - // Validation execution status. - enum Status { - // Unspecified status. - STATUS_UNSPECIFIED = 0; - - // Validation did not execute. - NOT_EXECUTED = 1; - - // Validation failed. - FAILED = 2; - - // Validation passed. - PASSED = 3; - } - - // A short description of the validation. - string description = 1; - - // Validation execution status. - Status status = 2; - - // Messages reflecting the validation results. - repeated ValidationMessage message = 3; - - // A custom code identifying this validation. - string code = 4; -} - -// Represent user-facing validation result message. -message ValidationMessage { - // Validation message level. - enum Level { - // Unspecified level. - LEVEL_UNSPECIFIED = 0; - - // Potentially cause issues with the Stream. - WARNING = 1; - - // Definitely cause issues with the Stream. - ERROR = 2; - } - - // The result of the validation. - string message = 1; - - // Message severity level (warning or error). - Level level = 2; - - // Additional metadata related to the result. - map metadata = 3; - - // A custom code identifying this specific message. - string code = 4; -} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_connection_profile.js deleted file mode 100644 index 0693192ed3c..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_connection_profile.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, connectionProfileId, connectionProfile) { - // [START datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent that owns the collection of ConnectionProfiles. - */ - // const parent = 'abc123' - /** - * Required. The connection profile identifier. - */ - // const connectionProfileId = 'abc123' - /** - * Required. The connection profile resource to create. - */ - // const connectionProfile = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callCreateConnectionProfile() { - // Construct request - const request = { - parent, - connectionProfileId, - connectionProfile, - }; - - // Run request - const [operation] = await datastreamClient.createConnectionProfile(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateConnectionProfile(); - // [END datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_private_connection.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_private_connection.js deleted file mode 100644 index ac7f5453c86..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_private_connection.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, privateConnectionId, privateConnection) { - // [START datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent that owns the collection of PrivateConnections. - */ - // const parent = 'abc123' - /** - * Required. The private connectivity identifier. - */ - // const privateConnectionId = 'abc123' - /** - * Required. The Private Connectivity resource to create. - */ - // const privateConnection = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callCreatePrivateConnection() { - // Construct request - const request = { - parent, - privateConnectionId, - privateConnection, - }; - - // Run request - const [operation] = await datastreamClient.createPrivateConnection(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreatePrivateConnection(); - // [END datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_route.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_route.js deleted file mode 100644 index 8a2ecb97050..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_route.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, routeId, route) { - // [START datastream_v1alpha1_generated_Datastream_CreateRoute_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent that owns the collection of Routes. - */ - // const parent = 'abc123' - /** - * Required. The Route identifier. - */ - // const routeId = 'abc123' - /** - * Required. The Route resource to create. - */ - // const route = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callCreateRoute() { - // Construct request - const request = { - parent, - routeId, - route, - }; - - // Run request - const [operation] = await datastreamClient.createRoute(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateRoute(); - // [END datastream_v1alpha1_generated_Datastream_CreateRoute_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_stream.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_stream.js deleted file mode 100644 index 8386d87ba33..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.create_stream.js +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, streamId, stream) { - // [START datastream_v1alpha1_generated_Datastream_CreateStream_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent that owns the collection of streams. - */ - // const parent = 'abc123' - /** - * Required. The stream identifier. - */ - // const streamId = 'abc123' - /** - * Required. The stream resource to create. - */ - // const stream = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - /** - * Optional. Only validate the stream, but do not create any resources. - * The default is false. - */ - // const validateOnly = true - /** - * Optional. Create the stream without validating it. - */ - // const force = true - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callCreateStream() { - // Construct request - const request = { - parent, - streamId, - stream, - }; - - // Run request - const [operation] = await datastreamClient.createStream(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateStream(); - // [END datastream_v1alpha1_generated_Datastream_CreateStream_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_connection_profile.js deleted file mode 100644 index 7e2b4d09e18..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_connection_profile.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the connection profile resource to delete. - */ - // const name = 'abc123' - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callDeleteConnectionProfile() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await datastreamClient.deleteConnectionProfile(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteConnectionProfile(); - // [END datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_private_connection.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_private_connection.js deleted file mode 100644 index 6d924f69778..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_private_connection.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the private connectivity configuration to delete. - */ - // const name = 'abc123' - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - /** - * Optional. If set to true, any child routes that belong to this PrivateConnection will - * also be deleted. - */ - // const force = true - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callDeletePrivateConnection() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await datastreamClient.deletePrivateConnection(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeletePrivateConnection(); - // [END datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_route.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_route.js deleted file mode 100644 index 6fb1e854751..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_route.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1alpha1_generated_Datastream_DeleteRoute_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Route resource to delete. - */ - // const name = 'abc123' - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callDeleteRoute() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await datastreamClient.deleteRoute(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteRoute(); - // [END datastream_v1alpha1_generated_Datastream_DeleteRoute_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_stream.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_stream.js deleted file mode 100644 index 707f5f3ef7a..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.delete_stream.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1alpha1_generated_Datastream_DeleteStream_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the stream resource to delete. - */ - // const name = 'abc123' - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callDeleteStream() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await datastreamClient.deleteStream(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteStream(); - // [END datastream_v1alpha1_generated_Datastream_DeleteStream_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.discover_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.discover_connection_profile.js deleted file mode 100644 index 20e71dcd71f..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.discover_connection_profile.js +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource of the ConnectionProfile type. Must be in the - * format `projects/* /locations/*`. - */ - // const parent = 'abc123' - /** - * An ad-hoc ConnectionProfile configuration. - */ - // const connectionProfile = {} - /** - * A reference to an existing ConnectionProfile. - */ - // const connectionProfileName = 'abc123' - /** - * Whether to retrieve the full hierarchy of data objects (TRUE) or only the - * current level (FALSE). - */ - // const recursive = true - /** - * The number of hierarchy levels below the current level to be retrieved. - */ - // const recursionDepth = 1234 - /** - * Oracle RDBMS to enrich with child data objects and metadata. - */ - // const oracleRdbms = {} - /** - * MySQL RDBMS to enrich with child data objects and metadata. - */ - // const mysqlRdbms = {} - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callDiscoverConnectionProfile() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await datastreamClient.discoverConnectionProfile(request); - console.log(response); - } - - callDiscoverConnectionProfile(); - // [END datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.fetch_errors.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.fetch_errors.js deleted file mode 100644 index 757fa7d5bac..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.fetch_errors.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main() { - // [START datastream_v1alpha1_generated_Datastream_FetchErrors_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Name of the Stream resource for which to fetch any errors. - */ - // const stream = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callFetchErrors() { - // Construct request - const request = { - }; - - // Run request - const [operation] = await datastreamClient.fetchErrors(request); - const [response] = await operation.promise(); - console.log(response); - } - - callFetchErrors(); - // [END datastream_v1alpha1_generated_Datastream_FetchErrors_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.fetch_static_ips.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.fetch_static_ips.js deleted file mode 100644 index 3a24a473112..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.fetch_static_ips.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1alpha1_generated_Datastream_FetchStaticIps_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name resource of the Response type. Must be in the - * format `projects/* /locations/*`. - */ - // const name = 'abc123' - /** - * Maximum number of Ips to return, will likely not be specified. - */ - // const pageSize = 1234 - /** - * A page token, received from a previous `ListStaticIps` call. - * will likely not be specified. - */ - // const pageToken = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callFetchStaticIps() { - // Construct request - const request = { - name, - }; - - // Run request - const iterable = await datastreamClient.fetchStaticIpsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callFetchStaticIps(); - // [END datastream_v1alpha1_generated_Datastream_FetchStaticIps_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_connection_profile.js deleted file mode 100644 index 3d858121316..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_connection_profile.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1alpha1_generated_Datastream_GetConnectionProfile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the connection profile resource to get. - */ - // const name = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callGetConnectionProfile() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await datastreamClient.getConnectionProfile(request); - console.log(response); - } - - callGetConnectionProfile(); - // [END datastream_v1alpha1_generated_Datastream_GetConnectionProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_private_connection.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_private_connection.js deleted file mode 100644 index 14317cda9a1..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_private_connection.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1alpha1_generated_Datastream_GetPrivateConnection_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the private connectivity configuration to get. - */ - // const name = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callGetPrivateConnection() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await datastreamClient.getPrivateConnection(request); - console.log(response); - } - - callGetPrivateConnection(); - // [END datastream_v1alpha1_generated_Datastream_GetPrivateConnection_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_route.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_route.js deleted file mode 100644 index def7158c41f..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_route.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1alpha1_generated_Datastream_GetRoute_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Route resource to get. - */ - // const name = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callGetRoute() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await datastreamClient.getRoute(request); - console.log(response); - } - - callGetRoute(); - // [END datastream_v1alpha1_generated_Datastream_GetRoute_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_stream.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_stream.js deleted file mode 100644 index 2a797874df9..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.get_stream.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START datastream_v1alpha1_generated_Datastream_GetStream_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the stream resource to get. - */ - // const name = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callGetStream() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await datastreamClient.getStream(request); - console.log(response); - } - - callGetStream(); - // [END datastream_v1alpha1_generated_Datastream_GetStream_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_connection_profiles.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_connection_profiles.js deleted file mode 100644 index d8a093a9bff..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_connection_profiles.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent that owns the collection of connection profiles. - */ - // const parent = 'abc123' - /** - * Maximum number of connection profiles to return. - * If unspecified, at most 50 connection profiles will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * Page token received from a previous `ListConnectionProfiles` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListConnectionProfiles` - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Filter request. - */ - // const filter = 'abc123' - /** - * Order by fields for the result. - */ - // const orderBy = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callListConnectionProfiles() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await datastreamClient.listConnectionProfilesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListConnectionProfiles(); - // [END datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_private_connections.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_private_connections.js deleted file mode 100644 index ae52a772e05..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_private_connections.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START datastream_v1alpha1_generated_Datastream_ListPrivateConnections_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent that owns the collection of private connectivity configurations. - */ - // const parent = 'abc123' - /** - * Maximum number of private connectivity configurations to return. - * If unspecified, at most 50 private connectivity configurations that will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - */ - // const pageSize = 1234 - /** - * Page token received from a previous `ListPrivateConnections` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * `ListPrivateConnections` must match the call that provided the page - * token. - */ - // const pageToken = 'abc123' - /** - * Filter request. - */ - // const filter = 'abc123' - /** - * Order by fields for the result. - */ - // const orderBy = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callListPrivateConnections() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await datastreamClient.listPrivateConnectionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListPrivateConnections(); - // [END datastream_v1alpha1_generated_Datastream_ListPrivateConnections_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_routes.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_routes.js deleted file mode 100644 index 3e28c388062..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_routes.js +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START datastream_v1alpha1_generated_Datastream_ListRoutes_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent that owns the collection of Routess. - */ - // const parent = 'abc123' - /** - * Maximum number of Routes to return. The service may return - * fewer than this value. If unspecified, at most 50 Routes - * will be returned. The maximum value is 1000; values above 1000 will be - * coerced to 1000. - */ - // const pageSize = 1234 - /** - * Page token received from a previous `ListRoutes` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to - * `ListRoutes` must match the call that provided the page - * token. - */ - // const pageToken = 'abc123' - /** - * Filter request. - */ - // const filter = 'abc123' - /** - * Order by fields for the result. - */ - // const orderBy = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callListRoutes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await datastreamClient.listRoutesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListRoutes(); - // [END datastream_v1alpha1_generated_Datastream_ListRoutes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_streams.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_streams.js deleted file mode 100644 index b995a0942c7..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.list_streams.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START datastream_v1alpha1_generated_Datastream_ListStreams_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent that owns the collection of streams. - */ - // const parent = 'abc123' - /** - * Maximum number of streams to return. - * If unspecified, at most 50 streams will be returned. The maximum - * value is 1000; values above 1000 will be coerced to 1000. - */ - // const pageSize = 1234 - /** - * Page token received from a previous `ListStreams` call. - * Provide this to retrieve the subsequent page. - * When paginating, all other parameters provided to `ListStreams` - * must match the call that provided the page token. - */ - // const pageToken = 'abc123' - /** - * Filter request. - */ - // const filter = 'abc123' - /** - * Order by fields for the result. - */ - // const orderBy = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callListStreams() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await datastreamClient.listStreamsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListStreams(); - // [END datastream_v1alpha1_generated_Datastream_ListStreams_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.update_connection_profile.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.update_connection_profile.js deleted file mode 100644 index 18e47143e25..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.update_connection_profile.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(connectionProfile) { - // [START datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. Field mask is used to specify the fields to be overwritten in the - * ConnectionProfile resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - */ - // const updateMask = {} - /** - * Required. The ConnectionProfile to update. - */ - // const connectionProfile = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callUpdateConnectionProfile() { - // Construct request - const request = { - connectionProfile, - }; - - // Run request - const [operation] = await datastreamClient.updateConnectionProfile(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateConnectionProfile(); - // [END datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.update_stream.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.update_stream.js deleted file mode 100644 index 274a8e722d1..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/datastream.update_stream.js +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(stream) { - // [START datastream_v1alpha1_generated_Datastream_UpdateStream_async] - /** - * This snippet has been automatically generated and should be regarded as a code template only. - * It will require modifications to work. - * It may require correct/in-range values for request initialization. - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. Field mask is used to specify the fields to be overwritten in the - * stream resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - */ - // const updateMask = {} - /** - * Required. The stream resource to update. - */ - // const stream = {} - /** - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - */ - // const requestId = 'abc123' - /** - * Optional. Only validate the stream with the changes, without actually updating it. - * The default is false. - */ - // const validateOnly = true - /** - * Optional. Execute the update without validating it. - */ - // const force = true - - // Imports the Datastream library - const {DatastreamClient} = require('@google-cloud/datastream').v1alpha1; - - // Instantiates a client - const datastreamClient = new DatastreamClient(); - - async function callUpdateStream() { - // Construct request - const request = { - stream, - }; - - // Run request - const [operation] = await datastreamClient.updateStream(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateStream(); - // [END datastream_v1alpha1_generated_Datastream_UpdateStream_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/snippet_metadata.google.cloud.datastream.v1alpha1.json b/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/snippet_metadata.google.cloud.datastream.v1alpha1.json deleted file mode 100644 index 60024d25853..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/samples/generated/v1alpha1/snippet_metadata.google.cloud.datastream.v1alpha1.json +++ /dev/null @@ -1,1051 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-datastream", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.datastream.v1alpha1", - "version": "v1alpha1" - } - ] - }, - "snippets": [ - { - "regionTag": "datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_async", - "title": "Datastream listConnectionProfiles Sample", - "origin": "API_DEFINITION", - "description": " Use this method to list connection profiles created in a project and location.", - "canonical": true, - "file": "datastream.list_connection_profiles.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListConnectionProfiles", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListConnectionProfiles", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1alpha1.ListConnectionProfilesResponse", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "ListConnectionProfiles", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListConnectionProfiles", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_GetConnectionProfile_async", - "title": "Datastream getConnectionProfile Sample", - "origin": "API_DEFINITION", - "description": " Use this method to get details about a connection profile.", - "canonical": true, - "file": "datastream.get_connection_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetConnectionProfile", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetConnectionProfile", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1alpha1.ConnectionProfile", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "GetConnectionProfile", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetConnectionProfile", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_async", - "title": "Datastream createConnectionProfile Sample", - "origin": "API_DEFINITION", - "description": " Use this method to create a connection profile in a project and location.", - "canonical": true, - "file": "datastream.create_connection_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateConnectionProfile", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreateConnectionProfile", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "connection_profile_id", - "type": "TYPE_STRING" - }, - { - "name": "connection_profile", - "type": ".google.cloud.datastream.v1alpha1.ConnectionProfile" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "CreateConnectionProfile", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreateConnectionProfile", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_async", - "title": "Datastream updateConnectionProfile Sample", - "origin": "API_DEFINITION", - "description": " Use this method to update the parameters of a connection profile.", - "canonical": true, - "file": "datastream.update_connection_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateConnectionProfile", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.UpdateConnectionProfile", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "connection_profile", - "type": ".google.cloud.datastream.v1alpha1.ConnectionProfile" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "UpdateConnectionProfile", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.UpdateConnectionProfile", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_async", - "title": "Datastream deleteConnectionProfile Sample", - "origin": "API_DEFINITION", - "description": " Use this method to delete a connection profile..", - "canonical": true, - "file": "datastream.delete_connection_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteConnectionProfile", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeleteConnectionProfile", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "DeleteConnectionProfile", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeleteConnectionProfile", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_async", - "title": "Datastream discoverConnectionProfile Sample", - "origin": "API_DEFINITION", - "description": " Use this method to discover a connection profile. The discover API call exposes the data objects and metadata belonging to the profile. Typically, a request returns children data objects under a parent data object that's optionally supplied in the request.", - "canonical": true, - "file": "datastream.discover_connection_profile.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 79, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DiscoverConnectionProfile", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.DiscoverConnectionProfile", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "connection_profile", - "type": ".google.cloud.datastream.v1alpha1.ConnectionProfile" - }, - { - "name": "connection_profile_name", - "type": "TYPE_STRING" - }, - { - "name": "recursive", - "type": "TYPE_BOOL" - }, - { - "name": "recursion_depth", - "type": "TYPE_INT32" - }, - { - "name": "oracle_rdbms", - "type": ".google.cloud.datastream.v1alpha1.OracleRdbms" - }, - { - "name": "mysql_rdbms", - "type": ".google.cloud.datastream.v1alpha1.MysqlRdbms" - } - ], - "resultType": ".google.cloud.datastream.v1alpha1.DiscoverConnectionProfileResponse", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "DiscoverConnectionProfile", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.DiscoverConnectionProfile", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_ListStreams_async", - "title": "Datastream listStreams Sample", - "origin": "API_DEFINITION", - "description": " Use this method to list streams in a project and location.", - "canonical": true, - "file": "datastream.list_streams.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListStreams", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListStreams", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1alpha1.ListStreamsResponse", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "ListStreams", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListStreams", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_GetStream_async", - "title": "Datastream getStream Sample", - "origin": "API_DEFINITION", - "description": " Use this method to get details about a stream.", - "canonical": true, - "file": "datastream.get_stream.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetStream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetStream", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1alpha1.Stream", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "GetStream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetStream", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_CreateStream_async", - "title": "Datastream createStream Sample", - "origin": "API_DEFINITION", - "description": " Use this method to create a stream.", - "canonical": true, - "file": "datastream.create_stream.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 87, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateStream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreateStream", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "stream_id", - "type": "TYPE_STRING" - }, - { - "name": "stream", - "type": ".google.cloud.datastream.v1alpha1.Stream" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "CreateStream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreateStream", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_UpdateStream_async", - "title": "Datastream updateStream Sample", - "origin": "API_DEFINITION", - "description": " Use this method to update the configuration of a stream.", - "canonical": true, - "file": "datastream.update_stream.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 85, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateStream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.UpdateStream", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "stream", - "type": ".google.cloud.datastream.v1alpha1.Stream" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "validate_only", - "type": "TYPE_BOOL" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "UpdateStream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.UpdateStream", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_DeleteStream_async", - "title": "Datastream deleteStream Sample", - "origin": "API_DEFINITION", - "description": " Use this method to delete a stream.", - "canonical": true, - "file": "datastream.delete_stream.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteStream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeleteStream", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "DeleteStream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeleteStream", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_FetchErrors_async", - "title": "Datastream fetchErrors Sample", - "origin": "API_DEFINITION", - "description": " Use this method to fetch any errors associated with a stream.", - "canonical": true, - "file": "datastream.fetch_errors.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FetchErrors", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.FetchErrors", - "async": true, - "parameters": [ - { - "name": "stream", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "FetchErrors", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.FetchErrors", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_FetchStaticIps_async", - "title": "Datastream fetchStaticIps Sample", - "origin": "API_DEFINITION", - "description": " The FetchStaticIps API call exposes the static ips used by Datastream. Typically, a request returns children data objects under a parent data object that's optionally supplied in the request.", - "canonical": true, - "file": "datastream.fetch_static_ips.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "FetchStaticIps", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.FetchStaticIps", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1alpha1.FetchStaticIpsResponse", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "FetchStaticIps", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.FetchStaticIps", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_async", - "title": "Datastream createPrivateConnection Sample", - "origin": "API_DEFINITION", - "description": " Use this method to create a private connectivity configuration.", - "canonical": true, - "file": "datastream.create_private_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreatePrivateConnection", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreatePrivateConnection", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "private_connection_id", - "type": "TYPE_STRING" - }, - { - "name": "private_connection", - "type": ".google.cloud.datastream.v1alpha1.PrivateConnection" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "CreatePrivateConnection", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreatePrivateConnection", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_GetPrivateConnection_async", - "title": "Datastream getPrivateConnection Sample", - "origin": "API_DEFINITION", - "description": " Use this method to get details about a private connectivity configuration.", - "canonical": true, - "file": "datastream.get_private_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetPrivateConnection", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetPrivateConnection", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1alpha1.PrivateConnection", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "GetPrivateConnection", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetPrivateConnection", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_ListPrivateConnections_async", - "title": "Datastream listPrivateConnections Sample", - "origin": "API_DEFINITION", - "description": " Use this method to list private connectivity configurations in a project and location.", - "canonical": true, - "file": "datastream.list_private_connections.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListPrivateConnections", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListPrivateConnections", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1alpha1.ListPrivateConnectionsResponse", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "ListPrivateConnections", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListPrivateConnections", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_async", - "title": "Datastream deletePrivateConnection Sample", - "origin": "API_DEFINITION", - "description": " Use this method to delete a private connectivity configuration.", - "canonical": true, - "file": "datastream.delete_private_connection.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeletePrivateConnection", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeletePrivateConnection", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - }, - { - "name": "force", - "type": "TYPE_BOOL" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "DeletePrivateConnection", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeletePrivateConnection", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_CreateRoute_async", - "title": "Datastream createRoute Sample", - "origin": "API_DEFINITION", - "description": " Use this method to create a route for a private connectivity in a project and location.", - "canonical": true, - "file": "datastream.create_route.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateRoute", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreateRoute", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "route_id", - "type": "TYPE_STRING" - }, - { - "name": "route", - "type": ".google.cloud.datastream.v1alpha1.Route" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "CreateRoute", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.CreateRoute", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_GetRoute_async", - "title": "Datastream getRoute Sample", - "origin": "API_DEFINITION", - "description": " Use this method to get details about a route.", - "canonical": true, - "file": "datastream.get_route.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetRoute", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetRoute", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1alpha1.Route", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "GetRoute", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.GetRoute", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_ListRoutes_async", - "title": "Datastream listRoutes Sample", - "origin": "API_DEFINITION", - "description": " Use this method to list routes created for a private connectivity in a project and location.", - "canonical": true, - "file": "datastream.list_routes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 78, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListRoutes", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListRoutes", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "page_size", - "type": "TYPE_INT32" - }, - { - "name": "page_token", - "type": "TYPE_STRING" - }, - { - "name": "filter", - "type": "TYPE_STRING" - }, - { - "name": "order_by", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.datastream.v1alpha1.ListRoutesResponse", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "ListRoutes", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.ListRoutes", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - }, - { - "regionTag": "datastream_v1alpha1_generated_Datastream_DeleteRoute_async", - "title": "Datastream deleteRoute Sample", - "origin": "API_DEFINITION", - "description": " Use this method to delete a route.", - "canonical": true, - "file": "datastream.delete_route.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteRoute", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeleteRoute", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "DatastreamClient", - "fullName": "google.cloud.datastream.v1alpha1.DatastreamClient" - }, - "method": { - "shortName": "DeleteRoute", - "fullName": "google.cloud.datastream.v1alpha1.Datastream.DeleteRoute", - "service": { - "shortName": "Datastream", - "fullName": "google.cloud.datastream.v1alpha1.Datastream" - } - } - } - } - ] -} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/src/index.ts b/owl-bot-staging/google-cloud-datastream/v1alpha1/src/index.ts deleted file mode 100644 index 67f6be0bba3..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1alpha1 from './v1alpha1'; -const DatastreamClient = v1alpha1.DatastreamClient; -type DatastreamClient = v1alpha1.DatastreamClient; -export {v1alpha1, DatastreamClient}; -export default {v1alpha1, DatastreamClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_client.ts b/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_client.ts deleted file mode 100644 index c4a9dc5f40f..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_client.ts +++ /dev/null @@ -1,3291 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import type * as gax from 'google-gax'; -import type {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; -import {Transform} from 'stream'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1alpha1/datastream_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './datastream_client_config.json'; -const version = require('../../../package.json').version; - -/** - * Datastream service - * @class - * @memberof v1alpha1 - */ -export class DatastreamClient { - 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; - datastreamStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of DatastreamClient. - * - * @param {object} [options] - The configuration object. - * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). - * The common options are: - * @param {object} [options.credentials] - Credentials object. - * @param {string} [options.credentials.client_email] - * @param {string} [options.credentials.private_key] - * @param {string} [options.email] - Account email address. Required when - * using a .pem or .p12 keyFilename. - * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or - * .p12 key downloaded from the Google Developers Console. If you provide - * a path to a JSON file, the projectId option below is not necessary. - * NOTE: .pem and .p12 require you to specify options.email as well. - * @param {number} [options.port] - The port on which to connect to - * the remote host. - * @param {string} [options.projectId] - The project ID from the Google - * Developer's Console, e.g. 'grape-spaceship-123'. We will also check - * the environment variable GCLOUD_PROJECT for your project ID. If your - * app is running in an environment which supports - * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, - * your project ID will be detected automatically. - * @param {string} [options.apiEndpoint] - The domain name of the - * API remote host. - * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. - * Follows the structure of {@link gapicConfig}. - * @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode. - * Pass "rest" to use HTTP/1.1 REST API instead of gRPC. - * For more information, please check the - * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. - * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you - * need to avoid loading the default gRPC version and want to use the fallback - * HTTP implementation. Load only fallback version and pass it to the constructor: - * ``` - * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC - * const client = new DatastreamClient({fallback: 'rest'}, gax); - * ``` - */ - constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof DatastreamClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // Request numeric enum values if REST transport is used. - opts.numericEnums = true; - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Load google-gax module synchronously if needed - if (!gaxInstance) { - gaxInstance = require('google-gax') as typeof gax; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - connectionProfilePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/connectionProfiles/{connection_profile}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - privateConnectionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateConnections/{private_connection}' - ), - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - routePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/privateConnections/{private_connection}/routes/{route}' - ), - streamPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/streams/{stream}' - ), - }; - - // 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 = { - listConnectionProfiles: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'connectionProfiles'), - listStreams: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'streams'), - fetchStaticIps: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'staticIps'), - listPrivateConnections: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'privateConnections'), - listRoutes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'routes') - }; - - const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); - // This API contains "long-running operations", which return a - // an Operation object that allows for tracking of the operation, - // rather than holding a request open. - const lroOptions: GrpcClientOptions = { - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }; - if (opts.fallback === 'rest') { - lroOptions.protoJson = protoFilesRoot; - lroOptions.httpRules = [{selector: 'google.cloud.location.Locations.GetLocation',get: '/v1alpha1/{name=projects/*/locations/*}',},{selector: 'google.cloud.location.Locations.ListLocations',get: '/v1alpha1/{name=projects/*}/locations',},{selector: 'google.longrunning.Operations.CancelOperation',post: '/v1alpha1/{name=projects/*/locations/*/operations/*}:cancel',body: '*',},{selector: 'google.longrunning.Operations.DeleteOperation',delete: '/v1alpha1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.GetOperation',get: '/v1alpha1/{name=projects/*/locations/*/operations/*}',},{selector: 'google.longrunning.Operations.ListOperations',get: '/v1alpha1/{name=projects/*/locations/*}/operations',}]; - } - this.operationsClient = this._gaxModule.lro(lroOptions).operationsClient(opts); - const createConnectionProfileResponse = protoFilesRoot.lookup( - '.google.cloud.datastream.v1alpha1.ConnectionProfile') as gax.protobuf.Type; - const createConnectionProfileMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const updateConnectionProfileResponse = protoFilesRoot.lookup( - '.google.cloud.datastream.v1alpha1.ConnectionProfile') as gax.protobuf.Type; - const updateConnectionProfileMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const deleteConnectionProfileResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteConnectionProfileMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const createStreamResponse = protoFilesRoot.lookup( - '.google.cloud.datastream.v1alpha1.Stream') as gax.protobuf.Type; - const createStreamMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const updateStreamResponse = protoFilesRoot.lookup( - '.google.cloud.datastream.v1alpha1.Stream') as gax.protobuf.Type; - const updateStreamMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const deleteStreamResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteStreamMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const fetchErrorsResponse = protoFilesRoot.lookup( - '.google.cloud.datastream.v1alpha1.FetchErrorsResponse') as gax.protobuf.Type; - const fetchErrorsMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const createPrivateConnectionResponse = protoFilesRoot.lookup( - '.google.cloud.datastream.v1alpha1.PrivateConnection') as gax.protobuf.Type; - const createPrivateConnectionMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const deletePrivateConnectionResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deletePrivateConnectionMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const createRouteResponse = protoFilesRoot.lookup( - '.google.cloud.datastream.v1alpha1.Route') as gax.protobuf.Type; - const createRouteMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const deleteRouteResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteRouteMetadata = protoFilesRoot.lookup( - '.google.cloud.datastream.v1alpha1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createConnectionProfile: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createConnectionProfileResponse.decode.bind(createConnectionProfileResponse), - createConnectionProfileMetadata.decode.bind(createConnectionProfileMetadata)), - updateConnectionProfile: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateConnectionProfileResponse.decode.bind(updateConnectionProfileResponse), - updateConnectionProfileMetadata.decode.bind(updateConnectionProfileMetadata)), - deleteConnectionProfile: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteConnectionProfileResponse.decode.bind(deleteConnectionProfileResponse), - deleteConnectionProfileMetadata.decode.bind(deleteConnectionProfileMetadata)), - createStream: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createStreamResponse.decode.bind(createStreamResponse), - createStreamMetadata.decode.bind(createStreamMetadata)), - updateStream: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateStreamResponse.decode.bind(updateStreamResponse), - updateStreamMetadata.decode.bind(updateStreamMetadata)), - deleteStream: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteStreamResponse.decode.bind(deleteStreamResponse), - deleteStreamMetadata.decode.bind(deleteStreamMetadata)), - fetchErrors: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - fetchErrorsResponse.decode.bind(fetchErrorsResponse), - fetchErrorsMetadata.decode.bind(fetchErrorsMetadata)), - createPrivateConnection: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createPrivateConnectionResponse.decode.bind(createPrivateConnectionResponse), - createPrivateConnectionMetadata.decode.bind(createPrivateConnectionMetadata)), - deletePrivateConnection: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deletePrivateConnectionResponse.decode.bind(deletePrivateConnectionResponse), - deletePrivateConnectionMetadata.decode.bind(deletePrivateConnectionMetadata)), - createRoute: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createRouteResponse.decode.bind(createRouteResponse), - createRouteMetadata.decode.bind(createRouteMetadata)), - deleteRoute: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteRouteResponse.decode.bind(deleteRouteResponse), - deleteRouteMetadata.decode.bind(deleteRouteMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.datastream.v1alpha1.Datastream', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = this._gaxModule.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.datastreamStub) { - return this.datastreamStub; - } - - // Put together the "service stub" for - // google.cloud.datastream.v1alpha1.Datastream. - this.datastreamStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.datastream.v1alpha1.Datastream') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.datastream.v1alpha1.Datastream, - 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 datastreamStubMethods = - ['listConnectionProfiles', 'getConnectionProfile', 'createConnectionProfile', 'updateConnectionProfile', 'deleteConnectionProfile', 'discoverConnectionProfile', 'listStreams', 'getStream', 'createStream', 'updateStream', 'deleteStream', 'fetchErrors', 'fetchStaticIps', 'createPrivateConnection', 'getPrivateConnection', 'listPrivateConnections', 'deletePrivateConnection', 'createRoute', 'getRoute', 'listRoutes', 'deleteRoute']; - for (const methodName of datastreamStubMethods) { - const callPromise = this.datastreamStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor, - this._opts.fallback - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.datastreamStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'datastream.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 'datastream.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Use this method to get details about a connection profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the connection profile resource to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.datastream.v1alpha1.ConnectionProfile | ConnectionProfile}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.get_connection_profile.js - * region_tag:datastream_v1alpha1_generated_Datastream_GetConnectionProfile_async - */ - getConnectionProfile( - request?: protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1alpha1.IConnectionProfile, - protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest|undefined, {}|undefined - ]>; - getConnectionProfile( - request: protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.datastream.v1alpha1.IConnectionProfile, - protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest|null|undefined, - {}|null|undefined>): void; - getConnectionProfile( - request: protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest, - callback: Callback< - protos.google.cloud.datastream.v1alpha1.IConnectionProfile, - protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest|null|undefined, - {}|null|undefined>): void; - getConnectionProfile( - request?: protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.datastream.v1alpha1.IConnectionProfile, - protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.datastream.v1alpha1.IConnectionProfile, - protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.datastream.v1alpha1.IConnectionProfile, - protos.google.cloud.datastream.v1alpha1.IGetConnectionProfileRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getConnectionProfile(request, options, callback); - } -/** - * Use this method to discover a connection profile. - * The discover API call exposes the data objects and metadata belonging to - * the profile. Typically, a request returns children data objects under a - * parent data object that's optionally supplied in the request. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the ConnectionProfile type. Must be in the - * format `projects/* /locations/*`. - * @param {google.cloud.datastream.v1alpha1.ConnectionProfile} request.connectionProfile - * An ad-hoc ConnectionProfile configuration. - * @param {string} request.connectionProfileName - * A reference to an existing ConnectionProfile. - * @param {boolean} request.recursive - * Whether to retrieve the full hierarchy of data objects (TRUE) or only the - * current level (FALSE). - * @param {number} request.recursionDepth - * The number of hierarchy levels below the current level to be retrieved. - * @param {google.cloud.datastream.v1alpha1.OracleRdbms} request.oracleRdbms - * Oracle RDBMS to enrich with child data objects and metadata. - * @param {google.cloud.datastream.v1alpha1.MysqlRdbms} request.mysqlRdbms - * MySQL RDBMS to enrich with child data objects and metadata. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.datastream.v1alpha1.DiscoverConnectionProfileResponse | DiscoverConnectionProfileResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.discover_connection_profile.js - * region_tag:datastream_v1alpha1_generated_Datastream_DiscoverConnectionProfile_async - */ - discoverConnectionProfile( - request?: protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileResponse, - protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest|undefined, {}|undefined - ]>; - discoverConnectionProfile( - request: protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileResponse, - protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest|null|undefined, - {}|null|undefined>): void; - discoverConnectionProfile( - request: protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest, - callback: Callback< - protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileResponse, - protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest|null|undefined, - {}|null|undefined>): void; - discoverConnectionProfile( - request?: protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileResponse, - protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileResponse, - protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileResponse, - protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.discoverConnectionProfile(request, options, callback); - } -/** - * Use this method to get details about a stream. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the stream resource to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.datastream.v1alpha1.Stream | Stream}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.get_stream.js - * region_tag:datastream_v1alpha1_generated_Datastream_GetStream_async - */ - getStream( - request?: protos.google.cloud.datastream.v1alpha1.IGetStreamRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1alpha1.IStream, - protos.google.cloud.datastream.v1alpha1.IGetStreamRequest|undefined, {}|undefined - ]>; - getStream( - request: protos.google.cloud.datastream.v1alpha1.IGetStreamRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.datastream.v1alpha1.IStream, - protos.google.cloud.datastream.v1alpha1.IGetStreamRequest|null|undefined, - {}|null|undefined>): void; - getStream( - request: protos.google.cloud.datastream.v1alpha1.IGetStreamRequest, - callback: Callback< - protos.google.cloud.datastream.v1alpha1.IStream, - protos.google.cloud.datastream.v1alpha1.IGetStreamRequest|null|undefined, - {}|null|undefined>): void; - getStream( - request?: protos.google.cloud.datastream.v1alpha1.IGetStreamRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.datastream.v1alpha1.IStream, - protos.google.cloud.datastream.v1alpha1.IGetStreamRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.datastream.v1alpha1.IStream, - protos.google.cloud.datastream.v1alpha1.IGetStreamRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.datastream.v1alpha1.IStream, - protos.google.cloud.datastream.v1alpha1.IGetStreamRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getStream(request, options, callback); - } -/** - * Use this method to get details about a private connectivity configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the private connectivity configuration to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.datastream.v1alpha1.PrivateConnection | PrivateConnection}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.get_private_connection.js - * region_tag:datastream_v1alpha1_generated_Datastream_GetPrivateConnection_async - */ - getPrivateConnection( - request?: protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1alpha1.IPrivateConnection, - protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest|undefined, {}|undefined - ]>; - getPrivateConnection( - request: protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.datastream.v1alpha1.IPrivateConnection, - protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest|null|undefined, - {}|null|undefined>): void; - getPrivateConnection( - request: protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest, - callback: Callback< - protos.google.cloud.datastream.v1alpha1.IPrivateConnection, - protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest|null|undefined, - {}|null|undefined>): void; - getPrivateConnection( - request?: protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.datastream.v1alpha1.IPrivateConnection, - protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.datastream.v1alpha1.IPrivateConnection, - protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.datastream.v1alpha1.IPrivateConnection, - protos.google.cloud.datastream.v1alpha1.IGetPrivateConnectionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getPrivateConnection(request, options, callback); - } -/** - * Use this method to get details about a route. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Route resource to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing {@link google.cloud.datastream.v1alpha1.Route | Route}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.get_route.js - * region_tag:datastream_v1alpha1_generated_Datastream_GetRoute_async - */ - getRoute( - request?: protos.google.cloud.datastream.v1alpha1.IGetRouteRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1alpha1.IRoute, - protos.google.cloud.datastream.v1alpha1.IGetRouteRequest|undefined, {}|undefined - ]>; - getRoute( - request: protos.google.cloud.datastream.v1alpha1.IGetRouteRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.datastream.v1alpha1.IRoute, - protos.google.cloud.datastream.v1alpha1.IGetRouteRequest|null|undefined, - {}|null|undefined>): void; - getRoute( - request: protos.google.cloud.datastream.v1alpha1.IGetRouteRequest, - callback: Callback< - protos.google.cloud.datastream.v1alpha1.IRoute, - protos.google.cloud.datastream.v1alpha1.IGetRouteRequest|null|undefined, - {}|null|undefined>): void; - getRoute( - request?: protos.google.cloud.datastream.v1alpha1.IGetRouteRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.datastream.v1alpha1.IRoute, - protos.google.cloud.datastream.v1alpha1.IGetRouteRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.datastream.v1alpha1.IRoute, - protos.google.cloud.datastream.v1alpha1.IGetRouteRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.datastream.v1alpha1.IRoute, - protos.google.cloud.datastream.v1alpha1.IGetRouteRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.getRoute(request, options, callback); - } - -/** - * Use this method to create a connection profile in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of ConnectionProfiles. - * @param {string} request.connectionProfileId - * Required. The connection profile identifier. - * @param {google.cloud.datastream.v1alpha1.ConnectionProfile} request.connectionProfile - * Required. The connection profile resource to create. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.create_connection_profile.js - * region_tag:datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_async - */ - createConnectionProfile( - request?: protos.google.cloud.datastream.v1alpha1.ICreateConnectionProfileRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createConnectionProfile( - request: protos.google.cloud.datastream.v1alpha1.ICreateConnectionProfileRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConnectionProfile( - request: protos.google.cloud.datastream.v1alpha1.ICreateConnectionProfileRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createConnectionProfile( - request?: protos.google.cloud.datastream.v1alpha1.ICreateConnectionProfileRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createConnectionProfile(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createConnectionProfile()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.create_connection_profile.js - * region_tag:datastream_v1alpha1_generated_Datastream_CreateConnectionProfile_async - */ - async checkCreateConnectionProfileProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createConnectionProfile, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to update the parameters of a connection profile. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * ConnectionProfile resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.datastream.v1alpha1.ConnectionProfile} request.connectionProfile - * Required. The ConnectionProfile to update. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.update_connection_profile.js - * region_tag:datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_async - */ - updateConnectionProfile( - request?: protos.google.cloud.datastream.v1alpha1.IUpdateConnectionProfileRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateConnectionProfile( - request: protos.google.cloud.datastream.v1alpha1.IUpdateConnectionProfileRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateConnectionProfile( - request: protos.google.cloud.datastream.v1alpha1.IUpdateConnectionProfileRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateConnectionProfile( - request?: protos.google.cloud.datastream.v1alpha1.IUpdateConnectionProfileRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'connection_profile.name': request.connectionProfile!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateConnectionProfile(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateConnectionProfile()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.update_connection_profile.js - * region_tag:datastream_v1alpha1_generated_Datastream_UpdateConnectionProfile_async - */ - async checkUpdateConnectionProfileProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateConnectionProfile, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to delete a connection profile.. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the connection profile resource to delete. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.delete_connection_profile.js - * region_tag:datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_async - */ - deleteConnectionProfile( - request?: protos.google.cloud.datastream.v1alpha1.IDeleteConnectionProfileRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteConnectionProfile( - request: protos.google.cloud.datastream.v1alpha1.IDeleteConnectionProfileRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteConnectionProfile( - request: protos.google.cloud.datastream.v1alpha1.IDeleteConnectionProfileRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteConnectionProfile( - request?: protos.google.cloud.datastream.v1alpha1.IDeleteConnectionProfileRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteConnectionProfile(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteConnectionProfile()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.delete_connection_profile.js - * region_tag:datastream_v1alpha1_generated_Datastream_DeleteConnectionProfile_async - */ - async checkDeleteConnectionProfileProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteConnectionProfile, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to create a stream. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of streams. - * @param {string} request.streamId - * Required. The stream identifier. - * @param {google.cloud.datastream.v1alpha1.Stream} request.stream - * Required. The stream resource to create. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.validateOnly] - * Optional. Only validate the stream, but do not create any resources. - * The default is false. - * @param {boolean} [request.force] - * Optional. Create the stream without validating it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.create_stream.js - * region_tag:datastream_v1alpha1_generated_Datastream_CreateStream_async - */ - createStream( - request?: protos.google.cloud.datastream.v1alpha1.ICreateStreamRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createStream( - request: protos.google.cloud.datastream.v1alpha1.ICreateStreamRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createStream( - request: protos.google.cloud.datastream.v1alpha1.ICreateStreamRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createStream( - request?: protos.google.cloud.datastream.v1alpha1.ICreateStreamRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createStream(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createStream()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.create_stream.js - * region_tag:datastream_v1alpha1_generated_Datastream_CreateStream_async - */ - async checkCreateStreamProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createStream, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to update the configuration of a stream. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. Field mask is used to specify the fields to be overwritten in the - * stream resource by the update. - * The fields specified in the update_mask are relative to the resource, not - * the full request. A field will be overwritten if it is in the mask. If the - * user does not provide a mask then all fields will be overwritten. - * @param {google.cloud.datastream.v1alpha1.Stream} request.stream - * Required. The stream resource to update. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.validateOnly] - * Optional. Only validate the stream with the changes, without actually updating it. - * The default is false. - * @param {boolean} [request.force] - * Optional. Execute the update without validating it. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.update_stream.js - * region_tag:datastream_v1alpha1_generated_Datastream_UpdateStream_async - */ - updateStream( - request?: protos.google.cloud.datastream.v1alpha1.IUpdateStreamRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateStream( - request: protos.google.cloud.datastream.v1alpha1.IUpdateStreamRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateStream( - request: protos.google.cloud.datastream.v1alpha1.IUpdateStreamRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateStream( - request?: protos.google.cloud.datastream.v1alpha1.IUpdateStreamRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'stream.name': request.stream!.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.updateStream(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateStream()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.update_stream.js - * region_tag:datastream_v1alpha1_generated_Datastream_UpdateStream_async - */ - async checkUpdateStreamProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateStream, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to delete a stream. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the stream resource to delete. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.delete_stream.js - * region_tag:datastream_v1alpha1_generated_Datastream_DeleteStream_async - */ - deleteStream( - request?: protos.google.cloud.datastream.v1alpha1.IDeleteStreamRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteStream( - request: protos.google.cloud.datastream.v1alpha1.IDeleteStreamRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteStream( - request: protos.google.cloud.datastream.v1alpha1.IDeleteStreamRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteStream( - request?: protos.google.cloud.datastream.v1alpha1.IDeleteStreamRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteStream(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteStream()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.delete_stream.js - * region_tag:datastream_v1alpha1_generated_Datastream_DeleteStream_async - */ - async checkDeleteStreamProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteStream, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to fetch any errors associated with a stream. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.stream - * Name of the Stream resource for which to fetch any errors. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.fetch_errors.js - * region_tag:datastream_v1alpha1_generated_Datastream_FetchErrors_async - */ - fetchErrors( - request?: protos.google.cloud.datastream.v1alpha1.IFetchErrorsRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - fetchErrors( - request: protos.google.cloud.datastream.v1alpha1.IFetchErrorsRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - fetchErrors( - request: protos.google.cloud.datastream.v1alpha1.IFetchErrorsRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - fetchErrors( - request?: protos.google.cloud.datastream.v1alpha1.IFetchErrorsRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'stream': request.stream ?? '', - }); - this.initialize(); - return this.innerApiCalls.fetchErrors(request, options, callback); - } -/** - * Check the status of the long running operation returned by `fetchErrors()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.fetch_errors.js - * region_tag:datastream_v1alpha1_generated_Datastream_FetchErrors_async - */ - async checkFetchErrorsProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.fetchErrors, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to create a private connectivity configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of PrivateConnections. - * @param {string} request.privateConnectionId - * Required. The private connectivity identifier. - * @param {google.cloud.datastream.v1alpha1.PrivateConnection} request.privateConnection - * Required. The Private Connectivity resource to create. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.create_private_connection.js - * region_tag:datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_async - */ - createPrivateConnection( - request?: protos.google.cloud.datastream.v1alpha1.ICreatePrivateConnectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createPrivateConnection( - request: protos.google.cloud.datastream.v1alpha1.ICreatePrivateConnectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createPrivateConnection( - request: protos.google.cloud.datastream.v1alpha1.ICreatePrivateConnectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createPrivateConnection( - request?: protos.google.cloud.datastream.v1alpha1.ICreatePrivateConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createPrivateConnection(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createPrivateConnection()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.create_private_connection.js - * region_tag:datastream_v1alpha1_generated_Datastream_CreatePrivateConnection_async - */ - async checkCreatePrivateConnectionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createPrivateConnection, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to delete a private connectivity configuration. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the private connectivity configuration to delete. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {boolean} [request.force] - * Optional. If set to true, any child routes that belong to this PrivateConnection will - * also be deleted. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.delete_private_connection.js - * region_tag:datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_async - */ - deletePrivateConnection( - request?: protos.google.cloud.datastream.v1alpha1.IDeletePrivateConnectionRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deletePrivateConnection( - request: protos.google.cloud.datastream.v1alpha1.IDeletePrivateConnectionRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deletePrivateConnection( - request: protos.google.cloud.datastream.v1alpha1.IDeletePrivateConnectionRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deletePrivateConnection( - request?: protos.google.cloud.datastream.v1alpha1.IDeletePrivateConnectionRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deletePrivateConnection(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deletePrivateConnection()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.delete_private_connection.js - * region_tag:datastream_v1alpha1_generated_Datastream_DeletePrivateConnection_async - */ - async checkDeletePrivateConnectionProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deletePrivateConnection, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to create a route for a private connectivity in a project - * and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of Routes. - * @param {string} request.routeId - * Required. The Route identifier. - * @param {google.cloud.datastream.v1alpha1.Route} request.route - * Required. The Route resource to create. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes since the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.create_route.js - * region_tag:datastream_v1alpha1_generated_Datastream_CreateRoute_async - */ - createRoute( - request?: protos.google.cloud.datastream.v1alpha1.ICreateRouteRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createRoute( - request: protos.google.cloud.datastream.v1alpha1.ICreateRouteRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createRoute( - request: protos.google.cloud.datastream.v1alpha1.ICreateRouteRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createRoute( - request?: protos.google.cloud.datastream.v1alpha1.ICreateRouteRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.createRoute(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createRoute()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.create_route.js - * region_tag:datastream_v1alpha1_generated_Datastream_CreateRoute_async - */ - async checkCreateRouteProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createRoute, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Use this method to delete a route. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Route resource to delete. - * @param {string} [request.requestId] - * Optional. A request ID to identify requests. Specify a unique request ID - * so that if you must retry your request, the server will know to ignore - * the request if it has already been completed. The server will guarantee - * that for at least 60 minutes after the first request. - * - * For example, consider a situation where you make an initial request and the - * request times out. If you make the request again with the same request ID, - * the server can check if original operation with the same request ID was - * received, and if so, will ignore the second request. This prevents clients - * from accidentally creating duplicate commitments. - * - * The request ID must be a valid UUID with the exception that zero UUID is - * not supported (00000000-0000-0000-0000-000000000000). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.delete_route.js - * region_tag:datastream_v1alpha1_generated_Datastream_DeleteRoute_async - */ - deleteRoute( - request?: protos.google.cloud.datastream.v1alpha1.IDeleteRouteRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteRoute( - request: protos.google.cloud.datastream.v1alpha1.IDeleteRouteRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteRoute( - request: protos.google.cloud.datastream.v1alpha1.IDeleteRouteRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteRoute( - request?: protos.google.cloud.datastream.v1alpha1.IDeleteRouteRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.deleteRoute(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteRoute()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.delete_route.js - * region_tag:datastream_v1alpha1_generated_Datastream_DeleteRoute_async - */ - async checkDeleteRouteProgress(name: string): Promise>{ - const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteRoute, this._gaxModule.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Use this method to list connection profiles created in a project and - * location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of connection profiles. - * @param {number} request.pageSize - * Maximum number of connection profiles to return. - * If unspecified, at most 50 connection profiles will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListConnectionProfiles` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListConnectionProfiles` - * must match the call that provided the page token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.datastream.v1alpha1.ConnectionProfile | ConnectionProfile}. - * 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 `listConnectionProfilesAsync()` - * 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. - */ - listConnectionProfiles( - request?: protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1alpha1.IConnectionProfile[], - protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest|null, - protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesResponse - ]>; - listConnectionProfiles( - request: protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, - protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesResponse|null|undefined, - protos.google.cloud.datastream.v1alpha1.IConnectionProfile>): void; - listConnectionProfiles( - request: protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, - callback: PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, - protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesResponse|null|undefined, - protos.google.cloud.datastream.v1alpha1.IConnectionProfile>): void; - listConnectionProfiles( - request?: protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, - protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesResponse|null|undefined, - protos.google.cloud.datastream.v1alpha1.IConnectionProfile>, - callback?: PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, - protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesResponse|null|undefined, - protos.google.cloud.datastream.v1alpha1.IConnectionProfile>): - Promise<[ - protos.google.cloud.datastream.v1alpha1.IConnectionProfile[], - protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest|null, - protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listConnectionProfiles(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of connection profiles. - * @param {number} request.pageSize - * Maximum number of connection profiles to return. - * If unspecified, at most 50 connection profiles will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListConnectionProfiles` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListConnectionProfiles` - * must match the call that provided the page token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.datastream.v1alpha1.ConnectionProfile | ConnectionProfile} 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 `listConnectionProfilesAsync()` - * 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. - */ - listConnectionProfilesStream( - request?: protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConnectionProfiles']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConnectionProfiles.createStream( - this.innerApiCalls.listConnectionProfiles as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listConnectionProfiles`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of connection profiles. - * @param {number} request.pageSize - * Maximum number of connection profiles to return. - * If unspecified, at most 50 connection profiles will be returned. - * The maximum value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListConnectionProfiles` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListConnectionProfiles` - * must match the call that provided the page token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.datastream.v1alpha1.ConnectionProfile | ConnectionProfile}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.list_connection_profiles.js - * region_tag:datastream_v1alpha1_generated_Datastream_ListConnectionProfiles_async - */ - listConnectionProfilesAsync( - request?: protos.google.cloud.datastream.v1alpha1.IListConnectionProfilesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listConnectionProfiles']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listConnectionProfiles.asyncIterate( - this.innerApiCalls['listConnectionProfiles'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Use this method to list streams in a project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of streams. - * @param {number} request.pageSize - * Maximum number of streams to return. - * If unspecified, at most 50 streams will be returned. The maximum - * value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListStreams` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListStreams` - * must match the call that provided the page token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.datastream.v1alpha1.Stream | Stream}. - * 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 `listStreamsAsync()` - * 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. - */ - listStreams( - request?: protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1alpha1.IStream[], - protos.google.cloud.datastream.v1alpha1.IListStreamsRequest|null, - protos.google.cloud.datastream.v1alpha1.IListStreamsResponse - ]>; - listStreams( - request: protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, - protos.google.cloud.datastream.v1alpha1.IListStreamsResponse|null|undefined, - protos.google.cloud.datastream.v1alpha1.IStream>): void; - listStreams( - request: protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, - callback: PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, - protos.google.cloud.datastream.v1alpha1.IListStreamsResponse|null|undefined, - protos.google.cloud.datastream.v1alpha1.IStream>): void; - listStreams( - request?: protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, - protos.google.cloud.datastream.v1alpha1.IListStreamsResponse|null|undefined, - protos.google.cloud.datastream.v1alpha1.IStream>, - callback?: PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, - protos.google.cloud.datastream.v1alpha1.IListStreamsResponse|null|undefined, - protos.google.cloud.datastream.v1alpha1.IStream>): - Promise<[ - protos.google.cloud.datastream.v1alpha1.IStream[], - protos.google.cloud.datastream.v1alpha1.IListStreamsRequest|null, - protos.google.cloud.datastream.v1alpha1.IListStreamsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listStreams(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of streams. - * @param {number} request.pageSize - * Maximum number of streams to return. - * If unspecified, at most 50 streams will be returned. The maximum - * value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListStreams` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListStreams` - * must match the call that provided the page token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.datastream.v1alpha1.Stream | Stream} 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 `listStreamsAsync()` - * 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. - */ - listStreamsStream( - request?: protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listStreams']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listStreams.createStream( - this.innerApiCalls.listStreams as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listStreams`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of streams. - * @param {number} request.pageSize - * Maximum number of streams to return. - * If unspecified, at most 50 streams will be returned. The maximum - * value is 1000; values above 1000 will be coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListStreams` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to `ListStreams` - * must match the call that provided the page token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.datastream.v1alpha1.Stream | Stream}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.list_streams.js - * region_tag:datastream_v1alpha1_generated_Datastream_ListStreams_async - */ - listStreamsAsync( - request?: protos.google.cloud.datastream.v1alpha1.IListStreamsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listStreams']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listStreams.asyncIterate( - this.innerApiCalls['listStreams'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * The FetchStaticIps API call exposes the static ips used by Datastream. - * Typically, a request returns children data objects under - * a parent data object that's optionally supplied in the request. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name resource of the Response type. Must be in the - * format `projects/* /locations/*`. - * @param {number} request.pageSize - * Maximum number of Ips to return, will likely not be specified. - * @param {string} request.pageToken - * A page token, received from a previous `ListStaticIps` call. - * will likely not 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 Array of string. - * 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 `fetchStaticIpsAsync()` - * 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. - */ - fetchStaticIps( - request?: protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, - options?: CallOptions): - Promise<[ - string[], - protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest|null, - protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsResponse - ]>; - fetchStaticIps( - request: protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, - protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsResponse|null|undefined, - string>): void; - fetchStaticIps( - request: protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, - callback: PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, - protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsResponse|null|undefined, - string>): void; - fetchStaticIps( - request?: protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, - protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsResponse|null|undefined, - string>, - callback?: PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, - protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsResponse|null|undefined, - string>): - Promise<[ - string[], - protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest|null, - protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - this.initialize(); - return this.innerApiCalls.fetchStaticIps(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.name - * Required. The name resource of the Response type. Must be in the - * format `projects/* /locations/*`. - * @param {number} request.pageSize - * Maximum number of Ips to return, will likely not be specified. - * @param {string} request.pageToken - * A page token, received from a previous `ListStaticIps` call. - * will likely not be specified. - * @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 string 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 `fetchStaticIpsAsync()` - * 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. - */ - fetchStaticIpsStream( - request?: protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['fetchStaticIps']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.fetchStaticIps.createStream( - this.innerApiCalls.fetchStaticIps as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `fetchStaticIps`, 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.name - * Required. The name resource of the Response type. Must be in the - * format `projects/* /locations/*`. - * @param {number} request.pageSize - * Maximum number of Ips to return, will likely not be specified. - * @param {string} request.pageToken - * A page token, received from a previous `ListStaticIps` call. - * will likely not be specified. - * @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 - * string. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.fetch_static_ips.js - * region_tag:datastream_v1alpha1_generated_Datastream_FetchStaticIps_async - */ - fetchStaticIpsAsync( - request?: protos.google.cloud.datastream.v1alpha1.IFetchStaticIpsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'name': request.name ?? '', - }); - const defaultCallSettings = this._defaults['fetchStaticIps']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.fetchStaticIps.asyncIterate( - this.innerApiCalls['fetchStaticIps'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Use this method to list private connectivity configurations in a project - * and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of private connectivity configurations. - * @param {number} request.pageSize - * Maximum number of private connectivity configurations to return. - * If unspecified, at most 50 private connectivity configurations that will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListPrivateConnections` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListPrivateConnections` must match the call that provided the page - * token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.datastream.v1alpha1.PrivateConnection | PrivateConnection}. - * 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 `listPrivateConnectionsAsync()` - * 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. - */ - listPrivateConnections( - request?: protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1alpha1.IPrivateConnection[], - protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest|null, - protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsResponse - ]>; - listPrivateConnections( - request: protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, - protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsResponse|null|undefined, - protos.google.cloud.datastream.v1alpha1.IPrivateConnection>): void; - listPrivateConnections( - request: protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, - callback: PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, - protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsResponse|null|undefined, - protos.google.cloud.datastream.v1alpha1.IPrivateConnection>): void; - listPrivateConnections( - request?: protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, - protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsResponse|null|undefined, - protos.google.cloud.datastream.v1alpha1.IPrivateConnection>, - callback?: PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, - protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsResponse|null|undefined, - protos.google.cloud.datastream.v1alpha1.IPrivateConnection>): - Promise<[ - protos.google.cloud.datastream.v1alpha1.IPrivateConnection[], - protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest|null, - protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listPrivateConnections(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of private connectivity configurations. - * @param {number} request.pageSize - * Maximum number of private connectivity configurations to return. - * If unspecified, at most 50 private connectivity configurations that will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListPrivateConnections` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListPrivateConnections` must match the call that provided the page - * token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.datastream.v1alpha1.PrivateConnection | PrivateConnection} 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 `listPrivateConnectionsAsync()` - * 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. - */ - listPrivateConnectionsStream( - request?: protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listPrivateConnections']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPrivateConnections.createStream( - this.innerApiCalls.listPrivateConnections as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listPrivateConnections`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of private connectivity configurations. - * @param {number} request.pageSize - * Maximum number of private connectivity configurations to return. - * If unspecified, at most 50 private connectivity configurations that will be - * returned. The maximum value is 1000; values above 1000 will be coerced to - * 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListPrivateConnections` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListPrivateConnections` must match the call that provided the page - * token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.datastream.v1alpha1.PrivateConnection | PrivateConnection}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.list_private_connections.js - * region_tag:datastream_v1alpha1_generated_Datastream_ListPrivateConnections_async - */ - listPrivateConnectionsAsync( - request?: protos.google.cloud.datastream.v1alpha1.IListPrivateConnectionsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listPrivateConnections']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPrivateConnections.asyncIterate( - this.innerApiCalls['listPrivateConnections'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - /** - * Use this method to list routes created for a private connectivity in a - * project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of Routess. - * @param {number} request.pageSize - * Maximum number of Routes to return. The service may return - * fewer than this value. If unspecified, at most 50 Routes - * will be returned. The maximum value is 1000; values above 1000 will be - * coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListRoutes` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListRoutes` must match the call that provided the page - * token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is Array of {@link google.cloud.datastream.v1alpha1.Route | Route}. - * 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 `listRoutesAsync()` - * 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. - */ - listRoutes( - request?: protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.datastream.v1alpha1.IRoute[], - protos.google.cloud.datastream.v1alpha1.IListRoutesRequest|null, - protos.google.cloud.datastream.v1alpha1.IListRoutesResponse - ]>; - listRoutes( - request: protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, - protos.google.cloud.datastream.v1alpha1.IListRoutesResponse|null|undefined, - protos.google.cloud.datastream.v1alpha1.IRoute>): void; - listRoutes( - request: protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, - callback: PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, - protos.google.cloud.datastream.v1alpha1.IListRoutesResponse|null|undefined, - protos.google.cloud.datastream.v1alpha1.IRoute>): void; - listRoutes( - request?: protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, - protos.google.cloud.datastream.v1alpha1.IListRoutesResponse|null|undefined, - protos.google.cloud.datastream.v1alpha1.IRoute>, - callback?: PaginationCallback< - protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, - protos.google.cloud.datastream.v1alpha1.IListRoutesResponse|null|undefined, - protos.google.cloud.datastream.v1alpha1.IRoute>): - Promise<[ - protos.google.cloud.datastream.v1alpha1.IRoute[], - protos.google.cloud.datastream.v1alpha1.IListRoutesRequest|null, - protos.google.cloud.datastream.v1alpha1.IListRoutesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - this.initialize(); - return this.innerApiCalls.listRoutes(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of Routess. - * @param {number} request.pageSize - * Maximum number of Routes to return. The service may return - * fewer than this value. If unspecified, at most 50 Routes - * will be returned. The maximum value is 1000; values above 1000 will be - * coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListRoutes` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListRoutes` must match the call that provided the page - * token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Stream} - * An object stream which emits an object representing {@link google.cloud.datastream.v1alpha1.Route | Route} 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 `listRoutesAsync()` - * 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. - */ - listRoutesStream( - request?: protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listRoutes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRoutes.createStream( - this.innerApiCalls.listRoutes as GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listRoutes`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent that owns the collection of Routess. - * @param {number} request.pageSize - * Maximum number of Routes to return. The service may return - * fewer than this value. If unspecified, at most 50 Routes - * will be returned. The maximum value is 1000; values above 1000 will be - * coerced to 1000. - * @param {string} request.pageToken - * Page token received from a previous `ListRoutes` call. - * Provide this to retrieve the subsequent page. - * - * When paginating, all other parameters provided to - * `ListRoutes` must match the call that provided the page - * token. - * @param {string} request.filter - * Filter request. - * @param {string} request.orderBy - * Order by fields for the result. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Object} - * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). - * When you iterate the returned iterable, each element will be an object representing - * {@link google.cloud.datastream.v1alpha1.Route | Route}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1alpha1/datastream.list_routes.js - * region_tag:datastream_v1alpha1_generated_Datastream_ListRoutes_async - */ - listRoutesAsync( - request?: protos.google.cloud.datastream.v1alpha1.IListRoutesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = this._gaxModule.routingHeader.fromParams({ - 'parent': request.parent ?? '', - }); - const defaultCallSettings = this._defaults['listRoutes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listRoutes.asyncIterate( - this.innerApiCalls['listRoutes'] as GaxCall, - request as {}, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified connectionProfile resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} connection_profile - * @returns {string} Resource name string. - */ - connectionProfilePath(project:string,location:string,connectionProfile:string) { - return this.pathTemplates.connectionProfilePathTemplate.render({ - project: project, - location: location, - connection_profile: connectionProfile, - }); - } - - /** - * Parse the project from ConnectionProfile resource. - * - * @param {string} connectionProfileName - * A fully-qualified path representing ConnectionProfile resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConnectionProfileName(connectionProfileName: string) { - return this.pathTemplates.connectionProfilePathTemplate.match(connectionProfileName).project; - } - - /** - * Parse the location from ConnectionProfile resource. - * - * @param {string} connectionProfileName - * A fully-qualified path representing ConnectionProfile resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConnectionProfileName(connectionProfileName: string) { - return this.pathTemplates.connectionProfilePathTemplate.match(connectionProfileName).location; - } - - /** - * Parse the connection_profile from ConnectionProfile resource. - * - * @param {string} connectionProfileName - * A fully-qualified path representing ConnectionProfile resource. - * @returns {string} A string representing the connection_profile. - */ - matchConnectionProfileFromConnectionProfileName(connectionProfileName: string) { - return this.pathTemplates.connectionProfilePathTemplate.match(connectionProfileName).connection_profile; - } - - /** - * Return a fully-qualified location resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - locationPath(project:string,location:string) { - return this.pathTemplates.locationPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the project. - */ - matchProjectFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).project; - } - - /** - * Parse the location from Location resource. - * - * @param {string} locationName - * A fully-qualified path representing Location resource. - * @returns {string} A string representing the location. - */ - matchLocationFromLocationName(locationName: string) { - return this.pathTemplates.locationPathTemplate.match(locationName).location; - } - - /** - * Return a fully-qualified privateConnection resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} private_connection - * @returns {string} Resource name string. - */ - privateConnectionPath(project:string,location:string,privateConnection:string) { - return this.pathTemplates.privateConnectionPathTemplate.render({ - project: project, - location: location, - private_connection: privateConnection, - }); - } - - /** - * Parse the project from PrivateConnection resource. - * - * @param {string} privateConnectionName - * A fully-qualified path representing PrivateConnection resource. - * @returns {string} A string representing the project. - */ - matchProjectFromPrivateConnectionName(privateConnectionName: string) { - return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).project; - } - - /** - * Parse the location from PrivateConnection resource. - * - * @param {string} privateConnectionName - * A fully-qualified path representing PrivateConnection resource. - * @returns {string} A string representing the location. - */ - matchLocationFromPrivateConnectionName(privateConnectionName: string) { - return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).location; - } - - /** - * Parse the private_connection from PrivateConnection resource. - * - * @param {string} privateConnectionName - * A fully-qualified path representing PrivateConnection resource. - * @returns {string} A string representing the private_connection. - */ - matchPrivateConnectionFromPrivateConnectionName(privateConnectionName: string) { - return this.pathTemplates.privateConnectionPathTemplate.match(privateConnectionName).private_connection; - } - - /** - * 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 route resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} private_connection - * @param {string} route - * @returns {string} Resource name string. - */ - routePath(project:string,location:string,privateConnection:string,route:string) { - return this.pathTemplates.routePathTemplate.render({ - project: project, - location: location, - private_connection: privateConnection, - route: route, - }); - } - - /** - * Parse the project from Route resource. - * - * @param {string} routeName - * A fully-qualified path representing Route resource. - * @returns {string} A string representing the project. - */ - matchProjectFromRouteName(routeName: string) { - return this.pathTemplates.routePathTemplate.match(routeName).project; - } - - /** - * Parse the location from Route resource. - * - * @param {string} routeName - * A fully-qualified path representing Route resource. - * @returns {string} A string representing the location. - */ - matchLocationFromRouteName(routeName: string) { - return this.pathTemplates.routePathTemplate.match(routeName).location; - } - - /** - * Parse the private_connection from Route resource. - * - * @param {string} routeName - * A fully-qualified path representing Route resource. - * @returns {string} A string representing the private_connection. - */ - matchPrivateConnectionFromRouteName(routeName: string) { - return this.pathTemplates.routePathTemplate.match(routeName).private_connection; - } - - /** - * Parse the route from Route resource. - * - * @param {string} routeName - * A fully-qualified path representing Route resource. - * @returns {string} A string representing the route. - */ - matchRouteFromRouteName(routeName: string) { - return this.pathTemplates.routePathTemplate.match(routeName).route; - } - - /** - * Return a fully-qualified stream resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} stream - * @returns {string} Resource name string. - */ - streamPath(project:string,location:string,stream:string) { - return this.pathTemplates.streamPathTemplate.render({ - project: project, - location: location, - stream: stream, - }); - } - - /** - * Parse the project from Stream resource. - * - * @param {string} streamName - * A fully-qualified path representing Stream resource. - * @returns {string} A string representing the project. - */ - matchProjectFromStreamName(streamName: string) { - return this.pathTemplates.streamPathTemplate.match(streamName).project; - } - - /** - * Parse the location from Stream resource. - * - * @param {string} streamName - * A fully-qualified path representing Stream resource. - * @returns {string} A string representing the location. - */ - matchLocationFromStreamName(streamName: string) { - return this.pathTemplates.streamPathTemplate.match(streamName).location; - } - - /** - * Parse the stream from Stream resource. - * - * @param {string} streamName - * A fully-qualified path representing Stream resource. - * @returns {string} A string representing the stream. - */ - matchStreamFromStreamName(streamName: string) { - return this.pathTemplates.streamPathTemplate.match(streamName).stream; - } - - /** - * Terminate the gRPC channel and close the client. - * - * The client will no longer be usable and all future behavior is undefined. - * @returns {Promise} A promise that resolves when the client is closed. - */ - close(): Promise { - if (this.datastreamStub && !this._terminated) { - return this.datastreamStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_client_config.json b/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_client_config.json deleted file mode 100644 index 0eeb5ffdfe9..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_client_config.json +++ /dev/null @@ -1,143 +0,0 @@ -{ - "interfaces": { - "google.cloud.datastream.v1alpha1.Datastream": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "unavailable": [ - "UNAVAILABLE" - ] - }, - "retry_params": { - "default": { - "initial_retry_delay_millis": 100, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListConnectionProfiles": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetConnectionProfile": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateConnectionProfile": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateConnectionProfile": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteConnectionProfile": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DiscoverConnectionProfile": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListStreams": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetStream": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateStream": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateStream": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteStream": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "FetchErrors": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "FetchStaticIps": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreatePrivateConnection": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetPrivateConnection": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListPrivateConnections": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeletePrivateConnection": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateRoute": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetRoute": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListRoutes": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteRoute": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_proto_list.json b/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_proto_list.json deleted file mode 100644 index baaa8482b91..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/datastream_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/datastream/v1alpha1/datastream.proto", - "../../protos/google/cloud/datastream/v1alpha1/datastream_resources.proto" -] diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/gapic_metadata.json b/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/gapic_metadata.json deleted file mode 100644 index 57db1ad343f..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/gapic_metadata.json +++ /dev/null @@ -1,253 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.datastream.v1alpha1", - "libraryPackage": "@google-cloud/datastream", - "services": { - "Datastream": { - "clients": { - "grpc": { - "libraryClient": "DatastreamClient", - "rpcs": { - "GetConnectionProfile": { - "methods": [ - "getConnectionProfile" - ] - }, - "DiscoverConnectionProfile": { - "methods": [ - "discoverConnectionProfile" - ] - }, - "GetStream": { - "methods": [ - "getStream" - ] - }, - "GetPrivateConnection": { - "methods": [ - "getPrivateConnection" - ] - }, - "GetRoute": { - "methods": [ - "getRoute" - ] - }, - "CreateConnectionProfile": { - "methods": [ - "createConnectionProfile" - ] - }, - "UpdateConnectionProfile": { - "methods": [ - "updateConnectionProfile" - ] - }, - "DeleteConnectionProfile": { - "methods": [ - "deleteConnectionProfile" - ] - }, - "CreateStream": { - "methods": [ - "createStream" - ] - }, - "UpdateStream": { - "methods": [ - "updateStream" - ] - }, - "DeleteStream": { - "methods": [ - "deleteStream" - ] - }, - "FetchErrors": { - "methods": [ - "fetchErrors" - ] - }, - "CreatePrivateConnection": { - "methods": [ - "createPrivateConnection" - ] - }, - "DeletePrivateConnection": { - "methods": [ - "deletePrivateConnection" - ] - }, - "CreateRoute": { - "methods": [ - "createRoute" - ] - }, - "DeleteRoute": { - "methods": [ - "deleteRoute" - ] - }, - "ListConnectionProfiles": { - "methods": [ - "listConnectionProfiles", - "listConnectionProfilesStream", - "listConnectionProfilesAsync" - ] - }, - "ListStreams": { - "methods": [ - "listStreams", - "listStreamsStream", - "listStreamsAsync" - ] - }, - "FetchStaticIps": { - "methods": [ - "fetchStaticIps", - "fetchStaticIpsStream", - "fetchStaticIpsAsync" - ] - }, - "ListPrivateConnections": { - "methods": [ - "listPrivateConnections", - "listPrivateConnectionsStream", - "listPrivateConnectionsAsync" - ] - }, - "ListRoutes": { - "methods": [ - "listRoutes", - "listRoutesStream", - "listRoutesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "DatastreamClient", - "rpcs": { - "GetConnectionProfile": { - "methods": [ - "getConnectionProfile" - ] - }, - "DiscoverConnectionProfile": { - "methods": [ - "discoverConnectionProfile" - ] - }, - "GetStream": { - "methods": [ - "getStream" - ] - }, - "GetPrivateConnection": { - "methods": [ - "getPrivateConnection" - ] - }, - "GetRoute": { - "methods": [ - "getRoute" - ] - }, - "CreateConnectionProfile": { - "methods": [ - "createConnectionProfile" - ] - }, - "UpdateConnectionProfile": { - "methods": [ - "updateConnectionProfile" - ] - }, - "DeleteConnectionProfile": { - "methods": [ - "deleteConnectionProfile" - ] - }, - "CreateStream": { - "methods": [ - "createStream" - ] - }, - "UpdateStream": { - "methods": [ - "updateStream" - ] - }, - "DeleteStream": { - "methods": [ - "deleteStream" - ] - }, - "FetchErrors": { - "methods": [ - "fetchErrors" - ] - }, - "CreatePrivateConnection": { - "methods": [ - "createPrivateConnection" - ] - }, - "DeletePrivateConnection": { - "methods": [ - "deletePrivateConnection" - ] - }, - "CreateRoute": { - "methods": [ - "createRoute" - ] - }, - "DeleteRoute": { - "methods": [ - "deleteRoute" - ] - }, - "ListConnectionProfiles": { - "methods": [ - "listConnectionProfiles", - "listConnectionProfilesStream", - "listConnectionProfilesAsync" - ] - }, - "ListStreams": { - "methods": [ - "listStreams", - "listStreamsStream", - "listStreamsAsync" - ] - }, - "FetchStaticIps": { - "methods": [ - "fetchStaticIps", - "fetchStaticIpsStream", - "fetchStaticIpsAsync" - ] - }, - "ListPrivateConnections": { - "methods": [ - "listPrivateConnections", - "listPrivateConnectionsStream", - "listPrivateConnectionsAsync" - ] - }, - "ListRoutes": { - "methods": [ - "listRoutes", - "listRoutesStream", - "listRoutesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/index.ts b/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/index.ts deleted file mode 100644 index 37416a69a13..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/src/v1alpha1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {DatastreamClient} from './datastream_client'; diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 0c39f11d9bc..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const datastream = require('@google-cloud/datastream'); - -function main() { - const datastreamClient = new datastream.DatastreamClient(); -} - -main(); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 9dd67114647..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {DatastreamClient} from '@google-cloud/datastream'; - -// check that the client class type name can be used -function doStuffWithDatastreamClient(client: DatastreamClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const datastreamClient = new DatastreamClient(); - doStuffWithDatastreamClient(datastreamClient); -} - -main(); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/install.ts b/owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/install.ts deleted file mode 100644 index c8f81b25a86..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {packNTest} from 'pack-n-play'; -import {readFileSync} from 'fs'; -import {describe, it} from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/test/gapic_datastream_v1alpha1.ts b/owl-bot-staging/google-cloud-datastream/v1alpha1/test/gapic_datastream_v1alpha1.ts deleted file mode 100644 index ab216043ed3..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/test/gapic_datastream_v1alpha1.ts +++ /dev/null @@ -1,3927 +0,0 @@ -// Copyright 2023 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import {describe, it} from 'mocha'; -import * as datastreamModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -// Dynamically loaded proto JSON is needed to get the type information -// to fill in default values for request objects -const root = protobuf.Root.fromJSON(require('../protos/protos.json')).resolveAll(); - -// eslint-disable-next-line @typescript-eslint/no-unused-vars -function getTypeDefaultValue(typeName: string, fields: string[]) { - let type = root.lookupType(typeName) as protobuf.Type; - for (const field of fields.slice(0, -1)) { - type = type.fields[field]?.resolvedType as protobuf.Type; - } - return type.fields[fields[fields.length - 1]]?.defaultValue; -} - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1alpha1.DatastreamClient', () => { - describe('Common methods', () => { - it('has servicePath', () => { - const servicePath = datastreamModule.v1alpha1.DatastreamClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = datastreamModule.v1alpha1.DatastreamClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = datastreamModule.v1alpha1.DatastreamClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new datastreamModule.v1alpha1.DatastreamClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.datastreamStub, undefined); - await client.initialize(); - assert(client.datastreamStub); - }); - - it('has close method for the initialized client', done => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.datastreamStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.datastreamStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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 datastreamModule.v1alpha1.DatastreamClient({ - 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('getConnectionProfile', () => { - it('invokes getConnectionProfile without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ConnectionProfile() - ); - client.innerApiCalls.getConnectionProfile = stubSimpleCall(expectedResponse); - const [response] = await client.getConnectionProfile(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnectionProfile without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ConnectionProfile() - ); - client.innerApiCalls.getConnectionProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConnectionProfile( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1alpha1.IConnectionProfile|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnectionProfile with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getConnectionProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConnectionProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.getConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getConnectionProfile with closed client', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetConnectionProfileRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getConnectionProfile(request), expectedError); - }); - }); - - describe('discoverConnectionProfile', () => { - it('invokes discoverConnectionProfile without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileResponse() - ); - client.innerApiCalls.discoverConnectionProfile = stubSimpleCall(expectedResponse); - const [response] = await client.discoverConnectionProfile(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.discoverConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.discoverConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes discoverConnectionProfile without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileResponse() - ); - client.innerApiCalls.discoverConnectionProfile = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.discoverConnectionProfile( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1alpha1.IDiscoverConnectionProfileResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.discoverConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.discoverConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes discoverConnectionProfile with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.discoverConnectionProfile = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.discoverConnectionProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.discoverConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.discoverConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes discoverConnectionProfile with closed client', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DiscoverConnectionProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.discoverConnectionProfile(request), expectedError); - }); - }); - - describe('getStream', () => { - it('invokes getStream without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.GetStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.Stream() - ); - client.innerApiCalls.getStream = stubSimpleCall(expectedResponse); - const [response] = await client.getStream(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStream without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.GetStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.Stream() - ); - client.innerApiCalls.getStream = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getStream( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1alpha1.IStream|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStream with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.GetStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getStream = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getStream(request), expectedError); - const actualRequest = (client.innerApiCalls.getStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getStream with closed client', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.GetStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetStreamRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getStream(request), expectedError); - }); - }); - - describe('getPrivateConnection', () => { - it('invokes getPrivateConnection without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.PrivateConnection() - ); - client.innerApiCalls.getPrivateConnection = stubSimpleCall(expectedResponse); - const [response] = await client.getPrivateConnection(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPrivateConnection without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.PrivateConnection() - ); - client.innerApiCalls.getPrivateConnection = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getPrivateConnection( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1alpha1.IPrivateConnection|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPrivateConnection with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getPrivateConnection = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getPrivateConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getPrivateConnection with closed client', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetPrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getPrivateConnection(request), expectedError); - }); - }); - - describe('getRoute', () => { - it('invokes getRoute without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.GetRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetRouteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.Route() - ); - client.innerApiCalls.getRoute = stubSimpleCall(expectedResponse); - const [response] = await client.getRoute(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoute without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.GetRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetRouteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.Route() - ); - client.innerApiCalls.getRoute = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getRoute( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1alpha1.IRoute|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.getRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoute with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.GetRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetRouteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.getRoute = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getRoute(request), expectedError); - const actualRequest = (client.innerApiCalls.getRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.getRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes getRoute with closed client', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.GetRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.GetRouteRequest', ['name']); - request.name = defaultValue1; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getRoute(request), expectedError); - }); - }); - - describe('createConnectionProfile', () => { - it('invokes createConnectionProfile without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConnectionProfile = stubLongRunningCall(expectedResponse); - const [operation] = await client.createConnectionProfile(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnectionProfile without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createConnectionProfile = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createConnectionProfile( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnectionProfile with call error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConnectionProfile = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createConnectionProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.createConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createConnectionProfile with LRO error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateConnectionProfileRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createConnectionProfile = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createConnectionProfile(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateConnectionProfileProgress without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkCreateConnectionProfileProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateConnectionProfileProgress with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkCreateConnectionProfileProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateConnectionProfile', () => { - it('invokes updateConnectionProfile without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest() - ); - request.connectionProfile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest', ['connectionProfile', 'name']); - request.connectionProfile.name = defaultValue1; - const expectedHeaderRequestParams = `connection_profile.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateConnectionProfile = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateConnectionProfile(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConnectionProfile without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest() - ); - request.connectionProfile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest', ['connectionProfile', 'name']); - request.connectionProfile.name = defaultValue1; - const expectedHeaderRequestParams = `connection_profile.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateConnectionProfile = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateConnectionProfile( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConnectionProfile with call error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest() - ); - request.connectionProfile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest', ['connectionProfile', 'name']); - request.connectionProfile.name = defaultValue1; - const expectedHeaderRequestParams = `connection_profile.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateConnectionProfile = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateConnectionProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.updateConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateConnectionProfile with LRO error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest() - ); - request.connectionProfile ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.UpdateConnectionProfileRequest', ['connectionProfile', 'name']); - request.connectionProfile.name = defaultValue1; - const expectedHeaderRequestParams = `connection_profile.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateConnectionProfile = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateConnectionProfile(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateConnectionProfileProgress without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkUpdateConnectionProfileProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateConnectionProfileProgress with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkUpdateConnectionProfileProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteConnectionProfile', () => { - it('invokes deleteConnectionProfile without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConnectionProfile = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteConnectionProfile(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnectionProfile without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteConnectionProfile = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteConnectionProfile( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnectionProfile with call error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConnectionProfile = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteConnectionProfile(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteConnectionProfile with LRO error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteConnectionProfileRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConnectionProfile = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteConnectionProfile(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteConnectionProfile as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteConnectionProfile as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteConnectionProfileProgress without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkDeleteConnectionProfileProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteConnectionProfileProgress with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkDeleteConnectionProfileProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createStream', () => { - it('invokes createStream without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.CreateStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateStreamRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createStream = stubLongRunningCall(expectedResponse); - const [operation] = await client.createStream(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createStream without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.CreateStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateStreamRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createStream = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createStream( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createStream with call error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.CreateStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateStreamRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createStream = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createStream(request), expectedError); - const actualRequest = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createStream with LRO error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.CreateStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateStreamRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createStream = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createStream(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateStreamProgress without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkCreateStreamProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateStreamProgress with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkCreateStreamProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateStream', () => { - it('invokes updateStream without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.UpdateStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.UpdateStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedHeaderRequestParams = `stream.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateStream = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateStream(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateStream without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.UpdateStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.UpdateStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedHeaderRequestParams = `stream.name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.updateStream = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateStream( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateStream with call error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.UpdateStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.UpdateStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedHeaderRequestParams = `stream.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateStream = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateStream(request), expectedError); - const actualRequest = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes updateStream with LRO error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.UpdateStreamRequest() - ); - request.stream ??= {}; - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.UpdateStreamRequest', ['stream', 'name']); - request.stream.name = defaultValue1; - const expectedHeaderRequestParams = `stream.name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.updateStream = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateStream(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.updateStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkUpdateStreamProgress without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkUpdateStreamProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateStreamProgress with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkUpdateStreamProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteStream', () => { - it('invokes deleteStream without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DeleteStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteStream = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteStream(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteStream without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DeleteStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteStream = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteStream( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteStream with call error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DeleteStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteStream = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteStream(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteStream with LRO error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DeleteStreamRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteStreamRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteStream = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteStream(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteStream as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteStreamProgress without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkDeleteStreamProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteStreamProgress with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkDeleteStreamProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('fetchErrors', () => { - it('invokes fetchErrors without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.FetchErrorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchErrorsRequest', ['stream']); - request.stream = defaultValue1; - const expectedHeaderRequestParams = `stream=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.fetchErrors = stubLongRunningCall(expectedResponse); - const [operation] = await client.fetchErrors(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchErrors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchErrors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchErrors without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.FetchErrorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchErrorsRequest', ['stream']); - request.stream = defaultValue1; - const expectedHeaderRequestParams = `stream=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.fetchErrors = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fetchErrors( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchErrors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchErrors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchErrors with call error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.FetchErrorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchErrorsRequest', ['stream']); - request.stream = defaultValue1; - const expectedHeaderRequestParams = `stream=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.fetchErrors = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.fetchErrors(request), expectedError); - const actualRequest = (client.innerApiCalls.fetchErrors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchErrors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchErrors with LRO error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.FetchErrorsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchErrorsRequest', ['stream']); - request.stream = defaultValue1; - const expectedHeaderRequestParams = `stream=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.fetchErrors = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.fetchErrors(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.fetchErrors as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchErrors as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkFetchErrorsProgress without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkFetchErrorsProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkFetchErrorsProgress with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkFetchErrorsProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createPrivateConnection', () => { - it('invokes createPrivateConnection without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPrivateConnection = stubLongRunningCall(expectedResponse); - const [operation] = await client.createPrivateConnection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPrivateConnection without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createPrivateConnection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createPrivateConnection( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPrivateConnection with call error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPrivateConnection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createPrivateConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createPrivateConnection with LRO error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreatePrivateConnectionRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createPrivateConnection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createPrivateConnection(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createPrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreatePrivateConnectionProgress without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkCreatePrivateConnectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreatePrivateConnectionProgress with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkCreatePrivateConnectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deletePrivateConnection', () => { - it('invokes deletePrivateConnection without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(expectedResponse); - const [operation] = await client.deletePrivateConnection(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePrivateConnection without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deletePrivateConnection = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deletePrivateConnection( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePrivateConnection with call error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deletePrivateConnection(request), expectedError); - const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deletePrivateConnection with LRO error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeletePrivateConnectionRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePrivateConnection = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deletePrivateConnection(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deletePrivateConnection as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeletePrivateConnectionProgress without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkDeletePrivateConnectionProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeletePrivateConnectionProgress with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkDeletePrivateConnectionProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createRoute', () => { - it('invokes createRoute without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.CreateRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateRouteRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createRoute = stubLongRunningCall(expectedResponse); - const [operation] = await client.createRoute(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRoute without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.CreateRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateRouteRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.createRoute = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createRoute( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.createRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRoute with call error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.CreateRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateRouteRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createRoute = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createRoute(request), expectedError); - const actualRequest = (client.innerApiCalls.createRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes createRoute with LRO error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.CreateRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.CreateRouteRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.createRoute = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createRoute(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.createRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.createRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkCreateRouteProgress without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkCreateRouteProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateRouteProgress with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkCreateRouteProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteRoute', () => { - it('invokes deleteRoute without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DeleteRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteRouteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteRoute = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteRoute(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoute without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DeleteRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteRouteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = generateSampleMessage( - new protos.google.longrunning.Operation() - ); - client.innerApiCalls.deleteRoute = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteRoute( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.deleteRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoute with call error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DeleteRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteRouteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRoute = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteRoute(request), expectedError); - const actualRequest = (client.innerApiCalls.deleteRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes deleteRoute with LRO error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.DeleteRouteRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.DeleteRouteRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteRoute = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteRoute(request); - await assert.rejects(operation.promise(), expectedError); - const actualRequest = (client.innerApiCalls.deleteRoute as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.deleteRoute as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes checkDeleteRouteProgress without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkDeleteRouteProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteRouteProgress with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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.checkDeleteRouteProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listConnectionProfiles', () => { - it('invokes listConnectionProfiles without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), - ]; - client.innerApiCalls.listConnectionProfiles = stubSimpleCall(expectedResponse); - const [response] = await client.listConnectionProfiles(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConnectionProfiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnectionProfiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnectionProfiles without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), - ]; - client.innerApiCalls.listConnectionProfiles = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listConnectionProfiles( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1alpha1.IConnectionProfile[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listConnectionProfiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnectionProfiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnectionProfiles with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listConnectionProfiles = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConnectionProfiles(request), expectedError); - const actualRequest = (client.innerApiCalls.listConnectionProfiles as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listConnectionProfiles as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listConnectionProfilesStream without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), - ]; - client.descriptors.page.listConnectionProfiles.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listConnectionProfilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.datastream.v1alpha1.ConnectionProfile[] = []; - stream.on('data', (response: protos.google.cloud.datastream.v1alpha1.ConnectionProfile) => { - 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.listConnectionProfiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConnectionProfiles, request)); - assert( - (client.descriptors.page.listConnectionProfiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listConnectionProfilesStream with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConnectionProfiles.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listConnectionProfilesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.datastream.v1alpha1.ConnectionProfile[] = []; - stream.on('data', (response: protos.google.cloud.datastream.v1alpha1.ConnectionProfile) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listConnectionProfiles.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listConnectionProfiles, request)); - assert( - (client.descriptors.page.listConnectionProfiles.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConnectionProfiles without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.ConnectionProfile()), - ]; - client.descriptors.page.listConnectionProfiles.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.datastream.v1alpha1.IConnectionProfile[] = []; - const iterable = client.listConnectionProfilesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listConnectionProfiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConnectionProfiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listConnectionProfiles with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListConnectionProfilesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listConnectionProfiles.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listConnectionProfilesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.datastream.v1alpha1.IConnectionProfile[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listConnectionProfiles.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listConnectionProfiles.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listStreams', () => { - it('invokes listStreams without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), - ]; - client.innerApiCalls.listStreams = stubSimpleCall(expectedResponse); - const [response] = await client.listStreams(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listStreams as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStreams as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStreams without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), - ]; - client.innerApiCalls.listStreams = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listStreams( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1alpha1.IStream[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listStreams as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStreams as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStreams with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listStreams = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listStreams(request), expectedError); - const actualRequest = (client.innerApiCalls.listStreams as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listStreams as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listStreamsStream without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), - ]; - client.descriptors.page.listStreams.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listStreamsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.datastream.v1alpha1.Stream[] = []; - stream.on('data', (response: protos.google.cloud.datastream.v1alpha1.Stream) => { - 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.listStreams.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listStreams, request)); - assert( - (client.descriptors.page.listStreams.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listStreamsStream with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listStreams.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listStreamsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.datastream.v1alpha1.Stream[] = []; - stream.on('data', (response: protos.google.cloud.datastream.v1alpha1.Stream) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listStreams.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listStreams, request)); - assert( - (client.descriptors.page.listStreams.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listStreams without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Stream()), - ]; - client.descriptors.page.listStreams.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.datastream.v1alpha1.IStream[] = []; - const iterable = client.listStreamsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listStreams.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listStreams.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listStreams with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListStreamsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListStreamsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listStreams.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listStreamsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.datastream.v1alpha1.IStream[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listStreams.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listStreams.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('fetchStaticIps', () => { - it('invokes fetchStaticIps without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [new String(), new String(), new String()]; - client.innerApiCalls.fetchStaticIps = stubSimpleCall(expectedResponse); - const [response] = await client.fetchStaticIps(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchStaticIps as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchStaticIps as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchStaticIps without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`;const expectedResponse = [new String(), new String(), new String()]; - client.innerApiCalls.fetchStaticIps = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.fetchStaticIps( - request, - (err?: Error|null, result?: string[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.fetchStaticIps as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchStaticIps as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchStaticIps with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.fetchStaticIps = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.fetchStaticIps(request), expectedError); - const actualRequest = (client.innerApiCalls.fetchStaticIps as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.fetchStaticIps as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes fetchStaticIpsStream without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [new String(), new String(), new String()]; - client.descriptors.page.fetchStaticIps.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.fetchStaticIpsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: string[] = []; - stream.on('data', (response: string) => { - 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.fetchStaticIps.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.fetchStaticIps, request)); - assert( - (client.descriptors.page.fetchStaticIps.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes fetchStaticIpsStream with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.fetchStaticIps.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.fetchStaticIpsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: string[] = []; - stream.on('data', (response: string) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.fetchStaticIps.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.fetchStaticIps, request)); - assert( - (client.descriptors.page.fetchStaticIps.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with fetchStaticIps without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedResponse = [new String(), new String(), new String()]; - client.descriptors.page.fetchStaticIps.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: string[] = []; - const iterable = client.fetchStaticIpsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.fetchStaticIps.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.fetchStaticIps.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with fetchStaticIps with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.FetchStaticIpsRequest', ['name']); - request.name = defaultValue1; - const expectedHeaderRequestParams = `name=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.fetchStaticIps.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.fetchStaticIpsAsync(request); - await assert.rejects(async () => { - const responses: string[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.fetchStaticIps.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.fetchStaticIps.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listPrivateConnections', () => { - it('invokes listPrivateConnections without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), - ]; - client.innerApiCalls.listPrivateConnections = stubSimpleCall(expectedResponse); - const [response] = await client.listPrivateConnections(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPrivateConnections without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), - ]; - client.innerApiCalls.listPrivateConnections = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPrivateConnections( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1alpha1.IPrivateConnection[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPrivateConnections with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listPrivateConnections = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPrivateConnections(request), expectedError); - const actualRequest = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listPrivateConnections as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listPrivateConnectionsStream without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), - ]; - client.descriptors.page.listPrivateConnections.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listPrivateConnectionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.datastream.v1alpha1.PrivateConnection[] = []; - stream.on('data', (response: protos.google.cloud.datastream.v1alpha1.PrivateConnection) => { - 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.listPrivateConnections.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPrivateConnections, request)); - assert( - (client.descriptors.page.listPrivateConnections.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listPrivateConnectionsStream with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPrivateConnections.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listPrivateConnectionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.datastream.v1alpha1.PrivateConnection[] = []; - stream.on('data', (response: protos.google.cloud.datastream.v1alpha1.PrivateConnection) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listPrivateConnections.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPrivateConnections, request)); - assert( - (client.descriptors.page.listPrivateConnections.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPrivateConnections without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.PrivateConnection()), - ]; - client.descriptors.page.listPrivateConnections.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.datastream.v1alpha1.IPrivateConnection[] = []; - const iterable = client.listPrivateConnectionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listPrivateConnections with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListPrivateConnectionsRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listPrivateConnections.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPrivateConnectionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.datastream.v1alpha1.IPrivateConnection[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listPrivateConnections.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('listRoutes', () => { - it('invokes listRoutes without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), - ]; - client.innerApiCalls.listRoutes = stubSimpleCall(expectedResponse); - const [response] = await client.listRoutes(request); - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRoutes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRoutes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRoutes without error using callback', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`;const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), - ]; - client.innerApiCalls.listRoutes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listRoutes( - request, - (err?: Error|null, result?: protos.google.cloud.datastream.v1alpha1.IRoute[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - const actualRequest = (client.innerApiCalls.listRoutes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRoutes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRoutes with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.innerApiCalls.listRoutes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listRoutes(request), expectedError); - const actualRequest = (client.innerApiCalls.listRoutes as SinonStub) - .getCall(0).args[0]; - assert.deepStrictEqual(actualRequest, request); - const actualHeaderRequestParams = (client.innerApiCalls.listRoutes as SinonStub) - .getCall(0).args[1].otherArgs.headers['x-goog-request-params']; - assert(actualHeaderRequestParams.includes(expectedHeaderRequestParams)); - }); - - it('invokes listRoutesStream without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), - ]; - client.descriptors.page.listRoutes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listRoutesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.datastream.v1alpha1.Route[] = []; - stream.on('data', (response: protos.google.cloud.datastream.v1alpha1.Route) => { - 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.listRoutes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRoutes, request)); - assert( - (client.descriptors.page.listRoutes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('invokes listRoutesStream with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRoutes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listRoutesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.datastream.v1alpha1.Route[] = []; - stream.on('data', (response: protos.google.cloud.datastream.v1alpha1.Route) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listRoutes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listRoutes, request)); - assert( - (client.descriptors.page.listRoutes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRoutes without error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), - generateSampleMessage(new protos.google.cloud.datastream.v1alpha1.Route()), - ]; - client.descriptors.page.listRoutes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.datastream.v1alpha1.IRoute[] = []; - const iterable = client.listRoutesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listRoutes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRoutes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - - it('uses async iteration with listRoutes with error', async () => { - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage( - new protos.google.cloud.datastream.v1alpha1.ListRoutesRequest() - ); - const defaultValue1 = - getTypeDefaultValue('.google.cloud.datastream.v1alpha1.ListRoutesRequest', ['parent']); - request.parent = defaultValue1; - const expectedHeaderRequestParams = `parent=${defaultValue1}`; - const expectedError = new Error('expected'); - client.descriptors.page.listRoutes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listRoutesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.datastream.v1alpha1.IRoute[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listRoutes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert( - (client.descriptors.page.listRoutes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'].includes( - expectedHeaderRequestParams - ) - ); - }); - }); - - describe('Path templates', () => { - - describe('connectionProfile', () => { - const fakePath = "/rendered/path/connectionProfile"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - connection_profile: "connectionProfileValue", - }; - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.connectionProfilePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.connectionProfilePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('connectionProfilePath', () => { - const result = client.connectionProfilePath("projectValue", "locationValue", "connectionProfileValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.connectionProfilePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConnectionProfileName', () => { - const result = client.matchProjectFromConnectionProfileName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.connectionProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConnectionProfileName', () => { - const result = client.matchLocationFromConnectionProfileName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.connectionProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConnectionProfileFromConnectionProfileName', () => { - const result = client.matchConnectionProfileFromConnectionProfileName(fakePath); - assert.strictEqual(result, "connectionProfileValue"); - assert((client.pathTemplates.connectionProfilePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.locationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.locationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('locationPath', () => { - const result = client.locationPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.locationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromLocationName', () => { - const result = client.matchProjectFromLocationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromLocationName', () => { - const result = client.matchLocationFromLocationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.locationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('privateConnection', () => { - const fakePath = "/rendered/path/privateConnection"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_connection: "privateConnectionValue", - }; - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.privateConnectionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.privateConnectionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('privateConnectionPath', () => { - const result = client.privateConnectionPath("projectValue", "locationValue", "privateConnectionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.privateConnectionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPrivateConnectionName', () => { - const result = client.matchProjectFromPrivateConnectionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPrivateConnectionName', () => { - const result = client.matchLocationFromPrivateConnectionName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateConnectionFromPrivateConnectionName', () => { - const result = client.matchPrivateConnectionFromPrivateConnectionName(fakePath); - assert.strictEqual(result, "privateConnectionValue"); - assert((client.pathTemplates.privateConnectionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new datastreamModule.v1alpha1.DatastreamClient({ - 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('route', () => { - const fakePath = "/rendered/path/route"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - private_connection: "privateConnectionValue", - route: "routeValue", - }; - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.routePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.routePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('routePath', () => { - const result = client.routePath("projectValue", "locationValue", "privateConnectionValue", "routeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.routePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromRouteName', () => { - const result = client.matchProjectFromRouteName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.routePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromRouteName', () => { - const result = client.matchLocationFromRouteName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.routePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPrivateConnectionFromRouteName', () => { - const result = client.matchPrivateConnectionFromRouteName(fakePath); - assert.strictEqual(result, "privateConnectionValue"); - assert((client.pathTemplates.routePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRouteFromRouteName', () => { - const result = client.matchRouteFromRouteName(fakePath); - assert.strictEqual(result, "routeValue"); - assert((client.pathTemplates.routePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('stream', () => { - const fakePath = "/rendered/path/stream"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - stream: "streamValue", - }; - const client = new datastreamModule.v1alpha1.DatastreamClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.streamPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.streamPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('streamPath', () => { - const result = client.streamPath("projectValue", "locationValue", "streamValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.streamPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromStreamName', () => { - const result = client.matchProjectFromStreamName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromStreamName', () => { - const result = client.matchLocationFromStreamName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchStreamFromStreamName', () => { - const result = client.matchStreamFromStreamName(fakePath); - assert.strictEqual(result, "streamValue"); - assert((client.pathTemplates.streamPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/tsconfig.json b/owl-bot-staging/google-cloud-datastream/v1alpha1/tsconfig.json deleted file mode 100644 index c78f1c884ef..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/google-cloud-datastream/v1alpha1/webpack.config.js b/owl-bot-staging/google-cloud-datastream/v1alpha1/webpack.config.js deleted file mode 100644 index ce71b478c09..00000000000 --- a/owl-bot-staging/google-cloud-datastream/v1alpha1/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: 'Datastream', - filename: './datastream.js', - }, - node: { - child_process: 'empty', - fs: 'empty', - crypto: 'empty', - }, - resolve: { - alias: { - '../../../package.json': path.resolve(__dirname, 'package.json'), - }, - extensions: ['.js', '.json', '.ts'], - }, - module: { - rules: [ - { - test: /\.tsx?$/, - use: 'ts-loader', - exclude: /node_modules/ - }, - { - test: /node_modules[\\/]@grpc[\\/]grpc-js/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]grpc/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]retry-request/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]https?-proxy-agent/, - use: 'null-loader' - }, - { - test: /node_modules[\\/]gtoken/, - use: 'null-loader' - }, - ], - }, - mode: 'production', -}; diff --git a/packages/google-cloud-datastream/README.md b/packages/google-cloud-datastream/README.md index abc51c351a5..f48a4e57464 100644 --- a/packages/google-cloud-datastream/README.md +++ b/packages/google-cloud-datastream/README.md @@ -2,7 +2,7 @@ [//]: # "To regenerate it, use `python -m synthtool`." Google Cloud Platform logo -# [Datastream: Node.js Client](https://github.com/googleapis/google-cloud-node) +# [Datastream: Node.js Client](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-datastream) [![release level](https://img.shields.io/badge/release%20level-stable-brightgreen.svg?style=flat)](https://cloud.google.com/terms/launch-stages) [![npm version](https://img.shields.io/npm/v/@google-cloud/datastream.svg)](https://www.npmjs.org/package/@google-cloud/datastream) @@ -115,58 +115,57 @@ listConnectionProfiles(); ## Samples -Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/tree/main/samples) directory. Each sample's `README.md` has instructions for running its sample. +Samples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-datastream/samples) directory. Each sample's `README.md` has instructions for running its sample. | Sample | Source Code | Try it | | --------------------------- | --------------------------------- | ------ | -| Datastream.create_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.create_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.create_connection_profile.js,samples/README.md) | -| Datastream.create_private_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.create_private_connection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.create_private_connection.js,samples/README.md) | -| Datastream.create_route | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.create_route.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.create_route.js,samples/README.md) | -| Datastream.create_stream | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.create_stream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.create_stream.js,samples/README.md) | -| Datastream.delete_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.delete_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.delete_connection_profile.js,samples/README.md) | -| Datastream.delete_private_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.delete_private_connection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.delete_private_connection.js,samples/README.md) | -| Datastream.delete_route | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.delete_route.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.delete_route.js,samples/README.md) | -| Datastream.delete_stream | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.delete_stream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.delete_stream.js,samples/README.md) | -| Datastream.discover_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.discover_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.discover_connection_profile.js,samples/README.md) | -| Datastream.fetch_static_ips | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.fetch_static_ips.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.fetch_static_ips.js,samples/README.md) | -| Datastream.get_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.get_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.get_connection_profile.js,samples/README.md) | -| Datastream.get_private_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.get_private_connection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.get_private_connection.js,samples/README.md) | -| Datastream.get_route | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.get_route.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.get_route.js,samples/README.md) | -| Datastream.get_stream | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.get_stream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.get_stream.js,samples/README.md) | -| Datastream.get_stream_object | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.get_stream_object.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.get_stream_object.js,samples/README.md) | -| Datastream.list_connection_profiles | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.list_connection_profiles.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.list_connection_profiles.js,samples/README.md) | -| Datastream.list_private_connections | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.list_private_connections.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.list_private_connections.js,samples/README.md) | -| Datastream.list_routes | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.list_routes.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.list_routes.js,samples/README.md) | -| Datastream.list_stream_objects | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.list_stream_objects.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.list_stream_objects.js,samples/README.md) | -| Datastream.list_streams | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.list_streams.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.list_streams.js,samples/README.md) | -| Datastream.lookup_stream_object | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.lookup_stream_object.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.lookup_stream_object.js,samples/README.md) | -| Datastream.start_backfill_job | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.start_backfill_job.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.start_backfill_job.js,samples/README.md) | -| Datastream.stop_backfill_job | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.stop_backfill_job.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.stop_backfill_job.js,samples/README.md) | -| Datastream.update_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.update_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.update_connection_profile.js,samples/README.md) | -| Datastream.update_stream | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.update_stream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.update_stream.js,samples/README.md) | -| Datastream.create_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.create_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.create_connection_profile.js,samples/README.md) | -| Datastream.create_private_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.create_private_connection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.create_private_connection.js,samples/README.md) | -| Datastream.create_route | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.create_route.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.create_route.js,samples/README.md) | -| Datastream.create_stream | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.create_stream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.create_stream.js,samples/README.md) | -| Datastream.delete_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.delete_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.delete_connection_profile.js,samples/README.md) | -| Datastream.delete_private_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.delete_private_connection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.delete_private_connection.js,samples/README.md) | -| Datastream.delete_route | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.delete_route.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.delete_route.js,samples/README.md) | -| Datastream.delete_stream | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.delete_stream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.delete_stream.js,samples/README.md) | -| Datastream.discover_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.discover_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.discover_connection_profile.js,samples/README.md) | -| Datastream.fetch_errors | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.fetch_errors.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.fetch_errors.js,samples/README.md) | -| Datastream.fetch_static_ips | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.fetch_static_ips.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.fetch_static_ips.js,samples/README.md) | -| Datastream.get_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.get_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.get_connection_profile.js,samples/README.md) | -| Datastream.get_private_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.get_private_connection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.get_private_connection.js,samples/README.md) | -| Datastream.get_route | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.get_route.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.get_route.js,samples/README.md) | -| Datastream.get_stream | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.get_stream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.get_stream.js,samples/README.md) | -| Datastream.list_connection_profiles | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.list_connection_profiles.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.list_connection_profiles.js,samples/README.md) | -| Datastream.list_private_connections | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.list_private_connections.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.list_private_connections.js,samples/README.md) | -| Datastream.list_routes | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.list_routes.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.list_routes.js,samples/README.md) | -| Datastream.list_streams | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.list_streams.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.list_streams.js,samples/README.md) | -| Datastream.update_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.update_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.update_connection_profile.js,samples/README.md) | -| Datastream.update_stream | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.update_stream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.update_stream.js,samples/README.md) | -| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/quickstart.js,samples/README.md) | -| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/test/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/test/quickstart.js,samples/README.md) | +| Datastream.create_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.create_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.create_connection_profile.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.create_private_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.create_private_connection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.create_private_connection.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.create_route | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.create_route.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.create_route.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.create_stream | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.create_stream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.create_stream.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.delete_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.delete_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.delete_connection_profile.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.delete_private_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.delete_private_connection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.delete_private_connection.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.delete_route | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.delete_route.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.delete_route.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.delete_stream | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.delete_stream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.delete_stream.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.discover_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.discover_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.discover_connection_profile.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.fetch_static_ips | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.fetch_static_ips.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.fetch_static_ips.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.get_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.get_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.get_connection_profile.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.get_private_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.get_private_connection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.get_private_connection.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.get_route | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.get_route.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.get_route.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.get_stream | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.get_stream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.get_stream.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.get_stream_object | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.get_stream_object.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.get_stream_object.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.list_connection_profiles | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.list_connection_profiles.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.list_connection_profiles.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.list_private_connections | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.list_private_connections.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.list_private_connections.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.list_routes | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.list_routes.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.list_routes.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.list_stream_objects | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.list_stream_objects.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.list_stream_objects.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.list_streams | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.list_streams.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.list_streams.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.lookup_stream_object | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.lookup_stream_object.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.lookup_stream_object.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.start_backfill_job | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.start_backfill_job.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.start_backfill_job.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.stop_backfill_job | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.stop_backfill_job.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.stop_backfill_job.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.update_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.update_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.update_connection_profile.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.update_stream | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1/datastream.update_stream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1/datastream.update_stream.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.create_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.create_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.create_connection_profile.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.create_private_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.create_private_connection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.create_private_connection.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.create_route | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.create_route.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.create_route.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.create_stream | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.create_stream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.create_stream.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.delete_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.delete_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.delete_connection_profile.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.delete_private_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.delete_private_connection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.delete_private_connection.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.delete_route | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.delete_route.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.delete_route.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.delete_stream | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.delete_stream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.delete_stream.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.discover_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.discover_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.discover_connection_profile.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.fetch_errors | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.fetch_errors.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.fetch_errors.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.fetch_static_ips | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.fetch_static_ips.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.fetch_static_ips.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.get_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.get_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.get_connection_profile.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.get_private_connection | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.get_private_connection.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.get_private_connection.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.get_route | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.get_route.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.get_route.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.get_stream | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.get_stream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.get_stream.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.list_connection_profiles | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.list_connection_profiles.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.list_connection_profiles.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.list_private_connections | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.list_private_connections.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.list_private_connections.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.list_routes | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.list_routes.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.list_routes.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.list_streams | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.list_streams.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.list_streams.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.update_connection_profile | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.update_connection_profile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.update_connection_profile.js,packages/google-cloud-datastream/samples/README.md) | +| Datastream.update_stream | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.update_stream.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/generated/v1alpha1/datastream.update_stream.js,packages/google-cloud-datastream/samples/README.md) | +| Quickstart | [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/quickstart.js,packages/google-cloud-datastream/samples/README.md) | diff --git a/packages/google-cloud-datastream/protos/google/cloud/datastream/v1/datastream.proto b/packages/google-cloud-datastream/protos/google/cloud/datastream/v1/datastream.proto index cd977079450..bf0b13f5e2a 100644 --- a/packages/google-cloud-datastream/protos/google/cloud/datastream/v1/datastream.proto +++ b/packages/google-cloud-datastream/protos/google/cloud/datastream/v1/datastream.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import "google/api/field_behavior.proto"; import "google/api/resource.proto"; import "google/cloud/datastream/v1/datastream_resources.proto"; import "google/longrunning/operations.proto"; +import "google/protobuf/empty.proto"; import "google/protobuf/field_mask.proto"; import "google/protobuf/timestamp.proto"; @@ -36,11 +37,13 @@ option ruby_package = "Google::Cloud::Datastream::V1"; // Datastream service service Datastream { option (google.api.default_host) = "datastream.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + option (google.api.oauth_scopes) = + "https://www.googleapis.com/auth/cloud-platform"; // Use this method to list connection profiles created in a project and // location. - rpc ListConnectionProfiles(ListConnectionProfilesRequest) returns (ListConnectionProfilesResponse) { + rpc ListConnectionProfiles(ListConnectionProfilesRequest) + returns (ListConnectionProfilesResponse) { option (google.api.http) = { get: "/v1/{parent=projects/*/locations/*}/connectionProfiles" }; @@ -48,7 +51,8 @@ service Datastream { } // Use this method to get details about a connection profile. - rpc GetConnectionProfile(GetConnectionProfileRequest) returns (ConnectionProfile) { + rpc GetConnectionProfile(GetConnectionProfileRequest) + returns (ConnectionProfile) { option (google.api.http) = { get: "/v1/{name=projects/*/locations/*/connectionProfiles/*}" }; @@ -56,12 +60,14 @@ service Datastream { } // Use this method to create a connection profile in a project and location. - rpc CreateConnectionProfile(CreateConnectionProfileRequest) returns (google.longrunning.Operation) { + rpc CreateConnectionProfile(CreateConnectionProfileRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v1/{parent=projects/*/locations/*}/connectionProfiles" body: "connection_profile" }; - option (google.api.method_signature) = "parent,connection_profile,connection_profile_id"; + option (google.api.method_signature) = + "parent,connection_profile,connection_profile_id"; option (google.longrunning.operation_info) = { response_type: "ConnectionProfile" metadata_type: "OperationMetadata" @@ -69,7 +75,8 @@ service Datastream { } // Use this method to update the parameters of a connection profile. - rpc UpdateConnectionProfile(UpdateConnectionProfileRequest) returns (google.longrunning.Operation) { + rpc UpdateConnectionProfile(UpdateConnectionProfileRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { patch: "/v1/{connection_profile.name=projects/*/locations/*/connectionProfiles/*}" body: "connection_profile" @@ -82,7 +89,8 @@ service Datastream { } // Use this method to delete a connection profile. - rpc DeleteConnectionProfile(DeleteConnectionProfileRequest) returns (google.longrunning.Operation) { + rpc DeleteConnectionProfile(DeleteConnectionProfileRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { delete: "/v1/{name=projects/*/locations/*/connectionProfiles/*}" }; @@ -97,7 +105,8 @@ service Datastream { // The discover API call exposes the data objects and metadata belonging to // the profile. Typically, a request returns children data objects of a // parent data object that's optionally supplied in the request. - rpc DiscoverConnectionProfile(DiscoverConnectionProfileRequest) returns (DiscoverConnectionProfileResponse) { + rpc DiscoverConnectionProfile(DiscoverConnectionProfileRequest) + returns (DiscoverConnectionProfileResponse) { option (google.api.http) = { post: "/v1/{parent=projects/*/locations/*}/connectionProfiles:discover" body: "*" @@ -175,7 +184,8 @@ service Datastream { } // Use this method to list the objects of a specific stream. - rpc ListStreamObjects(ListStreamObjectsRequest) returns (ListStreamObjectsResponse) { + rpc ListStreamObjects(ListStreamObjectsRequest) + returns (ListStreamObjectsResponse) { option (google.api.http) = { get: "/v1/{parent=projects/*/locations/*/streams/*}/objects" }; @@ -183,7 +193,8 @@ service Datastream { } // Use this method to start a backfill job for the specified stream object. - rpc StartBackfillJob(StartBackfillJobRequest) returns (StartBackfillJobResponse) { + rpc StartBackfillJob(StartBackfillJobRequest) + returns (StartBackfillJobResponse) { option (google.api.http) = { post: "/v1/{object=projects/*/locations/*/streams/*/objects/*}:startBackfillJob" body: "*" @@ -192,7 +203,8 @@ service Datastream { } // Use this method to stop a backfill job for the specified stream object. - rpc StopBackfillJob(StopBackfillJobRequest) returns (StopBackfillJobResponse) { + rpc StopBackfillJob(StopBackfillJobRequest) + returns (StopBackfillJobResponse) { option (google.api.http) = { post: "/v1/{object=projects/*/locations/*/streams/*/objects/*}:stopBackfillJob" body: "*" @@ -210,12 +222,14 @@ service Datastream { } // Use this method to create a private connectivity configuration. - rpc CreatePrivateConnection(CreatePrivateConnectionRequest) returns (google.longrunning.Operation) { + rpc CreatePrivateConnection(CreatePrivateConnectionRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { post: "/v1/{parent=projects/*/locations/*}/privateConnections" body: "private_connection" }; - option (google.api.method_signature) = "parent,private_connection,private_connection_id"; + option (google.api.method_signature) = + "parent,private_connection,private_connection_id"; option (google.longrunning.operation_info) = { response_type: "PrivateConnection" metadata_type: "OperationMetadata" @@ -223,7 +237,8 @@ service Datastream { } // Use this method to get details about a private connectivity configuration. - rpc GetPrivateConnection(GetPrivateConnectionRequest) returns (PrivateConnection) { + rpc GetPrivateConnection(GetPrivateConnectionRequest) + returns (PrivateConnection) { option (google.api.http) = { get: "/v1/{name=projects/*/locations/*/privateConnections/*}" }; @@ -232,7 +247,8 @@ service Datastream { // Use this method to list private connectivity configurations in a project // and location. - rpc ListPrivateConnections(ListPrivateConnectionsRequest) returns (ListPrivateConnectionsResponse) { + rpc ListPrivateConnections(ListPrivateConnectionsRequest) + returns (ListPrivateConnectionsResponse) { option (google.api.http) = { get: "/v1/{parent=projects/*/locations/*}/privateConnections" }; @@ -240,7 +256,8 @@ service Datastream { } // Use this method to delete a private connectivity configuration. - rpc DeletePrivateConnection(DeletePrivateConnectionRequest) returns (google.longrunning.Operation) { + rpc DeletePrivateConnection(DeletePrivateConnectionRequest) + returns (google.longrunning.Operation) { option (google.api.http) = { delete: "/v1/{name=projects/*/locations/*/privateConnections/*}" }; @@ -297,8 +314,8 @@ service Datastream { // Request message for 'discover' ConnectionProfile request. message DiscoverConnectionProfileRequest { - // Required. The parent resource of the connection profile type. Must be in the - // format `projects/*/locations/*`. + // Required. The parent resource of the connection profile type. Must be in + // the format `projects/*/locations/*`. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -355,8 +372,8 @@ message DiscoverConnectionProfileResponse { // Request message for 'FetchStaticIps' request. message FetchStaticIpsRequest { - // Required. The resource name for the location for which static IPs should be returned. - // Must be in the format `projects/*/locations/*`. + // Required. The resource name for the location for which static IPs should be + // returned. Must be in the format `projects/*/locations/*`. string name = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -449,7 +466,8 @@ message CreateConnectionProfileRequest { string connection_profile_id = 2 [(google.api.field_behavior) = REQUIRED]; // Required. The connection profile resource to create. - ConnectionProfile connection_profile = 3 [(google.api.field_behavior) = REQUIRED]; + ConnectionProfile connection_profile = 3 + [(google.api.field_behavior) = REQUIRED]; // Optional. A request ID to identify requests. Specify a unique request ID // so that if you must retry your request, the server will know to ignore @@ -466,8 +484,8 @@ message CreateConnectionProfileRequest { // not supported (00000000-0000-0000-0000-000000000000). string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Only validate the connection profile, but don't create any resources. - // The default is false. + // Optional. Only validate the connection profile, but don't create any + // resources. The default is false. bool validate_only = 5 [(google.api.field_behavior) = OPTIONAL]; // Optional. Create the connection profile without validating it. @@ -481,10 +499,12 @@ message UpdateConnectionProfileRequest { // The fields specified in the update_mask are relative to the resource, not // the full request. A field will be overwritten if it is in the mask. If the // user does not provide a mask then all fields will be overwritten. - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = OPTIONAL]; + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = OPTIONAL]; // Required. The connection profile to update. - ConnectionProfile connection_profile = 2 [(google.api.field_behavior) = REQUIRED]; + ConnectionProfile connection_profile = 2 + [(google.api.field_behavior) = REQUIRED]; // Optional. A request ID to identify requests. Specify a unique request ID // so that if you must retry your request, the server will know to ignore @@ -501,8 +521,8 @@ message UpdateConnectionProfileRequest { // not supported (00000000-0000-0000-0000-000000000000). string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Only validate the connection profile, but don't update any resources. - // The default is false. + // Optional. Only validate the connection profile, but don't update any + // resources. The default is false. bool validate_only = 4 [(google.api.field_behavior) = OPTIONAL]; // Optional. Update the connection profile without validating it. @@ -634,7 +654,8 @@ message UpdateStreamRequest { // The fields specified in the update_mask are relative to the resource, not // the full request. A field will be overwritten if it is in the mask. If the // user does not provide a mask then all fields will be overwritten. - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = OPTIONAL]; + google.protobuf.FieldMask update_mask = 1 + [(google.api.field_behavior) = OPTIONAL]; // Required. The stream resource to update. Stream stream = 2 [(google.api.field_behavior) = REQUIRED]; @@ -654,8 +675,8 @@ message UpdateStreamRequest { // not supported (00000000-0000-0000-0000-000000000000). string request_id = 3 [(google.api.field_behavior) = OPTIONAL]; - // Optional. Only validate the stream with the changes, without actually updating it. - // The default is false. + // Optional. Only validate the stream with the changes, without actually + // updating it. The default is false. bool validate_only = 4 [(google.api.field_behavior) = OPTIONAL]; // Optional. Update the stream without validating it. @@ -711,12 +732,14 @@ message LookupStreamObjectRequest { ]; // Required. The source object identifier which maps to the stream object. - SourceObjectIdentifier source_object_identifier = 2 [(google.api.field_behavior) = REQUIRED]; + SourceObjectIdentifier source_object_identifier = 2 + [(google.api.field_behavior) = REQUIRED]; } // Request for manually initiating a backfill job for a specific stream object. message StartBackfillJobRequest { - // Required. The name of the stream object resource to start a backfill job for. + // Required. The name of the stream object resource to start a backfill job + // for. string object = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -734,7 +757,8 @@ message StartBackfillJobResponse { // Request for manually stopping a running backfill job for a specific stream // object. message StopBackfillJobRequest { - // Required. The name of the stream object resource to stop the backfill job for. + // Required. The name of the stream object resource to stop the backfill job + // for. string object = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -784,10 +808,12 @@ message ListStreamObjectsResponse { // Represents the metadata of the long-running operation. message OperationMetadata { // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 1 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp end_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Server-defined resource path for the target of the operation. string target = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; @@ -800,15 +826,17 @@ message OperationMetadata { // Output only. Identifies whether the user has requested cancellation // of the operation. Operations that have successfully been cancelled - // have [Operation.error][] value with a [google.rpc.Status.code][google.rpc.Status.code] of 1, - // corresponding to `Code.CANCELLED`. + // have [Operation.error][] value with a + // [google.rpc.Status.code][google.rpc.Status.code] of 1, corresponding to + // `Code.CANCELLED`. bool requested_cancellation = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. API version used to start the operation. string api_version = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Results of executed validations if there are any. - ValidationResult validation_result = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + ValidationResult validation_result = 8 + [(google.api.field_behavior) = OUTPUT_ONLY]; } // Request for creating a private connection. @@ -825,7 +853,8 @@ message CreatePrivateConnectionRequest { string private_connection_id = 2 [(google.api.field_behavior) = REQUIRED]; // Required. The Private Connectivity resource to create. - PrivateConnection private_connection = 3 [(google.api.field_behavior) = REQUIRED]; + PrivateConnection private_connection = 3 + [(google.api.field_behavior) = REQUIRED]; // Optional. A request ID to identify requests. Specify a unique request ID // so that if you must retry your request, the server will know to ignore @@ -841,11 +870,15 @@ message CreatePrivateConnectionRequest { // The request ID must be a valid UUID with the exception that zero UUID is // not supported (00000000-0000-0000-0000-000000000000). string request_id = 4 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. If set to true, will skip validations. + bool force = 6 [(google.api.field_behavior) = OPTIONAL]; } // Request for listing private connections. message ListPrivateConnectionsRequest { - // Required. The parent that owns the collection of private connectivity configurations. + // Required. The parent that owns the collection of private connectivity + // configurations. string parent = 1 [ (google.api.field_behavior) = REQUIRED, (google.api.resource_reference) = { @@ -912,8 +945,8 @@ message DeletePrivateConnectionRequest { // not supported (00000000-0000-0000-0000-000000000000). string request_id = 2 [(google.api.field_behavior) = OPTIONAL]; - // Optional. If set to true, any child routes that belong to this PrivateConnection will - // also be deleted. + // Optional. If set to true, any child routes that belong to this + // PrivateConnection will also be deleted. bool force = 3 [(google.api.field_behavior) = OPTIONAL]; } diff --git a/packages/google-cloud-datastream/protos/google/cloud/datastream/v1/datastream_resources.proto b/packages/google-cloud-datastream/protos/google/cloud/datastream/v1/datastream_resources.proto index 80a8deeaefb..1007939dc8b 100644 --- a/packages/google-cloud-datastream/protos/google/cloud/datastream/v1/datastream_resources.proto +++ b/packages/google-cloud-datastream/protos/google/cloud/datastream/v1/datastream_resources.proto @@ -1,4 +1,4 @@ -// Copyright 2022 Google LLC +// Copyright 2023 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -103,14 +103,12 @@ message GcsProfile { } // BigQuery warehouse profile. -message BigQueryProfile { +message BigQueryProfile {} -} - -// Static IP address connectivity. -message StaticServiceIpConnectivity { - -} +// Static IP address connectivity. Used when the source database is configured +// to allow incoming connections from the Datastream public IP addresses +// for the region specified in the connection profile. +message StaticServiceIpConnectivity {} // Forward SSH Tunnel connectivity. message ForwardSshTunnelConnectivity { @@ -181,10 +179,12 @@ message PrivateConnection { string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The create time of the resource. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The update time of the resource. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Labels. map labels = 4; @@ -195,7 +195,8 @@ message PrivateConnection { // Output only. The state of the Private Connection. State state = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Output only. In case of error, the details of the error in a user-friendly format. + // Output only. In case of error, the details of the error in a user-friendly + // format. Error error = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; // VPC Peering Config. @@ -226,10 +227,12 @@ message Route { string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The create time of the resource. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The update time of the resource. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Labels. map labels = 4; @@ -262,8 +265,8 @@ message MysqlSslConfig { // Output only. Indicates whether the client_certificate field is set. bool client_certificate_set = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - // Input only. PEM-encoded certificate of the CA that signed the source database - // server's certificate. + // Input only. PEM-encoded certificate of the CA that signed the source + // database server's certificate. string ca_certificate = 5 [(google.api.field_behavior) = INPUT_ONLY]; // Output only. Indicates whether the ca_certificate field is set. @@ -282,10 +285,12 @@ message ConnectionProfile { string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The create time of the resource. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The update time of the resource. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Labels. map labels = 4; @@ -383,14 +388,10 @@ message OracleRdbms { // Oracle data source configuration message OracleSourceConfig { // Configuration to drop large object values. - message DropLargeObjects { - - } + message DropLargeObjects {} // Configuration to stream large object values. - message StreamLargeObjects { - - } + message StreamLargeObjects {} // Oracle objects to include in the stream. OracleRdbms include_objects = 1; @@ -398,16 +399,20 @@ message OracleSourceConfig { // Oracle objects to exclude from the stream. OracleRdbms exclude_objects = 2; - // Maximum number of concurrent CDC tasks. The number should be non negative. - // If not set (or set to 0), the system's default value will be used. + // Maximum number of concurrent CDC tasks. The number should be non-negative. + // If not set (or set to 0), the system's default value is used. int32 max_concurrent_cdc_tasks = 3; + // Maximum number of concurrent backfill tasks. The number should be + // non-negative. If not set (or set to 0), the system's default value is used. + int32 max_concurrent_backfill_tasks = 4; + // The configuration for handle Oracle large objects. oneof large_objects_handling { // Drop large object values. DropLargeObjects drop_large_objects = 100; - // Stream large object values. + // Stream large object values. NOTE: This feature is currently experimental. StreamLargeObjects stream_large_objects = 102; } } @@ -473,13 +478,21 @@ message PostgresqlSourceConfig { // PostgreSQL objects to exclude from the stream. PostgresqlRdbms exclude_objects = 2; - // Required. The name of the logical replication slot that's configured with the - // pgoutput plugin. - string replication_slot = 3 [(google.api.field_behavior) = REQUIRED]; + // Required. Immutable. The name of the logical replication slot that's + // configured with the pgoutput plugin. + string replication_slot = 3 [ + (google.api.field_behavior) = REQUIRED, + (google.api.field_behavior) = IMMUTABLE + ]; - // Required. The name of the publication that includes the set of all tables that are - // defined in the stream's include_objects. + // Required. The name of the publication that includes the set of all tables + // that are defined in the stream's include_objects. string publication = 4 [(google.api.field_behavior) = REQUIRED]; + + // Maximum number of concurrent backfill tasks. The number should be non + // negative. If not set (or set to 0), the system's default value will be + // used. + int32 max_concurrent_backfill_tasks = 5; } // MySQL Column. @@ -544,6 +557,11 @@ message MysqlSourceConfig { // Maximum number of concurrent CDC tasks. The number should be non negative. // If not set (or set to 0), the system's default value will be used. int32 max_concurrent_cdc_tasks = 3; + + // Maximum number of concurrent backfill tasks. The number should be non + // negative. If not set (or set to 0), the system's default value will be + // used. + int32 max_concurrent_backfill_tasks = 4; } // The configuration of the stream source. @@ -571,9 +589,7 @@ message SourceConfig { } // AVRO file format configuration. -message AvroFileFormat { - -} +message AvroFileFormat {} // JSON file format configuration. message JsonFileFormat { @@ -617,7 +633,8 @@ message GcsDestinationConfig { int32 file_rotation_mb = 2; // The maximum duration for which new events are added before a file is - // closed and a new file is created. + // closed and a new file is created. Values within the range of 15-60 seconds + // are allowed. google.protobuf.Duration file_rotation_interval = 3; // File Format that the data should be written in. @@ -630,9 +647,11 @@ message GcsDestinationConfig { } } +// BigQuery destination configuration message BigQueryDestinationConfig { // A single target dataset to which all data will be streamed. message SingleTargetDataset { + // The dataset ID of the target dataset. string dataset_id = 1; } @@ -661,6 +680,7 @@ message BigQueryDestinationConfig { string kms_key_name = 3; } + // The dataset template to use for dynamic dataset creation. DatasetTemplate dataset_template = 2; } @@ -759,18 +779,18 @@ message Stream { } // Backfill strategy to disable automatic backfill for the Stream's objects. - message BackfillNoneStrategy { - - } + message BackfillNoneStrategy {} // Output only. The stream's name. string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The creation time of the stream. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The last update time of the stream. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Labels. map labels = 4; @@ -782,7 +802,8 @@ message Stream { SourceConfig source_config = 6 [(google.api.field_behavior) = REQUIRED]; // Required. Destination connection profile configuration. - DestinationConfig destination_config = 7 [(google.api.field_behavior) = REQUIRED]; + DestinationConfig destination_config = 7 + [(google.api.field_behavior) = REQUIRED]; // The state of the stream. State state = 8; @@ -804,7 +825,8 @@ message Stream { // If provided, it will be used to encrypt the data. // If left blank, data will be encrypted using an internal Stream-specific // encryption key provisioned through KMS. - optional string customer_managed_encryption_key = 10 [(google.api.field_behavior) = IMMUTABLE]; + optional string customer_managed_encryption_key = 10 + [(google.api.field_behavior) = IMMUTABLE]; } // A specific stream object (e.g a specific DB table). @@ -818,10 +840,12 @@ message StreamObject { string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The creation time of the object. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp create_time = 2 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. The last update time of the object. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp update_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Required. Display name. string display_name = 5 [(google.api.field_behavior) = REQUIRED]; @@ -930,10 +954,12 @@ message BackfillJob { Trigger trigger = 2; // Output only. Backfill job's start time. - google.protobuf.Timestamp last_start_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp last_start_time = 3 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Backfill job's end time. - google.protobuf.Timestamp last_end_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + google.protobuf.Timestamp last_end_time = 4 + [(google.api.field_behavior) = OUTPUT_ONLY]; // Output only. Errors which caused the backfill job to fail. repeated Error errors = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; diff --git a/packages/google-cloud-datastream/protos/protos.d.ts b/packages/google-cloud-datastream/protos/protos.d.ts index ce591f8aa3c..d6e511be1be 100644 --- a/packages/google-cloud-datastream/protos/protos.d.ts +++ b/packages/google-cloud-datastream/protos/protos.d.ts @@ -3356,6 +3356,9 @@ export namespace google { /** CreatePrivateConnectionRequest requestId */ requestId?: (string|null); + + /** CreatePrivateConnectionRequest force */ + force?: (boolean|null); } /** Represents a CreatePrivateConnectionRequest. */ @@ -3379,6 +3382,9 @@ export namespace google { /** CreatePrivateConnectionRequest requestId. */ public requestId: string; + /** CreatePrivateConnectionRequest force. */ + public force: boolean; + /** * Creates a new CreatePrivateConnectionRequest instance using the specified properties. * @param [properties] Properties to set @@ -6463,6 +6469,9 @@ export namespace google { /** OracleSourceConfig maxConcurrentCdcTasks */ maxConcurrentCdcTasks?: (number|null); + /** OracleSourceConfig maxConcurrentBackfillTasks */ + maxConcurrentBackfillTasks?: (number|null); + /** OracleSourceConfig dropLargeObjects */ dropLargeObjects?: (google.cloud.datastream.v1.OracleSourceConfig.IDropLargeObjects|null); @@ -6488,6 +6497,9 @@ export namespace google { /** OracleSourceConfig maxConcurrentCdcTasks. */ public maxConcurrentCdcTasks: number; + /** OracleSourceConfig maxConcurrentBackfillTasks. */ + public maxConcurrentBackfillTasks: number; + /** OracleSourceConfig dropLargeObjects. */ public dropLargeObjects?: (google.cloud.datastream.v1.OracleSourceConfig.IDropLargeObjects|null); @@ -7216,6 +7228,9 @@ export namespace google { /** PostgresqlSourceConfig publication */ publication?: (string|null); + + /** PostgresqlSourceConfig maxConcurrentBackfillTasks */ + maxConcurrentBackfillTasks?: (number|null); } /** Represents a PostgresqlSourceConfig. */ @@ -7239,6 +7254,9 @@ export namespace google { /** PostgresqlSourceConfig publication. */ public publication: string; + /** PostgresqlSourceConfig maxConcurrentBackfillTasks. */ + public maxConcurrentBackfillTasks: number; + /** * Creates a new PostgresqlSourceConfig instance using the specified properties. * @param [properties] Properties to set @@ -7764,6 +7782,9 @@ export namespace google { /** MysqlSourceConfig maxConcurrentCdcTasks */ maxConcurrentCdcTasks?: (number|null); + + /** MysqlSourceConfig maxConcurrentBackfillTasks */ + maxConcurrentBackfillTasks?: (number|null); } /** Represents a MysqlSourceConfig. */ @@ -7784,6 +7805,9 @@ export namespace google { /** MysqlSourceConfig maxConcurrentCdcTasks. */ public maxConcurrentCdcTasks: number; + /** MysqlSourceConfig maxConcurrentBackfillTasks. */ + public maxConcurrentBackfillTasks: number; + /** * Creates a new MysqlSourceConfig instance using the specified properties. * @param [properties] Properties to set diff --git a/packages/google-cloud-datastream/protos/protos.js b/packages/google-cloud-datastream/protos/protos.js index 098953c87e5..358f987df6e 100644 --- a/packages/google-cloud-datastream/protos/protos.js +++ b/packages/google-cloud-datastream/protos/protos.js @@ -7610,6 +7610,7 @@ * @property {string|null} [privateConnectionId] CreatePrivateConnectionRequest privateConnectionId * @property {google.cloud.datastream.v1.IPrivateConnection|null} [privateConnection] CreatePrivateConnectionRequest privateConnection * @property {string|null} [requestId] CreatePrivateConnectionRequest requestId + * @property {boolean|null} [force] CreatePrivateConnectionRequest force */ /** @@ -7659,6 +7660,14 @@ */ CreatePrivateConnectionRequest.prototype.requestId = ""; + /** + * CreatePrivateConnectionRequest force. + * @member {boolean} force + * @memberof google.cloud.datastream.v1.CreatePrivateConnectionRequest + * @instance + */ + CreatePrivateConnectionRequest.prototype.force = false; + /** * Creates a new CreatePrivateConnectionRequest instance using the specified properties. * @function create @@ -7691,6 +7700,8 @@ $root.google.cloud.datastream.v1.PrivateConnection.encode(message.privateConnection, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); if (message.requestId != null && Object.hasOwnProperty.call(message, "requestId")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.requestId); + if (message.force != null && Object.hasOwnProperty.call(message, "force")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.force); return writer; }; @@ -7741,6 +7752,10 @@ message.requestId = reader.string(); break; } + case 6: { + message.force = reader.bool(); + break; + } default: reader.skipType(tag & 7); break; @@ -7790,6 +7805,9 @@ if (message.requestId != null && message.hasOwnProperty("requestId")) if (!$util.isString(message.requestId)) return "requestId: string expected"; + if (message.force != null && message.hasOwnProperty("force")) + if (typeof message.force !== "boolean") + return "force: boolean expected"; return null; }; @@ -7816,6 +7834,8 @@ } if (object.requestId != null) message.requestId = String(object.requestId); + if (object.force != null) + message.force = Boolean(object.force); return message; }; @@ -7837,6 +7857,7 @@ object.privateConnectionId = ""; object.privateConnection = null; object.requestId = ""; + object.force = false; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; @@ -7846,6 +7867,8 @@ object.privateConnection = $root.google.cloud.datastream.v1.PrivateConnection.toObject(message.privateConnection, options); if (message.requestId != null && message.hasOwnProperty("requestId")) object.requestId = message.requestId; + if (message.force != null && message.hasOwnProperty("force")) + object.force = message.force; return object; }; @@ -15437,6 +15460,7 @@ * @property {google.cloud.datastream.v1.IOracleRdbms|null} [includeObjects] OracleSourceConfig includeObjects * @property {google.cloud.datastream.v1.IOracleRdbms|null} [excludeObjects] OracleSourceConfig excludeObjects * @property {number|null} [maxConcurrentCdcTasks] OracleSourceConfig maxConcurrentCdcTasks + * @property {number|null} [maxConcurrentBackfillTasks] OracleSourceConfig maxConcurrentBackfillTasks * @property {google.cloud.datastream.v1.OracleSourceConfig.IDropLargeObjects|null} [dropLargeObjects] OracleSourceConfig dropLargeObjects * @property {google.cloud.datastream.v1.OracleSourceConfig.IStreamLargeObjects|null} [streamLargeObjects] OracleSourceConfig streamLargeObjects */ @@ -15480,6 +15504,14 @@ */ OracleSourceConfig.prototype.maxConcurrentCdcTasks = 0; + /** + * OracleSourceConfig maxConcurrentBackfillTasks. + * @member {number} maxConcurrentBackfillTasks + * @memberof google.cloud.datastream.v1.OracleSourceConfig + * @instance + */ + OracleSourceConfig.prototype.maxConcurrentBackfillTasks = 0; + /** * OracleSourceConfig dropLargeObjects. * @member {google.cloud.datastream.v1.OracleSourceConfig.IDropLargeObjects|null|undefined} dropLargeObjects @@ -15540,6 +15572,8 @@ $root.google.cloud.datastream.v1.OracleRdbms.encode(message.excludeObjects, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.maxConcurrentCdcTasks != null && Object.hasOwnProperty.call(message, "maxConcurrentCdcTasks")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.maxConcurrentCdcTasks); + if (message.maxConcurrentBackfillTasks != null && Object.hasOwnProperty.call(message, "maxConcurrentBackfillTasks")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.maxConcurrentBackfillTasks); if (message.dropLargeObjects != null && Object.hasOwnProperty.call(message, "dropLargeObjects")) $root.google.cloud.datastream.v1.OracleSourceConfig.DropLargeObjects.encode(message.dropLargeObjects, writer.uint32(/* id 100, wireType 2 =*/802).fork()).ldelim(); if (message.streamLargeObjects != null && Object.hasOwnProperty.call(message, "streamLargeObjects")) @@ -15590,6 +15624,10 @@ message.maxConcurrentCdcTasks = reader.int32(); break; } + case 4: { + message.maxConcurrentBackfillTasks = reader.int32(); + break; + } case 100: { message.dropLargeObjects = $root.google.cloud.datastream.v1.OracleSourceConfig.DropLargeObjects.decode(reader, reader.uint32()); break; @@ -15647,6 +15685,9 @@ if (message.maxConcurrentCdcTasks != null && message.hasOwnProperty("maxConcurrentCdcTasks")) if (!$util.isInteger(message.maxConcurrentCdcTasks)) return "maxConcurrentCdcTasks: integer expected"; + if (message.maxConcurrentBackfillTasks != null && message.hasOwnProperty("maxConcurrentBackfillTasks")) + if (!$util.isInteger(message.maxConcurrentBackfillTasks)) + return "maxConcurrentBackfillTasks: integer expected"; if (message.dropLargeObjects != null && message.hasOwnProperty("dropLargeObjects")) { properties.largeObjectsHandling = 1; { @@ -15692,6 +15733,8 @@ } if (object.maxConcurrentCdcTasks != null) message.maxConcurrentCdcTasks = object.maxConcurrentCdcTasks | 0; + if (object.maxConcurrentBackfillTasks != null) + message.maxConcurrentBackfillTasks = object.maxConcurrentBackfillTasks | 0; if (object.dropLargeObjects != null) { if (typeof object.dropLargeObjects !== "object") throw TypeError(".google.cloud.datastream.v1.OracleSourceConfig.dropLargeObjects: object expected"); @@ -15722,6 +15765,7 @@ object.includeObjects = null; object.excludeObjects = null; object.maxConcurrentCdcTasks = 0; + object.maxConcurrentBackfillTasks = 0; } if (message.includeObjects != null && message.hasOwnProperty("includeObjects")) object.includeObjects = $root.google.cloud.datastream.v1.OracleRdbms.toObject(message.includeObjects, options); @@ -15729,6 +15773,8 @@ object.excludeObjects = $root.google.cloud.datastream.v1.OracleRdbms.toObject(message.excludeObjects, options); if (message.maxConcurrentCdcTasks != null && message.hasOwnProperty("maxConcurrentCdcTasks")) object.maxConcurrentCdcTasks = message.maxConcurrentCdcTasks; + if (message.maxConcurrentBackfillTasks != null && message.hasOwnProperty("maxConcurrentBackfillTasks")) + object.maxConcurrentBackfillTasks = message.maxConcurrentBackfillTasks; if (message.dropLargeObjects != null && message.hasOwnProperty("dropLargeObjects")) { object.dropLargeObjects = $root.google.cloud.datastream.v1.OracleSourceConfig.DropLargeObjects.toObject(message.dropLargeObjects, options); if (options.oneofs) @@ -17216,6 +17262,7 @@ * @property {google.cloud.datastream.v1.IPostgresqlRdbms|null} [excludeObjects] PostgresqlSourceConfig excludeObjects * @property {string|null} [replicationSlot] PostgresqlSourceConfig replicationSlot * @property {string|null} [publication] PostgresqlSourceConfig publication + * @property {number|null} [maxConcurrentBackfillTasks] PostgresqlSourceConfig maxConcurrentBackfillTasks */ /** @@ -17265,6 +17312,14 @@ */ PostgresqlSourceConfig.prototype.publication = ""; + /** + * PostgresqlSourceConfig maxConcurrentBackfillTasks. + * @member {number} maxConcurrentBackfillTasks + * @memberof google.cloud.datastream.v1.PostgresqlSourceConfig + * @instance + */ + PostgresqlSourceConfig.prototype.maxConcurrentBackfillTasks = 0; + /** * Creates a new PostgresqlSourceConfig instance using the specified properties. * @function create @@ -17297,6 +17352,8 @@ writer.uint32(/* id 3, wireType 2 =*/26).string(message.replicationSlot); if (message.publication != null && Object.hasOwnProperty.call(message, "publication")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.publication); + if (message.maxConcurrentBackfillTasks != null && Object.hasOwnProperty.call(message, "maxConcurrentBackfillTasks")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maxConcurrentBackfillTasks); return writer; }; @@ -17347,6 +17404,10 @@ message.publication = reader.string(); break; } + case 5: { + message.maxConcurrentBackfillTasks = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -17398,6 +17459,9 @@ if (message.publication != null && message.hasOwnProperty("publication")) if (!$util.isString(message.publication)) return "publication: string expected"; + if (message.maxConcurrentBackfillTasks != null && message.hasOwnProperty("maxConcurrentBackfillTasks")) + if (!$util.isInteger(message.maxConcurrentBackfillTasks)) + return "maxConcurrentBackfillTasks: integer expected"; return null; }; @@ -17427,6 +17491,8 @@ message.replicationSlot = String(object.replicationSlot); if (object.publication != null) message.publication = String(object.publication); + if (object.maxConcurrentBackfillTasks != null) + message.maxConcurrentBackfillTasks = object.maxConcurrentBackfillTasks | 0; return message; }; @@ -17448,6 +17514,7 @@ object.excludeObjects = null; object.replicationSlot = ""; object.publication = ""; + object.maxConcurrentBackfillTasks = 0; } if (message.includeObjects != null && message.hasOwnProperty("includeObjects")) object.includeObjects = $root.google.cloud.datastream.v1.PostgresqlRdbms.toObject(message.includeObjects, options); @@ -17457,6 +17524,8 @@ object.replicationSlot = message.replicationSlot; if (message.publication != null && message.hasOwnProperty("publication")) object.publication = message.publication; + if (message.maxConcurrentBackfillTasks != null && message.hasOwnProperty("maxConcurrentBackfillTasks")) + object.maxConcurrentBackfillTasks = message.maxConcurrentBackfillTasks; return object; }; @@ -18560,6 +18629,7 @@ * @property {google.cloud.datastream.v1.IMysqlRdbms|null} [includeObjects] MysqlSourceConfig includeObjects * @property {google.cloud.datastream.v1.IMysqlRdbms|null} [excludeObjects] MysqlSourceConfig excludeObjects * @property {number|null} [maxConcurrentCdcTasks] MysqlSourceConfig maxConcurrentCdcTasks + * @property {number|null} [maxConcurrentBackfillTasks] MysqlSourceConfig maxConcurrentBackfillTasks */ /** @@ -18601,6 +18671,14 @@ */ MysqlSourceConfig.prototype.maxConcurrentCdcTasks = 0; + /** + * MysqlSourceConfig maxConcurrentBackfillTasks. + * @member {number} maxConcurrentBackfillTasks + * @memberof google.cloud.datastream.v1.MysqlSourceConfig + * @instance + */ + MysqlSourceConfig.prototype.maxConcurrentBackfillTasks = 0; + /** * Creates a new MysqlSourceConfig instance using the specified properties. * @function create @@ -18631,6 +18709,8 @@ $root.google.cloud.datastream.v1.MysqlRdbms.encode(message.excludeObjects, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); if (message.maxConcurrentCdcTasks != null && Object.hasOwnProperty.call(message, "maxConcurrentCdcTasks")) writer.uint32(/* id 3, wireType 0 =*/24).int32(message.maxConcurrentCdcTasks); + if (message.maxConcurrentBackfillTasks != null && Object.hasOwnProperty.call(message, "maxConcurrentBackfillTasks")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.maxConcurrentBackfillTasks); return writer; }; @@ -18677,6 +18757,10 @@ message.maxConcurrentCdcTasks = reader.int32(); break; } + case 4: { + message.maxConcurrentBackfillTasks = reader.int32(); + break; + } default: reader.skipType(tag & 7); break; @@ -18725,6 +18809,9 @@ if (message.maxConcurrentCdcTasks != null && message.hasOwnProperty("maxConcurrentCdcTasks")) if (!$util.isInteger(message.maxConcurrentCdcTasks)) return "maxConcurrentCdcTasks: integer expected"; + if (message.maxConcurrentBackfillTasks != null && message.hasOwnProperty("maxConcurrentBackfillTasks")) + if (!$util.isInteger(message.maxConcurrentBackfillTasks)) + return "maxConcurrentBackfillTasks: integer expected"; return null; }; @@ -18752,6 +18839,8 @@ } if (object.maxConcurrentCdcTasks != null) message.maxConcurrentCdcTasks = object.maxConcurrentCdcTasks | 0; + if (object.maxConcurrentBackfillTasks != null) + message.maxConcurrentBackfillTasks = object.maxConcurrentBackfillTasks | 0; return message; }; @@ -18772,6 +18861,7 @@ object.includeObjects = null; object.excludeObjects = null; object.maxConcurrentCdcTasks = 0; + object.maxConcurrentBackfillTasks = 0; } if (message.includeObjects != null && message.hasOwnProperty("includeObjects")) object.includeObjects = $root.google.cloud.datastream.v1.MysqlRdbms.toObject(message.includeObjects, options); @@ -18779,6 +18869,8 @@ object.excludeObjects = $root.google.cloud.datastream.v1.MysqlRdbms.toObject(message.excludeObjects, options); if (message.maxConcurrentCdcTasks != null && message.hasOwnProperty("maxConcurrentCdcTasks")) object.maxConcurrentCdcTasks = message.maxConcurrentCdcTasks; + if (message.maxConcurrentBackfillTasks != null && message.hasOwnProperty("maxConcurrentBackfillTasks")) + object.maxConcurrentBackfillTasks = message.maxConcurrentBackfillTasks; return object; }; diff --git a/packages/google-cloud-datastream/protos/protos.json b/packages/google-cloud-datastream/protos/protos.json index 1735d370cb6..23d3888d8c7 100644 --- a/packages/google-cloud-datastream/protos/protos.json +++ b/packages/google-cloud-datastream/protos/protos.json @@ -1208,6 +1208,13 @@ "options": { "(google.api.field_behavior)": "OPTIONAL" } + }, + "force": { + "type": "bool", + "id": 6, + "options": { + "(google.api.field_behavior)": "OPTIONAL" + } } } }, @@ -1968,6 +1975,10 @@ "type": "int32", "id": 3 }, + "maxConcurrentBackfillTasks": { + "type": "int32", + "id": 4 + }, "dropLargeObjects": { "type": "DropLargeObjects", "id": 100 @@ -2071,7 +2082,7 @@ "type": "string", "id": 3, "options": { - "(google.api.field_behavior)": "REQUIRED" + "(google.api.field_behavior)": "IMMUTABLE" } }, "publication": { @@ -2080,6 +2091,10 @@ "options": { "(google.api.field_behavior)": "REQUIRED" } + }, + "maxConcurrentBackfillTasks": { + "type": "int32", + "id": 5 } } }, @@ -2163,6 +2178,10 @@ "maxConcurrentCdcTasks": { "type": "int32", "id": 3 + }, + "maxConcurrentBackfillTasks": { + "type": "int32", + "id": 4 } } }, diff --git a/packages/google-cloud-datastream/samples/README.md b/packages/google-cloud-datastream/samples/README.md index bca158717e0..fd48e19a268 100644 --- a/packages/google-cloud-datastream/samples/README.md +++ b/packages/google-cloud-datastream/samples/README.md @@ -59,7 +59,6 @@ * [Datastream.update_connection_profile](#datastream.update_connection_profile) * [Datastream.update_stream](#datastream.update_stream) * [Quickstart](#quickstart) - * [Quickstart](#quickstart) ## Before you begin @@ -870,23 +869,6 @@ __Usage:__ `node packages/google-cloud-datastream/samples/quickstart.js` ------ - - - - -### Quickstart - -View the [source code](https://github.com/googleapis/google-cloud-node/blob/main/packages/google-cloud-datastream/samples/test/quickstart.js). - -[![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/google-cloud-node&page=editor&open_in_editor=packages/google-cloud-datastream/samples/test/quickstart.js,samples/README.md) - -__Usage:__ - - -`node packages/google-cloud-datastream/samples/test/quickstart.js` - - diff --git a/packages/google-cloud-datastream/samples/generated/v1/datastream.create_connection_profile.js b/packages/google-cloud-datastream/samples/generated/v1/datastream.create_connection_profile.js index f7af7f4a91c..34ad81ed63b 100644 --- a/packages/google-cloud-datastream/samples/generated/v1/datastream.create_connection_profile.js +++ b/packages/google-cloud-datastream/samples/generated/v1/datastream.create_connection_profile.js @@ -55,8 +55,8 @@ function main(parent, connectionProfileId, connectionProfile) { */ // const requestId = 'abc123' /** - * Optional. Only validate the connection profile, but don't create any resources. - * The default is false. + * Optional. Only validate the connection profile, but don't create any + * resources. The default is false. */ // const validateOnly = true /** diff --git a/packages/google-cloud-datastream/samples/generated/v1/datastream.create_private_connection.js b/packages/google-cloud-datastream/samples/generated/v1/datastream.create_private_connection.js index acfb975e55e..15cbea3137f 100644 --- a/packages/google-cloud-datastream/samples/generated/v1/datastream.create_private_connection.js +++ b/packages/google-cloud-datastream/samples/generated/v1/datastream.create_private_connection.js @@ -54,6 +54,10 @@ function main(parent, privateConnectionId, privateConnection) { * not supported (00000000-0000-0000-0000-000000000000). */ // const requestId = 'abc123' + /** + * Optional. If set to true, will skip validations. + */ + // const force = true // Imports the Datastream library const {DatastreamClient} = require('@google-cloud/datastream').v1; diff --git a/packages/google-cloud-datastream/samples/generated/v1/datastream.delete_private_connection.js b/packages/google-cloud-datastream/samples/generated/v1/datastream.delete_private_connection.js index 312338d1a4e..5ca12d1ac7f 100644 --- a/packages/google-cloud-datastream/samples/generated/v1/datastream.delete_private_connection.js +++ b/packages/google-cloud-datastream/samples/generated/v1/datastream.delete_private_connection.js @@ -47,8 +47,8 @@ function main(name) { */ // const requestId = 'abc123' /** - * Optional. If set to true, any child routes that belong to this PrivateConnection will - * also be deleted. + * Optional. If set to true, any child routes that belong to this + * PrivateConnection will also be deleted. */ // const force = true diff --git a/packages/google-cloud-datastream/samples/generated/v1/datastream.discover_connection_profile.js b/packages/google-cloud-datastream/samples/generated/v1/datastream.discover_connection_profile.js index 781977f5536..3627ae02f73 100644 --- a/packages/google-cloud-datastream/samples/generated/v1/datastream.discover_connection_profile.js +++ b/packages/google-cloud-datastream/samples/generated/v1/datastream.discover_connection_profile.js @@ -29,8 +29,8 @@ function main(parent) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The parent resource of the connection profile type. Must be in the - * format `projects/* /locations/*`. + * Required. The parent resource of the connection profile type. Must be in + * the format `projects/* /locations/*`. */ // const parent = 'abc123' /** diff --git a/packages/google-cloud-datastream/samples/generated/v1/datastream.fetch_static_ips.js b/packages/google-cloud-datastream/samples/generated/v1/datastream.fetch_static_ips.js index 8361829619a..fb209ac613b 100644 --- a/packages/google-cloud-datastream/samples/generated/v1/datastream.fetch_static_ips.js +++ b/packages/google-cloud-datastream/samples/generated/v1/datastream.fetch_static_ips.js @@ -29,8 +29,8 @@ function main(name) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The resource name for the location for which static IPs should be returned. - * Must be in the format `projects/* /locations/*`. + * Required. The resource name for the location for which static IPs should be + * returned. Must be in the format `projects/* /locations/*`. */ // const name = 'abc123' /** diff --git a/packages/google-cloud-datastream/samples/generated/v1/datastream.list_private_connections.js b/packages/google-cloud-datastream/samples/generated/v1/datastream.list_private_connections.js index d67cba691e8..417b8d77b75 100644 --- a/packages/google-cloud-datastream/samples/generated/v1/datastream.list_private_connections.js +++ b/packages/google-cloud-datastream/samples/generated/v1/datastream.list_private_connections.js @@ -29,7 +29,8 @@ function main(parent) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The parent that owns the collection of private connectivity configurations. + * Required. The parent that owns the collection of private connectivity + * configurations. */ // const parent = 'abc123' /** diff --git a/packages/google-cloud-datastream/samples/generated/v1/datastream.start_backfill_job.js b/packages/google-cloud-datastream/samples/generated/v1/datastream.start_backfill_job.js index 8211d507edf..8143825d24d 100644 --- a/packages/google-cloud-datastream/samples/generated/v1/datastream.start_backfill_job.js +++ b/packages/google-cloud-datastream/samples/generated/v1/datastream.start_backfill_job.js @@ -29,7 +29,8 @@ function main(object) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The name of the stream object resource to start a backfill job for. + * Required. The name of the stream object resource to start a backfill job + * for. */ // const object = 'abc123' diff --git a/packages/google-cloud-datastream/samples/generated/v1/datastream.stop_backfill_job.js b/packages/google-cloud-datastream/samples/generated/v1/datastream.stop_backfill_job.js index 74db633e5ae..d5d41bf6f0c 100644 --- a/packages/google-cloud-datastream/samples/generated/v1/datastream.stop_backfill_job.js +++ b/packages/google-cloud-datastream/samples/generated/v1/datastream.stop_backfill_job.js @@ -29,7 +29,8 @@ function main(object) { * TODO(developer): Uncomment these variables before running the sample. */ /** - * Required. The name of the stream object resource to stop the backfill job for. + * Required. The name of the stream object resource to stop the backfill job + * for. */ // const object = 'abc123' diff --git a/packages/google-cloud-datastream/samples/generated/v1/datastream.update_connection_profile.js b/packages/google-cloud-datastream/samples/generated/v1/datastream.update_connection_profile.js index 84684de0713..1c82f487811 100644 --- a/packages/google-cloud-datastream/samples/generated/v1/datastream.update_connection_profile.js +++ b/packages/google-cloud-datastream/samples/generated/v1/datastream.update_connection_profile.js @@ -55,8 +55,8 @@ function main(connectionProfile) { */ // const requestId = 'abc123' /** - * Optional. Only validate the connection profile, but don't update any resources. - * The default is false. + * Optional. Only validate the connection profile, but don't update any + * resources. The default is false. */ // const validateOnly = true /** diff --git a/packages/google-cloud-datastream/samples/generated/v1/datastream.update_stream.js b/packages/google-cloud-datastream/samples/generated/v1/datastream.update_stream.js index 11a55c08515..dd42264aa24 100644 --- a/packages/google-cloud-datastream/samples/generated/v1/datastream.update_stream.js +++ b/packages/google-cloud-datastream/samples/generated/v1/datastream.update_stream.js @@ -55,8 +55,8 @@ function main(stream) { */ // const requestId = 'abc123' /** - * Optional. Only validate the stream with the changes, without actually updating it. - * The default is false. + * Optional. Only validate the stream with the changes, without actually + * updating it. The default is false. */ // const validateOnly = true /** diff --git a/packages/google-cloud-datastream/samples/generated/v1/snippet_metadata.google.cloud.datastream.v1.json b/packages/google-cloud-datastream/samples/generated/v1/snippet_metadata.google.cloud.datastream.v1.json index e61264d01ff..ea5a61dbb5f 100644 --- a/packages/google-cloud-datastream/samples/generated/v1/snippet_metadata.google.cloud.datastream.v1.json +++ b/packages/google-cloud-datastream/samples/generated/v1/snippet_metadata.google.cloud.datastream.v1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-datastream", - "version": "2.2.0", + "version": "2.2.2", "language": "TYPESCRIPT", "apis": [ { @@ -734,7 +734,7 @@ "segments": [ { "start": 25, - "end": 53, + "end": 54, "type": "FULL" } ], @@ -774,7 +774,7 @@ "segments": [ { "start": 25, - "end": 53, + "end": 54, "type": "FULL" } ], @@ -862,7 +862,7 @@ "segments": [ { "start": 25, - "end": 78, + "end": 82, "type": "FULL" } ], @@ -886,6 +886,10 @@ { "name": "request_id", "type": "TYPE_STRING" + }, + { + "name": "force", + "type": "TYPE_BOOL" } ], "resultType": ".google.longrunning.Operation", @@ -954,7 +958,7 @@ "segments": [ { "start": 25, - "end": 78, + "end": 79, "type": "FULL" } ], diff --git a/packages/google-cloud-datastream/samples/generated/v1alpha1/snippet_metadata.google.cloud.datastream.v1alpha1.json b/packages/google-cloud-datastream/samples/generated/v1alpha1/snippet_metadata.google.cloud.datastream.v1alpha1.json index 015966cd05b..134d718a69d 100644 --- a/packages/google-cloud-datastream/samples/generated/v1alpha1/snippet_metadata.google.cloud.datastream.v1alpha1.json +++ b/packages/google-cloud-datastream/samples/generated/v1alpha1/snippet_metadata.google.cloud.datastream.v1alpha1.json @@ -1,7 +1,7 @@ { "clientLibrary": { "name": "nodejs-datastream", - "version": "2.2.0", + "version": "2.2.2", "language": "TYPESCRIPT", "apis": [ { diff --git a/packages/google-cloud-datastream/src/v1/datastream_client.ts b/packages/google-cloud-datastream/src/v1/datastream_client.ts index 9f2b2eaa1a8..ffa18cd1bca 100644 --- a/packages/google-cloud-datastream/src/v1/datastream_client.ts +++ b/packages/google-cloud-datastream/src/v1/datastream_client.ts @@ -694,8 +694,8 @@ export class DatastreamClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The parent resource of the connection profile type. Must be in the - * format `projects/* /locations/*`. + * Required. The parent resource of the connection profile type. Must be in + * the format `projects/* /locations/*`. * @param {google.cloud.datastream.v1.ConnectionProfile} request.connectionProfile * An ad-hoc connection profile configuration. * @param {string} request.connectionProfileName @@ -1080,7 +1080,8 @@ export class DatastreamClient { * @param {Object} request * The request object that will be sent. * @param {string} request.object - * Required. The name of the stream object resource to start a backfill job for. + * Required. The name of the stream object resource to start a backfill job + * for. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1171,7 +1172,8 @@ export class DatastreamClient { * @param {Object} request * The request object that will be sent. * @param {string} request.object - * Required. The name of the stream object resource to stop the backfill job for. + * Required. The name of the stream object resource to stop the backfill job + * for. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -1463,8 +1465,8 @@ export class DatastreamClient { * The request ID must be a valid UUID with the exception that zero UUID is * not supported (00000000-0000-0000-0000-000000000000). * @param {boolean} [request.validateOnly] - * Optional. Only validate the connection profile, but don't create any resources. - * The default is false. + * Optional. Only validate the connection profile, but don't create any + * resources. The default is false. * @param {boolean} [request.force] * Optional. Create the connection profile without validating it. * @param {object} [options] @@ -1630,8 +1632,8 @@ export class DatastreamClient { * The request ID must be a valid UUID with the exception that zero UUID is * not supported (00000000-0000-0000-0000-000000000000). * @param {boolean} [request.validateOnly] - * Optional. Only validate the connection profile, but don't update any resources. - * The default is false. + * Optional. Only validate the connection profile, but don't update any + * resources. The default is false. * @param {boolean} [request.force] * Optional. Update the connection profile without validating it. * @param {object} [options] @@ -2114,8 +2116,8 @@ export class DatastreamClient { * The request ID must be a valid UUID with the exception that zero UUID is * not supported (00000000-0000-0000-0000-000000000000). * @param {boolean} [request.validateOnly] - * Optional. Only validate the stream with the changes, without actually updating it. - * The default is false. + * Optional. Only validate the stream with the changes, without actually + * updating it. The default is false. * @param {boolean} [request.force] * Optional. Update the stream without validating it. * @param {object} [options] @@ -2426,6 +2428,8 @@ export class DatastreamClient { * * The request ID must be a valid UUID with the exception that zero UUID is * not supported (00000000-0000-0000-0000-000000000000). + * @param {boolean} [request.force] + * Optional. If set to true, will skip validations. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -2583,8 +2587,8 @@ export class DatastreamClient { * The request ID must be a valid UUID with the exception that zero UUID is * not supported (00000000-0000-0000-0000-000000000000). * @param {boolean} [request.force] - * Optional. If set to true, any child routes that belong to this PrivateConnection will - * also be deleted. + * Optional. If set to true, any child routes that belong to this + * PrivateConnection will also be deleted. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. @@ -3680,8 +3684,8 @@ export class DatastreamClient { * @param {Object} request * The request object that will be sent. * @param {string} request.name - * Required. The resource name for the location for which static IPs should be returned. - * Must be in the format `projects/* /locations/*`. + * Required. The resource name for the location for which static IPs should be + * returned. Must be in the format `projects/* /locations/*`. * @param {number} request.pageSize * Maximum number of Ips to return, will likely not be specified. * @param {string} request.pageToken @@ -3780,8 +3784,8 @@ export class DatastreamClient { * @param {Object} request * The request object that will be sent. * @param {string} request.name - * Required. The resource name for the location for which static IPs should be returned. - * Must be in the format `projects/* /locations/*`. + * Required. The resource name for the location for which static IPs should be + * returned. Must be in the format `projects/* /locations/*`. * @param {number} request.pageSize * Maximum number of Ips to return, will likely not be specified. * @param {string} request.pageToken @@ -3828,8 +3832,8 @@ export class DatastreamClient { * @param {Object} request * The request object that will be sent. * @param {string} request.name - * Required. The resource name for the location for which static IPs should be returned. - * Must be in the format `projects/* /locations/*`. + * Required. The resource name for the location for which static IPs should be + * returned. Must be in the format `projects/* /locations/*`. * @param {number} request.pageSize * Maximum number of Ips to return, will likely not be specified. * @param {string} request.pageToken @@ -3876,7 +3880,8 @@ export class DatastreamClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The parent that owns the collection of private connectivity configurations. + * Required. The parent that owns the collection of private connectivity + * configurations. * @param {number} request.pageSize * Maximum number of private connectivity configurations to return. * If unspecified, at most 50 private connectivity configurations that will be @@ -3990,7 +3995,8 @@ export class DatastreamClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The parent that owns the collection of private connectivity configurations. + * Required. The parent that owns the collection of private connectivity + * configurations. * @param {number} request.pageSize * Maximum number of private connectivity configurations to return. * If unspecified, at most 50 private connectivity configurations that will be @@ -4048,7 +4054,8 @@ export class DatastreamClient { * @param {Object} request * The request object that will be sent. * @param {string} request.parent - * Required. The parent that owns the collection of private connectivity configurations. + * Required. The parent that owns the collection of private connectivity + * configurations. * @param {number} request.pageSize * Maximum number of private connectivity configurations to return. * If unspecified, at most 50 private connectivity configurations that will be