From 8148cf5365b38c82d8214a2bfb2274c38db30689 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 Jun 2022 10:18:17 +0000 Subject: [PATCH 1/2] feat: support regapic LRO Use gapic-generator-typescript v2.15.1. PiperOrigin-RevId: 456946341 Source-Link: https://github.com/googleapis/googleapis/commit/88fd18d9d3b872b3d06a3d9392879f50b5bf3ce5 Source-Link: https://github.com/googleapis/googleapis-gen/commit/accfa371f667439313335c64042b063c1c53102e Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYWNjZmEzNzFmNjY3NDM5MzEzMzM1YzY0MDQyYjA2M2MxYzUzMTAyZSJ9 --- owl-bot-staging/v1/.eslintignore | 7 + owl-bot-staging/v1/.eslintrc.json | 3 + owl-bot-staging/v1/.gitignore | 14 + owl-bot-staging/v1/.jsdoc.js | 55 + owl-bot-staging/v1/.mocharc.js | 33 + owl-bot-staging/v1/.prettierrc.js | 22 + owl-bot-staging/v1/README.md | 1 + owl-bot-staging/v1/linkinator.config.json | 16 + owl-bot-staging/v1/package.json | 64 + .../cloud/networkconnectivity/v1/common.proto | 56 + .../cloud/networkconnectivity/v1/hub.proto | 652 ++++++ .../generated/v1/hub_service.create_hub.js | 84 + .../generated/v1/hub_service.create_spoke.js | 84 + .../generated/v1/hub_service.delete_hub.js | 74 + .../generated/v1/hub_service.delete_spoke.js | 74 + .../generated/v1/hub_service.get_hub.js | 58 + .../generated/v1/hub_service.get_spoke.js | 58 + .../generated/v1/hub_service.list_hubs.js | 76 + .../generated/v1/hub_service.list_spokes.js | 76 + .../generated/v1/hub_service.update_hub.js | 82 + .../generated/v1/hub_service.update_spoke.js | 82 + ...a.google.cloud.networkconnectivity.v1.json | 495 ++++ owl-bot-staging/v1/src/index.ts | 25 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 131 ++ .../v1/src/v1/hub_service_client.ts | 1881 +++++++++++++++ .../v1/src/v1/hub_service_client_config.json | 88 + .../v1/src/v1/hub_service_proto_list.json | 4 + owl-bot-staging/v1/src/v1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + owl-bot-staging/v1/system-test/install.ts | 49 + .../v1/test/gapic_hub_service_v1.ts | 2011 +++++++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 + owl-bot-staging/v1alpha1/.eslintignore | 7 + owl-bot-staging/v1alpha1/.eslintrc.json | 3 + owl-bot-staging/v1alpha1/.gitignore | 14 + owl-bot-staging/v1alpha1/.jsdoc.js | 55 + owl-bot-staging/v1alpha1/.mocharc.js | 33 + owl-bot-staging/v1alpha1/.prettierrc.js | 22 + owl-bot-staging/v1alpha1/README.md | 1 + .../v1alpha1/linkinator.config.json | 16 + owl-bot-staging/v1alpha1/package.json | 64 + .../networkconnectivity/v1alpha1/common.proto | 56 + .../networkconnectivity/v1alpha1/hub.proto | 551 +++++ .../v1alpha1/hub_service.create_hub.js | 82 + .../v1alpha1/hub_service.create_spoke.js | 82 + .../v1alpha1/hub_service.delete_hub.js | 73 + .../v1alpha1/hub_service.delete_spoke.js | 73 + .../generated/v1alpha1/hub_service.get_hub.js | 58 + .../v1alpha1/hub_service.get_spoke.js | 58 + .../v1alpha1/hub_service.list_hubs.js | 76 + .../v1alpha1/hub_service.list_spokes.js | 76 + .../v1alpha1/hub_service.update_hub.js | 81 + .../v1alpha1/hub_service.update_spoke.js | 81 + ...le.cloud.networkconnectivity.v1alpha1.json | 495 ++++ owl-bot-staging/v1alpha1/src/index.ts | 25 + .../v1alpha1/src/v1alpha1/gapic_metadata.json | 131 ++ .../src/v1alpha1/hub_service_client.ts | 1837 +++++++++++++++ .../v1alpha1/hub_service_client_config.json | 88 + .../src/v1alpha1/hub_service_proto_list.json | 4 + .../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_hub_service_v1alpha1.ts | 1973 ++++++++++++++++ owl-bot-staging/v1alpha1/tsconfig.json | 19 + owl-bot-staging/v1alpha1/webpack.config.js | 64 + 68 files changed, 12841 insertions(+) create mode 100644 owl-bot-staging/v1/.eslintignore create mode 100644 owl-bot-staging/v1/.eslintrc.json create mode 100644 owl-bot-staging/v1/.gitignore create mode 100644 owl-bot-staging/v1/.jsdoc.js create mode 100644 owl-bot-staging/v1/.mocharc.js create mode 100644 owl-bot-staging/v1/.prettierrc.js create mode 100644 owl-bot-staging/v1/README.md create mode 100644 owl-bot-staging/v1/linkinator.config.json create mode 100644 owl-bot-staging/v1/package.json create mode 100644 owl-bot-staging/v1/protos/google/cloud/networkconnectivity/v1/common.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/networkconnectivity/v1/hub.proto create mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.create_hub.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.create_spoke.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.delete_hub.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.delete_spoke.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.get_hub.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.get_spoke.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.list_hubs.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.list_spokes.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.update_hub.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.update_spoke.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.networkconnectivity.v1.json create mode 100644 owl-bot-staging/v1/src/index.ts create mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/v1/src/v1/hub_service_client.ts create mode 100644 owl-bot-staging/v1/src/v1/hub_service_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/hub_service_proto_list.json create mode 100644 owl-bot-staging/v1/src/v1/index.ts create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1/system-test/install.ts create mode 100644 owl-bot-staging/v1/test/gapic_hub_service_v1.ts create mode 100644 owl-bot-staging/v1/tsconfig.json create mode 100644 owl-bot-staging/v1/webpack.config.js create mode 100644 owl-bot-staging/v1alpha1/.eslintignore create mode 100644 owl-bot-staging/v1alpha1/.eslintrc.json create mode 100644 owl-bot-staging/v1alpha1/.gitignore create mode 100644 owl-bot-staging/v1alpha1/.jsdoc.js create mode 100644 owl-bot-staging/v1alpha1/.mocharc.js create mode 100644 owl-bot-staging/v1alpha1/.prettierrc.js create mode 100644 owl-bot-staging/v1alpha1/README.md create mode 100644 owl-bot-staging/v1alpha1/linkinator.config.json create mode 100644 owl-bot-staging/v1alpha1/package.json create mode 100644 owl-bot-staging/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/common.proto create mode 100644 owl-bot-staging/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/hub.proto create mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.create_hub.js create mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.create_spoke.js create mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.delete_hub.js create mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.delete_spoke.js create mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.get_hub.js create mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.get_spoke.js create mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.list_hubs.js create mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.list_spokes.js create mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.update_hub.js create mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.update_spoke.js create mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/snippet_metadata.google.cloud.networkconnectivity.v1alpha1.json create mode 100644 owl-bot-staging/v1alpha1/src/index.ts create mode 100644 owl-bot-staging/v1alpha1/src/v1alpha1/gapic_metadata.json create mode 100644 owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_client.ts create mode 100644 owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_client_config.json create mode 100644 owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_proto_list.json create mode 100644 owl-bot-staging/v1alpha1/src/v1alpha1/index.ts create mode 100644 owl-bot-staging/v1alpha1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1alpha1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1alpha1/system-test/install.ts create mode 100644 owl-bot-staging/v1alpha1/test/gapic_hub_service_v1alpha1.ts create mode 100644 owl-bot-staging/v1alpha1/tsconfig.json create mode 100644 owl-bot-staging/v1alpha1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore new file mode 100644 index 0000000..cfc348e --- /dev/null +++ b/owl-bot-staging/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/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/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js new file mode 100644 index 0000000..7d9f7fc --- /dev/null +++ b/owl-bot-staging/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/network-connectivity', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js new file mode 100644 index 0000000..481c522 --- /dev/null +++ b/owl-bot-staging/v1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js new file mode 100644 index 0000000..494e147 --- /dev/null +++ b/owl-bot-staging/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md new file mode 100644 index 0000000..086026d --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Networkconnectivity: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json new file mode 100644 index 0000000..befd23c --- /dev/null +++ b/owl-bot-staging/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/v1/package.json b/owl-bot-staging/v1/package.json new file mode 100644 index 0000000..695c121 --- /dev/null +++ b/owl-bot-staging/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/network-connectivity", + "version": "0.1.0", + "description": "Networkconnectivity client for Node.js", + "repository": "googleapis/nodejs-networkconnectivity", + "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 networkconnectivity", + "networkconnectivity", + "hub service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.1.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/networkconnectivity/v1/common.proto b/owl-bot-staging/v1/protos/google/cloud/networkconnectivity/v1/common.proto new file mode 100644 index 0000000..ed96c8e --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/networkconnectivity/v1/common.proto @@ -0,0 +1,56 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.networkconnectivity.v1; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1;networkconnectivity"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.cloud.networkconnectivity.v1"; +option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1"; +option ruby_package = "Google::Cloud::NetworkConnectivity::V1"; + +// 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 been cancelled successfully + // 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]; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/networkconnectivity/v1/hub.proto b/owl-bot-staging/v1/protos/google/cloud/networkconnectivity/v1/hub.proto new file mode 100644 index 0000000..c28ca9a --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/networkconnectivity/v1/hub.proto @@ -0,0 +1,652 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.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.networkconnectivity.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1;networkconnectivity"; +option java_multiple_files = true; +option java_outer_classname = "HubProto"; +option java_package = "com.google.cloud.networkconnectivity.v1"; +option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1"; +option ruby_package = "Google::Cloud::NetworkConnectivity::V1"; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/VpnTunnel" + pattern: "projects/{project}/regions/{region}/vpnTunnels/{resource_id}" +}; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/InterconnectAttachment" + pattern: "projects/{project}/regions/{region}/interconnectAttachments/{resource_id}" +}; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Instance" + pattern: "projects/{project}/zones/{zone}/instances/{instance}" +}; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Network" + pattern: "projects/{project}/global/networks/{resource_id}" +}; + +// Network Connectivity Center is a hub-and-spoke abstraction for network +// connectivity management in Google Cloud. It reduces operational complexity +// through a simple, centralized connectivity management model. +service HubService { + option (google.api.default_host) = "networkconnectivity.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists hubs in a given project. + rpc ListHubs(ListHubsRequest) returns (ListHubsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/global}/hubs" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details about the specified hub. + rpc GetHub(GetHubRequest) returns (Hub) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/global/hubs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new hub in the specified project. + rpc CreateHub(CreateHubRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/global}/hubs" + body: "hub" + }; + option (google.api.method_signature) = "parent,hub,hub_id"; + option (google.longrunning.operation_info) = { + response_type: "Hub" + metadata_type: "OperationMetadata" + }; + } + + // Updates the description and/or labels of the specified hub. + rpc UpdateHub(UpdateHubRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{hub.name=projects/*/locations/global/hubs/*}" + body: "hub" + }; + option (google.api.method_signature) = "hub,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Hub" + metadata_type: "OperationMetadata" + }; + } + + // Deletes the specified hub. + rpc DeleteHub(DeleteHubRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/global/hubs/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Lists the spokes in the specified project and location. + rpc ListSpokes(ListSpokesRequest) returns (ListSpokesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/spokes" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details about the specified spoke. + rpc GetSpoke(GetSpokeRequest) returns (Spoke) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/spokes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a spoke in the specified project and location. + rpc CreateSpoke(CreateSpokeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/spokes" + body: "spoke" + }; + option (google.api.method_signature) = "parent,spoke,spoke_id"; + option (google.longrunning.operation_info) = { + response_type: "Spoke" + metadata_type: "OperationMetadata" + }; + } + + // Updates the parameters of the specified spoke. + rpc UpdateSpoke(UpdateSpokeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1/{spoke.name=projects/*/locations/*/spokes/*}" + body: "spoke" + }; + option (google.api.method_signature) = "spoke,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Spoke" + metadata_type: "OperationMetadata" + }; + } + + // Deletes the specified spoke. + rpc DeleteSpoke(DeleteSpokeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/spokes/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } +} + +// The State enum represents the lifecycle stage of a Network Connectivity +// Center resource. +enum State { + // No state information available + STATE_UNSPECIFIED = 0; + + // The resource's create operation is in progress + CREATING = 1; + + // The resource is active + ACTIVE = 2; + + // The resource's Delete operation is in progress + DELETING = 3; +} + +// Supported features for a location +enum LocationFeature { + // No publicly supported feature in this location + LOCATION_FEATURE_UNSPECIFIED = 0; + + // Site-to-cloud spokes are supported in this location + SITE_TO_CLOUD_SPOKES = 1; + + // Site-to-site spokes are supported in this location + SITE_TO_SITE_SPOKES = 2; +} + +// A hub is a collection of spokes. A single hub can contain spokes from +// multiple regions. However, if any of a hub's spokes use the data transfer +// feature, the resources associated with those spokes must all reside in the +// same VPC network. Spokes that do not use data transfer can be associated +// with any VPC network in your project. +message Hub { + option (google.api.resource) = { + type: "networkconnectivity.googleapis.com/Hub" + pattern: "projects/{project}/locations/global/hubs/{hub}" + }; + + // Immutable. The name of the hub. Hub names must be unique. They use the + // following form: + // `projects/{project_number}/locations/global/hubs/{hub_id}` + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time the hub was created. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the hub was last updated. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional labels in key:value format. For more information about labels, see + // [Requirements for + // labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements). + map labels = 4; + + // An optional description of the hub. + string description = 5; + + // Output only. The Google-generated UUID for the hub. This value is unique across all hub + // resources. If a hub is deleted and another with the same name is created, + // the new hub is assigned a different unique_id. + string unique_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current lifecycle state of this hub. + State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The VPC networks associated with this hub's spokes. + // + // This field is read-only. Network Connectivity Center automatically + // populates it based on the set of spokes attached to the hub. + repeated RoutingVPC routing_vpcs = 10; +} + +// RoutingVPC contains information about the VPC networks that are associated +// with a hub's spokes. +message RoutingVPC { + // The URI of the VPC network. + string uri = 1 [(google.api.resource_reference) = { + type: "compute.googleapis.com/Network" + }]; + + // Output only. If true, indicates that this VPC network is currently associated with + // spokes that use the data transfer feature (spokes where the + // site_to_site_data_transfer field is set to true). If you create new spokes + // that use data transfer, they must be associated with this VPC network. At + // most, one VPC network will have this field set to true. + bool required_for_new_site_to_site_data_transfer_spokes = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A spoke represents a connection between your Google Cloud network resources +// and a non-Google-Cloud network. +// +// When you create a spoke, you associate it with a hub. You must also identify +// a value for exactly one of the following fields: +// +// * linked_vpn_tunnels +// * linked_interconnect_attachments +// * linked_router_appliance_instances +message Spoke { + option (google.api.resource) = { + type: "networkconnectivity.googleapis.com/Spoke" + pattern: "projects/{project}/locations/{location}/spokes/{spoke}" + }; + + // Immutable. The name of the spoke. Spoke names must be unique. They use the + // following form: + // `projects/{project_number}/locations/{region}/spokes/{spoke_id}` + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time the spoke was created. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the spoke was last updated. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Optional labels in key:value format. For more information about labels, see + // [Requirements for + // labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements). + map labels = 4; + + // An optional description of the spoke. + string description = 5; + + // Immutable. The name of the hub that this spoke is attached to. + string hub = 6 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Hub" + } + ]; + + // VPN tunnels that are associated with the spoke. + LinkedVpnTunnels linked_vpn_tunnels = 17; + + // VLAN attachments that are associated with the spoke. + LinkedInterconnectAttachments linked_interconnect_attachments = 18; + + // Router appliance instances that are associated with the spoke. + LinkedRouterApplianceInstances linked_router_appliance_instances = 19; + + // Output only. The Google-generated UUID for the spoke. This value is unique across all + // spoke resources. If a spoke is deleted and another with the same name is + // created, the new spoke is assigned a different unique_id. + string unique_id = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current lifecycle state of this spoke. + State state = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request for [HubService.ListHubs][google.cloud.networkconnectivity.v1.HubService.ListHubs] method. +message ListHubsRequest { + // Required. The parent resource's name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of results per page that should be returned. + int32 page_size = 2; + + // The page token. + string page_token = 3; + + // An expression that filters the results listed in the response. + string filter = 4; + + // Sort the results by a certain order. + string order_by = 5; +} + +// Response for [HubService.ListHubs][google.cloud.networkconnectivity.v1.HubService.ListHubs] method. +message ListHubsResponse { + // The requested hubs. + repeated Hub hubs = 1; + + // The next pagination token in the List response. It should be used as + // page_token for the following request. An empty value means no more result. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request for [HubService.GetHub][google.cloud.networkconnectivity.v1.HubService.GetHub] method. +message GetHubRequest { + // Required. The name of the hub resource to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Hub" + } + ]; +} + +// Request for [HubService.CreateHub][google.cloud.networkconnectivity.v1.HubService.CreateHub] method. +message CreateHubRequest { + // Required. The parent resource. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. A unique identifier for the hub. + string hub_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The initial values for a new hub. + Hub hub = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A unique request ID (optional). If you specify this ID, you can use it + // in cases when you need to retry your request. When you need to retry, this + // ID lets the server know that it can ignore the request if it has already + // been completed. The server guarantees 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 to see whether the original operation + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly 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]; +} + +// Request for [HubService.UpdateHub][google.cloud.networkconnectivity.v1.HubService.UpdateHub] method. +message UpdateHubRequest { + // Optional. In the case of an update to an existing hub, field mask is used to specify + // the fields to be overwritten. The fields specified in the update_mask are + // relative to the resource, not the full request. A field is overwritten if + // it is in the mask. If the user does not provide a mask, then all fields are + // overwritten. + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The state that the hub should be in after the update. + Hub hub = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A unique request ID (optional). If you specify this ID, you can use it + // in cases when you need to retry your request. When you need to retry, this + // ID lets the server know that it can ignore the request if it has already + // been completed. The server guarantees 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 to see whether the original operation + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly 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]; +} + +// The request for [HubService.DeleteHub][google.cloud.networkconnectivity.v1.HubService.DeleteHub]. +message DeleteHubRequest { + // Required. The name of the hub to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Hub" + } + ]; + + // Optional. A unique request ID (optional). If you specify this ID, you can use it + // in cases when you need to retry your request. When you need to retry, this + // ID lets the server know that it can ignore the request if it has already + // been completed. The server guarantees 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 to see whether the original operation + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly 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]; +} + +// The request for [HubService.ListSpokes][google.cloud.networkconnectivity.v1.HubService.ListSpokes]. +message ListSpokesRequest { + // Required. The parent resource. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of results per page that should be returned. + int32 page_size = 2; + + // The page token. + string page_token = 3; + + // An expression that filters the results listed in the response. + string filter = 4; + + // Sort the results by a certain order. + string order_by = 5; +} + +// The response for [HubService.ListSpokes][google.cloud.networkconnectivity.v1.HubService.ListSpokes]. +message ListSpokesResponse { + // The requested spokes. + repeated Spoke spokes = 1; + + // The next pagination token in the List response. It should be used as + // page_token for the following request. An empty value means no more result. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// The request for [HubService.GetSpoke][google.cloud.networkconnectivity.v1.HubService.GetSpoke]. +message GetSpokeRequest { + // Required. The name of the spoke resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Spoke" + } + ]; +} + +// The request for [HubService.CreateSpoke][google.cloud.networkconnectivity.v1.HubService.CreateSpoke]. +message CreateSpokeRequest { + // Required. The parent resource. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. Unique id for the spoke to create. + string spoke_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. The initial values for a new spoke. + Spoke spoke = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A unique request ID (optional). If you specify this ID, you can use it + // in cases when you need to retry your request. When you need to retry, this + // ID lets the server know that it can ignore the request if it has already + // been completed. The server guarantees 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 to see whether the original operation + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly 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]; +} + +// Request for [HubService.UpdateSpoke][google.cloud.networkconnectivity.v1.HubService.UpdateSpoke] method. +message UpdateSpokeRequest { + // Optional. In the case of an update to an existing spoke, field mask is used to + // specify the fields to be overwritten. The fields specified in the + // update_mask are relative to the resource, not the full request. A field is + // overwritten if it is in the mask. If the user does not provide a mask, then + // all fields are overwritten. + google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Required. The state that the spoke should be in after the update. + Spoke spoke = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. A unique request ID (optional). If you specify this ID, you can use it + // in cases when you need to retry your request. When you need to retry, this + // ID lets the server know that it can ignore the request if it has already + // been completed. The server guarantees 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 to see whether the original operation + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly 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]; +} + +// The request for [HubService.DeleteSpoke][google.cloud.networkconnectivity.v1.HubService.DeleteSpoke]. +message DeleteSpokeRequest { + // Required. The name of the spoke to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Spoke" + } + ]; + + // Optional. A unique request ID (optional). If you specify this ID, you can use it + // in cases when you need to retry your request. When you need to retry, this + // ID lets the server know that it can ignore the request if it has already + // been completed. The server guarantees 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 to see whether the original operation + // was received. If it was, the server ignores the second request. This + // behavior prevents clients from mistakenly 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]; +} + +// A collection of Cloud VPN tunnel resources. These resources should be +// redundant HA VPN tunnels that all advertise the same prefixes to Google +// Cloud. Alternatively, in a passive/active configuration, all tunnels +// should be capable of advertising the same prefixes. +message LinkedVpnTunnels { + // The URIs of linked VPN tunnel resources. + repeated string uris = 1 [(google.api.resource_reference) = { + type: "compute.googleapis.com/VpnTunnel" + }]; + + // A value that controls whether site-to-site data transfer is enabled for + // these resources. Data transfer is available only in [supported + // locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations). + bool site_to_site_data_transfer = 2; +} + +// A collection of VLAN attachment resources. These resources should +// be redundant attachments that all advertise the same prefixes to Google +// Cloud. Alternatively, in active/passive configurations, all attachments +// should be capable of advertising the same prefixes. +message LinkedInterconnectAttachments { + // The URIs of linked interconnect attachment resources + repeated string uris = 1 [(google.api.resource_reference) = { + type: "compute.googleapis.com/InterconnectAttachment" + }]; + + // A value that controls whether site-to-site data transfer is enabled for + // these resources. Data transfer is available only in [supported + // locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations). + bool site_to_site_data_transfer = 2; +} + +// A collection of router appliance instances. If you configure multiple router +// appliance instances to receive data from the same set of sites outside of +// Google Cloud, we recommend that you associate those instances with the same +// spoke. +message LinkedRouterApplianceInstances { + // The list of router appliance instances. + repeated RouterApplianceInstance instances = 1; + + // A value that controls whether site-to-site data transfer is enabled for + // these resources. Data transfer is available only in [supported + // locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations). + bool site_to_site_data_transfer = 2; +} + +// A router appliance instance is a Compute Engine virtual machine (VM) instance +// that acts as a BGP speaker. A router appliance instance is specified by the +// URI of the VM and the internal IP address of one of the VM's network +// interfaces. +message RouterApplianceInstance { + // The URI of the VM. + string virtual_machine = 1 [(google.api.resource_reference) = { + type: "compute.googleapis.com/Instance" + }]; + + // The IP address on the VM to use for peering. + string ip_address = 3; +} + +// Metadata about locations +message LocationMetadata { + // List of supported features + repeated LocationFeature location_features = 1; +} diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.create_hub.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.create_hub.js new file mode 100644 index 0000000..f440f26 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/hub_service.create_hub.js @@ -0,0 +1,84 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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, hubId, hub) { + // [START networkconnectivity_v1_generated_HubService_CreateHub_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource. + */ + // const parent = 'abc123' + /** + * Required. A unique identifier for the hub. + */ + // const hubId = 'abc123' + /** + * Required. The initial values for a new hub. + */ + // const hub = {} + /** + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees 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 to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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 Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callCreateHub() { + // Construct request + const request = { + parent, + hubId, + hub, + }; + + // Run request + const [operation] = await networkconnectivityClient.createHub(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateHub(); + // [END networkconnectivity_v1_generated_HubService_CreateHub_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.create_spoke.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.create_spoke.js new file mode 100644 index 0000000..bca54f0 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/hub_service.create_spoke.js @@ -0,0 +1,84 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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, spokeId, spoke) { + // [START networkconnectivity_v1_generated_HubService_CreateSpoke_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource. + */ + // const parent = 'abc123' + /** + * Required. Unique id for the spoke to create. + */ + // const spokeId = 'abc123' + /** + * Required. The initial values for a new spoke. + */ + // const spoke = {} + /** + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees 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 to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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 Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callCreateSpoke() { + // Construct request + const request = { + parent, + spokeId, + spoke, + }; + + // Run request + const [operation] = await networkconnectivityClient.createSpoke(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateSpoke(); + // [END networkconnectivity_v1_generated_HubService_CreateSpoke_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.delete_hub.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.delete_hub.js new file mode 100644 index 0000000..19f719d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/hub_service.delete_hub.js @@ -0,0 +1,74 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START networkconnectivity_v1_generated_HubService_DeleteHub_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the hub to delete. + */ + // const name = 'abc123' + /** + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees 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 to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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 Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callDeleteHub() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await networkconnectivityClient.deleteHub(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteHub(); + // [END networkconnectivity_v1_generated_HubService_DeleteHub_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.delete_spoke.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.delete_spoke.js new file mode 100644 index 0000000..8907704 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/hub_service.delete_spoke.js @@ -0,0 +1,74 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START networkconnectivity_v1_generated_HubService_DeleteSpoke_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the spoke to delete. + */ + // const name = 'abc123' + /** + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees 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 to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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 Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callDeleteSpoke() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await networkconnectivityClient.deleteSpoke(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteSpoke(); + // [END networkconnectivity_v1_generated_HubService_DeleteSpoke_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.get_hub.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.get_hub.js new file mode 100644 index 0000000..151b067 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/hub_service.get_hub.js @@ -0,0 +1,58 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 networkconnectivity_v1_generated_HubService_GetHub_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the hub resource to get. + */ + // const name = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callGetHub() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await networkconnectivityClient.getHub(request); + console.log(response); + } + + callGetHub(); + // [END networkconnectivity_v1_generated_HubService_GetHub_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.get_spoke.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.get_spoke.js new file mode 100644 index 0000000..ac9951b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/hub_service.get_spoke.js @@ -0,0 +1,58 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 networkconnectivity_v1_generated_HubService_GetSpoke_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the spoke resource. + */ + // const name = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callGetSpoke() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await networkconnectivityClient.getSpoke(request); + console.log(response); + } + + callGetSpoke(); + // [END networkconnectivity_v1_generated_HubService_GetSpoke_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.list_hubs.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.list_hubs.js new file mode 100644 index 0000000..24e9692 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/hub_service.list_hubs.js @@ -0,0 +1,76 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START networkconnectivity_v1_generated_HubService_ListHubs_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource's name. + */ + // const parent = 'abc123' + /** + * The maximum number of results per page that should be returned. + */ + // const pageSize = 1234 + /** + * The page token. + */ + // const pageToken = 'abc123' + /** + * An expression that filters the results listed in the response. + */ + // const filter = 'abc123' + /** + * Sort the results by a certain order. + */ + // const orderBy = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callListHubs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await networkconnectivityClient.listHubsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListHubs(); + // [END networkconnectivity_v1_generated_HubService_ListHubs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.list_spokes.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.list_spokes.js new file mode 100644 index 0000000..8d6426f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/hub_service.list_spokes.js @@ -0,0 +1,76 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START networkconnectivity_v1_generated_HubService_ListSpokes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource. + */ + // const parent = 'abc123' + /** + * The maximum number of results per page that should be returned. + */ + // const pageSize = 1234 + /** + * The page token. + */ + // const pageToken = 'abc123' + /** + * An expression that filters the results listed in the response. + */ + // const filter = 'abc123' + /** + * Sort the results by a certain order. + */ + // const orderBy = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callListSpokes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await networkconnectivityClient.listSpokesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSpokes(); + // [END networkconnectivity_v1_generated_HubService_ListSpokes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.update_hub.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.update_hub.js new file mode 100644 index 0000000..d6bc74e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/hub_service.update_hub.js @@ -0,0 +1,82 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(hub) { + // [START networkconnectivity_v1_generated_HubService_UpdateHub_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Optional. In the case of an update to an existing hub, field mask is used to specify + * the fields to be overwritten. The fields specified in the update_mask are + * relative to the resource, not the full request. A field is overwritten if + * it is in the mask. If the user does not provide a mask, then all fields are + * overwritten. + */ + // const updateMask = {} + /** + * Required. The state that the hub should be in after the update. + */ + // const hub = {} + /** + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees 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 to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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 Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callUpdateHub() { + // Construct request + const request = { + hub, + }; + + // Run request + const [operation] = await networkconnectivityClient.updateHub(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateHub(); + // [END networkconnectivity_v1_generated_HubService_UpdateHub_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.update_spoke.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.update_spoke.js new file mode 100644 index 0000000..4f41576 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/hub_service.update_spoke.js @@ -0,0 +1,82 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(spoke) { + // [START networkconnectivity_v1_generated_HubService_UpdateSpoke_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Optional. In the case of an update to an existing spoke, field mask is used to + * specify the fields to be overwritten. The fields specified in the + * update_mask are relative to the resource, not the full request. A field is + * overwritten if it is in the mask. If the user does not provide a mask, then + * all fields are overwritten. + */ + // const updateMask = {} + /** + * Required. The state that the spoke should be in after the update. + */ + // const spoke = {} + /** + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees 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 to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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 Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callUpdateSpoke() { + // Construct request + const request = { + spoke, + }; + + // Run request + const [operation] = await networkconnectivityClient.updateSpoke(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateSpoke(); + // [END networkconnectivity_v1_generated_HubService_UpdateSpoke_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.networkconnectivity.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.networkconnectivity.v1.json new file mode 100644 index 0000000..e70014d --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.networkconnectivity.v1.json @@ -0,0 +1,495 @@ +{ + "clientLibrary": { + "name": "nodejs-networkconnectivity", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.networkconnectivity.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "networkconnectivity_v1_generated_HubService_ListHubs_async", + "title": "HubService listHubs Sample", + "origin": "API_DEFINITION", + "description": " Lists hubs in a given project.", + "canonical": true, + "file": "hub_service.list_hubs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListHubs", + "fullName": "google.cloud.networkconnectivity.v1.HubService.ListHubs", + "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.networkconnectivity.v1.ListHubsResponse", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "ListHubs", + "fullName": "google.cloud.networkconnectivity.v1.HubService.ListHubs", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1_generated_HubService_GetHub_async", + "title": "HubService getHub Sample", + "origin": "API_DEFINITION", + "description": " Gets details about the specified hub.", + "canonical": true, + "file": "hub_service.get_hub.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetHub", + "fullName": "google.cloud.networkconnectivity.v1.HubService.GetHub", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networkconnectivity.v1.Hub", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "GetHub", + "fullName": "google.cloud.networkconnectivity.v1.HubService.GetHub", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1_generated_HubService_CreateHub_async", + "title": "HubService createHub Sample", + "origin": "API_DEFINITION", + "description": " Creates a new hub in the specified project.", + "canonical": true, + "file": "hub_service.create_hub.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateHub", + "fullName": "google.cloud.networkconnectivity.v1.HubService.CreateHub", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "hub_id", + "type": "TYPE_STRING" + }, + { + "name": "hub", + "type": ".google.cloud.networkconnectivity.v1.Hub" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "CreateHub", + "fullName": "google.cloud.networkconnectivity.v1.HubService.CreateHub", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1_generated_HubService_UpdateHub_async", + "title": "HubService updateHub Sample", + "origin": "API_DEFINITION", + "description": " Updates the description and/or labels of the specified hub.", + "canonical": true, + "file": "hub_service.update_hub.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateHub", + "fullName": "google.cloud.networkconnectivity.v1.HubService.UpdateHub", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "hub", + "type": ".google.cloud.networkconnectivity.v1.Hub" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "UpdateHub", + "fullName": "google.cloud.networkconnectivity.v1.HubService.UpdateHub", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1_generated_HubService_DeleteHub_async", + "title": "HubService deleteHub Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified hub.", + "canonical": true, + "file": "hub_service.delete_hub.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteHub", + "fullName": "google.cloud.networkconnectivity.v1.HubService.DeleteHub", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "DeleteHub", + "fullName": "google.cloud.networkconnectivity.v1.HubService.DeleteHub", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1_generated_HubService_ListSpokes_async", + "title": "HubService listSpokes Sample", + "origin": "API_DEFINITION", + "description": " Lists the spokes in the specified project and location.", + "canonical": true, + "file": "hub_service.list_spokes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSpokes", + "fullName": "google.cloud.networkconnectivity.v1.HubService.ListSpokes", + "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.networkconnectivity.v1.ListSpokesResponse", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "ListSpokes", + "fullName": "google.cloud.networkconnectivity.v1.HubService.ListSpokes", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1_generated_HubService_GetSpoke_async", + "title": "HubService getSpoke Sample", + "origin": "API_DEFINITION", + "description": " Gets details about the specified spoke.", + "canonical": true, + "file": "hub_service.get_spoke.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSpoke", + "fullName": "google.cloud.networkconnectivity.v1.HubService.GetSpoke", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networkconnectivity.v1.Spoke", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "GetSpoke", + "fullName": "google.cloud.networkconnectivity.v1.HubService.GetSpoke", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1_generated_HubService_CreateSpoke_async", + "title": "HubService createSpoke Sample", + "origin": "API_DEFINITION", + "description": " Creates a spoke in the specified project and location.", + "canonical": true, + "file": "hub_service.create_spoke.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 76, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSpoke", + "fullName": "google.cloud.networkconnectivity.v1.HubService.CreateSpoke", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "spoke_id", + "type": "TYPE_STRING" + }, + { + "name": "spoke", + "type": ".google.cloud.networkconnectivity.v1.Spoke" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "CreateSpoke", + "fullName": "google.cloud.networkconnectivity.v1.HubService.CreateSpoke", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1_generated_HubService_UpdateSpoke_async", + "title": "HubService updateSpoke Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of the specified spoke.", + "canonical": true, + "file": "hub_service.update_spoke.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSpoke", + "fullName": "google.cloud.networkconnectivity.v1.HubService.UpdateSpoke", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "spoke", + "type": ".google.cloud.networkconnectivity.v1.Spoke" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "UpdateSpoke", + "fullName": "google.cloud.networkconnectivity.v1.HubService.UpdateSpoke", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1_generated_HubService_DeleteSpoke_async", + "title": "HubService deleteSpoke Sample", + "origin": "API_DEFINITION", + "description": " Deletes the specified spoke.", + "canonical": true, + "file": "hub_service.delete_spoke.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSpoke", + "fullName": "google.cloud.networkconnectivity.v1.HubService.DeleteSpoke", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" + }, + "method": { + "shortName": "DeleteSpoke", + "fullName": "google.cloud.networkconnectivity.v1.HubService.DeleteSpoke", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1.HubService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 0000000..fba5f87 --- /dev/null +++ b/owl-bot-staging/v1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; +const HubServiceClient = v1.HubServiceClient; +type HubServiceClient = v1.HubServiceClient; +export {v1, HubServiceClient}; +export default {v1, HubServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json new file mode 100644 index 0000000..3e4f0fe --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,131 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.networkconnectivity.v1", + "libraryPackage": "@google-cloud/network-connectivity", + "services": { + "HubService": { + "clients": { + "grpc": { + "libraryClient": "HubServiceClient", + "rpcs": { + "GetHub": { + "methods": [ + "getHub" + ] + }, + "GetSpoke": { + "methods": [ + "getSpoke" + ] + }, + "CreateHub": { + "methods": [ + "createHub" + ] + }, + "UpdateHub": { + "methods": [ + "updateHub" + ] + }, + "DeleteHub": { + "methods": [ + "deleteHub" + ] + }, + "CreateSpoke": { + "methods": [ + "createSpoke" + ] + }, + "UpdateSpoke": { + "methods": [ + "updateSpoke" + ] + }, + "DeleteSpoke": { + "methods": [ + "deleteSpoke" + ] + }, + "ListHubs": { + "methods": [ + "listHubs", + "listHubsStream", + "listHubsAsync" + ] + }, + "ListSpokes": { + "methods": [ + "listSpokes", + "listSpokesStream", + "listSpokesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "HubServiceClient", + "rpcs": { + "GetHub": { + "methods": [ + "getHub" + ] + }, + "GetSpoke": { + "methods": [ + "getSpoke" + ] + }, + "CreateHub": { + "methods": [ + "createHub" + ] + }, + "UpdateHub": { + "methods": [ + "updateHub" + ] + }, + "DeleteHub": { + "methods": [ + "deleteHub" + ] + }, + "CreateSpoke": { + "methods": [ + "createSpoke" + ] + }, + "UpdateSpoke": { + "methods": [ + "updateSpoke" + ] + }, + "DeleteSpoke": { + "methods": [ + "deleteSpoke" + ] + }, + "ListHubs": { + "methods": [ + "listHubs", + "listHubsStream", + "listHubsAsync" + ] + }, + "ListSpokes": { + "methods": [ + "listSpokes", + "listSpokesStream", + "listSpokesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/hub_service_client.ts b/owl-bot-staging/v1/src/v1/hub_service_client.ts new file mode 100644 index 0000000..b974b06 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/hub_service_client.ts @@ -0,0 +1,1881 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/hub_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './hub_service_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Network Connectivity Center is a hub-and-spoke abstraction for network + * connectivity management in Google Cloud. It reduces operational complexity + * through a simple, centralized connectivity management model. + * @class + * @memberof v1 + */ +export class HubServiceClient { + 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; + hubServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of HubServiceClient. + * + * @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}. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof HubServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + hubPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/global/hubs/{hub}' + ), + instancePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/zones/{zone}/instances/{instance}' + ), + interconnectAttachmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/interconnectAttachments/{resource_id}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + networkPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/global/networks/{resource_id}' + ), + spokePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/spokes/{spoke}' + ), + vpnTunnelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/vpnTunnels/{resource_id}' + ), + }; + + // 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 = { + listHubs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'hubs'), + listSpokes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spokes') + }; + + 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.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/global/hubs/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/spokes/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/global/hubs/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/spokes/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/global/hubs/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/spokes/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:testIamPermissions',body: '*',}], + },{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 createHubResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.Hub') as gax.protobuf.Type; + const createHubMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; + const updateHubResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.Hub') as gax.protobuf.Type; + const updateHubMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; + const deleteHubResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteHubMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; + const createSpokeResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.Spoke') as gax.protobuf.Type; + const createSpokeMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; + const updateSpokeResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.Spoke') as gax.protobuf.Type; + const updateSpokeMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; + const deleteSpokeResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteSpokeMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createHub: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createHubResponse.decode.bind(createHubResponse), + createHubMetadata.decode.bind(createHubMetadata)), + updateHub: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateHubResponse.decode.bind(updateHubResponse), + updateHubMetadata.decode.bind(updateHubMetadata)), + deleteHub: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteHubResponse.decode.bind(deleteHubResponse), + deleteHubMetadata.decode.bind(deleteHubMetadata)), + createSpoke: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createSpokeResponse.decode.bind(createSpokeResponse), + createSpokeMetadata.decode.bind(createSpokeMetadata)), + updateSpoke: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateSpokeResponse.decode.bind(updateSpokeResponse), + updateSpokeMetadata.decode.bind(updateSpokeMetadata)), + deleteSpoke: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteSpokeResponse.decode.bind(deleteSpokeResponse), + deleteSpokeMetadata.decode.bind(deleteSpokeMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.networkconnectivity.v1.HubService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.hubServiceStub) { + return this.hubServiceStub; + } + + // Put together the "service stub" for + // google.cloud.networkconnectivity.v1.HubService. + this.hubServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.networkconnectivity.v1.HubService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networkconnectivity.v1.HubService, + 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 hubServiceStubMethods = + ['listHubs', 'getHub', 'createHub', 'updateHub', 'deleteHub', 'listSpokes', 'getSpoke', 'createSpoke', 'updateSpoke', 'deleteSpoke']; + for (const methodName of hubServiceStubMethods) { + const callPromise = this.hubServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.hubServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'networkconnectivity.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 'networkconnectivity.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Gets details about the specified hub. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the hub 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 [Hub]{@link google.cloud.networkconnectivity.v1.Hub}. + * 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/hub_service.get_hub.js + * region_tag:networkconnectivity_v1_generated_HubService_GetHub_async + */ + getHub( + request?: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IGetHubRequest|undefined, {}|undefined + ]>; + getHub( + request: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IGetHubRequest|null|undefined, + {}|null|undefined>): void; + getHub( + request: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, + callback: Callback< + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IGetHubRequest|null|undefined, + {}|null|undefined>): void; + getHub( + request?: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IGetHubRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IGetHubRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.networkconnectivity.v1.IHub, + protos.google.cloud.networkconnectivity.v1.IGetHubRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getHub(request, options, callback); + } +/** + * Gets details about the specified spoke. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spoke resource. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Spoke]{@link google.cloud.networkconnectivity.v1.Spoke}. + * 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/hub_service.get_spoke.js + * region_tag:networkconnectivity_v1_generated_HubService_GetSpoke_async + */ + getSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|undefined, {}|undefined + ]>; + getSpoke( + request: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|null|undefined, + {}|null|undefined>): void; + getSpoke( + request: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, + callback: Callback< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|null|undefined, + {}|null|undefined>): void; + getSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.networkconnectivity.v1.ISpoke, + protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getSpoke(request, options, callback); + } + +/** + * Creates a new hub in the specified project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource. + * @param {string} request.hubId + * Required. A unique identifier for the hub. + * @param {google.cloud.networkconnectivity.v1.Hub} request.hub + * Required. The initial values for a new hub. + * @param {string} [request.requestId] + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees 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 to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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/hub_service.create_hub.js + * region_tag:networkconnectivity_v1_generated_HubService_CreateHub_async + */ + createHub( + request?: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createHub( + request: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createHub( + request: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createHub( + request?: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createHub(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createHub()`. + * @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/hub_service.create_hub.js + * region_tag:networkconnectivity_v1_generated_HubService_CreateHub_async + */ + async checkCreateHubProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createHub, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the description and/or labels of the specified hub. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. In the case of an update to an existing hub, field mask is used to specify + * the fields to be overwritten. The fields specified in the update_mask are + * relative to the resource, not the full request. A field is overwritten if + * it is in the mask. If the user does not provide a mask, then all fields are + * overwritten. + * @param {google.cloud.networkconnectivity.v1.Hub} request.hub + * Required. The state that the hub should be in after the update. + * @param {string} [request.requestId] + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees 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 to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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/hub_service.update_hub.js + * region_tag:networkconnectivity_v1_generated_HubService_UpdateHub_async + */ + updateHub( + request?: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateHub( + request: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateHub( + request: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateHub( + request?: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'hub.name': request.hub!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateHub(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateHub()`. + * @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/hub_service.update_hub.js + * region_tag:networkconnectivity_v1_generated_HubService_UpdateHub_async + */ + async checkUpdateHubProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateHub, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes the specified hub. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the hub to delete. + * @param {string} [request.requestId] + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees 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 to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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/hub_service.delete_hub.js + * region_tag:networkconnectivity_v1_generated_HubService_DeleteHub_async + */ + deleteHub( + request?: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteHub( + request: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteHub( + request: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteHub( + request?: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteHub(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteHub()`. + * @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/hub_service.delete_hub.js + * region_tag:networkconnectivity_v1_generated_HubService_DeleteHub_async + */ + async checkDeleteHubProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteHub, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a spoke in the specified project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource. + * @param {string} request.spokeId + * Required. Unique id for the spoke to create. + * @param {google.cloud.networkconnectivity.v1.Spoke} request.spoke + * Required. The initial values for a new spoke. + * @param {string} [request.requestId] + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees 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 to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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/hub_service.create_spoke.js + * region_tag:networkconnectivity_v1_generated_HubService_CreateSpoke_async + */ + createSpoke( + request?: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createSpoke( + request: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createSpoke( + request: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createSpoke( + request?: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createSpoke(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createSpoke()`. + * @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/hub_service.create_spoke.js + * region_tag:networkconnectivity_v1_generated_HubService_CreateSpoke_async + */ + async checkCreateSpokeProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createSpoke, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the parameters of the specified spoke. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.protobuf.FieldMask} [request.updateMask] + * Optional. In the case of an update to an existing spoke, field mask is used to + * specify the fields to be overwritten. The fields specified in the + * update_mask are relative to the resource, not the full request. A field is + * overwritten if it is in the mask. If the user does not provide a mask, then + * all fields are overwritten. + * @param {google.cloud.networkconnectivity.v1.Spoke} request.spoke + * Required. The state that the spoke should be in after the update. + * @param {string} [request.requestId] + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees 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 to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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/hub_service.update_spoke.js + * region_tag:networkconnectivity_v1_generated_HubService_UpdateSpoke_async + */ + updateSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateSpoke( + request: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateSpoke( + request: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'spoke.name': request.spoke!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateSpoke(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateSpoke()`. + * @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/hub_service.update_spoke.js + * region_tag:networkconnectivity_v1_generated_HubService_UpdateSpoke_async + */ + async checkUpdateSpokeProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateSpoke, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes the specified spoke. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the spoke to delete. + * @param {string} [request.requestId] + * Optional. A unique request ID (optional). If you specify this ID, you can use it + * in cases when you need to retry your request. When you need to retry, this + * ID lets the server know that it can ignore the request if it has already + * been completed. The server guarantees 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 to see whether the original operation + * was received. If it was, the server ignores the second request. This + * behavior prevents clients from mistakenly 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/hub_service.delete_spoke.js + * region_tag:networkconnectivity_v1_generated_HubService_DeleteSpoke_async + */ + deleteSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteSpoke( + request: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteSpoke( + request: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteSpoke( + request?: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteSpoke(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteSpoke()`. + * @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/hub_service.delete_spoke.js + * region_tag:networkconnectivity_v1_generated_HubService_DeleteSpoke_async + */ + async checkDeleteSpokeProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteSpoke, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists hubs in a given project. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource's name. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * An expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Hub]{@link google.cloud.networkconnectivity.v1.Hub}. + * 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 `listHubsAsync()` + * 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. + */ + listHubs( + request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkconnectivity.v1.IHub[], + protos.google.cloud.networkconnectivity.v1.IListHubsRequest|null, + protos.google.cloud.networkconnectivity.v1.IListHubsResponse + ]>; + listHubs( + request: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + protos.google.cloud.networkconnectivity.v1.IListHubsResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1.IHub>): void; + listHubs( + request: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + protos.google.cloud.networkconnectivity.v1.IListHubsResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1.IHub>): void; + listHubs( + request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + protos.google.cloud.networkconnectivity.v1.IListHubsResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1.IHub>, + callback?: PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + protos.google.cloud.networkconnectivity.v1.IListHubsResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1.IHub>): + Promise<[ + protos.google.cloud.networkconnectivity.v1.IHub[], + protos.google.cloud.networkconnectivity.v1.IListHubsRequest|null, + protos.google.cloud.networkconnectivity.v1.IListHubsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listHubs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource's name. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * An expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @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 [Hub]{@link google.cloud.networkconnectivity.v1.Hub} 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 `listHubsAsync()` + * 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. + */ + listHubsStream( + request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listHubs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listHubs.createStream( + this.innerApiCalls.listHubs as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listHubs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource's name. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * An expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @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 + * [Hub]{@link google.cloud.networkconnectivity.v1.Hub}. 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/hub_service.list_hubs.js + * region_tag:networkconnectivity_v1_generated_HubService_ListHubs_async + */ + listHubsAsync( + request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listHubs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listHubs.asyncIterate( + this.innerApiCalls['listHubs'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists the spokes in the specified project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * An expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Spoke]{@link google.cloud.networkconnectivity.v1.Spoke}. + * 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 `listSpokesAsync()` + * 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. + */ + listSpokes( + request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkconnectivity.v1.ISpoke[], + protos.google.cloud.networkconnectivity.v1.IListSpokesRequest|null, + protos.google.cloud.networkconnectivity.v1.IListSpokesResponse + ]>; + listSpokes( + request: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + protos.google.cloud.networkconnectivity.v1.IListSpokesResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1.ISpoke>): void; + listSpokes( + request: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + protos.google.cloud.networkconnectivity.v1.IListSpokesResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1.ISpoke>): void; + listSpokes( + request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + protos.google.cloud.networkconnectivity.v1.IListSpokesResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1.ISpoke>, + callback?: PaginationCallback< + protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + protos.google.cloud.networkconnectivity.v1.IListSpokesResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1.ISpoke>): + Promise<[ + protos.google.cloud.networkconnectivity.v1.ISpoke[], + protos.google.cloud.networkconnectivity.v1.IListSpokesRequest|null, + protos.google.cloud.networkconnectivity.v1.IListSpokesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listSpokes(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * An expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @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 [Spoke]{@link google.cloud.networkconnectivity.v1.Spoke} 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 `listSpokesAsync()` + * 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. + */ + listSpokesStream( + request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listSpokes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSpokes.createStream( + this.innerApiCalls.listSpokes as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSpokes`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * An expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @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 + * [Spoke]{@link google.cloud.networkconnectivity.v1.Spoke}. 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/hub_service.list_spokes.js + * region_tag:networkconnectivity_v1_generated_HubService_ListSpokes_async + */ + listSpokesAsync( + request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listSpokes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSpokes.asyncIterate( + this.innerApiCalls['listSpokes'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified hub resource name string. + * + * @param {string} project + * @param {string} hub + * @returns {string} Resource name string. + */ + hubPath(project:string,hub:string) { + return this.pathTemplates.hubPathTemplate.render({ + project: project, + hub: hub, + }); + } + + /** + * Parse the project from Hub resource. + * + * @param {string} hubName + * A fully-qualified path representing Hub resource. + * @returns {string} A string representing the project. + */ + matchProjectFromHubName(hubName: string) { + return this.pathTemplates.hubPathTemplate.match(hubName).project; + } + + /** + * Parse the hub from Hub resource. + * + * @param {string} hubName + * A fully-qualified path representing Hub resource. + * @returns {string} A string representing the hub. + */ + matchHubFromHubName(hubName: string) { + return this.pathTemplates.hubPathTemplate.match(hubName).hub; + } + + /** + * Return a fully-qualified instance resource name string. + * + * @param {string} project + * @param {string} zone + * @param {string} instance + * @returns {string} Resource name string. + */ + instancePath(project:string,zone:string,instance:string) { + return this.pathTemplates.instancePathTemplate.render({ + project: project, + zone: zone, + instance: instance, + }); + } + + /** + * Parse the project from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).project; + } + + /** + * Parse the zone from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the zone. + */ + matchZoneFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).zone; + } + + /** + * Parse the instance from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).instance; + } + + /** + * Return a fully-qualified interconnectAttachment resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} resource_id + * @returns {string} Resource name string. + */ + interconnectAttachmentPath(project:string,region:string,resourceId:string) { + return this.pathTemplates.interconnectAttachmentPathTemplate.render({ + project: project, + region: region, + resource_id: resourceId, + }); + } + + /** + * Parse the project from InterconnectAttachment resource. + * + * @param {string} interconnectAttachmentName + * A fully-qualified path representing InterconnectAttachment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInterconnectAttachmentName(interconnectAttachmentName: string) { + return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).project; + } + + /** + * Parse the region from InterconnectAttachment resource. + * + * @param {string} interconnectAttachmentName + * A fully-qualified path representing InterconnectAttachment resource. + * @returns {string} A string representing the region. + */ + matchRegionFromInterconnectAttachmentName(interconnectAttachmentName: string) { + return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).region; + } + + /** + * Parse the resource_id from InterconnectAttachment resource. + * + * @param {string} interconnectAttachmentName + * A fully-qualified path representing InterconnectAttachment resource. + * @returns {string} A string representing the resource_id. + */ + matchResourceIdFromInterconnectAttachmentName(interconnectAttachmentName: string) { + return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).resource_id; + } + + /** + * 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 network resource name string. + * + * @param {string} project + * @param {string} resource_id + * @returns {string} Resource name string. + */ + networkPath(project:string,resourceId:string) { + return this.pathTemplates.networkPathTemplate.render({ + project: project, + resource_id: resourceId, + }); + } + + /** + * Parse the project from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the project. + */ + matchProjectFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).project; + } + + /** + * Parse the resource_id from Network resource. + * + * @param {string} networkName + * A fully-qualified path representing Network resource. + * @returns {string} A string representing the resource_id. + */ + matchResourceIdFromNetworkName(networkName: string) { + return this.pathTemplates.networkPathTemplate.match(networkName).resource_id; + } + + /** + * Return a fully-qualified spoke resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} spoke + * @returns {string} Resource name string. + */ + spokePath(project:string,location:string,spoke:string) { + return this.pathTemplates.spokePathTemplate.render({ + project: project, + location: location, + spoke: spoke, + }); + } + + /** + * Parse the project from Spoke resource. + * + * @param {string} spokeName + * A fully-qualified path representing Spoke resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSpokeName(spokeName: string) { + return this.pathTemplates.spokePathTemplate.match(spokeName).project; + } + + /** + * Parse the location from Spoke resource. + * + * @param {string} spokeName + * A fully-qualified path representing Spoke resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSpokeName(spokeName: string) { + return this.pathTemplates.spokePathTemplate.match(spokeName).location; + } + + /** + * Parse the spoke from Spoke resource. + * + * @param {string} spokeName + * A fully-qualified path representing Spoke resource. + * @returns {string} A string representing the spoke. + */ + matchSpokeFromSpokeName(spokeName: string) { + return this.pathTemplates.spokePathTemplate.match(spokeName).spoke; + } + + /** + * Return a fully-qualified vpnTunnel resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} resource_id + * @returns {string} Resource name string. + */ + vpnTunnelPath(project:string,region:string,resourceId:string) { + return this.pathTemplates.vpnTunnelPathTemplate.render({ + project: project, + region: region, + resource_id: resourceId, + }); + } + + /** + * Parse the project from VpnTunnel resource. + * + * @param {string} vpnTunnelName + * A fully-qualified path representing VpnTunnel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVpnTunnelName(vpnTunnelName: string) { + return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).project; + } + + /** + * Parse the region from VpnTunnel resource. + * + * @param {string} vpnTunnelName + * A fully-qualified path representing VpnTunnel resource. + * @returns {string} A string representing the region. + */ + matchRegionFromVpnTunnelName(vpnTunnelName: string) { + return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).region; + } + + /** + * Parse the resource_id from VpnTunnel resource. + * + * @param {string} vpnTunnelName + * A fully-qualified path representing VpnTunnel resource. + * @returns {string} A string representing the resource_id. + */ + matchResourceIdFromVpnTunnelName(vpnTunnelName: string) { + return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).resource_id; + } + + /** + * 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.hubServiceStub && !this._terminated) { + return this.hubServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/hub_service_client_config.json b/owl-bot-staging/v1/src/v1/hub_service_client_config.json new file mode 100644 index 0000000..068f769 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/hub_service_client_config.json @@ -0,0 +1,88 @@ +{ + "interfaces": { + "google.cloud.networkconnectivity.v1.HubService": { + "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": { + "ListHubs": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetHub": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateHub": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateHub": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteHub": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListSpokes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/hub_service_proto_list.json b/owl-bot-staging/v1/src/v1/hub_service_proto_list.json new file mode 100644 index 0000000..ebe50fa --- /dev/null +++ b/owl-bot-staging/v1/src/v1/hub_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/networkconnectivity/v1/common.proto", + "../../protos/google/cloud/networkconnectivity/v1/hub.proto" +] diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts new file mode 100644 index 0000000..ae38769 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {HubServiceClient} from './hub_service_client'; diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..672a15d --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const networkconnectivity = require('@google-cloud/network-connectivity'); + +function main() { + const hubServiceClient = new networkconnectivity.HubServiceClient(); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..5a5e64b --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {HubServiceClient} from '@google-cloud/network-connectivity'; + +// check that the client class type name can be used +function doStuffWithHubServiceClient(client: HubServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const hubServiceClient = new HubServiceClient(); + doStuffWithHubServiceClient(hubServiceClient); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts new file mode 100644 index 0000000..8ec4522 --- /dev/null +++ b/owl-bot-staging/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1/test/gapic_hub_service_v1.ts b/owl-bot-staging/v1/test/gapic_hub_service_v1.ts new file mode 100644 index 0000000..c0ccef5 --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_hub_service_v1.ts @@ -0,0 +1,2011 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 hubserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.HubServiceClient', () => { + it('has servicePath', () => { + const servicePath = hubserviceModule.v1.HubServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = hubserviceModule.v1.HubServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = hubserviceModule.v1.HubServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new hubserviceModule.v1.HubServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new hubserviceModule.v1.HubServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.hubServiceStub, undefined); + await client.initialize(); + assert(client.hubServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.hubServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.hubServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new hubserviceModule.v1.HubServiceClient({ + 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 hubserviceModule.v1.HubServiceClient({ + 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('getHub', () => { + it('invokes getHub without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.GetHubRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()); + client.innerApiCalls.getHub = stubSimpleCall(expectedResponse); + const [response] = await client.getHub(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getHub without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.GetHubRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()); + client.innerApiCalls.getHub = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getHub( + request, + (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1.IHub|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getHub with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.GetHubRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getHub = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getHub(request), expectedError); + assert((client.innerApiCalls.getHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getHub with closed client', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.GetHubRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getHub(request), expectedError); + }); + }); + + describe('getSpoke', () => { + it('invokes getSpoke without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.GetSpokeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()); + client.innerApiCalls.getSpoke = stubSimpleCall(expectedResponse); + const [response] = await client.getSpoke(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSpoke without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.GetSpokeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()); + client.innerApiCalls.getSpoke = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSpoke( + request, + (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1.ISpoke|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getSpoke with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.GetSpokeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getSpoke = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSpoke(request), expectedError); + assert((client.innerApiCalls.getSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSpoke with closed client', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.GetSpokeRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSpoke(request), expectedError); + }); + }); + + describe('createHub', () => { + it('invokes createHub without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.CreateHubRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createHub = stubLongRunningCall(expectedResponse); + const [operation] = await client.createHub(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createHub without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.CreateHubRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createHub = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createHub( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createHub with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.CreateHubRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createHub = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createHub(request), expectedError); + assert((client.innerApiCalls.createHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createHub with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.CreateHubRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createHub = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createHub(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateHubProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkCreateHubProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateHubProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkCreateHubProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateHub', () => { + it('invokes updateHub without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest()); + request.hub = {}; + request.hub.name = ''; + const expectedHeaderRequestParams = "hub.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateHub = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateHub(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateHub without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest()); + request.hub = {}; + request.hub.name = ''; + const expectedHeaderRequestParams = "hub.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateHub = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateHub( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateHub with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest()); + request.hub = {}; + request.hub.name = ''; + const expectedHeaderRequestParams = "hub.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateHub = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateHub(request), expectedError); + assert((client.innerApiCalls.updateHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateHub with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest()); + request.hub = {}; + request.hub.name = ''; + const expectedHeaderRequestParams = "hub.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateHub = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateHub(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateHubProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkUpdateHubProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateHubProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkUpdateHubProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteHub', () => { + it('invokes deleteHub without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteHub = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteHub(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteHub without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteHub = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteHub( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteHub with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteHub = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteHub(request), expectedError); + assert((client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteHub with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteHub = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteHub(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteHubProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkDeleteHubProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteHubProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkDeleteHubProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createSpoke', () => { + it('invokes createSpoke without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createSpoke = stubLongRunningCall(expectedResponse); + const [operation] = await client.createSpoke(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createSpoke without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createSpoke = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSpoke( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createSpoke with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createSpoke = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createSpoke(request), expectedError); + assert((client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createSpoke with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createSpoke = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createSpoke(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateSpokeProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkCreateSpokeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateSpokeProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkCreateSpokeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateSpoke', () => { + it('invokes updateSpoke without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest()); + request.spoke = {}; + request.spoke.name = ''; + const expectedHeaderRequestParams = "spoke.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateSpoke = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateSpoke(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateSpoke without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest()); + request.spoke = {}; + request.spoke.name = ''; + const expectedHeaderRequestParams = "spoke.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateSpoke = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSpoke( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateSpoke with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest()); + request.spoke = {}; + request.spoke.name = ''; + const expectedHeaderRequestParams = "spoke.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSpoke = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateSpoke(request), expectedError); + assert((client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateSpoke with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest()); + request.spoke = {}; + request.spoke.name = ''; + const expectedHeaderRequestParams = "spoke.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSpoke = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateSpoke(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateSpokeProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkUpdateSpokeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateSpokeProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkUpdateSpokeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteSpoke', () => { + it('invokes deleteSpoke without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteSpoke = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSpoke(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteSpoke without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteSpoke = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSpoke( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteSpoke with call error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSpoke = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteSpoke(request), expectedError); + assert((client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteSpoke with LRO error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSpoke = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteSpoke(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteSpokeProgress without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkDeleteSpokeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteSpokeProgress with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + 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.checkDeleteSpokeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listHubs', () => { + it('invokes listHubs without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListHubsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + ]; + client.innerApiCalls.listHubs = stubSimpleCall(expectedResponse); + const [response] = await client.listHubs(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listHubs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listHubs without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListHubsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + ]; + client.innerApiCalls.listHubs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listHubs( + request, + (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1.IHub[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listHubs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listHubs with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListHubsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listHubs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listHubs(request), expectedError); + assert((client.innerApiCalls.listHubs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listHubsStream without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListHubsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + ]; + client.descriptors.page.listHubs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listHubsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1.Hub[] = []; + stream.on('data', (response: protos.google.cloud.networkconnectivity.v1.Hub) => { + 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.listHubs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listHubs, request)); + assert.strictEqual( + (client.descriptors.page.listHubs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listHubsStream with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListHubsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listHubs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listHubsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1.Hub[] = []; + stream.on('data', (response: protos.google.cloud.networkconnectivity.v1.Hub) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listHubs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listHubs, request)); + assert.strictEqual( + (client.descriptors.page.listHubs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listHubs without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListHubsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), + ]; + client.descriptors.page.listHubs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networkconnectivity.v1.IHub[] = []; + const iterable = client.listHubsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listHubs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listHubs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listHubs with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListHubsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listHubs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listHubsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networkconnectivity.v1.IHub[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listHubs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listHubs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listSpokes', () => { + it('invokes listSpokes without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + ]; + client.innerApiCalls.listSpokes = stubSimpleCall(expectedResponse); + const [response] = await client.listSpokes(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSpokes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSpokes without error using callback', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + ]; + client.innerApiCalls.listSpokes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSpokes( + request, + (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1.ISpoke[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSpokes as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listSpokes with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listSpokes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSpokes(request), expectedError); + assert((client.innerApiCalls.listSpokes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSpokesStream without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + ]; + client.descriptors.page.listSpokes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSpokesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1.Spoke[] = []; + stream.on('data', (response: protos.google.cloud.networkconnectivity.v1.Spoke) => { + 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.listSpokes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSpokes, request)); + assert.strictEqual( + (client.descriptors.page.listSpokes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listSpokesStream with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listSpokes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSpokesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1.Spoke[] = []; + stream.on('data', (response: protos.google.cloud.networkconnectivity.v1.Spoke) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSpokes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSpokes, request)); + assert.strictEqual( + (client.descriptors.page.listSpokes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSpokes without error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), + ]; + client.descriptors.page.listSpokes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networkconnectivity.v1.ISpoke[] = []; + const iterable = client.listSpokesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSpokes with error', async () => { + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listSpokes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSpokesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networkconnectivity.v1.ISpoke[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('hub', () => { + const fakePath = "/rendered/path/hub"; + const expectedParameters = { + project: "projectValue", + hub: "hubValue", + }; + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.hubPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.hubPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('hubPath', () => { + const result = client.hubPath("projectValue", "hubValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.hubPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromHubName', () => { + const result = client.matchProjectFromHubName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.hubPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchHubFromHubName', () => { + const result = client.matchHubFromHubName(fakePath); + assert.strictEqual(result, "hubValue"); + assert((client.pathTemplates.hubPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('instance', () => { + const fakePath = "/rendered/path/instance"; + const expectedParameters = { + project: "projectValue", + zone: "zoneValue", + instance: "instanceValue", + }; + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.instancePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.instancePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath("projectValue", "zoneValue", "instanceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchZoneFromInstanceName', () => { + const result = client.matchZoneFromInstanceName(fakePath); + assert.strictEqual(result, "zoneValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('interconnectAttachment', () => { + const fakePath = "/rendered/path/interconnectAttachment"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + resource_id: "resourceIdValue", + }; + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.interconnectAttachmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interconnectAttachmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interconnectAttachmentPath', () => { + const result = client.interconnectAttachmentPath("projectValue", "regionValue", "resourceIdValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.interconnectAttachmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInterconnectAttachmentName', () => { + const result = client.matchProjectFromInterconnectAttachmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromInterconnectAttachmentName', () => { + const result = client.matchRegionFromInterconnectAttachmentName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchResourceIdFromInterconnectAttachmentName', () => { + const result = client.matchResourceIdFromInterconnectAttachmentName(fakePath); + assert.strictEqual(result, "resourceIdValue"); + assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new hubserviceModule.v1.HubServiceClient({ + 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('network', () => { + const fakePath = "/rendered/path/network"; + const expectedParameters = { + project: "projectValue", + resource_id: "resourceIdValue", + }; + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.networkPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.networkPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('networkPath', () => { + const result = client.networkPath("projectValue", "resourceIdValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.networkPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromNetworkName', () => { + const result = client.matchProjectFromNetworkName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchResourceIdFromNetworkName', () => { + const result = client.matchResourceIdFromNetworkName(fakePath); + assert.strictEqual(result, "resourceIdValue"); + assert((client.pathTemplates.networkPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('spoke', () => { + const fakePath = "/rendered/path/spoke"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + spoke: "spokeValue", + }; + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.spokePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.spokePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('spokePath', () => { + const result = client.spokePath("projectValue", "locationValue", "spokeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.spokePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSpokeName', () => { + const result = client.matchProjectFromSpokeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.spokePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromSpokeName', () => { + const result = client.matchLocationFromSpokeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.spokePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSpokeFromSpokeName', () => { + const result = client.matchSpokeFromSpokeName(fakePath); + assert.strictEqual(result, "spokeValue"); + assert((client.pathTemplates.spokePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('vpnTunnel', () => { + const fakePath = "/rendered/path/vpnTunnel"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + resource_id: "resourceIdValue", + }; + const client = new hubserviceModule.v1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.vpnTunnelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.vpnTunnelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('vpnTunnelPath', () => { + const result = client.vpnTunnelPath("projectValue", "regionValue", "resourceIdValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.vpnTunnelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromVpnTunnelName', () => { + const result = client.matchProjectFromVpnTunnelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromVpnTunnelName', () => { + const result = client.matchRegionFromVpnTunnelName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchResourceIdFromVpnTunnelName', () => { + const result = client.matchResourceIdFromVpnTunnelName(fakePath); + assert.strictEqual(result, "resourceIdValue"); + assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/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/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js new file mode 100644 index 0000000..2412b4e --- /dev/null +++ b/owl-bot-staging/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: 'HubService', + filename: './hub-service.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/v1alpha1/.eslintignore b/owl-bot-staging/v1alpha1/.eslintignore new file mode 100644 index 0000000..cfc348e --- /dev/null +++ b/owl-bot-staging/v1alpha1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1alpha1/.eslintrc.json b/owl-bot-staging/v1alpha1/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v1alpha1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1alpha1/.gitignore b/owl-bot-staging/v1alpha1/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/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/v1alpha1/.jsdoc.js b/owl-bot-staging/v1alpha1/.jsdoc.js new file mode 100644 index 0000000..7d9f7fc --- /dev/null +++ b/owl-bot-staging/v1alpha1/.jsdoc.js @@ -0,0 +1,55 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +'use strict'; + +module.exports = { + opts: { + readme: './README.md', + package: './package.json', + template: './node_modules/jsdoc-fresh', + recurse: true, + verbose: true, + destination: './docs/' + }, + plugins: [ + 'plugins/markdown', + 'jsdoc-region-tag' + ], + source: { + excludePattern: '(^|\\/|\\\\)[._]', + include: [ + 'build/src', + 'protos' + ], + includePattern: '\\.js$' + }, + templates: { + copyright: 'Copyright 2022 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/network-connectivity', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1alpha1/.mocharc.js b/owl-bot-staging/v1alpha1/.mocharc.js new file mode 100644 index 0000000..481c522 --- /dev/null +++ b/owl-bot-staging/v1alpha1/.mocharc.js @@ -0,0 +1,33 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +if (process.env.MOCHA_THROW_DEPRECATION === 'false') { + delete config['throw-deprecation']; +} +if (process.env.MOCHA_REPORTER) { + config.reporter = process.env.MOCHA_REPORTER; +} +if (process.env.MOCHA_REPORTER_OUTPUT) { + config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; +} +module.exports = config diff --git a/owl-bot-staging/v1alpha1/.prettierrc.js b/owl-bot-staging/v1alpha1/.prettierrc.js new file mode 100644 index 0000000..494e147 --- /dev/null +++ b/owl-bot-staging/v1alpha1/.prettierrc.js @@ -0,0 +1,22 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1alpha1/README.md b/owl-bot-staging/v1alpha1/README.md new file mode 100644 index 0000000..086026d --- /dev/null +++ b/owl-bot-staging/v1alpha1/README.md @@ -0,0 +1 @@ +Networkconnectivity: Nodejs Client diff --git a/owl-bot-staging/v1alpha1/linkinator.config.json b/owl-bot-staging/v1alpha1/linkinator.config.json new file mode 100644 index 0000000..befd23c --- /dev/null +++ b/owl-bot-staging/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/v1alpha1/package.json b/owl-bot-staging/v1alpha1/package.json new file mode 100644 index 0000000..695c121 --- /dev/null +++ b/owl-bot-staging/v1alpha1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/network-connectivity", + "version": "0.1.0", + "description": "Networkconnectivity client for Node.js", + "repository": "googleapis/nodejs-networkconnectivity", + "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 networkconnectivity", + "networkconnectivity", + "hub service" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^3.1.1" + }, + "devDependencies": { + "@types/mocha": "^9.1.0", + "@types/node": "^16.0.0", + "@types/sinon": "^10.0.8", + "c8": "^7.11.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^3.0.0", + "mocha": "^9.1.4", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^13.0.0", + "ts-loader": "^9.2.6", + "typescript": "^4.5.5", + "webpack": "^5.67.0", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v12" + } +} diff --git a/owl-bot-staging/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/common.proto b/owl-bot-staging/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/common.proto new file mode 100644 index 0000000..88c3fe5 --- /dev/null +++ b/owl-bot-staging/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/common.proto @@ -0,0 +1,56 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.networkconnectivity.v1alpha1; + +import "google/api/field_behavior.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1Alpha1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1;networkconnectivity"; +option java_multiple_files = true; +option java_outer_classname = "CommonProto"; +option java_package = "com.google.cloud.networkconnectivity.v1alpha1"; +option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1alpha1"; +option ruby_package = "Google::Cloud::NetworkConnectivity::V1alpha1"; + +// 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]; +} diff --git a/owl-bot-staging/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/hub.proto b/owl-bot-staging/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/hub.proto new file mode 100644 index 0000000..6f1b8ee --- /dev/null +++ b/owl-bot-staging/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/hub.proto @@ -0,0 +1,551 @@ +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.networkconnectivity.v1alpha1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1Alpha1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1;networkconnectivity"; +option java_multiple_files = true; +option java_outer_classname = "HubProto"; +option java_package = "com.google.cloud.networkconnectivity.v1alpha1"; +option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1alpha1"; +option ruby_package = "Google::Cloud::NetworkConnectivity::V1alpha1"; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/VpnTunnel" + pattern: "projects/{project}/regions/{region}/vpnTunnels/{resource_id}" +}; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/InterconnectAttachment" + pattern: "projects/{project}/regions/{region}/interconnectAttachments/{resource_id}" +}; +option (google.api.resource_definition) = { + type: "compute.googleapis.com/Instance" + pattern: "projects/{project}/zones/{zone}/instances/{instance}" +}; + +// Network Connectivity Center is a hub-and-spoke abstraction for +// network connectivity management in Google Cloud. It reduces +// operational complexity through a simple, centralized connectivity management +// model. +service HubService { + option (google.api.default_host) = "networkconnectivity.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists Hubs in a given project and location. + rpc ListHubs(ListHubsRequest) returns (ListHubsResponse) { + option (google.api.http) = { + get: "/v1alpha1/{parent=projects/*/locations/global}/hubs" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single Hub. + rpc GetHub(GetHubRequest) returns (Hub) { + option (google.api.http) = { + get: "/v1alpha1/{name=projects/*/locations/global/hubs/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new Hub in a given project and location. + rpc CreateHub(CreateHubRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha1/{parent=projects/*/locations/global}/hubs" + body: "hub" + }; + option (google.api.method_signature) = "parent,hub,hub_id"; + option (google.longrunning.operation_info) = { + response_type: "Hub" + metadata_type: "OperationMetadata" + }; + } + + // Updates the parameters of a single Hub. + rpc UpdateHub(UpdateHubRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1alpha1/{hub.name=projects/*/locations/global/hubs/*}" + body: "hub" + }; + option (google.api.method_signature) = "hub,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Hub" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a single Hub. + rpc DeleteHub(DeleteHubRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1alpha1/{name=projects/*/locations/global/hubs/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } + + // Lists Spokes in a given project and location. + rpc ListSpokes(ListSpokesRequest) returns (ListSpokesResponse) { + option (google.api.http) = { + get: "/v1alpha1/{parent=projects/*/locations/*}/spokes" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets details of a single Spoke. + rpc GetSpoke(GetSpokeRequest) returns (Spoke) { + option (google.api.http) = { + get: "/v1alpha1/{name=projects/*/locations/*/spokes/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates a new Spoke in a given project and location. + rpc CreateSpoke(CreateSpokeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1alpha1/{parent=projects/*/locations/*}/spokes" + body: "spoke" + }; + option (google.api.method_signature) = "parent,spoke,spoke_id"; + option (google.longrunning.operation_info) = { + response_type: "Spoke" + metadata_type: "OperationMetadata" + }; + } + + // Updates the parameters of a single Spoke. + rpc UpdateSpoke(UpdateSpokeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + patch: "/v1alpha1/{spoke.name=projects/*/locations/*/spokes/*}" + body: "spoke" + }; + option (google.api.method_signature) = "spoke,update_mask"; + option (google.longrunning.operation_info) = { + response_type: "Spoke" + metadata_type: "OperationMetadata" + }; + } + + // Deletes a single Spoke. + rpc DeleteSpoke(DeleteSpokeRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1alpha1/{name=projects/*/locations/*/spokes/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "OperationMetadata" + }; + } +} + +// Network Connectivity Center is a hub-and-spoke abstraction for +// network connectivity management in Google Cloud. It reduces +// operational complexity through a simple, centralized connectivity management +// model. Following is the resource message of a hub. +message Hub { + option (google.api.resource) = { + type: "networkconnectivity.googleapis.com/Hub" + pattern: "projects/{project}/locations/global/hubs/{hub}" + }; + + // Immutable. The name of a Hub resource. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Time when the Hub was created. + google.protobuf.Timestamp create_time = 2; + + // Time when the Hub was updated. + google.protobuf.Timestamp update_time = 3; + + // User-defined labels. + map labels = 4; + + // Short description of the hub resource. + string description = 5; + + // Output only. A list of the URIs of all attached spokes + repeated string spokes = 6 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Spoke" + } + ]; + + // Output only. Google-generated UUID for this resource. This is unique across all Hub + // resources. If a Hub resource is deleted and another with the same name is + // created, it gets a different unique_id. + string unique_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current lifecycle state of this Hub. + State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A Spoke is an abstraction of a network attachment being attached +// to a Hub. A Spoke can be underlying a VPN tunnel, a +// VLAN (interconnect) attachment, a Router appliance, etc. +message Spoke { + option (google.api.resource) = { + type: "networkconnectivity.googleapis.com/Spoke" + pattern: "projects/{project}/locations/{location}/spokes/{spoke}" + }; + + // Immutable. The name of a Spoke resource. + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // The time when the Spoke was created. + google.protobuf.Timestamp create_time = 2; + + // The time when the Spoke was updated. + google.protobuf.Timestamp update_time = 3; + + // User-defined labels. + map labels = 4; + + // Short description of the spoke resource + string description = 5; + + // The resource URL of the hub resource that the spoke is attached to + string hub = 6 [(google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Hub" + }]; + + // The URIs of linked VPN tunnel resources + repeated string linked_vpn_tunnels = 12 [(google.api.resource_reference) = { + type: "compute.googleapis.com/VpnTunnel" + }]; + + // The URIs of linked interconnect attachment resources + repeated string linked_interconnect_attachments = 13 [(google.api.resource_reference) = { + type: "compute.googleapis.com/InterconnectAttachment" + }]; + + // The URIs of linked Router appliance resources + repeated RouterApplianceInstance linked_router_appliance_instances = 14; + + // Output only. Google-generated UUID for this resource. This is unique across all Spoke + // resources. If a Spoke resource is deleted and another with the same name is + // created, it gets a different unique_id. + string unique_id = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current lifecycle state of this Hub. + State state = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Request for [HubService.ListHubs][google.cloud.networkconnectivity.v1alpha1.HubService.ListHubs] method. +message ListHubsRequest { + // Required. The parent resource's name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of results per page that should be returned. + int32 page_size = 2; + + // The page token. + string page_token = 3; + + // A filter expression that filters the results listed in the response. + string filter = 4; + + // Sort the results by a certain order. + string order_by = 5; +} + +// Response for [HubService.ListHubs][google.cloud.networkconnectivity.v1alpha1.HubService.ListHubs] method. +message ListHubsResponse { + // Hubs to be returned. + repeated Hub hubs = 1; + + // The next pagination token in the List response. It should be used as + // page_token for the following request. An empty value means no more result. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// Request for [HubService.GetHub][google.cloud.networkconnectivity.v1alpha1.HubService.GetHub] method. +message GetHubRequest { + // Required. Name of the Hub resource to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Hub" + } + ]; +} + +// Request for [HubService.CreateHub][google.cloud.networkconnectivity.v1alpha1.HubService.CreateHub] method. +message CreateHubRequest { + // Required. The parent resource's name of the Hub. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Unique id for the Hub to create. + string hub_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Initial values for a new Hub. + Hub hub = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional 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 t + // he 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]; +} + +// Request for [HubService.UpdateHub][google.cloud.networkconnectivity.v1alpha1.HubService.UpdateHub] method. +message UpdateHubRequest { + // Optional. Field mask is used to specify the fields to be overwritten in the + // Hub 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 state that the Hub should be in after the update. + Hub hub = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional 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 t + // he 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]; +} + +// The request for [HubService.DeleteHub][google.cloud.networkconnectivity.v1alpha1.HubService.DeleteHub]. +message DeleteHubRequest { + // Required. The name of the Hub to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Hub" + } + ]; + + // Optional. An optional 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 t + // he 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]; +} + +// The request for [HubService.ListSpokes][google.cloud.networkconnectivity.v1alpha1.HubService.ListSpokes]. +message ListSpokesRequest { + // Required. The parent's resource name. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of results per page that should be returned. + int32 page_size = 2; + + // The page token. + string page_token = 3; + + // A filter expression that filters the results listed in the response. + string filter = 4; + + // Sort the results by a certain order. + string order_by = 5; +} + +// The response for [HubService.ListSpokes][google.cloud.networkconnectivity.v1alpha1.HubService.ListSpokes]. +message ListSpokesResponse { + // Spokes to be returned. + repeated Spoke spokes = 1; + + // The next pagination token in the List response. It should be used as + // page_token for the following request. An empty value means no more result. + string next_page_token = 2; + + // Locations that could not be reached. + repeated string unreachable = 3; +} + +// The request for [HubService.GetSpoke][google.cloud.networkconnectivity.v1alpha1.HubService.GetSpoke]. +message GetSpokeRequest { + // Required. The name of Spoke resource. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Spoke" + } + ]; +} + +// The request for [HubService.CreateSpoke][google.cloud.networkconnectivity.v1alpha1.HubService.CreateSpoke]. +message CreateSpokeRequest { + // Required. The parent's resource name of the Spoke. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Optional. Unique id for the Spoke to create. + string spoke_id = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Required. Initial values for a new Hub. + Spoke spoke = 3 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional 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 t + // he 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]; +} + +// Request for [HubService.UpdateSpoke][google.cloud.networkconnectivity.v1alpha1.HubService.UpdateSpoke] method. +message UpdateSpokeRequest { + // Optional. Field mask is used to specify the fields to be overwritten in the + // Spoke 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 state that the Spoke should be in after the update. + Spoke spoke = 2 [(google.api.field_behavior) = REQUIRED]; + + // Optional. An optional 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 t + // he 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]; +} + +// The request for [HubService.DeleteSpoke][google.cloud.networkconnectivity.v1alpha1.HubService.DeleteSpoke]. +message DeleteSpokeRequest { + // Required. The name of the Spoke to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "networkconnectivity.googleapis.com/Spoke" + } + ]; + + // Optional. An optional 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 t + // he 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]; +} + +// RouterAppliance represents a Router appliance which is specified by a VM URI +// and a NIC address. +message RouterApplianceInstance { + // The URI of the virtual machine resource + string virtual_machine = 1 [(google.api.resource_reference) = { + type: "compute.googleapis.com/Instance" + }]; + + // The IP address of the network interface to use for peering. + string ip_address = 3; + + string network_interface = 2 [deprecated = true]; +} + +// The State enum represents the lifecycle of a Network Connectivity Center +// resource. +enum State { + // No state information available + STATE_UNSPECIFIED = 0; + + // The resource's create operation is in progress + CREATING = 1; + + // The resource is active + ACTIVE = 2; + + // The resource's Delete operation is in progress + DELETING = 3; +} diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.create_hub.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.create_hub.js new file mode 100644 index 0000000..7851233 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.create_hub.js @@ -0,0 +1,82 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, hub) { + // [START networkconnectivity_v1alpha1_generated_HubService_CreateHub_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource's name of the Hub. + */ + // const parent = 'abc123' + /** + * Optional. Unique id for the Hub to create. + */ + // const hubId = 'abc123' + /** + * Required. Initial values for a new Hub. + */ + // const hub = {} + /** + * Optional. An optional 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 t + * he 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 Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callCreateHub() { + // Construct request + const request = { + parent, + hub, + }; + + // Run request + const [operation] = await networkconnectivityClient.createHub(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateHub(); + // [END networkconnectivity_v1alpha1_generated_HubService_CreateHub_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.create_spoke.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.create_spoke.js new file mode 100644 index 0000000..259a033 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.create_spoke.js @@ -0,0 +1,82 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, spoke) { + // [START networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent's resource name of the Spoke. + */ + // const parent = 'abc123' + /** + * Optional. Unique id for the Spoke to create. + */ + // const spokeId = 'abc123' + /** + * Required. Initial values for a new Hub. + */ + // const spoke = {} + /** + * Optional. An optional 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 t + * he 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 Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callCreateSpoke() { + // Construct request + const request = { + parent, + spoke, + }; + + // Run request + const [operation] = await networkconnectivityClient.createSpoke(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateSpoke(); + // [END networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.delete_hub.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.delete_hub.js new file mode 100644 index 0000000..934adfe --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.delete_hub.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START networkconnectivity_v1alpha1_generated_HubService_DeleteHub_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Hub to delete. + */ + // const name = 'abc123' + /** + * Optional. An optional 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 t + * he 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 Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callDeleteHub() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await networkconnectivityClient.deleteHub(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteHub(); + // [END networkconnectivity_v1alpha1_generated_HubService_DeleteHub_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.delete_spoke.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.delete_spoke.js new file mode 100644 index 0000000..8e08b13 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.delete_spoke.js @@ -0,0 +1,73 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the Spoke to delete. + */ + // const name = 'abc123' + /** + * Optional. An optional 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 t + * he 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 Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callDeleteSpoke() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await networkconnectivityClient.deleteSpoke(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteSpoke(); + // [END networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.get_hub.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.get_hub.js new file mode 100644 index 0000000..c5f1181 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.get_hub.js @@ -0,0 +1,58 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 networkconnectivity_v1alpha1_generated_HubService_GetHub_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Name of the Hub resource to get. + */ + // const name = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callGetHub() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await networkconnectivityClient.getHub(request); + console.log(response); + } + + callGetHub(); + // [END networkconnectivity_v1alpha1_generated_HubService_GetHub_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.get_spoke.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.get_spoke.js new file mode 100644 index 0000000..47ce4c7 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.get_spoke.js @@ -0,0 +1,58 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically 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 networkconnectivity_v1alpha1_generated_HubService_GetSpoke_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of Spoke resource. + */ + // const name = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callGetSpoke() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await networkconnectivityClient.getSpoke(request); + console.log(response); + } + + callGetSpoke(); + // [END networkconnectivity_v1alpha1_generated_HubService_GetSpoke_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.list_hubs.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.list_hubs.js new file mode 100644 index 0000000..f997316 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.list_hubs.js @@ -0,0 +1,76 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START networkconnectivity_v1alpha1_generated_HubService_ListHubs_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource's name. + */ + // const parent = 'abc123' + /** + * The maximum number of results per page that should be returned. + */ + // const pageSize = 1234 + /** + * The page token. + */ + // const pageToken = 'abc123' + /** + * A filter expression that filters the results listed in the response. + */ + // const filter = 'abc123' + /** + * Sort the results by a certain order. + */ + // const orderBy = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callListHubs() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await networkconnectivityClient.listHubsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListHubs(); + // [END networkconnectivity_v1alpha1_generated_HubService_ListHubs_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.list_spokes.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.list_spokes.js new file mode 100644 index 0000000..64eabec --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.list_spokes.js @@ -0,0 +1,76 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START networkconnectivity_v1alpha1_generated_HubService_ListSpokes_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent's resource name. + */ + // const parent = 'abc123' + /** + * The maximum number of results per page that should be returned. + */ + // const pageSize = 1234 + /** + * The page token. + */ + // const pageToken = 'abc123' + /** + * A filter expression that filters the results listed in the response. + */ + // const filter = 'abc123' + /** + * Sort the results by a certain order. + */ + // const orderBy = 'abc123' + + // Imports the Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callListSpokes() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await networkconnectivityClient.listSpokesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSpokes(); + // [END networkconnectivity_v1alpha1_generated_HubService_ListSpokes_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.update_hub.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.update_hub.js new file mode 100644 index 0000000..e69b800 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.update_hub.js @@ -0,0 +1,81 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(hub) { + // [START networkconnectivity_v1alpha1_generated_HubService_UpdateHub_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Hub 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 state that the Hub should be in after the update. + */ + // const hub = {} + /** + * Optional. An optional 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 t + * he 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 Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callUpdateHub() { + // Construct request + const request = { + hub, + }; + + // Run request + const [operation] = await networkconnectivityClient.updateHub(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateHub(); + // [END networkconnectivity_v1alpha1_generated_HubService_UpdateHub_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.update_spoke.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.update_spoke.js new file mode 100644 index 0000000..69c5bbb --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.update_spoke.js @@ -0,0 +1,81 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(spoke) { + // [START networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Optional. Field mask is used to specify the fields to be overwritten in the + * Spoke 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 state that the Spoke should be in after the update. + */ + // const spoke = {} + /** + * Optional. An optional 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 t + * he 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 Networkconnectivity library + const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; + + // Instantiates a client + const networkconnectivityClient = new HubServiceClient(); + + async function callUpdateSpoke() { + // Construct request + const request = { + spoke, + }; + + // Run request + const [operation] = await networkconnectivityClient.updateSpoke(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUpdateSpoke(); + // [END networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/snippet_metadata.google.cloud.networkconnectivity.v1alpha1.json b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/snippet_metadata.google.cloud.networkconnectivity.v1alpha1.json new file mode 100644 index 0000000..c323742 --- /dev/null +++ b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/snippet_metadata.google.cloud.networkconnectivity.v1alpha1.json @@ -0,0 +1,495 @@ +{ + "clientLibrary": { + "name": "nodejs-networkconnectivity", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.networkconnectivity.v1alpha1", + "version": "v1alpha1" + } + ] + }, + "snippets": [ + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_ListHubs_async", + "title": "HubService listHubs Sample", + "origin": "API_DEFINITION", + "description": " Lists Hubs in a given project and location.", + "canonical": true, + "file": "hub_service.list_hubs.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListHubs", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.ListHubs", + "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.networkconnectivity.v1alpha1.ListHubsResponse", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "ListHubs", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.ListHubs", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_GetHub_async", + "title": "HubService getHub Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single Hub.", + "canonical": true, + "file": "hub_service.get_hub.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetHub", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.GetHub", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networkconnectivity.v1alpha1.Hub", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "GetHub", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.GetHub", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_CreateHub_async", + "title": "HubService createHub Sample", + "origin": "API_DEFINITION", + "description": " Creates a new Hub in a given project and location.", + "canonical": true, + "file": "hub_service.create_hub.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateHub", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.CreateHub", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "hub_id", + "type": "TYPE_STRING" + }, + { + "name": "hub", + "type": ".google.cloud.networkconnectivity.v1alpha1.Hub" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "CreateHub", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.CreateHub", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_UpdateHub_async", + "title": "HubService updateHub Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a single Hub.", + "canonical": true, + "file": "hub_service.update_hub.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateHub", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.UpdateHub", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "hub", + "type": ".google.cloud.networkconnectivity.v1alpha1.Hub" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "UpdateHub", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.UpdateHub", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_DeleteHub_async", + "title": "HubService deleteHub Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single Hub.", + "canonical": true, + "file": "hub_service.delete_hub.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteHub", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.DeleteHub", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "DeleteHub", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.DeleteHub", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_ListSpokes_async", + "title": "HubService listSpokes Sample", + "origin": "API_DEFINITION", + "description": " Lists Spokes in a given project and location.", + "canonical": true, + "file": "hub_service.list_spokes.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 68, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSpokes", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.ListSpokes", + "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.networkconnectivity.v1alpha1.ListSpokesResponse", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "ListSpokes", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.ListSpokes", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_GetSpoke_async", + "title": "HubService getSpoke Sample", + "origin": "API_DEFINITION", + "description": " Gets details of a single Spoke.", + "canonical": true, + "file": "hub_service.get_spoke.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSpoke", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.GetSpoke", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.networkconnectivity.v1alpha1.Spoke", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "GetSpoke", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.GetSpoke", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_async", + "title": "HubService createSpoke Sample", + "origin": "API_DEFINITION", + "description": " Creates a new Spoke in a given project and location.", + "canonical": true, + "file": "hub_service.create_spoke.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 74, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSpoke", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.CreateSpoke", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "spoke_id", + "type": "TYPE_STRING" + }, + { + "name": "spoke", + "type": ".google.cloud.networkconnectivity.v1alpha1.Spoke" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "CreateSpoke", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.CreateSpoke", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_async", + "title": "HubService updateSpoke Sample", + "origin": "API_DEFINITION", + "description": " Updates the parameters of a single Spoke.", + "canonical": true, + "file": "hub_service.update_spoke.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSpoke", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.UpdateSpoke", + "async": true, + "parameters": [ + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + }, + { + "name": "spoke", + "type": ".google.cloud.networkconnectivity.v1alpha1.Spoke" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "UpdateSpoke", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.UpdateSpoke", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + }, + { + "regionTag": "networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_async", + "title": "HubService deleteSpoke Sample", + "origin": "API_DEFINITION", + "description": " Deletes a single Spoke.", + "canonical": true, + "file": "hub_service.delete_spoke.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 65, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSpoke", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.DeleteSpoke", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "request_id", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.longrunning.Operation", + "client": { + "shortName": "HubServiceClient", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" + }, + "method": { + "shortName": "DeleteSpoke", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.DeleteSpoke", + "service": { + "shortName": "HubService", + "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1alpha1/src/index.ts b/owl-bot-staging/v1alpha1/src/index.ts new file mode 100644 index 0000000..c3052ee --- /dev/null +++ b/owl-bot-staging/v1alpha1/src/index.ts @@ -0,0 +1,25 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1alpha1 from './v1alpha1'; +const HubServiceClient = v1alpha1.HubServiceClient; +type HubServiceClient = v1alpha1.HubServiceClient; +export {v1alpha1, HubServiceClient}; +export default {v1alpha1, HubServiceClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1alpha1/src/v1alpha1/gapic_metadata.json b/owl-bot-staging/v1alpha1/src/v1alpha1/gapic_metadata.json new file mode 100644 index 0000000..c9dd97f --- /dev/null +++ b/owl-bot-staging/v1alpha1/src/v1alpha1/gapic_metadata.json @@ -0,0 +1,131 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.networkconnectivity.v1alpha1", + "libraryPackage": "@google-cloud/network-connectivity", + "services": { + "HubService": { + "clients": { + "grpc": { + "libraryClient": "HubServiceClient", + "rpcs": { + "GetHub": { + "methods": [ + "getHub" + ] + }, + "GetSpoke": { + "methods": [ + "getSpoke" + ] + }, + "CreateHub": { + "methods": [ + "createHub" + ] + }, + "UpdateHub": { + "methods": [ + "updateHub" + ] + }, + "DeleteHub": { + "methods": [ + "deleteHub" + ] + }, + "CreateSpoke": { + "methods": [ + "createSpoke" + ] + }, + "UpdateSpoke": { + "methods": [ + "updateSpoke" + ] + }, + "DeleteSpoke": { + "methods": [ + "deleteSpoke" + ] + }, + "ListHubs": { + "methods": [ + "listHubs", + "listHubsStream", + "listHubsAsync" + ] + }, + "ListSpokes": { + "methods": [ + "listSpokes", + "listSpokesStream", + "listSpokesAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "HubServiceClient", + "rpcs": { + "GetHub": { + "methods": [ + "getHub" + ] + }, + "GetSpoke": { + "methods": [ + "getSpoke" + ] + }, + "CreateHub": { + "methods": [ + "createHub" + ] + }, + "UpdateHub": { + "methods": [ + "updateHub" + ] + }, + "DeleteHub": { + "methods": [ + "deleteHub" + ] + }, + "CreateSpoke": { + "methods": [ + "createSpoke" + ] + }, + "UpdateSpoke": { + "methods": [ + "updateSpoke" + ] + }, + "DeleteSpoke": { + "methods": [ + "deleteSpoke" + ] + }, + "ListHubs": { + "methods": [ + "listHubs", + "listHubsStream", + "listHubsAsync" + ] + }, + "ListSpokes": { + "methods": [ + "listSpokes", + "listSpokesStream", + "listSpokesAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_client.ts b/owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_client.ts new file mode 100644 index 0000000..ce69481 --- /dev/null +++ b/owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_client.ts @@ -0,0 +1,1837 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +/* global window */ +import * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1alpha1/hub_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './hub_service_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * Network Connectivity Center is a hub-and-spoke abstraction for + * network connectivity management in Google Cloud. It reduces + * operational complexity through a simple, centralized connectivity management + * model. + * @class + * @memberof v1alpha1 + */ +export class HubServiceClient { + 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; + hubServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of HubServiceClient. + * + * @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}. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof HubServiceClient; + const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; + this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); + const port = opts?.port || staticMembers.port; + const clientConfig = opts?.clientConfig ?? {}; + const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); + opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); + + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + hubPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/global/hubs/{hub}' + ), + instancePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/zones/{zone}/instances/{instance}' + ), + interconnectAttachmentPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/interconnectAttachments/{resource_id}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + spokePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/spokes/{spoke}' + ), + vpnTunnelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/regions/{region}/vpnTunnels/{resource_id}' + ), + }; + + // 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 = { + listHubs: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'hubs'), + listSpokes: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spokes') + }; + + 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.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha1/{resource=projects/*/locations/global/hubs/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha1/{resource=projects/*/locations/*/spokes/*}:getIamPolicy',}], + },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha1/{resource=projects/*/locations/global/hubs/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/spokes/*}:setIamPolicy',body: '*',}], + },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha1/{resource=projects/*/locations/global/hubs/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/spokes/*}:testIamPermissions',body: '*',}], + },{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 createHubResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.Hub') as gax.protobuf.Type; + const createHubMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const updateHubResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.Hub') as gax.protobuf.Type; + const updateHubMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const deleteHubResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteHubMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const createSpokeResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.Spoke') as gax.protobuf.Type; + const createSpokeMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const updateSpokeResponse = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.Spoke') as gax.protobuf.Type; + const updateSpokeMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + const deleteSpokeResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteSpokeMetadata = protoFilesRoot.lookup( + '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createHub: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createHubResponse.decode.bind(createHubResponse), + createHubMetadata.decode.bind(createHubMetadata)), + updateHub: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateHubResponse.decode.bind(updateHubResponse), + updateHubMetadata.decode.bind(updateHubMetadata)), + deleteHub: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteHubResponse.decode.bind(deleteHubResponse), + deleteHubMetadata.decode.bind(deleteHubMetadata)), + createSpoke: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createSpokeResponse.decode.bind(createSpokeResponse), + createSpokeMetadata.decode.bind(createSpokeMetadata)), + updateSpoke: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + updateSpokeResponse.decode.bind(updateSpokeResponse), + updateSpokeMetadata.decode.bind(updateSpokeMetadata)), + deleteSpoke: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteSpokeResponse.decode.bind(deleteSpokeResponse), + deleteSpokeMetadata.decode.bind(deleteSpokeMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.networkconnectivity.v1alpha1.HubService', gapicConfig as gax.ClientConfig, + opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); + + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + + // Add a warn function to the client constructor so it can be easily tested. + this.warn = gax.warn; + } + + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.hubServiceStub) { + return this.hubServiceStub; + } + + // Put together the "service stub" for + // google.cloud.networkconnectivity.v1alpha1.HubService. + this.hubServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.networkconnectivity.v1alpha1.HubService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.networkconnectivity.v1alpha1.HubService, + 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 hubServiceStubMethods = + ['listHubs', 'getHub', 'createHub', 'updateHub', 'deleteHub', 'listSpokes', 'getSpoke', 'createSpoke', 'updateSpoke', 'deleteSpoke']; + for (const methodName of hubServiceStubMethods) { + const callPromise = this.hubServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.hubServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'networkconnectivity.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 'networkconnectivity.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Gets details of a single Hub. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. Name of the Hub 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 [Hub]{@link google.cloud.networkconnectivity.v1alpha1.Hub}. + * 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/hub_service.get_hub.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_GetHub_async + */ + getHub( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkconnectivity.v1alpha1.IHub, + protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|undefined, {}|undefined + ]>; + getHub( + request: protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networkconnectivity.v1alpha1.IHub, + protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|null|undefined, + {}|null|undefined>): void; + getHub( + request: protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest, + callback: Callback< + protos.google.cloud.networkconnectivity.v1alpha1.IHub, + protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|null|undefined, + {}|null|undefined>): void; + getHub( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.networkconnectivity.v1alpha1.IHub, + protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.networkconnectivity.v1alpha1.IHub, + protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.networkconnectivity.v1alpha1.IHub, + protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getHub(request, options, callback); + } +/** + * Gets details of a single Spoke. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of Spoke resource. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Spoke]{@link google.cloud.networkconnectivity.v1alpha1.Spoke}. + * 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/hub_service.get_spoke.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_GetSpoke_async + */ + getSpoke( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, + protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|undefined, {}|undefined + ]>; + getSpoke( + request: protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, + protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|null|undefined, + {}|null|undefined>): void; + getSpoke( + request: protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest, + callback: Callback< + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, + protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|null|undefined, + {}|null|undefined>): void; + getSpoke( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, + protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, + protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, + protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getSpoke(request, options, callback); + } + +/** + * Creates a new Hub in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource's name of the Hub. + * @param {string} [request.hubId] + * Optional. Unique id for the Hub to create. + * @param {google.cloud.networkconnectivity.v1alpha1.Hub} request.hub + * Required. Initial values for a new Hub. + * @param {string} [request.requestId] + * Optional. An optional 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 t + * he 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/hub_service.create_hub.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_CreateHub_async + */ + createHub( + request?: protos.google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createHub( + request: protos.google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createHub( + request: protos.google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createHub( + request?: protos.google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createHub(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createHub()`. + * @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/hub_service.create_hub.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_CreateHub_async + */ + async checkCreateHubProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createHub, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the parameters of a single Hub. + * + * @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 + * Hub 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.networkconnectivity.v1alpha1.Hub} request.hub + * Required. The state that the Hub should be in after the update. + * @param {string} [request.requestId] + * Optional. An optional 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 t + * he 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/hub_service.update_hub.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_UpdateHub_async + */ + updateHub( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateHubRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateHub( + request: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateHubRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateHub( + request: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateHubRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateHub( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateHubRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'hub.name': request.hub!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateHub(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateHub()`. + * @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/hub_service.update_hub.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_UpdateHub_async + */ + async checkUpdateHubProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateHub, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single Hub. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Hub to delete. + * @param {string} [request.requestId] + * Optional. An optional 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 t + * he 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/hub_service.delete_hub.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_DeleteHub_async + */ + deleteHub( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteHubRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteHub( + request: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteHubRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteHub( + request: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteHubRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteHub( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteHubRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteHub(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteHub()`. + * @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/hub_service.delete_hub.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_DeleteHub_async + */ + async checkDeleteHubProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteHub, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates a new Spoke in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent's resource name of the Spoke. + * @param {string} [request.spokeId] + * Optional. Unique id for the Spoke to create. + * @param {google.cloud.networkconnectivity.v1alpha1.Spoke} request.spoke + * Required. Initial values for a new Hub. + * @param {string} [request.requestId] + * Optional. An optional 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 t + * he 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/hub_service.create_spoke.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_async + */ + createSpoke( + request?: protos.google.cloud.networkconnectivity.v1alpha1.ICreateSpokeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createSpoke( + request: protos.google.cloud.networkconnectivity.v1alpha1.ICreateSpokeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createSpoke( + request: protos.google.cloud.networkconnectivity.v1alpha1.ICreateSpokeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createSpoke( + request?: protos.google.cloud.networkconnectivity.v1alpha1.ICreateSpokeRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createSpoke(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createSpoke()`. + * @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/hub_service.create_spoke.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_async + */ + async checkCreateSpokeProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createSpoke, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Updates the parameters of a single Spoke. + * + * @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 + * Spoke 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.networkconnectivity.v1alpha1.Spoke} request.spoke + * Required. The state that the Spoke should be in after the update. + * @param {string} [request.requestId] + * Optional. An optional 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 t + * he 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/hub_service.update_spoke.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_async + */ + updateSpoke( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateSpokeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + updateSpoke( + request: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateSpokeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateSpoke( + request: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateSpokeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + updateSpoke( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateSpokeRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'spoke.name': request.spoke!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateSpoke(request, options, callback); + } +/** + * Check the status of the long running operation returned by `updateSpoke()`. + * @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/hub_service.update_spoke.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_async + */ + async checkUpdateSpokeProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateSpoke, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes a single Spoke. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the Spoke to delete. + * @param {string} [request.requestId] + * Optional. An optional 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 t + * he 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/hub_service.delete_spoke.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_async + */ + deleteSpoke( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteSpokeRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteSpoke( + request: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteSpokeRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteSpoke( + request: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteSpokeRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteSpoke( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteSpokeRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteSpoke(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteSpoke()`. + * @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/hub_service.delete_spoke.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_async + */ + async checkDeleteSpokeProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteSpoke, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists Hubs in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource's name. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * A filter expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Hub]{@link google.cloud.networkconnectivity.v1alpha1.Hub}. + * 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 `listHubsAsync()` + * 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. + */ + listHubs( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkconnectivity.v1alpha1.IHub[], + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest|null, + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse + ]>; + listHubs( + request: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1alpha1.IHub>): void; + listHubs( + request: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1alpha1.IHub>): void; + listHubs( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1alpha1.IHub>, + callback?: PaginationCallback< + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1alpha1.IHub>): + Promise<[ + protos.google.cloud.networkconnectivity.v1alpha1.IHub[], + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest|null, + protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listHubs(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource's name. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * A filter expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @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 [Hub]{@link google.cloud.networkconnectivity.v1alpha1.Hub} 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 `listHubsAsync()` + * 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. + */ + listHubsStream( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listHubs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listHubs.createStream( + this.innerApiCalls.listHubs as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listHubs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource's name. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * A filter expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @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 + * [Hub]{@link google.cloud.networkconnectivity.v1alpha1.Hub}. 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/hub_service.list_hubs.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_ListHubs_async + */ + listHubsAsync( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listHubs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listHubs.asyncIterate( + this.innerApiCalls['listHubs'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists Spokes in a given project and location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent's resource name. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * A filter expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Spoke]{@link google.cloud.networkconnectivity.v1alpha1.Spoke}. + * 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 `listSpokesAsync()` + * 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. + */ + listSpokes( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[], + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest|null, + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse + ]>; + listSpokes( + request: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke>): void; + listSpokes( + request: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + callback: PaginationCallback< + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke>): void; + listSpokes( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke>, + callback?: PaginationCallback< + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse|null|undefined, + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke>): + Promise<[ + protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[], + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest|null, + protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listSpokes(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's resource name. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * A filter expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @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 [Spoke]{@link google.cloud.networkconnectivity.v1alpha1.Spoke} 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 `listSpokesAsync()` + * 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. + */ + listSpokesStream( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listSpokes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSpokes.createStream( + this.innerApiCalls.listSpokes as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSpokes`, 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's resource name. + * @param {number} request.pageSize + * The maximum number of results per page that should be returned. + * @param {string} request.pageToken + * The page token. + * @param {string} request.filter + * A filter expression that filters the results listed in the response. + * @param {string} request.orderBy + * Sort the results by a certain order. + * @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 + * [Spoke]{@link google.cloud.networkconnectivity.v1alpha1.Spoke}. 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/hub_service.list_spokes.js + * region_tag:networkconnectivity_v1alpha1_generated_HubService_ListSpokes_async + */ + listSpokesAsync( + request?: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listSpokes']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSpokes.asyncIterate( + this.innerApiCalls['listSpokes'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified hub resource name string. + * + * @param {string} project + * @param {string} hub + * @returns {string} Resource name string. + */ + hubPath(project:string,hub:string) { + return this.pathTemplates.hubPathTemplate.render({ + project: project, + hub: hub, + }); + } + + /** + * Parse the project from Hub resource. + * + * @param {string} hubName + * A fully-qualified path representing Hub resource. + * @returns {string} A string representing the project. + */ + matchProjectFromHubName(hubName: string) { + return this.pathTemplates.hubPathTemplate.match(hubName).project; + } + + /** + * Parse the hub from Hub resource. + * + * @param {string} hubName + * A fully-qualified path representing Hub resource. + * @returns {string} A string representing the hub. + */ + matchHubFromHubName(hubName: string) { + return this.pathTemplates.hubPathTemplate.match(hubName).hub; + } + + /** + * Return a fully-qualified instance resource name string. + * + * @param {string} project + * @param {string} zone + * @param {string} instance + * @returns {string} Resource name string. + */ + instancePath(project:string,zone:string,instance:string) { + return this.pathTemplates.instancePathTemplate.render({ + project: project, + zone: zone, + instance: instance, + }); + } + + /** + * Parse the project from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).project; + } + + /** + * Parse the zone from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the zone. + */ + matchZoneFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).zone; + } + + /** + * Parse the instance from Instance resource. + * + * @param {string} instanceName + * A fully-qualified path representing Instance resource. + * @returns {string} A string representing the instance. + */ + matchInstanceFromInstanceName(instanceName: string) { + return this.pathTemplates.instancePathTemplate.match(instanceName).instance; + } + + /** + * Return a fully-qualified interconnectAttachment resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} resource_id + * @returns {string} Resource name string. + */ + interconnectAttachmentPath(project:string,region:string,resourceId:string) { + return this.pathTemplates.interconnectAttachmentPathTemplate.render({ + project: project, + region: region, + resource_id: resourceId, + }); + } + + /** + * Parse the project from InterconnectAttachment resource. + * + * @param {string} interconnectAttachmentName + * A fully-qualified path representing InterconnectAttachment resource. + * @returns {string} A string representing the project. + */ + matchProjectFromInterconnectAttachmentName(interconnectAttachmentName: string) { + return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).project; + } + + /** + * Parse the region from InterconnectAttachment resource. + * + * @param {string} interconnectAttachmentName + * A fully-qualified path representing InterconnectAttachment resource. + * @returns {string} A string representing the region. + */ + matchRegionFromInterconnectAttachmentName(interconnectAttachmentName: string) { + return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).region; + } + + /** + * Parse the resource_id from InterconnectAttachment resource. + * + * @param {string} interconnectAttachmentName + * A fully-qualified path representing InterconnectAttachment resource. + * @returns {string} A string representing the resource_id. + */ + matchResourceIdFromInterconnectAttachmentName(interconnectAttachmentName: string) { + return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).resource_id; + } + + /** + * 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 spoke resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} spoke + * @returns {string} Resource name string. + */ + spokePath(project:string,location:string,spoke:string) { + return this.pathTemplates.spokePathTemplate.render({ + project: project, + location: location, + spoke: spoke, + }); + } + + /** + * Parse the project from Spoke resource. + * + * @param {string} spokeName + * A fully-qualified path representing Spoke resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSpokeName(spokeName: string) { + return this.pathTemplates.spokePathTemplate.match(spokeName).project; + } + + /** + * Parse the location from Spoke resource. + * + * @param {string} spokeName + * A fully-qualified path representing Spoke resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSpokeName(spokeName: string) { + return this.pathTemplates.spokePathTemplate.match(spokeName).location; + } + + /** + * Parse the spoke from Spoke resource. + * + * @param {string} spokeName + * A fully-qualified path representing Spoke resource. + * @returns {string} A string representing the spoke. + */ + matchSpokeFromSpokeName(spokeName: string) { + return this.pathTemplates.spokePathTemplate.match(spokeName).spoke; + } + + /** + * Return a fully-qualified vpnTunnel resource name string. + * + * @param {string} project + * @param {string} region + * @param {string} resource_id + * @returns {string} Resource name string. + */ + vpnTunnelPath(project:string,region:string,resourceId:string) { + return this.pathTemplates.vpnTunnelPathTemplate.render({ + project: project, + region: region, + resource_id: resourceId, + }); + } + + /** + * Parse the project from VpnTunnel resource. + * + * @param {string} vpnTunnelName + * A fully-qualified path representing VpnTunnel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromVpnTunnelName(vpnTunnelName: string) { + return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).project; + } + + /** + * Parse the region from VpnTunnel resource. + * + * @param {string} vpnTunnelName + * A fully-qualified path representing VpnTunnel resource. + * @returns {string} A string representing the region. + */ + matchRegionFromVpnTunnelName(vpnTunnelName: string) { + return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).region; + } + + /** + * Parse the resource_id from VpnTunnel resource. + * + * @param {string} vpnTunnelName + * A fully-qualified path representing VpnTunnel resource. + * @returns {string} A string representing the resource_id. + */ + matchResourceIdFromVpnTunnelName(vpnTunnelName: string) { + return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).resource_id; + } + + /** + * 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.hubServiceStub && !this._terminated) { + return this.hubServiceStub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_client_config.json b/owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_client_config.json new file mode 100644 index 0000000..ac38b3f --- /dev/null +++ b/owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_client_config.json @@ -0,0 +1,88 @@ +{ + "interfaces": { + "google.cloud.networkconnectivity.v1alpha1.HubService": { + "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": { + "ListHubs": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetHub": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateHub": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateHub": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteHub": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListSpokes": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteSpoke": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_proto_list.json b/owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_proto_list.json new file mode 100644 index 0000000..af2e832 --- /dev/null +++ b/owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/networkconnectivity/v1alpha1/common.proto", + "../../protos/google/cloud/networkconnectivity/v1alpha1/hub.proto" +] diff --git a/owl-bot-staging/v1alpha1/src/v1alpha1/index.ts b/owl-bot-staging/v1alpha1/src/v1alpha1/index.ts new file mode 100644 index 0000000..ae38769 --- /dev/null +++ b/owl-bot-staging/v1alpha1/src/v1alpha1/index.ts @@ -0,0 +1,19 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +export {HubServiceClient} from './hub_service_client'; diff --git a/owl-bot-staging/v1alpha1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1alpha1/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..672a15d --- /dev/null +++ b/owl-bot-staging/v1alpha1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +/* eslint-disable node/no-missing-require, no-unused-vars */ +const networkconnectivity = require('@google-cloud/network-connectivity'); + +function main() { + const hubServiceClient = new networkconnectivity.HubServiceClient(); +} + +main(); diff --git a/owl-bot-staging/v1alpha1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1alpha1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..5a5e64b --- /dev/null +++ b/owl-bot-staging/v1alpha1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import {HubServiceClient} from '@google-cloud/network-connectivity'; + +// check that the client class type name can be used +function doStuffWithHubServiceClient(client: HubServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const hubServiceClient = new HubServiceClient(); + doStuffWithHubServiceClient(hubServiceClient); +} + +main(); diff --git a/owl-bot-staging/v1alpha1/system-test/install.ts b/owl-bot-staging/v1alpha1/system-test/install.ts new file mode 100644 index 0000000..8ec4522 --- /dev/null +++ b/owl-bot-staging/v1alpha1/system-test/install.ts @@ -0,0 +1,49 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import { packNTest } from 'pack-n-play'; +import { readFileSync } from 'fs'; +import { describe, it } from 'mocha'; + +describe('📦 pack-n-play test', () => { + + it('TypeScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'TypeScript user can use the type definitions', + ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() + } + }; + await packNTest(options); + }); + + it('JavaScript code', async function() { + this.timeout(300000); + const options = { + packageDir: process.cwd(), + sample: { + description: 'JavaScript user can use the library', + ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() + } + }; + await packNTest(options); + }); + +}); diff --git a/owl-bot-staging/v1alpha1/test/gapic_hub_service_v1alpha1.ts b/owl-bot-staging/v1alpha1/test/gapic_hub_service_v1alpha1.ts new file mode 100644 index 0000000..93594ef --- /dev/null +++ b/owl-bot-staging/v1alpha1/test/gapic_hub_service_v1alpha1.ts @@ -0,0 +1,1973 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** 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 hubserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1alpha1.HubServiceClient', () => { + it('has servicePath', () => { + const servicePath = hubserviceModule.v1alpha1.HubServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = hubserviceModule.v1alpha1.HubServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = hubserviceModule.v1alpha1.HubServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.hubServiceStub, undefined); + await client.initialize(); + assert(client.hubServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.hubServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.hubServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + 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 hubserviceModule.v1alpha1.HubServiceClient({ + 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('getHub', () => { + it('invokes getHub without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.GetHubRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()); + client.innerApiCalls.getHub = stubSimpleCall(expectedResponse); + const [response] = await client.getHub(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getHub without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.GetHubRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()); + client.innerApiCalls.getHub = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getHub( + request, + (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1alpha1.IHub|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getHub with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.GetHubRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getHub = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getHub(request), expectedError); + assert((client.innerApiCalls.getHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getHub with closed client', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.GetHubRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getHub(request), expectedError); + }); + }); + + describe('getSpoke', () => { + it('invokes getSpoke without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()); + client.innerApiCalls.getSpoke = stubSimpleCall(expectedResponse); + const [response] = await client.getSpoke(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSpoke without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()); + client.innerApiCalls.getSpoke = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSpoke( + request, + (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getSpoke with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getSpoke = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSpoke(request), expectedError); + assert((client.innerApiCalls.getSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSpoke with closed client', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSpoke(request), expectedError); + }); + }); + + describe('createHub', () => { + it('invokes createHub without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createHub = stubLongRunningCall(expectedResponse); + const [operation] = await client.createHub(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createHub without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createHub = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createHub( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createHub with call error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createHub = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createHub(request), expectedError); + assert((client.innerApiCalls.createHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createHub with LRO error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createHub = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createHub(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateHubProgress without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + 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.checkCreateHubProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateHubProgress with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + 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.checkCreateHubProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateHub', () => { + it('invokes updateHub without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest()); + request.hub = {}; + request.hub.name = ''; + const expectedHeaderRequestParams = "hub.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateHub = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateHub(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateHub without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest()); + request.hub = {}; + request.hub.name = ''; + const expectedHeaderRequestParams = "hub.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateHub = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateHub( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateHub with call error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest()); + request.hub = {}; + request.hub.name = ''; + const expectedHeaderRequestParams = "hub.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateHub = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateHub(request), expectedError); + assert((client.innerApiCalls.updateHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateHub with LRO error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest()); + request.hub = {}; + request.hub.name = ''; + const expectedHeaderRequestParams = "hub.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateHub = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateHub(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateHubProgress without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + 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.checkUpdateHubProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateHubProgress with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + 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.checkUpdateHubProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteHub', () => { + it('invokes deleteHub without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteHub = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteHub(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteHub without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteHub = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteHub( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteHub with call error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteHub = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteHub(request), expectedError); + assert((client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteHub with LRO error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteHub = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteHub(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteHub as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteHubProgress without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + 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.checkDeleteHubProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteHubProgress with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + 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.checkDeleteHubProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createSpoke', () => { + it('invokes createSpoke without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createSpoke = stubLongRunningCall(expectedResponse); + const [operation] = await client.createSpoke(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createSpoke without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createSpoke = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSpoke( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createSpoke with call error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createSpoke = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createSpoke(request), expectedError); + assert((client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createSpoke with LRO error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createSpoke = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createSpoke(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateSpokeProgress without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + 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.checkCreateSpokeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateSpokeProgress with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + 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.checkCreateSpokeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('updateSpoke', () => { + it('invokes updateSpoke without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest()); + request.spoke = {}; + request.spoke.name = ''; + const expectedHeaderRequestParams = "spoke.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateSpoke = stubLongRunningCall(expectedResponse); + const [operation] = await client.updateSpoke(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateSpoke without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest()); + request.spoke = {}; + request.spoke.name = ''; + const expectedHeaderRequestParams = "spoke.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.updateSpoke = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSpoke( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateSpoke with call error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest()); + request.spoke = {}; + request.spoke.name = ''; + const expectedHeaderRequestParams = "spoke.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSpoke = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.updateSpoke(request), expectedError); + assert((client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateSpoke with LRO error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest()); + request.spoke = {}; + request.spoke.name = ''; + const expectedHeaderRequestParams = "spoke.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSpoke = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.updateSpoke(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.updateSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUpdateSpokeProgress without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + 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.checkUpdateSpokeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUpdateSpokeProgress with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + 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.checkUpdateSpokeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteSpoke', () => { + it('invokes deleteSpoke without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteSpoke = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteSpoke(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteSpoke without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteSpoke = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSpoke( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteSpoke with call error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSpoke = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteSpoke(request), expectedError); + assert((client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteSpoke with LRO error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSpoke = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteSpoke(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteSpoke as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteSpokeProgress without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + 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.checkDeleteSpokeProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteSpokeProgress with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + 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.checkDeleteSpokeProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listHubs', () => { + it('invokes listHubs without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + ]; + client.innerApiCalls.listHubs = stubSimpleCall(expectedResponse); + const [response] = await client.listHubs(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listHubs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listHubs without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + ]; + client.innerApiCalls.listHubs = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listHubs( + request, + (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1alpha1.IHub[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listHubs as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listHubs with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listHubs = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listHubs(request), expectedError); + assert((client.innerApiCalls.listHubs as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listHubsStream without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + ]; + client.descriptors.page.listHubs.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listHubsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1alpha1.Hub[] = []; + stream.on('data', (response: protos.google.cloud.networkconnectivity.v1alpha1.Hub) => { + 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.listHubs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listHubs, request)); + assert.strictEqual( + (client.descriptors.page.listHubs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listHubsStream with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listHubs.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listHubsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1alpha1.Hub[] = []; + stream.on('data', (response: protos.google.cloud.networkconnectivity.v1alpha1.Hub) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listHubs.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listHubs, request)); + assert.strictEqual( + (client.descriptors.page.listHubs.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listHubs without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), + ]; + client.descriptors.page.listHubs.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networkconnectivity.v1alpha1.IHub[] = []; + const iterable = client.listHubsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listHubs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listHubs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listHubs with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listHubs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listHubsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networkconnectivity.v1alpha1.IHub[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listHubs.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listHubs.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listSpokes', () => { + it('invokes listSpokes without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + ]; + client.innerApiCalls.listSpokes = stubSimpleCall(expectedResponse); + const [response] = await client.listSpokes(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSpokes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSpokes without error using callback', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + ]; + client.innerApiCalls.listSpokes = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSpokes( + request, + (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSpokes as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listSpokes with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listSpokes = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSpokes(request), expectedError); + assert((client.innerApiCalls.listSpokes as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSpokesStream without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + ]; + client.descriptors.page.listSpokes.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSpokesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1alpha1.Spoke[] = []; + stream.on('data', (response: protos.google.cloud.networkconnectivity.v1alpha1.Spoke) => { + 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.listSpokes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSpokes, request)); + assert.strictEqual( + (client.descriptors.page.listSpokes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listSpokesStream with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listSpokes.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSpokesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.networkconnectivity.v1alpha1.Spoke[] = []; + stream.on('data', (response: protos.google.cloud.networkconnectivity.v1alpha1.Spoke) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSpokes.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSpokes, request)); + assert.strictEqual( + (client.descriptors.page.listSpokes.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSpokes without error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), + ]; + client.descriptors.page.listSpokes.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[] = []; + const iterable = client.listSpokesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSpokes with error', async () => { + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listSpokes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSpokesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSpokes.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('hub', () => { + const fakePath = "/rendered/path/hub"; + const expectedParameters = { + project: "projectValue", + hub: "hubValue", + }; + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.hubPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.hubPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('hubPath', () => { + const result = client.hubPath("projectValue", "hubValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.hubPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromHubName', () => { + const result = client.matchProjectFromHubName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.hubPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchHubFromHubName', () => { + const result = client.matchHubFromHubName(fakePath); + assert.strictEqual(result, "hubValue"); + assert((client.pathTemplates.hubPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('instance', () => { + const fakePath = "/rendered/path/instance"; + const expectedParameters = { + project: "projectValue", + zone: "zoneValue", + instance: "instanceValue", + }; + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.instancePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.instancePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('instancePath', () => { + const result = client.instancePath("projectValue", "zoneValue", "instanceValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.instancePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInstanceName', () => { + const result = client.matchProjectFromInstanceName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchZoneFromInstanceName', () => { + const result = client.matchZoneFromInstanceName(fakePath); + assert.strictEqual(result, "zoneValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchInstanceFromInstanceName', () => { + const result = client.matchInstanceFromInstanceName(fakePath); + assert.strictEqual(result, "instanceValue"); + assert((client.pathTemplates.instancePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('interconnectAttachment', () => { + const fakePath = "/rendered/path/interconnectAttachment"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + resource_id: "resourceIdValue", + }; + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.interconnectAttachmentPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.interconnectAttachmentPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('interconnectAttachmentPath', () => { + const result = client.interconnectAttachmentPath("projectValue", "regionValue", "resourceIdValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.interconnectAttachmentPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromInterconnectAttachmentName', () => { + const result = client.matchProjectFromInterconnectAttachmentName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromInterconnectAttachmentName', () => { + const result = client.matchRegionFromInterconnectAttachmentName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchResourceIdFromInterconnectAttachmentName', () => { + const result = client.matchResourceIdFromInterconnectAttachmentName(fakePath); + assert.strictEqual(result, "resourceIdValue"); + assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + 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('spoke', () => { + const fakePath = "/rendered/path/spoke"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + spoke: "spokeValue", + }; + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.spokePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.spokePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('spokePath', () => { + const result = client.spokePath("projectValue", "locationValue", "spokeValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.spokePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSpokeName', () => { + const result = client.matchProjectFromSpokeName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.spokePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromSpokeName', () => { + const result = client.matchLocationFromSpokeName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.spokePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSpokeFromSpokeName', () => { + const result = client.matchSpokeFromSpokeName(fakePath); + assert.strictEqual(result, "spokeValue"); + assert((client.pathTemplates.spokePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('vpnTunnel', () => { + const fakePath = "/rendered/path/vpnTunnel"; + const expectedParameters = { + project: "projectValue", + region: "regionValue", + resource_id: "resourceIdValue", + }; + const client = new hubserviceModule.v1alpha1.HubServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.vpnTunnelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.vpnTunnelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('vpnTunnelPath', () => { + const result = client.vpnTunnelPath("projectValue", "regionValue", "resourceIdValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.vpnTunnelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromVpnTunnelName', () => { + const result = client.matchProjectFromVpnTunnelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchRegionFromVpnTunnelName', () => { + const result = client.matchRegionFromVpnTunnelName(fakePath); + assert.strictEqual(result, "regionValue"); + assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchResourceIdFromVpnTunnelName', () => { + const result = client.matchResourceIdFromVpnTunnelName(fakePath); + assert.strictEqual(result, "resourceIdValue"); + assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1alpha1/tsconfig.json b/owl-bot-staging/v1alpha1/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/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/v1alpha1/webpack.config.js b/owl-bot-staging/v1alpha1/webpack.config.js new file mode 100644 index 0000000..2412b4e --- /dev/null +++ b/owl-bot-staging/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: 'HubService', + filename: './hub-service.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 74f747c0b997b29722967716a6ea215a9b8572b7 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 Jun 2022 10:20:03 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot=20po?= =?UTF-8?q?st-processor?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- owl-bot-staging/v1/.eslintignore | 7 - owl-bot-staging/v1/.eslintrc.json | 3 - owl-bot-staging/v1/.gitignore | 14 - owl-bot-staging/v1/.jsdoc.js | 55 - owl-bot-staging/v1/.mocharc.js | 33 - owl-bot-staging/v1/.prettierrc.js | 22 - owl-bot-staging/v1/README.md | 1 - owl-bot-staging/v1/linkinator.config.json | 16 - owl-bot-staging/v1/package.json | 64 - .../cloud/networkconnectivity/v1/common.proto | 56 - .../cloud/networkconnectivity/v1/hub.proto | 652 ------ .../generated/v1/hub_service.create_hub.js | 84 - .../generated/v1/hub_service.create_spoke.js | 84 - .../generated/v1/hub_service.delete_hub.js | 74 - .../generated/v1/hub_service.delete_spoke.js | 74 - .../generated/v1/hub_service.get_hub.js | 58 - .../generated/v1/hub_service.get_spoke.js | 58 - .../generated/v1/hub_service.list_hubs.js | 76 - .../generated/v1/hub_service.list_spokes.js | 76 - .../generated/v1/hub_service.update_hub.js | 82 - .../generated/v1/hub_service.update_spoke.js | 82 - ...a.google.cloud.networkconnectivity.v1.json | 495 ---- owl-bot-staging/v1/src/index.ts | 25 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 131 -- .../v1/src/v1/hub_service_client.ts | 1881 --------------- .../v1/src/v1/hub_service_client_config.json | 88 - .../v1/src/v1/hub_service_proto_list.json | 4 - owl-bot-staging/v1/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - owl-bot-staging/v1/system-test/install.ts | 49 - .../v1/test/gapic_hub_service_v1.ts | 2011 ----------------- owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 - owl-bot-staging/v1alpha1/.eslintignore | 7 - owl-bot-staging/v1alpha1/.eslintrc.json | 3 - owl-bot-staging/v1alpha1/.gitignore | 14 - owl-bot-staging/v1alpha1/.jsdoc.js | 55 - owl-bot-staging/v1alpha1/.mocharc.js | 33 - owl-bot-staging/v1alpha1/.prettierrc.js | 22 - owl-bot-staging/v1alpha1/README.md | 1 - .../v1alpha1/linkinator.config.json | 16 - owl-bot-staging/v1alpha1/package.json | 64 - .../networkconnectivity/v1alpha1/common.proto | 56 - .../networkconnectivity/v1alpha1/hub.proto | 551 ----- .../v1alpha1/hub_service.create_hub.js | 82 - .../v1alpha1/hub_service.create_spoke.js | 82 - .../v1alpha1/hub_service.delete_hub.js | 73 - .../v1alpha1/hub_service.delete_spoke.js | 73 - .../generated/v1alpha1/hub_service.get_hub.js | 58 - .../v1alpha1/hub_service.get_spoke.js | 58 - .../v1alpha1/hub_service.list_hubs.js | 76 - .../v1alpha1/hub_service.list_spokes.js | 76 - .../v1alpha1/hub_service.update_hub.js | 81 - .../v1alpha1/hub_service.update_spoke.js | 81 - ...le.cloud.networkconnectivity.v1alpha1.json | 495 ---- owl-bot-staging/v1alpha1/src/index.ts | 25 - .../v1alpha1/src/v1alpha1/gapic_metadata.json | 131 -- .../src/v1alpha1/hub_service_client.ts | 1837 --------------- .../v1alpha1/hub_service_client_config.json | 88 - .../src/v1alpha1/hub_service_proto_list.json | 4 - .../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_hub_service_v1alpha1.ts | 1973 ---------------- owl-bot-staging/v1alpha1/tsconfig.json | 19 - owl-bot-staging/v1alpha1/webpack.config.js | 64 - src/v1/hub_service_client.ts | 95 +- src/v1alpha1/hub_service_client.ts | 84 +- 70 files changed, 155 insertions(+), 12865 deletions(-) delete mode 100644 owl-bot-staging/v1/.eslintignore delete mode 100644 owl-bot-staging/v1/.eslintrc.json delete mode 100644 owl-bot-staging/v1/.gitignore delete mode 100644 owl-bot-staging/v1/.jsdoc.js delete mode 100644 owl-bot-staging/v1/.mocharc.js delete mode 100644 owl-bot-staging/v1/.prettierrc.js delete mode 100644 owl-bot-staging/v1/README.md delete mode 100644 owl-bot-staging/v1/linkinator.config.json delete mode 100644 owl-bot-staging/v1/package.json delete mode 100644 owl-bot-staging/v1/protos/google/cloud/networkconnectivity/v1/common.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/networkconnectivity/v1/hub.proto delete mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.create_hub.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.create_spoke.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.delete_hub.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.delete_spoke.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.get_hub.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.get_spoke.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.list_hubs.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.list_spokes.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.update_hub.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/hub_service.update_spoke.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.networkconnectivity.v1.json delete mode 100644 owl-bot-staging/v1/src/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1/src/v1/hub_service_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/hub_service_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/hub_service_proto_list.json delete mode 100644 owl-bot-staging/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1/system-test/install.ts delete mode 100644 owl-bot-staging/v1/test/gapic_hub_service_v1.ts delete mode 100644 owl-bot-staging/v1/tsconfig.json delete mode 100644 owl-bot-staging/v1/webpack.config.js delete mode 100644 owl-bot-staging/v1alpha1/.eslintignore delete mode 100644 owl-bot-staging/v1alpha1/.eslintrc.json delete mode 100644 owl-bot-staging/v1alpha1/.gitignore delete mode 100644 owl-bot-staging/v1alpha1/.jsdoc.js delete mode 100644 owl-bot-staging/v1alpha1/.mocharc.js delete mode 100644 owl-bot-staging/v1alpha1/.prettierrc.js delete mode 100644 owl-bot-staging/v1alpha1/README.md delete mode 100644 owl-bot-staging/v1alpha1/linkinator.config.json delete mode 100644 owl-bot-staging/v1alpha1/package.json delete mode 100644 owl-bot-staging/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/common.proto delete mode 100644 owl-bot-staging/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/hub.proto delete mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.create_hub.js delete mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.create_spoke.js delete mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.delete_hub.js delete mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.delete_spoke.js delete mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.get_hub.js delete mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.get_spoke.js delete mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.list_hubs.js delete mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.list_spokes.js delete mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.update_hub.js delete mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.update_spoke.js delete mode 100644 owl-bot-staging/v1alpha1/samples/generated/v1alpha1/snippet_metadata.google.cloud.networkconnectivity.v1alpha1.json delete mode 100644 owl-bot-staging/v1alpha1/src/index.ts delete mode 100644 owl-bot-staging/v1alpha1/src/v1alpha1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_client.ts delete mode 100644 owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_client_config.json delete mode 100644 owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_proto_list.json delete mode 100644 owl-bot-staging/v1alpha1/src/v1alpha1/index.ts delete mode 100644 owl-bot-staging/v1alpha1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1alpha1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1alpha1/system-test/install.ts delete mode 100644 owl-bot-staging/v1alpha1/test/gapic_hub_service_v1alpha1.ts delete mode 100644 owl-bot-staging/v1alpha1/tsconfig.json delete mode 100644 owl-bot-staging/v1alpha1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore deleted file mode 100644 index cfc348e..0000000 --- a/owl-bot-staging/v1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/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/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js deleted file mode 100644 index 7d9f7fc..0000000 --- a/owl-bot-staging/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/network-connectivity', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js deleted file mode 100644 index 481c522..0000000 --- a/owl-bot-staging/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js deleted file mode 100644 index 494e147..0000000 --- a/owl-bot-staging/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md deleted file mode 100644 index 086026d..0000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Networkconnectivity: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json deleted file mode 100644 index befd23c..0000000 --- a/owl-bot-staging/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/v1/package.json b/owl-bot-staging/v1/package.json deleted file mode 100644 index 695c121..0000000 --- a/owl-bot-staging/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/network-connectivity", - "version": "0.1.0", - "description": "Networkconnectivity client for Node.js", - "repository": "googleapis/nodejs-networkconnectivity", - "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 networkconnectivity", - "networkconnectivity", - "hub service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.1.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/networkconnectivity/v1/common.proto b/owl-bot-staging/v1/protos/google/cloud/networkconnectivity/v1/common.proto deleted file mode 100644 index ed96c8e..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/networkconnectivity/v1/common.proto +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.networkconnectivity.v1; - -import "google/api/annotations.proto"; -import "google/api/field_behavior.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1;networkconnectivity"; -option java_multiple_files = true; -option java_outer_classname = "CommonProto"; -option java_package = "com.google.cloud.networkconnectivity.v1"; -option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1"; -option ruby_package = "Google::Cloud::NetworkConnectivity::V1"; - -// 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 been cancelled successfully - // 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]; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/networkconnectivity/v1/hub.proto b/owl-bot-staging/v1/protos/google/cloud/networkconnectivity/v1/hub.proto deleted file mode 100644 index c28ca9a..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/networkconnectivity/v1/hub.proto +++ /dev/null @@ -1,652 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.networkconnectivity.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1;networkconnectivity"; -option java_multiple_files = true; -option java_outer_classname = "HubProto"; -option java_package = "com.google.cloud.networkconnectivity.v1"; -option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1"; -option ruby_package = "Google::Cloud::NetworkConnectivity::V1"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/VpnTunnel" - pattern: "projects/{project}/regions/{region}/vpnTunnels/{resource_id}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/InterconnectAttachment" - pattern: "projects/{project}/regions/{region}/interconnectAttachments/{resource_id}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Instance" - pattern: "projects/{project}/zones/{zone}/instances/{instance}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Network" - pattern: "projects/{project}/global/networks/{resource_id}" -}; - -// Network Connectivity Center is a hub-and-spoke abstraction for network -// connectivity management in Google Cloud. It reduces operational complexity -// through a simple, centralized connectivity management model. -service HubService { - option (google.api.default_host) = "networkconnectivity.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists hubs in a given project. - rpc ListHubs(ListHubsRequest) returns (ListHubsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/global}/hubs" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details about the specified hub. - rpc GetHub(GetHubRequest) returns (Hub) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/global/hubs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new hub in the specified project. - rpc CreateHub(CreateHubRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/global}/hubs" - body: "hub" - }; - option (google.api.method_signature) = "parent,hub,hub_id"; - option (google.longrunning.operation_info) = { - response_type: "Hub" - metadata_type: "OperationMetadata" - }; - } - - // Updates the description and/or labels of the specified hub. - rpc UpdateHub(UpdateHubRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{hub.name=projects/*/locations/global/hubs/*}" - body: "hub" - }; - option (google.api.method_signature) = "hub,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Hub" - metadata_type: "OperationMetadata" - }; - } - - // Deletes the specified hub. - rpc DeleteHub(DeleteHubRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/global/hubs/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Lists the spokes in the specified project and location. - rpc ListSpokes(ListSpokesRequest) returns (ListSpokesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/spokes" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details about the specified spoke. - rpc GetSpoke(GetSpokeRequest) returns (Spoke) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/spokes/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a spoke in the specified project and location. - rpc CreateSpoke(CreateSpokeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/spokes" - body: "spoke" - }; - option (google.api.method_signature) = "parent,spoke,spoke_id"; - option (google.longrunning.operation_info) = { - response_type: "Spoke" - metadata_type: "OperationMetadata" - }; - } - - // Updates the parameters of the specified spoke. - rpc UpdateSpoke(UpdateSpokeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1/{spoke.name=projects/*/locations/*/spokes/*}" - body: "spoke" - }; - option (google.api.method_signature) = "spoke,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Spoke" - metadata_type: "OperationMetadata" - }; - } - - // Deletes the specified spoke. - rpc DeleteSpoke(DeleteSpokeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/spokes/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } -} - -// The State enum represents the lifecycle stage of a Network Connectivity -// Center resource. -enum State { - // No state information available - STATE_UNSPECIFIED = 0; - - // The resource's create operation is in progress - CREATING = 1; - - // The resource is active - ACTIVE = 2; - - // The resource's Delete operation is in progress - DELETING = 3; -} - -// Supported features for a location -enum LocationFeature { - // No publicly supported feature in this location - LOCATION_FEATURE_UNSPECIFIED = 0; - - // Site-to-cloud spokes are supported in this location - SITE_TO_CLOUD_SPOKES = 1; - - // Site-to-site spokes are supported in this location - SITE_TO_SITE_SPOKES = 2; -} - -// A hub is a collection of spokes. A single hub can contain spokes from -// multiple regions. However, if any of a hub's spokes use the data transfer -// feature, the resources associated with those spokes must all reside in the -// same VPC network. Spokes that do not use data transfer can be associated -// with any VPC network in your project. -message Hub { - option (google.api.resource) = { - type: "networkconnectivity.googleapis.com/Hub" - pattern: "projects/{project}/locations/global/hubs/{hub}" - }; - - // Immutable. The name of the hub. Hub names must be unique. They use the - // following form: - // `projects/{project_number}/locations/global/hubs/{hub_id}` - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time the hub was created. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the hub was last updated. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional labels in key:value format. For more information about labels, see - // [Requirements for - // labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements). - map labels = 4; - - // An optional description of the hub. - string description = 5; - - // Output only. The Google-generated UUID for the hub. This value is unique across all hub - // resources. If a hub is deleted and another with the same name is created, - // the new hub is assigned a different unique_id. - string unique_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current lifecycle state of this hub. - State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The VPC networks associated with this hub's spokes. - // - // This field is read-only. Network Connectivity Center automatically - // populates it based on the set of spokes attached to the hub. - repeated RoutingVPC routing_vpcs = 10; -} - -// RoutingVPC contains information about the VPC networks that are associated -// with a hub's spokes. -message RoutingVPC { - // The URI of the VPC network. - string uri = 1 [(google.api.resource_reference) = { - type: "compute.googleapis.com/Network" - }]; - - // Output only. If true, indicates that this VPC network is currently associated with - // spokes that use the data transfer feature (spokes where the - // site_to_site_data_transfer field is set to true). If you create new spokes - // that use data transfer, they must be associated with this VPC network. At - // most, one VPC network will have this field set to true. - bool required_for_new_site_to_site_data_transfer_spokes = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A spoke represents a connection between your Google Cloud network resources -// and a non-Google-Cloud network. -// -// When you create a spoke, you associate it with a hub. You must also identify -// a value for exactly one of the following fields: -// -// * linked_vpn_tunnels -// * linked_interconnect_attachments -// * linked_router_appliance_instances -message Spoke { - option (google.api.resource) = { - type: "networkconnectivity.googleapis.com/Spoke" - pattern: "projects/{project}/locations/{location}/spokes/{spoke}" - }; - - // Immutable. The name of the spoke. Spoke names must be unique. They use the - // following form: - // `projects/{project_number}/locations/{region}/spokes/{spoke_id}` - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time the spoke was created. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the spoke was last updated. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Optional labels in key:value format. For more information about labels, see - // [Requirements for - // labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements). - map labels = 4; - - // An optional description of the spoke. - string description = 5; - - // Immutable. The name of the hub that this spoke is attached to. - string hub = 6 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Hub" - } - ]; - - // VPN tunnels that are associated with the spoke. - LinkedVpnTunnels linked_vpn_tunnels = 17; - - // VLAN attachments that are associated with the spoke. - LinkedInterconnectAttachments linked_interconnect_attachments = 18; - - // Router appliance instances that are associated with the spoke. - LinkedRouterApplianceInstances linked_router_appliance_instances = 19; - - // Output only. The Google-generated UUID for the spoke. This value is unique across all - // spoke resources. If a spoke is deleted and another with the same name is - // created, the new spoke is assigned a different unique_id. - string unique_id = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current lifecycle state of this spoke. - State state = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request for [HubService.ListHubs][google.cloud.networkconnectivity.v1.HubService.ListHubs] method. -message ListHubsRequest { - // Required. The parent resource's name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of results per page that should be returned. - int32 page_size = 2; - - // The page token. - string page_token = 3; - - // An expression that filters the results listed in the response. - string filter = 4; - - // Sort the results by a certain order. - string order_by = 5; -} - -// Response for [HubService.ListHubs][google.cloud.networkconnectivity.v1.HubService.ListHubs] method. -message ListHubsResponse { - // The requested hubs. - repeated Hub hubs = 1; - - // The next pagination token in the List response. It should be used as - // page_token for the following request. An empty value means no more result. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request for [HubService.GetHub][google.cloud.networkconnectivity.v1.HubService.GetHub] method. -message GetHubRequest { - // Required. The name of the hub resource to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Hub" - } - ]; -} - -// Request for [HubService.CreateHub][google.cloud.networkconnectivity.v1.HubService.CreateHub] method. -message CreateHubRequest { - // Required. The parent resource. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. A unique identifier for the hub. - string hub_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The initial values for a new hub. - Hub hub = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A unique request ID (optional). If you specify this ID, you can use it - // in cases when you need to retry your request. When you need to retry, this - // ID lets the server know that it can ignore the request if it has already - // been completed. The server guarantees 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 to see whether the original operation - // was received. If it was, the server ignores the second request. This - // behavior prevents clients from mistakenly 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]; -} - -// Request for [HubService.UpdateHub][google.cloud.networkconnectivity.v1.HubService.UpdateHub] method. -message UpdateHubRequest { - // Optional. In the case of an update to an existing hub, field mask is used to specify - // the fields to be overwritten. The fields specified in the update_mask are - // relative to the resource, not the full request. A field is overwritten if - // it is in the mask. If the user does not provide a mask, then all fields are - // overwritten. - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The state that the hub should be in after the update. - Hub hub = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A unique request ID (optional). If you specify this ID, you can use it - // in cases when you need to retry your request. When you need to retry, this - // ID lets the server know that it can ignore the request if it has already - // been completed. The server guarantees 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 to see whether the original operation - // was received. If it was, the server ignores the second request. This - // behavior prevents clients from mistakenly 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]; -} - -// The request for [HubService.DeleteHub][google.cloud.networkconnectivity.v1.HubService.DeleteHub]. -message DeleteHubRequest { - // Required. The name of the hub to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Hub" - } - ]; - - // Optional. A unique request ID (optional). If you specify this ID, you can use it - // in cases when you need to retry your request. When you need to retry, this - // ID lets the server know that it can ignore the request if it has already - // been completed. The server guarantees 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 to see whether the original operation - // was received. If it was, the server ignores the second request. This - // behavior prevents clients from mistakenly 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]; -} - -// The request for [HubService.ListSpokes][google.cloud.networkconnectivity.v1.HubService.ListSpokes]. -message ListSpokesRequest { - // Required. The parent resource. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of results per page that should be returned. - int32 page_size = 2; - - // The page token. - string page_token = 3; - - // An expression that filters the results listed in the response. - string filter = 4; - - // Sort the results by a certain order. - string order_by = 5; -} - -// The response for [HubService.ListSpokes][google.cloud.networkconnectivity.v1.HubService.ListSpokes]. -message ListSpokesResponse { - // The requested spokes. - repeated Spoke spokes = 1; - - // The next pagination token in the List response. It should be used as - // page_token for the following request. An empty value means no more result. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// The request for [HubService.GetSpoke][google.cloud.networkconnectivity.v1.HubService.GetSpoke]. -message GetSpokeRequest { - // Required. The name of the spoke resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Spoke" - } - ]; -} - -// The request for [HubService.CreateSpoke][google.cloud.networkconnectivity.v1.HubService.CreateSpoke]. -message CreateSpokeRequest { - // Required. The parent resource. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. Unique id for the spoke to create. - string spoke_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. The initial values for a new spoke. - Spoke spoke = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A unique request ID (optional). If you specify this ID, you can use it - // in cases when you need to retry your request. When you need to retry, this - // ID lets the server know that it can ignore the request if it has already - // been completed. The server guarantees 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 to see whether the original operation - // was received. If it was, the server ignores the second request. This - // behavior prevents clients from mistakenly 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]; -} - -// Request for [HubService.UpdateSpoke][google.cloud.networkconnectivity.v1.HubService.UpdateSpoke] method. -message UpdateSpokeRequest { - // Optional. In the case of an update to an existing spoke, field mask is used to - // specify the fields to be overwritten. The fields specified in the - // update_mask are relative to the resource, not the full request. A field is - // overwritten if it is in the mask. If the user does not provide a mask, then - // all fields are overwritten. - google.protobuf.FieldMask update_mask = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Required. The state that the spoke should be in after the update. - Spoke spoke = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. A unique request ID (optional). If you specify this ID, you can use it - // in cases when you need to retry your request. When you need to retry, this - // ID lets the server know that it can ignore the request if it has already - // been completed. The server guarantees 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 to see whether the original operation - // was received. If it was, the server ignores the second request. This - // behavior prevents clients from mistakenly 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]; -} - -// The request for [HubService.DeleteSpoke][google.cloud.networkconnectivity.v1.HubService.DeleteSpoke]. -message DeleteSpokeRequest { - // Required. The name of the spoke to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Spoke" - } - ]; - - // Optional. A unique request ID (optional). If you specify this ID, you can use it - // in cases when you need to retry your request. When you need to retry, this - // ID lets the server know that it can ignore the request if it has already - // been completed. The server guarantees 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 to see whether the original operation - // was received. If it was, the server ignores the second request. This - // behavior prevents clients from mistakenly 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]; -} - -// A collection of Cloud VPN tunnel resources. These resources should be -// redundant HA VPN tunnels that all advertise the same prefixes to Google -// Cloud. Alternatively, in a passive/active configuration, all tunnels -// should be capable of advertising the same prefixes. -message LinkedVpnTunnels { - // The URIs of linked VPN tunnel resources. - repeated string uris = 1 [(google.api.resource_reference) = { - type: "compute.googleapis.com/VpnTunnel" - }]; - - // A value that controls whether site-to-site data transfer is enabled for - // these resources. Data transfer is available only in [supported - // locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations). - bool site_to_site_data_transfer = 2; -} - -// A collection of VLAN attachment resources. These resources should -// be redundant attachments that all advertise the same prefixes to Google -// Cloud. Alternatively, in active/passive configurations, all attachments -// should be capable of advertising the same prefixes. -message LinkedInterconnectAttachments { - // The URIs of linked interconnect attachment resources - repeated string uris = 1 [(google.api.resource_reference) = { - type: "compute.googleapis.com/InterconnectAttachment" - }]; - - // A value that controls whether site-to-site data transfer is enabled for - // these resources. Data transfer is available only in [supported - // locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations). - bool site_to_site_data_transfer = 2; -} - -// A collection of router appliance instances. If you configure multiple router -// appliance instances to receive data from the same set of sites outside of -// Google Cloud, we recommend that you associate those instances with the same -// spoke. -message LinkedRouterApplianceInstances { - // The list of router appliance instances. - repeated RouterApplianceInstance instances = 1; - - // A value that controls whether site-to-site data transfer is enabled for - // these resources. Data transfer is available only in [supported - // locations](https://cloud.google.com/network-connectivity/docs/network-connectivity-center/concepts/locations). - bool site_to_site_data_transfer = 2; -} - -// A router appliance instance is a Compute Engine virtual machine (VM) instance -// that acts as a BGP speaker. A router appliance instance is specified by the -// URI of the VM and the internal IP address of one of the VM's network -// interfaces. -message RouterApplianceInstance { - // The URI of the VM. - string virtual_machine = 1 [(google.api.resource_reference) = { - type: "compute.googleapis.com/Instance" - }]; - - // The IP address on the VM to use for peering. - string ip_address = 3; -} - -// Metadata about locations -message LocationMetadata { - // List of supported features - repeated LocationFeature location_features = 1; -} diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.create_hub.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.create_hub.js deleted file mode 100644 index f440f26..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/hub_service.create_hub.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, hubId, hub) { - // [START networkconnectivity_v1_generated_HubService_CreateHub_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource. - */ - // const parent = 'abc123' - /** - * Required. A unique identifier for the hub. - */ - // const hubId = 'abc123' - /** - * Required. The initial values for a new hub. - */ - // const hub = {} - /** - * Optional. A unique request ID (optional). If you specify this ID, you can use it - * in cases when you need to retry your request. When you need to retry, this - * ID lets the server know that it can ignore the request if it has already - * been completed. The server guarantees 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 to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly 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 Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callCreateHub() { - // Construct request - const request = { - parent, - hubId, - hub, - }; - - // Run request - const [operation] = await networkconnectivityClient.createHub(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateHub(); - // [END networkconnectivity_v1_generated_HubService_CreateHub_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.create_spoke.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.create_spoke.js deleted file mode 100644 index bca54f0..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/hub_service.create_spoke.js +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, spokeId, spoke) { - // [START networkconnectivity_v1_generated_HubService_CreateSpoke_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource. - */ - // const parent = 'abc123' - /** - * Required. Unique id for the spoke to create. - */ - // const spokeId = 'abc123' - /** - * Required. The initial values for a new spoke. - */ - // const spoke = {} - /** - * Optional. A unique request ID (optional). If you specify this ID, you can use it - * in cases when you need to retry your request. When you need to retry, this - * ID lets the server know that it can ignore the request if it has already - * been completed. The server guarantees 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 to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly 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 Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callCreateSpoke() { - // Construct request - const request = { - parent, - spokeId, - spoke, - }; - - // Run request - const [operation] = await networkconnectivityClient.createSpoke(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateSpoke(); - // [END networkconnectivity_v1_generated_HubService_CreateSpoke_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.delete_hub.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.delete_hub.js deleted file mode 100644 index 19f719d..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/hub_service.delete_hub.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START networkconnectivity_v1_generated_HubService_DeleteHub_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the hub to delete. - */ - // const name = 'abc123' - /** - * Optional. A unique request ID (optional). If you specify this ID, you can use it - * in cases when you need to retry your request. When you need to retry, this - * ID lets the server know that it can ignore the request if it has already - * been completed. The server guarantees 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 to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly 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 Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callDeleteHub() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await networkconnectivityClient.deleteHub(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteHub(); - // [END networkconnectivity_v1_generated_HubService_DeleteHub_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.delete_spoke.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.delete_spoke.js deleted file mode 100644 index 8907704..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/hub_service.delete_spoke.js +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START networkconnectivity_v1_generated_HubService_DeleteSpoke_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the spoke to delete. - */ - // const name = 'abc123' - /** - * Optional. A unique request ID (optional). If you specify this ID, you can use it - * in cases when you need to retry your request. When you need to retry, this - * ID lets the server know that it can ignore the request if it has already - * been completed. The server guarantees 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 to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly 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 Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callDeleteSpoke() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await networkconnectivityClient.deleteSpoke(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteSpoke(); - // [END networkconnectivity_v1_generated_HubService_DeleteSpoke_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.get_hub.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.get_hub.js deleted file mode 100644 index 151b067..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/hub_service.get_hub.js +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START networkconnectivity_v1_generated_HubService_GetHub_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the hub resource to get. - */ - // const name = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callGetHub() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await networkconnectivityClient.getHub(request); - console.log(response); - } - - callGetHub(); - // [END networkconnectivity_v1_generated_HubService_GetHub_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.get_spoke.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.get_spoke.js deleted file mode 100644 index ac9951b..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/hub_service.get_spoke.js +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START networkconnectivity_v1_generated_HubService_GetSpoke_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the spoke resource. - */ - // const name = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callGetSpoke() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await networkconnectivityClient.getSpoke(request); - console.log(response); - } - - callGetSpoke(); - // [END networkconnectivity_v1_generated_HubService_GetSpoke_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.list_hubs.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.list_hubs.js deleted file mode 100644 index 24e9692..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/hub_service.list_hubs.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START networkconnectivity_v1_generated_HubService_ListHubs_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource's name. - */ - // const parent = 'abc123' - /** - * The maximum number of results per page that should be returned. - */ - // const pageSize = 1234 - /** - * The page token. - */ - // const pageToken = 'abc123' - /** - * An expression that filters the results listed in the response. - */ - // const filter = 'abc123' - /** - * Sort the results by a certain order. - */ - // const orderBy = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callListHubs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await networkconnectivityClient.listHubsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListHubs(); - // [END networkconnectivity_v1_generated_HubService_ListHubs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.list_spokes.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.list_spokes.js deleted file mode 100644 index 8d6426f..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/hub_service.list_spokes.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START networkconnectivity_v1_generated_HubService_ListSpokes_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource. - */ - // const parent = 'abc123' - /** - * The maximum number of results per page that should be returned. - */ - // const pageSize = 1234 - /** - * The page token. - */ - // const pageToken = 'abc123' - /** - * An expression that filters the results listed in the response. - */ - // const filter = 'abc123' - /** - * Sort the results by a certain order. - */ - // const orderBy = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callListSpokes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await networkconnectivityClient.listSpokesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSpokes(); - // [END networkconnectivity_v1_generated_HubService_ListSpokes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.update_hub.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.update_hub.js deleted file mode 100644 index d6bc74e..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/hub_service.update_hub.js +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(hub) { - // [START networkconnectivity_v1_generated_HubService_UpdateHub_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. In the case of an update to an existing hub, field mask is used to specify - * the fields to be overwritten. The fields specified in the update_mask are - * relative to the resource, not the full request. A field is overwritten if - * it is in the mask. If the user does not provide a mask, then all fields are - * overwritten. - */ - // const updateMask = {} - /** - * Required. The state that the hub should be in after the update. - */ - // const hub = {} - /** - * Optional. A unique request ID (optional). If you specify this ID, you can use it - * in cases when you need to retry your request. When you need to retry, this - * ID lets the server know that it can ignore the request if it has already - * been completed. The server guarantees 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 to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly 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 Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callUpdateHub() { - // Construct request - const request = { - hub, - }; - - // Run request - const [operation] = await networkconnectivityClient.updateHub(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateHub(); - // [END networkconnectivity_v1_generated_HubService_UpdateHub_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/hub_service.update_spoke.js b/owl-bot-staging/v1/samples/generated/v1/hub_service.update_spoke.js deleted file mode 100644 index 4f41576..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/hub_service.update_spoke.js +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(spoke) { - // [START networkconnectivity_v1_generated_HubService_UpdateSpoke_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. In the case of an update to an existing spoke, field mask is used to - * specify the fields to be overwritten. The fields specified in the - * update_mask are relative to the resource, not the full request. A field is - * overwritten if it is in the mask. If the user does not provide a mask, then - * all fields are overwritten. - */ - // const updateMask = {} - /** - * Required. The state that the spoke should be in after the update. - */ - // const spoke = {} - /** - * Optional. A unique request ID (optional). If you specify this ID, you can use it - * in cases when you need to retry your request. When you need to retry, this - * ID lets the server know that it can ignore the request if it has already - * been completed. The server guarantees 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 to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly 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 Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callUpdateSpoke() { - // Construct request - const request = { - spoke, - }; - - // Run request - const [operation] = await networkconnectivityClient.updateSpoke(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateSpoke(); - // [END networkconnectivity_v1_generated_HubService_UpdateSpoke_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.networkconnectivity.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.networkconnectivity.v1.json deleted file mode 100644 index e70014d..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.networkconnectivity.v1.json +++ /dev/null @@ -1,495 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-networkconnectivity", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.networkconnectivity.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "networkconnectivity_v1_generated_HubService_ListHubs_async", - "title": "HubService listHubs Sample", - "origin": "API_DEFINITION", - "description": " Lists hubs in a given project.", - "canonical": true, - "file": "hub_service.list_hubs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListHubs", - "fullName": "google.cloud.networkconnectivity.v1.HubService.ListHubs", - "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.networkconnectivity.v1.ListHubsResponse", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "ListHubs", - "fullName": "google.cloud.networkconnectivity.v1.HubService.ListHubs", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_HubService_GetHub_async", - "title": "HubService getHub Sample", - "origin": "API_DEFINITION", - "description": " Gets details about the specified hub.", - "canonical": true, - "file": "hub_service.get_hub.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 50, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetHub", - "fullName": "google.cloud.networkconnectivity.v1.HubService.GetHub", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.networkconnectivity.v1.Hub", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "GetHub", - "fullName": "google.cloud.networkconnectivity.v1.HubService.GetHub", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_HubService_CreateHub_async", - "title": "HubService createHub Sample", - "origin": "API_DEFINITION", - "description": " Creates a new hub in the specified project.", - "canonical": true, - "file": "hub_service.create_hub.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateHub", - "fullName": "google.cloud.networkconnectivity.v1.HubService.CreateHub", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "hub_id", - "type": "TYPE_STRING" - }, - { - "name": "hub", - "type": ".google.cloud.networkconnectivity.v1.Hub" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "CreateHub", - "fullName": "google.cloud.networkconnectivity.v1.HubService.CreateHub", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_HubService_UpdateHub_async", - "title": "HubService updateHub Sample", - "origin": "API_DEFINITION", - "description": " Updates the description and/or labels of the specified hub.", - "canonical": true, - "file": "hub_service.update_hub.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateHub", - "fullName": "google.cloud.networkconnectivity.v1.HubService.UpdateHub", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "hub", - "type": ".google.cloud.networkconnectivity.v1.Hub" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "UpdateHub", - "fullName": "google.cloud.networkconnectivity.v1.HubService.UpdateHub", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_HubService_DeleteHub_async", - "title": "HubService deleteHub Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified hub.", - "canonical": true, - "file": "hub_service.delete_hub.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteHub", - "fullName": "google.cloud.networkconnectivity.v1.HubService.DeleteHub", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "DeleteHub", - "fullName": "google.cloud.networkconnectivity.v1.HubService.DeleteHub", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_HubService_ListSpokes_async", - "title": "HubService listSpokes Sample", - "origin": "API_DEFINITION", - "description": " Lists the spokes in the specified project and location.", - "canonical": true, - "file": "hub_service.list_spokes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSpokes", - "fullName": "google.cloud.networkconnectivity.v1.HubService.ListSpokes", - "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.networkconnectivity.v1.ListSpokesResponse", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "ListSpokes", - "fullName": "google.cloud.networkconnectivity.v1.HubService.ListSpokes", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_HubService_GetSpoke_async", - "title": "HubService getSpoke Sample", - "origin": "API_DEFINITION", - "description": " Gets details about the specified spoke.", - "canonical": true, - "file": "hub_service.get_spoke.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 50, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSpoke", - "fullName": "google.cloud.networkconnectivity.v1.HubService.GetSpoke", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.networkconnectivity.v1.Spoke", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "GetSpoke", - "fullName": "google.cloud.networkconnectivity.v1.HubService.GetSpoke", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_HubService_CreateSpoke_async", - "title": "HubService createSpoke Sample", - "origin": "API_DEFINITION", - "description": " Creates a spoke in the specified project and location.", - "canonical": true, - "file": "hub_service.create_spoke.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 76, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSpoke", - "fullName": "google.cloud.networkconnectivity.v1.HubService.CreateSpoke", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "spoke_id", - "type": "TYPE_STRING" - }, - { - "name": "spoke", - "type": ".google.cloud.networkconnectivity.v1.Spoke" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "CreateSpoke", - "fullName": "google.cloud.networkconnectivity.v1.HubService.CreateSpoke", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_HubService_UpdateSpoke_async", - "title": "HubService updateSpoke Sample", - "origin": "API_DEFINITION", - "description": " Updates the parameters of the specified spoke.", - "canonical": true, - "file": "hub_service.update_spoke.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSpoke", - "fullName": "google.cloud.networkconnectivity.v1.HubService.UpdateSpoke", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "spoke", - "type": ".google.cloud.networkconnectivity.v1.Spoke" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "UpdateSpoke", - "fullName": "google.cloud.networkconnectivity.v1.HubService.UpdateSpoke", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1_generated_HubService_DeleteSpoke_async", - "title": "HubService deleteSpoke Sample", - "origin": "API_DEFINITION", - "description": " Deletes the specified spoke.", - "canonical": true, - "file": "hub_service.delete_spoke.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteSpoke", - "fullName": "google.cloud.networkconnectivity.v1.HubService.DeleteSpoke", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1.HubServiceClient" - }, - "method": { - "shortName": "DeleteSpoke", - "fullName": "google.cloud.networkconnectivity.v1.HubService.DeleteSpoke", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1.HubService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index fba5f87..0000000 --- a/owl-bot-staging/v1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1 from './v1'; -const HubServiceClient = v1.HubServiceClient; -type HubServiceClient = v1.HubServiceClient; -export {v1, HubServiceClient}; -export default {v1, HubServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json deleted file mode 100644 index 3e4f0fe..0000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.networkconnectivity.v1", - "libraryPackage": "@google-cloud/network-connectivity", - "services": { - "HubService": { - "clients": { - "grpc": { - "libraryClient": "HubServiceClient", - "rpcs": { - "GetHub": { - "methods": [ - "getHub" - ] - }, - "GetSpoke": { - "methods": [ - "getSpoke" - ] - }, - "CreateHub": { - "methods": [ - "createHub" - ] - }, - "UpdateHub": { - "methods": [ - "updateHub" - ] - }, - "DeleteHub": { - "methods": [ - "deleteHub" - ] - }, - "CreateSpoke": { - "methods": [ - "createSpoke" - ] - }, - "UpdateSpoke": { - "methods": [ - "updateSpoke" - ] - }, - "DeleteSpoke": { - "methods": [ - "deleteSpoke" - ] - }, - "ListHubs": { - "methods": [ - "listHubs", - "listHubsStream", - "listHubsAsync" - ] - }, - "ListSpokes": { - "methods": [ - "listSpokes", - "listSpokesStream", - "listSpokesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "HubServiceClient", - "rpcs": { - "GetHub": { - "methods": [ - "getHub" - ] - }, - "GetSpoke": { - "methods": [ - "getSpoke" - ] - }, - "CreateHub": { - "methods": [ - "createHub" - ] - }, - "UpdateHub": { - "methods": [ - "updateHub" - ] - }, - "DeleteHub": { - "methods": [ - "deleteHub" - ] - }, - "CreateSpoke": { - "methods": [ - "createSpoke" - ] - }, - "UpdateSpoke": { - "methods": [ - "updateSpoke" - ] - }, - "DeleteSpoke": { - "methods": [ - "deleteSpoke" - ] - }, - "ListHubs": { - "methods": [ - "listHubs", - "listHubsStream", - "listHubsAsync" - ] - }, - "ListSpokes": { - "methods": [ - "listSpokes", - "listSpokesStream", - "listSpokesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/hub_service_client.ts b/owl-bot-staging/v1/src/v1/hub_service_client.ts deleted file mode 100644 index b974b06..0000000 --- a/owl-bot-staging/v1/src/v1/hub_service_client.ts +++ /dev/null @@ -1,1881 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/hub_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './hub_service_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * Network Connectivity Center is a hub-and-spoke abstraction for network - * connectivity management in Google Cloud. It reduces operational complexity - * through a simple, centralized connectivity management model. - * @class - * @memberof v1 - */ -export class HubServiceClient { - 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; - hubServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of HubServiceClient. - * - * @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}. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof HubServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - hubPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/global/hubs/{hub}' - ), - instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/zones/{zone}/instances/{instance}' - ), - interconnectAttachmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/interconnectAttachments/{resource_id}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - networkPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/global/networks/{resource_id}' - ), - spokePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/spokes/{spoke}' - ), - vpnTunnelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/vpnTunnels/{resource_id}' - ), - }; - - // 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 = { - listHubs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'hubs'), - listSpokes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spokes') - }; - - 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.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1/{resource=projects/*/locations/global/hubs/*}:getIamPolicy',additional_bindings: [{get: '/v1/{resource=projects/*/locations/*/spokes/*}:getIamPolicy',},{get: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1/{resource=projects/*/locations/global/hubs/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/spokes/*}:setIamPolicy',body: '*',},{post: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1/{resource=projects/*/locations/global/hubs/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1/{resource=projects/*/locations/*/spokes/*}:testIamPermissions',body: '*',},{post: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:testIamPermissions',body: '*',}], - },{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 createHubResponse = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.Hub') as gax.protobuf.Type; - const createHubMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; - const updateHubResponse = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.Hub') as gax.protobuf.Type; - const updateHubMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; - const deleteHubResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteHubMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; - const createSpokeResponse = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.Spoke') as gax.protobuf.Type; - const createSpokeMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; - const updateSpokeResponse = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.Spoke') as gax.protobuf.Type; - const updateSpokeMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; - const deleteSpokeResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteSpokeMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createHub: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createHubResponse.decode.bind(createHubResponse), - createHubMetadata.decode.bind(createHubMetadata)), - updateHub: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateHubResponse.decode.bind(updateHubResponse), - updateHubMetadata.decode.bind(updateHubMetadata)), - deleteHub: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteHubResponse.decode.bind(deleteHubResponse), - deleteHubMetadata.decode.bind(deleteHubMetadata)), - createSpoke: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createSpokeResponse.decode.bind(createSpokeResponse), - createSpokeMetadata.decode.bind(createSpokeMetadata)), - updateSpoke: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateSpokeResponse.decode.bind(updateSpokeResponse), - updateSpokeMetadata.decode.bind(updateSpokeMetadata)), - deleteSpoke: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteSpokeResponse.decode.bind(deleteSpokeResponse), - deleteSpokeMetadata.decode.bind(deleteSpokeMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networkconnectivity.v1.HubService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.hubServiceStub) { - return this.hubServiceStub; - } - - // Put together the "service stub" for - // google.cloud.networkconnectivity.v1.HubService. - this.hubServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networkconnectivity.v1.HubService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networkconnectivity.v1.HubService, - 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 hubServiceStubMethods = - ['listHubs', 'getHub', 'createHub', 'updateHub', 'deleteHub', 'listSpokes', 'getSpoke', 'createSpoke', 'updateSpoke', 'deleteSpoke']; - for (const methodName of hubServiceStubMethods) { - const callPromise = this.hubServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.hubServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'networkconnectivity.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 'networkconnectivity.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets details about the specified hub. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the hub 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 [Hub]{@link google.cloud.networkconnectivity.v1.Hub}. - * 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/hub_service.get_hub.js - * region_tag:networkconnectivity_v1_generated_HubService_GetHub_async - */ - getHub( - request?: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkconnectivity.v1.IHub, - protos.google.cloud.networkconnectivity.v1.IGetHubRequest|undefined, {}|undefined - ]>; - getHub( - request: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networkconnectivity.v1.IHub, - protos.google.cloud.networkconnectivity.v1.IGetHubRequest|null|undefined, - {}|null|undefined>): void; - getHub( - request: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, - callback: Callback< - protos.google.cloud.networkconnectivity.v1.IHub, - protos.google.cloud.networkconnectivity.v1.IGetHubRequest|null|undefined, - {}|null|undefined>): void; - getHub( - request?: protos.google.cloud.networkconnectivity.v1.IGetHubRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networkconnectivity.v1.IHub, - protos.google.cloud.networkconnectivity.v1.IGetHubRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.networkconnectivity.v1.IHub, - protos.google.cloud.networkconnectivity.v1.IGetHubRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networkconnectivity.v1.IHub, - protos.google.cloud.networkconnectivity.v1.IGetHubRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getHub(request, options, callback); - } -/** - * Gets details about the specified spoke. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spoke resource. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Spoke]{@link google.cloud.networkconnectivity.v1.Spoke}. - * 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/hub_service.get_spoke.js - * region_tag:networkconnectivity_v1_generated_HubService_GetSpoke_async - */ - getSpoke( - request?: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkconnectivity.v1.ISpoke, - protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|undefined, {}|undefined - ]>; - getSpoke( - request: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networkconnectivity.v1.ISpoke, - protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|null|undefined, - {}|null|undefined>): void; - getSpoke( - request: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, - callback: Callback< - protos.google.cloud.networkconnectivity.v1.ISpoke, - protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|null|undefined, - {}|null|undefined>): void; - getSpoke( - request?: protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networkconnectivity.v1.ISpoke, - protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.networkconnectivity.v1.ISpoke, - protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networkconnectivity.v1.ISpoke, - protos.google.cloud.networkconnectivity.v1.IGetSpokeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getSpoke(request, options, callback); - } - -/** - * Creates a new hub in the specified project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource. - * @param {string} request.hubId - * Required. A unique identifier for the hub. - * @param {google.cloud.networkconnectivity.v1.Hub} request.hub - * Required. The initial values for a new hub. - * @param {string} [request.requestId] - * Optional. A unique request ID (optional). If you specify this ID, you can use it - * in cases when you need to retry your request. When you need to retry, this - * ID lets the server know that it can ignore the request if it has already - * been completed. The server guarantees 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 to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly 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/hub_service.create_hub.js - * region_tag:networkconnectivity_v1_generated_HubService_CreateHub_async - */ - createHub( - request?: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createHub( - request: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createHub( - request: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createHub( - request?: protos.google.cloud.networkconnectivity.v1.ICreateHubRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createHub(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createHub()`. - * @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/hub_service.create_hub.js - * region_tag:networkconnectivity_v1_generated_HubService_CreateHub_async - */ - async checkCreateHubProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createHub, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the description and/or labels of the specified hub. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. In the case of an update to an existing hub, field mask is used to specify - * the fields to be overwritten. The fields specified in the update_mask are - * relative to the resource, not the full request. A field is overwritten if - * it is in the mask. If the user does not provide a mask, then all fields are - * overwritten. - * @param {google.cloud.networkconnectivity.v1.Hub} request.hub - * Required. The state that the hub should be in after the update. - * @param {string} [request.requestId] - * Optional. A unique request ID (optional). If you specify this ID, you can use it - * in cases when you need to retry your request. When you need to retry, this - * ID lets the server know that it can ignore the request if it has already - * been completed. The server guarantees 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 to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly 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/hub_service.update_hub.js - * region_tag:networkconnectivity_v1_generated_HubService_UpdateHub_async - */ - updateHub( - request?: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateHub( - request: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateHub( - request: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateHub( - request?: protos.google.cloud.networkconnectivity.v1.IUpdateHubRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'hub.name': request.hub!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateHub(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateHub()`. - * @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/hub_service.update_hub.js - * region_tag:networkconnectivity_v1_generated_HubService_UpdateHub_async - */ - async checkUpdateHubProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateHub, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes the specified hub. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the hub to delete. - * @param {string} [request.requestId] - * Optional. A unique request ID (optional). If you specify this ID, you can use it - * in cases when you need to retry your request. When you need to retry, this - * ID lets the server know that it can ignore the request if it has already - * been completed. The server guarantees 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 to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly 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/hub_service.delete_hub.js - * region_tag:networkconnectivity_v1_generated_HubService_DeleteHub_async - */ - deleteHub( - request?: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteHub( - request: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteHub( - request: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteHub( - request?: protos.google.cloud.networkconnectivity.v1.IDeleteHubRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteHub(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteHub()`. - * @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/hub_service.delete_hub.js - * region_tag:networkconnectivity_v1_generated_HubService_DeleteHub_async - */ - async checkDeleteHubProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteHub, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a spoke in the specified project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource. - * @param {string} request.spokeId - * Required. Unique id for the spoke to create. - * @param {google.cloud.networkconnectivity.v1.Spoke} request.spoke - * Required. The initial values for a new spoke. - * @param {string} [request.requestId] - * Optional. A unique request ID (optional). If you specify this ID, you can use it - * in cases when you need to retry your request. When you need to retry, this - * ID lets the server know that it can ignore the request if it has already - * been completed. The server guarantees 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 to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly 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/hub_service.create_spoke.js - * region_tag:networkconnectivity_v1_generated_HubService_CreateSpoke_async - */ - createSpoke( - request?: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createSpoke( - request: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createSpoke( - request: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createSpoke( - request?: protos.google.cloud.networkconnectivity.v1.ICreateSpokeRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createSpoke(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createSpoke()`. - * @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/hub_service.create_spoke.js - * region_tag:networkconnectivity_v1_generated_HubService_CreateSpoke_async - */ - async checkCreateSpokeProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createSpoke, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the parameters of the specified spoke. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.protobuf.FieldMask} [request.updateMask] - * Optional. In the case of an update to an existing spoke, field mask is used to - * specify the fields to be overwritten. The fields specified in the - * update_mask are relative to the resource, not the full request. A field is - * overwritten if it is in the mask. If the user does not provide a mask, then - * all fields are overwritten. - * @param {google.cloud.networkconnectivity.v1.Spoke} request.spoke - * Required. The state that the spoke should be in after the update. - * @param {string} [request.requestId] - * Optional. A unique request ID (optional). If you specify this ID, you can use it - * in cases when you need to retry your request. When you need to retry, this - * ID lets the server know that it can ignore the request if it has already - * been completed. The server guarantees 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 to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly 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/hub_service.update_spoke.js - * region_tag:networkconnectivity_v1_generated_HubService_UpdateSpoke_async - */ - updateSpoke( - request?: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateSpoke( - request: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateSpoke( - request: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateSpoke( - request?: protos.google.cloud.networkconnectivity.v1.IUpdateSpokeRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'spoke.name': request.spoke!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateSpoke(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateSpoke()`. - * @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/hub_service.update_spoke.js - * region_tag:networkconnectivity_v1_generated_HubService_UpdateSpoke_async - */ - async checkUpdateSpokeProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateSpoke, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes the specified spoke. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the spoke to delete. - * @param {string} [request.requestId] - * Optional. A unique request ID (optional). If you specify this ID, you can use it - * in cases when you need to retry your request. When you need to retry, this - * ID lets the server know that it can ignore the request if it has already - * been completed. The server guarantees 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 to see whether the original operation - * was received. If it was, the server ignores the second request. This - * behavior prevents clients from mistakenly 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/hub_service.delete_spoke.js - * region_tag:networkconnectivity_v1_generated_HubService_DeleteSpoke_async - */ - deleteSpoke( - request?: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteSpoke( - request: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteSpoke( - request: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteSpoke( - request?: protos.google.cloud.networkconnectivity.v1.IDeleteSpokeRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteSpoke(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteSpoke()`. - * @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/hub_service.delete_spoke.js - * region_tag:networkconnectivity_v1_generated_HubService_DeleteSpoke_async - */ - async checkDeleteSpokeProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteSpoke, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists hubs in a given project. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource's name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * An expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Hub]{@link google.cloud.networkconnectivity.v1.Hub}. - * 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 `listHubsAsync()` - * 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. - */ - listHubs( - request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkconnectivity.v1.IHub[], - protos.google.cloud.networkconnectivity.v1.IListHubsRequest|null, - protos.google.cloud.networkconnectivity.v1.IListHubsResponse - ]>; - listHubs( - request: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - protos.google.cloud.networkconnectivity.v1.IListHubsResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1.IHub>): void; - listHubs( - request: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - callback: PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - protos.google.cloud.networkconnectivity.v1.IListHubsResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1.IHub>): void; - listHubs( - request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - protos.google.cloud.networkconnectivity.v1.IListHubsResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1.IHub>, - callback?: PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - protos.google.cloud.networkconnectivity.v1.IListHubsResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1.IHub>): - Promise<[ - protos.google.cloud.networkconnectivity.v1.IHub[], - protos.google.cloud.networkconnectivity.v1.IListHubsRequest|null, - protos.google.cloud.networkconnectivity.v1.IListHubsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listHubs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource's name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * An expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @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 [Hub]{@link google.cloud.networkconnectivity.v1.Hub} 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 `listHubsAsync()` - * 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. - */ - listHubsStream( - request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listHubs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listHubs.createStream( - this.innerApiCalls.listHubs as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listHubs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource's name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * An expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @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 - * [Hub]{@link google.cloud.networkconnectivity.v1.Hub}. 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/hub_service.list_hubs.js - * region_tag:networkconnectivity_v1_generated_HubService_ListHubs_async - */ - listHubsAsync( - request?: protos.google.cloud.networkconnectivity.v1.IListHubsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listHubs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listHubs.asyncIterate( - this.innerApiCalls['listHubs'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists the spokes in the specified project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * An expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Spoke]{@link google.cloud.networkconnectivity.v1.Spoke}. - * 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 `listSpokesAsync()` - * 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. - */ - listSpokes( - request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkconnectivity.v1.ISpoke[], - protos.google.cloud.networkconnectivity.v1.IListSpokesRequest|null, - protos.google.cloud.networkconnectivity.v1.IListSpokesResponse - ]>; - listSpokes( - request: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - protos.google.cloud.networkconnectivity.v1.IListSpokesResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1.ISpoke>): void; - listSpokes( - request: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - callback: PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - protos.google.cloud.networkconnectivity.v1.IListSpokesResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1.ISpoke>): void; - listSpokes( - request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - protos.google.cloud.networkconnectivity.v1.IListSpokesResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1.ISpoke>, - callback?: PaginationCallback< - protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - protos.google.cloud.networkconnectivity.v1.IListSpokesResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1.ISpoke>): - Promise<[ - protos.google.cloud.networkconnectivity.v1.ISpoke[], - protos.google.cloud.networkconnectivity.v1.IListSpokesRequest|null, - protos.google.cloud.networkconnectivity.v1.IListSpokesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listSpokes(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * An expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @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 [Spoke]{@link google.cloud.networkconnectivity.v1.Spoke} 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 `listSpokesAsync()` - * 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. - */ - listSpokesStream( - request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listSpokes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSpokes.createStream( - this.innerApiCalls.listSpokes as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSpokes`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * An expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @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 - * [Spoke]{@link google.cloud.networkconnectivity.v1.Spoke}. 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/hub_service.list_spokes.js - * region_tag:networkconnectivity_v1_generated_HubService_ListSpokes_async - */ - listSpokesAsync( - request?: protos.google.cloud.networkconnectivity.v1.IListSpokesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listSpokes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSpokes.asyncIterate( - this.innerApiCalls['listSpokes'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified hub resource name string. - * - * @param {string} project - * @param {string} hub - * @returns {string} Resource name string. - */ - hubPath(project:string,hub:string) { - return this.pathTemplates.hubPathTemplate.render({ - project: project, - hub: hub, - }); - } - - /** - * Parse the project from Hub resource. - * - * @param {string} hubName - * A fully-qualified path representing Hub resource. - * @returns {string} A string representing the project. - */ - matchProjectFromHubName(hubName: string) { - return this.pathTemplates.hubPathTemplate.match(hubName).project; - } - - /** - * Parse the hub from Hub resource. - * - * @param {string} hubName - * A fully-qualified path representing Hub resource. - * @returns {string} A string representing the hub. - */ - matchHubFromHubName(hubName: string) { - return this.pathTemplates.hubPathTemplate.match(hubName).hub; - } - - /** - * Return a fully-qualified instance resource name string. - * - * @param {string} project - * @param {string} zone - * @param {string} instance - * @returns {string} Resource name string. - */ - instancePath(project:string,zone:string,instance:string) { - return this.pathTemplates.instancePathTemplate.render({ - project: project, - zone: zone, - instance: instance, - }); - } - - /** - * Parse the project from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).project; - } - - /** - * Parse the zone from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the zone. - */ - matchZoneFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).zone; - } - - /** - * Parse the instance from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).instance; - } - - /** - * Return a fully-qualified interconnectAttachment resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} resource_id - * @returns {string} Resource name string. - */ - interconnectAttachmentPath(project:string,region:string,resourceId:string) { - return this.pathTemplates.interconnectAttachmentPathTemplate.render({ - project: project, - region: region, - resource_id: resourceId, - }); - } - - /** - * Parse the project from InterconnectAttachment resource. - * - * @param {string} interconnectAttachmentName - * A fully-qualified path representing InterconnectAttachment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInterconnectAttachmentName(interconnectAttachmentName: string) { - return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).project; - } - - /** - * Parse the region from InterconnectAttachment resource. - * - * @param {string} interconnectAttachmentName - * A fully-qualified path representing InterconnectAttachment resource. - * @returns {string} A string representing the region. - */ - matchRegionFromInterconnectAttachmentName(interconnectAttachmentName: string) { - return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).region; - } - - /** - * Parse the resource_id from InterconnectAttachment resource. - * - * @param {string} interconnectAttachmentName - * A fully-qualified path representing InterconnectAttachment resource. - * @returns {string} A string representing the resource_id. - */ - matchResourceIdFromInterconnectAttachmentName(interconnectAttachmentName: string) { - return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).resource_id; - } - - /** - * 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 network resource name string. - * - * @param {string} project - * @param {string} resource_id - * @returns {string} Resource name string. - */ - networkPath(project:string,resourceId:string) { - return this.pathTemplates.networkPathTemplate.render({ - project: project, - resource_id: resourceId, - }); - } - - /** - * Parse the project from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the project. - */ - matchProjectFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).project; - } - - /** - * Parse the resource_id from Network resource. - * - * @param {string} networkName - * A fully-qualified path representing Network resource. - * @returns {string} A string representing the resource_id. - */ - matchResourceIdFromNetworkName(networkName: string) { - return this.pathTemplates.networkPathTemplate.match(networkName).resource_id; - } - - /** - * Return a fully-qualified spoke resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} spoke - * @returns {string} Resource name string. - */ - spokePath(project:string,location:string,spoke:string) { - return this.pathTemplates.spokePathTemplate.render({ - project: project, - location: location, - spoke: spoke, - }); - } - - /** - * Parse the project from Spoke resource. - * - * @param {string} spokeName - * A fully-qualified path representing Spoke resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSpokeName(spokeName: string) { - return this.pathTemplates.spokePathTemplate.match(spokeName).project; - } - - /** - * Parse the location from Spoke resource. - * - * @param {string} spokeName - * A fully-qualified path representing Spoke resource. - * @returns {string} A string representing the location. - */ - matchLocationFromSpokeName(spokeName: string) { - return this.pathTemplates.spokePathTemplate.match(spokeName).location; - } - - /** - * Parse the spoke from Spoke resource. - * - * @param {string} spokeName - * A fully-qualified path representing Spoke resource. - * @returns {string} A string representing the spoke. - */ - matchSpokeFromSpokeName(spokeName: string) { - return this.pathTemplates.spokePathTemplate.match(spokeName).spoke; - } - - /** - * Return a fully-qualified vpnTunnel resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} resource_id - * @returns {string} Resource name string. - */ - vpnTunnelPath(project:string,region:string,resourceId:string) { - return this.pathTemplates.vpnTunnelPathTemplate.render({ - project: project, - region: region, - resource_id: resourceId, - }); - } - - /** - * Parse the project from VpnTunnel resource. - * - * @param {string} vpnTunnelName - * A fully-qualified path representing VpnTunnel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromVpnTunnelName(vpnTunnelName: string) { - return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).project; - } - - /** - * Parse the region from VpnTunnel resource. - * - * @param {string} vpnTunnelName - * A fully-qualified path representing VpnTunnel resource. - * @returns {string} A string representing the region. - */ - matchRegionFromVpnTunnelName(vpnTunnelName: string) { - return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).region; - } - - /** - * Parse the resource_id from VpnTunnel resource. - * - * @param {string} vpnTunnelName - * A fully-qualified path representing VpnTunnel resource. - * @returns {string} A string representing the resource_id. - */ - matchResourceIdFromVpnTunnelName(vpnTunnelName: string) { - return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).resource_id; - } - - /** - * 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.hubServiceStub && !this._terminated) { - return this.hubServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/hub_service_client_config.json b/owl-bot-staging/v1/src/v1/hub_service_client_config.json deleted file mode 100644 index 068f769..0000000 --- a/owl-bot-staging/v1/src/v1/hub_service_client_config.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "interfaces": { - "google.cloud.networkconnectivity.v1.HubService": { - "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": { - "ListHubs": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetHub": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateHub": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateHub": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteHub": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListSpokes": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetSpoke": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateSpoke": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSpoke": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteSpoke": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/hub_service_proto_list.json b/owl-bot-staging/v1/src/v1/hub_service_proto_list.json deleted file mode 100644 index ebe50fa..0000000 --- a/owl-bot-staging/v1/src/v1/hub_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/networkconnectivity/v1/common.proto", - "../../protos/google/cloud/networkconnectivity/v1/hub.proto" -] diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts deleted file mode 100644 index ae38769..0000000 --- a/owl-bot-staging/v1/src/v1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {HubServiceClient} from './hub_service_client'; diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 672a15d..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const networkconnectivity = require('@google-cloud/network-connectivity'); - -function main() { - const hubServiceClient = new networkconnectivity.HubServiceClient(); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 5a5e64b..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {HubServiceClient} from '@google-cloud/network-connectivity'; - -// check that the client class type name can be used -function doStuffWithHubServiceClient(client: HubServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const hubServiceClient = new HubServiceClient(); - doStuffWithHubServiceClient(hubServiceClient); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts deleted file mode 100644 index 8ec4522..0000000 --- a/owl-bot-staging/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1/test/gapic_hub_service_v1.ts b/owl-bot-staging/v1/test/gapic_hub_service_v1.ts deleted file mode 100644 index c0ccef5..0000000 --- a/owl-bot-staging/v1/test/gapic_hub_service_v1.ts +++ /dev/null @@ -1,2011 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as hubserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.HubServiceClient', () => { - it('has servicePath', () => { - const servicePath = hubserviceModule.v1.HubServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = hubserviceModule.v1.HubServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = hubserviceModule.v1.HubServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new hubserviceModule.v1.HubServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new hubserviceModule.v1.HubServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.hubServiceStub, undefined); - await client.initialize(); - assert(client.hubServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.hubServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.hubServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new hubserviceModule.v1.HubServiceClient({ - 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 hubserviceModule.v1.HubServiceClient({ - 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('getHub', () => { - it('invokes getHub without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.GetHubRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()); - client.innerApiCalls.getHub = stubSimpleCall(expectedResponse); - const [response] = await client.getHub(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getHub without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.GetHubRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()); - client.innerApiCalls.getHub = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getHub( - request, - (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1.IHub|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getHub with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.GetHubRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getHub = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getHub(request), expectedError); - assert((client.innerApiCalls.getHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getHub with closed client', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.GetHubRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getHub(request), expectedError); - }); - }); - - describe('getSpoke', () => { - it('invokes getSpoke without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.GetSpokeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()); - client.innerApiCalls.getSpoke = stubSimpleCall(expectedResponse); - const [response] = await client.getSpoke(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getSpoke without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.GetSpokeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()); - client.innerApiCalls.getSpoke = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSpoke( - request, - (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1.ISpoke|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getSpoke with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.GetSpokeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getSpoke = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSpoke(request), expectedError); - assert((client.innerApiCalls.getSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getSpoke with closed client', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.GetSpokeRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSpoke(request), expectedError); - }); - }); - - describe('createHub', () => { - it('invokes createHub without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.CreateHubRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createHub = stubLongRunningCall(expectedResponse); - const [operation] = await client.createHub(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createHub without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.CreateHubRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createHub = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createHub( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createHub with call error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.CreateHubRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createHub = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createHub(request), expectedError); - assert((client.innerApiCalls.createHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createHub with LRO error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.CreateHubRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createHub = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createHub(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateHubProgress without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - 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.checkCreateHubProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateHubProgress with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - 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.checkCreateHubProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateHub', () => { - it('invokes updateHub without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest()); - request.hub = {}; - request.hub.name = ''; - const expectedHeaderRequestParams = "hub.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateHub = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateHub(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateHub without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest()); - request.hub = {}; - request.hub.name = ''; - const expectedHeaderRequestParams = "hub.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateHub = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateHub( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateHub with call error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest()); - request.hub = {}; - request.hub.name = ''; - const expectedHeaderRequestParams = "hub.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateHub = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateHub(request), expectedError); - assert((client.innerApiCalls.updateHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateHub with LRO error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.UpdateHubRequest()); - request.hub = {}; - request.hub.name = ''; - const expectedHeaderRequestParams = "hub.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateHub = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateHub(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateHubProgress without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - 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.checkUpdateHubProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateHubProgress with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - 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.checkUpdateHubProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteHub', () => { - it('invokes deleteHub without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteHub = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteHub(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteHub without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteHub = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteHub( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteHub with call error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteHub = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteHub(request), expectedError); - assert((client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteHub with LRO error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.DeleteHubRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteHub = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteHub(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteHubProgress without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - 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.checkDeleteHubProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteHubProgress with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - 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.checkDeleteHubProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createSpoke', () => { - it('invokes createSpoke without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createSpoke = stubLongRunningCall(expectedResponse); - const [operation] = await client.createSpoke(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createSpoke without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createSpoke = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSpoke( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createSpoke with call error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createSpoke = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createSpoke(request), expectedError); - assert((client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createSpoke with LRO error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.CreateSpokeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createSpoke = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createSpoke(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateSpokeProgress without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - 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.checkCreateSpokeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateSpokeProgress with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - 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.checkCreateSpokeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateSpoke', () => { - it('invokes updateSpoke without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest()); - request.spoke = {}; - request.spoke.name = ''; - const expectedHeaderRequestParams = "spoke.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateSpoke = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateSpoke(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateSpoke without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest()); - request.spoke = {}; - request.spoke.name = ''; - const expectedHeaderRequestParams = "spoke.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateSpoke = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSpoke( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateSpoke with call error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest()); - request.spoke = {}; - request.spoke.name = ''; - const expectedHeaderRequestParams = "spoke.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSpoke = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateSpoke(request), expectedError); - assert((client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateSpoke with LRO error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.UpdateSpokeRequest()); - request.spoke = {}; - request.spoke.name = ''; - const expectedHeaderRequestParams = "spoke.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSpoke = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateSpoke(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateSpokeProgress without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - 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.checkUpdateSpokeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateSpokeProgress with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - 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.checkUpdateSpokeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteSpoke', () => { - it('invokes deleteSpoke without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteSpoke = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteSpoke(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteSpoke without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteSpoke = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSpoke( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteSpoke with call error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSpoke = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteSpoke(request), expectedError); - assert((client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteSpoke with LRO error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.DeleteSpokeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSpoke = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteSpoke(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteSpokeProgress without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - 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.checkDeleteSpokeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteSpokeProgress with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - 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.checkDeleteSpokeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listHubs', () => { - it('invokes listHubs without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListHubsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - ]; - client.innerApiCalls.listHubs = stubSimpleCall(expectedResponse); - const [response] = await client.listHubs(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listHubs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listHubs without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListHubsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - ]; - client.innerApiCalls.listHubs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listHubs( - request, - (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1.IHub[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listHubs as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listHubs with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListHubsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listHubs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listHubs(request), expectedError); - assert((client.innerApiCalls.listHubs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listHubsStream without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListHubsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - ]; - client.descriptors.page.listHubs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listHubsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1.Hub[] = []; - stream.on('data', (response: protos.google.cloud.networkconnectivity.v1.Hub) => { - 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.listHubs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listHubs, request)); - assert.strictEqual( - (client.descriptors.page.listHubs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listHubsStream with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListHubsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listHubs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listHubsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1.Hub[] = []; - stream.on('data', (response: protos.google.cloud.networkconnectivity.v1.Hub) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listHubs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listHubs, request)); - assert.strictEqual( - (client.descriptors.page.listHubs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listHubs without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListHubsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Hub()), - ]; - client.descriptors.page.listHubs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networkconnectivity.v1.IHub[] = []; - const iterable = client.listHubsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listHubs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listHubs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listHubs with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListHubsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listHubs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listHubsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networkconnectivity.v1.IHub[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listHubs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listHubs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listSpokes', () => { - it('invokes listSpokes without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - ]; - client.innerApiCalls.listSpokes = stubSimpleCall(expectedResponse); - const [response] = await client.listSpokes(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSpokes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSpokes without error using callback', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - ]; - client.innerApiCalls.listSpokes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSpokes( - request, - (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1.ISpoke[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSpokes as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listSpokes with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listSpokes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSpokes(request), expectedError); - assert((client.innerApiCalls.listSpokes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSpokesStream without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - ]; - client.descriptors.page.listSpokes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSpokesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1.Spoke[] = []; - stream.on('data', (response: protos.google.cloud.networkconnectivity.v1.Spoke) => { - 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.listSpokes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSpokes, request)); - assert.strictEqual( - (client.descriptors.page.listSpokes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listSpokesStream with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listSpokes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSpokesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1.Spoke[] = []; - stream.on('data', (response: protos.google.cloud.networkconnectivity.v1.Spoke) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSpokes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSpokes, request)); - assert.strictEqual( - (client.descriptors.page.listSpokes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSpokes without error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.Spoke()), - ]; - client.descriptors.page.listSpokes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networkconnectivity.v1.ISpoke[] = []; - const iterable = client.listSpokesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSpokes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSpokes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSpokes with error', async () => { - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1.ListSpokesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listSpokes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSpokesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networkconnectivity.v1.ISpoke[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSpokes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSpokes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('hub', () => { - const fakePath = "/rendered/path/hub"; - const expectedParameters = { - project: "projectValue", - hub: "hubValue", - }; - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.hubPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.hubPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('hubPath', () => { - const result = client.hubPath("projectValue", "hubValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.hubPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromHubName', () => { - const result = client.matchProjectFromHubName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.hubPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchHubFromHubName', () => { - const result = client.matchHubFromHubName(fakePath); - assert.strictEqual(result, "hubValue"); - assert((client.pathTemplates.hubPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('instance', () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - zone: "zoneValue", - instance: "instanceValue", - }; - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "zoneValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchZoneFromInstanceName', () => { - const result = client.matchZoneFromInstanceName(fakePath); - assert.strictEqual(result, "zoneValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interconnectAttachment', () => { - const fakePath = "/rendered/path/interconnectAttachment"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - resource_id: "resourceIdValue", - }; - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.interconnectAttachmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interconnectAttachmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interconnectAttachmentPath', () => { - const result = client.interconnectAttachmentPath("projectValue", "regionValue", "resourceIdValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interconnectAttachmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterconnectAttachmentName', () => { - const result = client.matchProjectFromInterconnectAttachmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromInterconnectAttachmentName', () => { - const result = client.matchRegionFromInterconnectAttachmentName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchResourceIdFromInterconnectAttachmentName', () => { - const result = client.matchResourceIdFromInterconnectAttachmentName(fakePath); - assert.strictEqual(result, "resourceIdValue"); - assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new hubserviceModule.v1.HubServiceClient({ - 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('network', () => { - const fakePath = "/rendered/path/network"; - const expectedParameters = { - project: "projectValue", - resource_id: "resourceIdValue", - }; - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.networkPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.networkPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('networkPath', () => { - const result = client.networkPath("projectValue", "resourceIdValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.networkPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromNetworkName', () => { - const result = client.matchProjectFromNetworkName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchResourceIdFromNetworkName', () => { - const result = client.matchResourceIdFromNetworkName(fakePath); - assert.strictEqual(result, "resourceIdValue"); - assert((client.pathTemplates.networkPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('spoke', () => { - const fakePath = "/rendered/path/spoke"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - spoke: "spokeValue", - }; - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.spokePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.spokePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('spokePath', () => { - const result = client.spokePath("projectValue", "locationValue", "spokeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.spokePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSpokeName', () => { - const result = client.matchProjectFromSpokeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.spokePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSpokeName', () => { - const result = client.matchLocationFromSpokeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.spokePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSpokeFromSpokeName', () => { - const result = client.matchSpokeFromSpokeName(fakePath); - assert.strictEqual(result, "spokeValue"); - assert((client.pathTemplates.spokePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('vpnTunnel', () => { - const fakePath = "/rendered/path/vpnTunnel"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - resource_id: "resourceIdValue", - }; - const client = new hubserviceModule.v1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.vpnTunnelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.vpnTunnelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('vpnTunnelPath', () => { - const result = client.vpnTunnelPath("projectValue", "regionValue", "resourceIdValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.vpnTunnelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromVpnTunnelName', () => { - const result = client.matchProjectFromVpnTunnelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromVpnTunnelName', () => { - const result = client.matchRegionFromVpnTunnelName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchResourceIdFromVpnTunnelName', () => { - const result = client.matchResourceIdFromVpnTunnelName(fakePath); - assert.strictEqual(result, "resourceIdValue"); - assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/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/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js deleted file mode 100644 index 2412b4e..0000000 --- a/owl-bot-staging/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: 'HubService', - filename: './hub-service.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/v1alpha1/.eslintignore b/owl-bot-staging/v1alpha1/.eslintignore deleted file mode 100644 index cfc348e..0000000 --- a/owl-bot-staging/v1alpha1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1alpha1/.eslintrc.json b/owl-bot-staging/v1alpha1/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v1alpha1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1alpha1/.gitignore b/owl-bot-staging/v1alpha1/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/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/v1alpha1/.jsdoc.js b/owl-bot-staging/v1alpha1/.jsdoc.js deleted file mode 100644 index 7d9f7fc..0000000 --- a/owl-bot-staging/v1alpha1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -'use strict'; - -module.exports = { - opts: { - readme: './README.md', - package: './package.json', - template: './node_modules/jsdoc-fresh', - recurse: true, - verbose: true, - destination: './docs/' - }, - plugins: [ - 'plugins/markdown', - 'jsdoc-region-tag' - ], - source: { - excludePattern: '(^|\\/|\\\\)[._]', - include: [ - 'build/src', - 'protos' - ], - includePattern: '\\.js$' - }, - templates: { - copyright: 'Copyright 2022 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/network-connectivity', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1alpha1/.mocharc.js b/owl-bot-staging/v1alpha1/.mocharc.js deleted file mode 100644 index 481c522..0000000 --- a/owl-bot-staging/v1alpha1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -if (process.env.MOCHA_THROW_DEPRECATION === 'false') { - delete config['throw-deprecation']; -} -if (process.env.MOCHA_REPORTER) { - config.reporter = process.env.MOCHA_REPORTER; -} -if (process.env.MOCHA_REPORTER_OUTPUT) { - config['reporter-option'] = `output=${process.env.MOCHA_REPORTER_OUTPUT}`; -} -module.exports = config diff --git a/owl-bot-staging/v1alpha1/.prettierrc.js b/owl-bot-staging/v1alpha1/.prettierrc.js deleted file mode 100644 index 494e147..0000000 --- a/owl-bot-staging/v1alpha1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1alpha1/README.md b/owl-bot-staging/v1alpha1/README.md deleted file mode 100644 index 086026d..0000000 --- a/owl-bot-staging/v1alpha1/README.md +++ /dev/null @@ -1 +0,0 @@ -Networkconnectivity: Nodejs Client diff --git a/owl-bot-staging/v1alpha1/linkinator.config.json b/owl-bot-staging/v1alpha1/linkinator.config.json deleted file mode 100644 index befd23c..0000000 --- a/owl-bot-staging/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/v1alpha1/package.json b/owl-bot-staging/v1alpha1/package.json deleted file mode 100644 index 695c121..0000000 --- a/owl-bot-staging/v1alpha1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/network-connectivity", - "version": "0.1.0", - "description": "Networkconnectivity client for Node.js", - "repository": "googleapis/nodejs-networkconnectivity", - "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 networkconnectivity", - "networkconnectivity", - "hub service" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^3.1.1" - }, - "devDependencies": { - "@types/mocha": "^9.1.0", - "@types/node": "^16.0.0", - "@types/sinon": "^10.0.8", - "c8": "^7.11.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^3.0.0", - "mocha": "^9.1.4", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^13.0.0", - "ts-loader": "^9.2.6", - "typescript": "^4.5.5", - "webpack": "^5.67.0", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v12" - } -} diff --git a/owl-bot-staging/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/common.proto b/owl-bot-staging/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/common.proto deleted file mode 100644 index 88c3fe5..0000000 --- a/owl-bot-staging/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/common.proto +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.networkconnectivity.v1alpha1; - -import "google/api/field_behavior.proto"; -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1Alpha1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1;networkconnectivity"; -option java_multiple_files = true; -option java_outer_classname = "CommonProto"; -option java_package = "com.google.cloud.networkconnectivity.v1alpha1"; -option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1alpha1"; -option ruby_package = "Google::Cloud::NetworkConnectivity::V1alpha1"; - -// 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]; -} diff --git a/owl-bot-staging/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/hub.proto b/owl-bot-staging/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/hub.proto deleted file mode 100644 index 6f1b8ee..0000000 --- a/owl-bot-staging/v1alpha1/protos/google/cloud/networkconnectivity/v1alpha1/hub.proto +++ /dev/null @@ -1,551 +0,0 @@ -// Copyright 2020 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.networkconnectivity.v1alpha1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; - -option csharp_namespace = "Google.Cloud.NetworkConnectivity.V1Alpha1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1;networkconnectivity"; -option java_multiple_files = true; -option java_outer_classname = "HubProto"; -option java_package = "com.google.cloud.networkconnectivity.v1alpha1"; -option php_namespace = "Google\\Cloud\\NetworkConnectivity\\V1alpha1"; -option ruby_package = "Google::Cloud::NetworkConnectivity::V1alpha1"; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/VpnTunnel" - pattern: "projects/{project}/regions/{region}/vpnTunnels/{resource_id}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/InterconnectAttachment" - pattern: "projects/{project}/regions/{region}/interconnectAttachments/{resource_id}" -}; -option (google.api.resource_definition) = { - type: "compute.googleapis.com/Instance" - pattern: "projects/{project}/zones/{zone}/instances/{instance}" -}; - -// Network Connectivity Center is a hub-and-spoke abstraction for -// network connectivity management in Google Cloud. It reduces -// operational complexity through a simple, centralized connectivity management -// model. -service HubService { - option (google.api.default_host) = "networkconnectivity.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists Hubs in a given project and location. - rpc ListHubs(ListHubsRequest) returns (ListHubsResponse) { - option (google.api.http) = { - get: "/v1alpha1/{parent=projects/*/locations/global}/hubs" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single Hub. - rpc GetHub(GetHubRequest) returns (Hub) { - option (google.api.http) = { - get: "/v1alpha1/{name=projects/*/locations/global/hubs/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new Hub in a given project and location. - rpc CreateHub(CreateHubRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha1/{parent=projects/*/locations/global}/hubs" - body: "hub" - }; - option (google.api.method_signature) = "parent,hub,hub_id"; - option (google.longrunning.operation_info) = { - response_type: "Hub" - metadata_type: "OperationMetadata" - }; - } - - // Updates the parameters of a single Hub. - rpc UpdateHub(UpdateHubRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1alpha1/{hub.name=projects/*/locations/global/hubs/*}" - body: "hub" - }; - option (google.api.method_signature) = "hub,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Hub" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a single Hub. - rpc DeleteHub(DeleteHubRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1alpha1/{name=projects/*/locations/global/hubs/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } - - // Lists Spokes in a given project and location. - rpc ListSpokes(ListSpokesRequest) returns (ListSpokesResponse) { - option (google.api.http) = { - get: "/v1alpha1/{parent=projects/*/locations/*}/spokes" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets details of a single Spoke. - rpc GetSpoke(GetSpokeRequest) returns (Spoke) { - option (google.api.http) = { - get: "/v1alpha1/{name=projects/*/locations/*/spokes/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates a new Spoke in a given project and location. - rpc CreateSpoke(CreateSpokeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1alpha1/{parent=projects/*/locations/*}/spokes" - body: "spoke" - }; - option (google.api.method_signature) = "parent,spoke,spoke_id"; - option (google.longrunning.operation_info) = { - response_type: "Spoke" - metadata_type: "OperationMetadata" - }; - } - - // Updates the parameters of a single Spoke. - rpc UpdateSpoke(UpdateSpokeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - patch: "/v1alpha1/{spoke.name=projects/*/locations/*/spokes/*}" - body: "spoke" - }; - option (google.api.method_signature) = "spoke,update_mask"; - option (google.longrunning.operation_info) = { - response_type: "Spoke" - metadata_type: "OperationMetadata" - }; - } - - // Deletes a single Spoke. - rpc DeleteSpoke(DeleteSpokeRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1alpha1/{name=projects/*/locations/*/spokes/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "OperationMetadata" - }; - } -} - -// Network Connectivity Center is a hub-and-spoke abstraction for -// network connectivity management in Google Cloud. It reduces -// operational complexity through a simple, centralized connectivity management -// model. Following is the resource message of a hub. -message Hub { - option (google.api.resource) = { - type: "networkconnectivity.googleapis.com/Hub" - pattern: "projects/{project}/locations/global/hubs/{hub}" - }; - - // Immutable. The name of a Hub resource. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Time when the Hub was created. - google.protobuf.Timestamp create_time = 2; - - // Time when the Hub was updated. - google.protobuf.Timestamp update_time = 3; - - // User-defined labels. - map labels = 4; - - // Short description of the hub resource. - string description = 5; - - // Output only. A list of the URIs of all attached spokes - repeated string spokes = 6 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Spoke" - } - ]; - - // Output only. Google-generated UUID for this resource. This is unique across all Hub - // resources. If a Hub resource is deleted and another with the same name is - // created, it gets a different unique_id. - string unique_id = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current lifecycle state of this Hub. - State state = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A Spoke is an abstraction of a network attachment being attached -// to a Hub. A Spoke can be underlying a VPN tunnel, a -// VLAN (interconnect) attachment, a Router appliance, etc. -message Spoke { - option (google.api.resource) = { - type: "networkconnectivity.googleapis.com/Spoke" - pattern: "projects/{project}/locations/{location}/spokes/{spoke}" - }; - - // Immutable. The name of a Spoke resource. - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // The time when the Spoke was created. - google.protobuf.Timestamp create_time = 2; - - // The time when the Spoke was updated. - google.protobuf.Timestamp update_time = 3; - - // User-defined labels. - map labels = 4; - - // Short description of the spoke resource - string description = 5; - - // The resource URL of the hub resource that the spoke is attached to - string hub = 6 [(google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Hub" - }]; - - // The URIs of linked VPN tunnel resources - repeated string linked_vpn_tunnels = 12 [(google.api.resource_reference) = { - type: "compute.googleapis.com/VpnTunnel" - }]; - - // The URIs of linked interconnect attachment resources - repeated string linked_interconnect_attachments = 13 [(google.api.resource_reference) = { - type: "compute.googleapis.com/InterconnectAttachment" - }]; - - // The URIs of linked Router appliance resources - repeated RouterApplianceInstance linked_router_appliance_instances = 14; - - // Output only. Google-generated UUID for this resource. This is unique across all Spoke - // resources. If a Spoke resource is deleted and another with the same name is - // created, it gets a different unique_id. - string unique_id = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current lifecycle state of this Hub. - State state = 15 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Request for [HubService.ListHubs][google.cloud.networkconnectivity.v1alpha1.HubService.ListHubs] method. -message ListHubsRequest { - // Required. The parent resource's name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of results per page that should be returned. - int32 page_size = 2; - - // The page token. - string page_token = 3; - - // A filter expression that filters the results listed in the response. - string filter = 4; - - // Sort the results by a certain order. - string order_by = 5; -} - -// Response for [HubService.ListHubs][google.cloud.networkconnectivity.v1alpha1.HubService.ListHubs] method. -message ListHubsResponse { - // Hubs to be returned. - repeated Hub hubs = 1; - - // The next pagination token in the List response. It should be used as - // page_token for the following request. An empty value means no more result. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// Request for [HubService.GetHub][google.cloud.networkconnectivity.v1alpha1.HubService.GetHub] method. -message GetHubRequest { - // Required. Name of the Hub resource to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Hub" - } - ]; -} - -// Request for [HubService.CreateHub][google.cloud.networkconnectivity.v1alpha1.HubService.CreateHub] method. -message CreateHubRequest { - // Required. The parent resource's name of the Hub. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. Unique id for the Hub to create. - string hub_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Initial values for a new Hub. - Hub hub = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional 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 t - // he 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]; -} - -// Request for [HubService.UpdateHub][google.cloud.networkconnectivity.v1alpha1.HubService.UpdateHub] method. -message UpdateHubRequest { - // Optional. Field mask is used to specify the fields to be overwritten in the - // Hub 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 state that the Hub should be in after the update. - Hub hub = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional 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 t - // he 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]; -} - -// The request for [HubService.DeleteHub][google.cloud.networkconnectivity.v1alpha1.HubService.DeleteHub]. -message DeleteHubRequest { - // Required. The name of the Hub to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Hub" - } - ]; - - // Optional. An optional 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 t - // he 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]; -} - -// The request for [HubService.ListSpokes][google.cloud.networkconnectivity.v1alpha1.HubService.ListSpokes]. -message ListSpokesRequest { - // Required. The parent's resource name. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of results per page that should be returned. - int32 page_size = 2; - - // The page token. - string page_token = 3; - - // A filter expression that filters the results listed in the response. - string filter = 4; - - // Sort the results by a certain order. - string order_by = 5; -} - -// The response for [HubService.ListSpokes][google.cloud.networkconnectivity.v1alpha1.HubService.ListSpokes]. -message ListSpokesResponse { - // Spokes to be returned. - repeated Spoke spokes = 1; - - // The next pagination token in the List response. It should be used as - // page_token for the following request. An empty value means no more result. - string next_page_token = 2; - - // Locations that could not be reached. - repeated string unreachable = 3; -} - -// The request for [HubService.GetSpoke][google.cloud.networkconnectivity.v1alpha1.HubService.GetSpoke]. -message GetSpokeRequest { - // Required. The name of Spoke resource. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Spoke" - } - ]; -} - -// The request for [HubService.CreateSpoke][google.cloud.networkconnectivity.v1alpha1.HubService.CreateSpoke]. -message CreateSpokeRequest { - // Required. The parent's resource name of the Spoke. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Optional. Unique id for the Spoke to create. - string spoke_id = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Required. Initial values for a new Hub. - Spoke spoke = 3 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional 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 t - // he 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]; -} - -// Request for [HubService.UpdateSpoke][google.cloud.networkconnectivity.v1alpha1.HubService.UpdateSpoke] method. -message UpdateSpokeRequest { - // Optional. Field mask is used to specify the fields to be overwritten in the - // Spoke 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 state that the Spoke should be in after the update. - Spoke spoke = 2 [(google.api.field_behavior) = REQUIRED]; - - // Optional. An optional 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 t - // he 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]; -} - -// The request for [HubService.DeleteSpoke][google.cloud.networkconnectivity.v1alpha1.HubService.DeleteSpoke]. -message DeleteSpokeRequest { - // Required. The name of the Spoke to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "networkconnectivity.googleapis.com/Spoke" - } - ]; - - // Optional. An optional 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 t - // he 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]; -} - -// RouterAppliance represents a Router appliance which is specified by a VM URI -// and a NIC address. -message RouterApplianceInstance { - // The URI of the virtual machine resource - string virtual_machine = 1 [(google.api.resource_reference) = { - type: "compute.googleapis.com/Instance" - }]; - - // The IP address of the network interface to use for peering. - string ip_address = 3; - - string network_interface = 2 [deprecated = true]; -} - -// The State enum represents the lifecycle of a Network Connectivity Center -// resource. -enum State { - // No state information available - STATE_UNSPECIFIED = 0; - - // The resource's create operation is in progress - CREATING = 1; - - // The resource is active - ACTIVE = 2; - - // The resource's Delete operation is in progress - DELETING = 3; -} diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.create_hub.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.create_hub.js deleted file mode 100644 index 7851233..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.create_hub.js +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, hub) { - // [START networkconnectivity_v1alpha1_generated_HubService_CreateHub_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource's name of the Hub. - */ - // const parent = 'abc123' - /** - * Optional. Unique id for the Hub to create. - */ - // const hubId = 'abc123' - /** - * Required. Initial values for a new Hub. - */ - // const hub = {} - /** - * Optional. An optional 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 t - * he 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 Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callCreateHub() { - // Construct request - const request = { - parent, - hub, - }; - - // Run request - const [operation] = await networkconnectivityClient.createHub(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateHub(); - // [END networkconnectivity_v1alpha1_generated_HubService_CreateHub_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.create_spoke.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.create_spoke.js deleted file mode 100644 index 259a033..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.create_spoke.js +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, spoke) { - // [START networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent's resource name of the Spoke. - */ - // const parent = 'abc123' - /** - * Optional. Unique id for the Spoke to create. - */ - // const spokeId = 'abc123' - /** - * Required. Initial values for a new Hub. - */ - // const spoke = {} - /** - * Optional. An optional 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 t - * he 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 Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callCreateSpoke() { - // Construct request - const request = { - parent, - spoke, - }; - - // Run request - const [operation] = await networkconnectivityClient.createSpoke(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateSpoke(); - // [END networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.delete_hub.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.delete_hub.js deleted file mode 100644 index 934adfe..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.delete_hub.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START networkconnectivity_v1alpha1_generated_HubService_DeleteHub_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Hub to delete. - */ - // const name = 'abc123' - /** - * Optional. An optional 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 t - * he 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 Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callDeleteHub() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await networkconnectivityClient.deleteHub(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteHub(); - // [END networkconnectivity_v1alpha1_generated_HubService_DeleteHub_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.delete_spoke.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.delete_spoke.js deleted file mode 100644 index 8e08b13..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.delete_spoke.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the Spoke to delete. - */ - // const name = 'abc123' - /** - * Optional. An optional 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 t - * he 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 Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callDeleteSpoke() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await networkconnectivityClient.deleteSpoke(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteSpoke(); - // [END networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.get_hub.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.get_hub.js deleted file mode 100644 index c5f1181..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.get_hub.js +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START networkconnectivity_v1alpha1_generated_HubService_GetHub_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Name of the Hub resource to get. - */ - // const name = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callGetHub() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await networkconnectivityClient.getHub(request); - console.log(response); - } - - callGetHub(); - // [END networkconnectivity_v1alpha1_generated_HubService_GetHub_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.get_spoke.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.get_spoke.js deleted file mode 100644 index 47ce4c7..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.get_spoke.js +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START networkconnectivity_v1alpha1_generated_HubService_GetSpoke_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of Spoke resource. - */ - // const name = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callGetSpoke() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await networkconnectivityClient.getSpoke(request); - console.log(response); - } - - callGetSpoke(); - // [END networkconnectivity_v1alpha1_generated_HubService_GetSpoke_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.list_hubs.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.list_hubs.js deleted file mode 100644 index f997316..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.list_hubs.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START networkconnectivity_v1alpha1_generated_HubService_ListHubs_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource's name. - */ - // const parent = 'abc123' - /** - * The maximum number of results per page that should be returned. - */ - // const pageSize = 1234 - /** - * The page token. - */ - // const pageToken = 'abc123' - /** - * A filter expression that filters the results listed in the response. - */ - // const filter = 'abc123' - /** - * Sort the results by a certain order. - */ - // const orderBy = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callListHubs() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await networkconnectivityClient.listHubsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListHubs(); - // [END networkconnectivity_v1alpha1_generated_HubService_ListHubs_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.list_spokes.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.list_spokes.js deleted file mode 100644 index 64eabec..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.list_spokes.js +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START networkconnectivity_v1alpha1_generated_HubService_ListSpokes_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent's resource name. - */ - // const parent = 'abc123' - /** - * The maximum number of results per page that should be returned. - */ - // const pageSize = 1234 - /** - * The page token. - */ - // const pageToken = 'abc123' - /** - * A filter expression that filters the results listed in the response. - */ - // const filter = 'abc123' - /** - * Sort the results by a certain order. - */ - // const orderBy = 'abc123' - - // Imports the Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callListSpokes() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await networkconnectivityClient.listSpokesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSpokes(); - // [END networkconnectivity_v1alpha1_generated_HubService_ListSpokes_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.update_hub.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.update_hub.js deleted file mode 100644 index e69b800..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.update_hub.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(hub) { - // [START networkconnectivity_v1alpha1_generated_HubService_UpdateHub_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. Field mask is used to specify the fields to be overwritten in the - * Hub 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 state that the Hub should be in after the update. - */ - // const hub = {} - /** - * Optional. An optional 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 t - * he 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 Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callUpdateHub() { - // Construct request - const request = { - hub, - }; - - // Run request - const [operation] = await networkconnectivityClient.updateHub(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateHub(); - // [END networkconnectivity_v1alpha1_generated_HubService_UpdateHub_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.update_spoke.js b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.update_spoke.js deleted file mode 100644 index 69c5bbb..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/hub_service.update_spoke.js +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(spoke) { - // [START networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Optional. Field mask is used to specify the fields to be overwritten in the - * Spoke 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 state that the Spoke should be in after the update. - */ - // const spoke = {} - /** - * Optional. An optional 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 t - * he 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 Networkconnectivity library - const {HubServiceClient} = require('@google-cloud/network-connectivity').v1alpha1; - - // Instantiates a client - const networkconnectivityClient = new HubServiceClient(); - - async function callUpdateSpoke() { - // Construct request - const request = { - spoke, - }; - - // Run request - const [operation] = await networkconnectivityClient.updateSpoke(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUpdateSpoke(); - // [END networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/snippet_metadata.google.cloud.networkconnectivity.v1alpha1.json b/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/snippet_metadata.google.cloud.networkconnectivity.v1alpha1.json deleted file mode 100644 index c323742..0000000 --- a/owl-bot-staging/v1alpha1/samples/generated/v1alpha1/snippet_metadata.google.cloud.networkconnectivity.v1alpha1.json +++ /dev/null @@ -1,495 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-networkconnectivity", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.networkconnectivity.v1alpha1", - "version": "v1alpha1" - } - ] - }, - "snippets": [ - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_ListHubs_async", - "title": "HubService listHubs Sample", - "origin": "API_DEFINITION", - "description": " Lists Hubs in a given project and location.", - "canonical": true, - "file": "hub_service.list_hubs.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListHubs", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.ListHubs", - "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.networkconnectivity.v1alpha1.ListHubsResponse", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "ListHubs", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.ListHubs", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_GetHub_async", - "title": "HubService getHub Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single Hub.", - "canonical": true, - "file": "hub_service.get_hub.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 50, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetHub", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.GetHub", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.networkconnectivity.v1alpha1.Hub", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "GetHub", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.GetHub", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_CreateHub_async", - "title": "HubService createHub Sample", - "origin": "API_DEFINITION", - "description": " Creates a new Hub in a given project and location.", - "canonical": true, - "file": "hub_service.create_hub.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateHub", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.CreateHub", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "hub_id", - "type": "TYPE_STRING" - }, - { - "name": "hub", - "type": ".google.cloud.networkconnectivity.v1alpha1.Hub" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "CreateHub", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.CreateHub", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_UpdateHub_async", - "title": "HubService updateHub Sample", - "origin": "API_DEFINITION", - "description": " Updates the parameters of a single Hub.", - "canonical": true, - "file": "hub_service.update_hub.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateHub", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.UpdateHub", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "hub", - "type": ".google.cloud.networkconnectivity.v1alpha1.Hub" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "UpdateHub", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.UpdateHub", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_DeleteHub_async", - "title": "HubService deleteHub Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single Hub.", - "canonical": true, - "file": "hub_service.delete_hub.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteHub", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.DeleteHub", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "DeleteHub", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.DeleteHub", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_ListSpokes_async", - "title": "HubService listSpokes Sample", - "origin": "API_DEFINITION", - "description": " Lists Spokes in a given project and location.", - "canonical": true, - "file": "hub_service.list_spokes.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 68, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSpokes", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.ListSpokes", - "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.networkconnectivity.v1alpha1.ListSpokesResponse", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "ListSpokes", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.ListSpokes", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_GetSpoke_async", - "title": "HubService getSpoke Sample", - "origin": "API_DEFINITION", - "description": " Gets details of a single Spoke.", - "canonical": true, - "file": "hub_service.get_spoke.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 50, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSpoke", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.GetSpoke", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.networkconnectivity.v1alpha1.Spoke", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "GetSpoke", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.GetSpoke", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_async", - "title": "HubService createSpoke Sample", - "origin": "API_DEFINITION", - "description": " Creates a new Spoke in a given project and location.", - "canonical": true, - "file": "hub_service.create_spoke.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 74, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSpoke", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.CreateSpoke", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "spoke_id", - "type": "TYPE_STRING" - }, - { - "name": "spoke", - "type": ".google.cloud.networkconnectivity.v1alpha1.Spoke" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "CreateSpoke", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.CreateSpoke", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_async", - "title": "HubService updateSpoke Sample", - "origin": "API_DEFINITION", - "description": " Updates the parameters of a single Spoke.", - "canonical": true, - "file": "hub_service.update_spoke.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSpoke", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.UpdateSpoke", - "async": true, - "parameters": [ - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - }, - { - "name": "spoke", - "type": ".google.cloud.networkconnectivity.v1alpha1.Spoke" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "UpdateSpoke", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.UpdateSpoke", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - }, - { - "regionTag": "networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_async", - "title": "HubService deleteSpoke Sample", - "origin": "API_DEFINITION", - "description": " Deletes a single Spoke.", - "canonical": true, - "file": "hub_service.delete_spoke.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 65, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteSpoke", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.DeleteSpoke", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "request_id", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.longrunning.Operation", - "client": { - "shortName": "HubServiceClient", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubServiceClient" - }, - "method": { - "shortName": "DeleteSpoke", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService.DeleteSpoke", - "service": { - "shortName": "HubService", - "fullName": "google.cloud.networkconnectivity.v1alpha1.HubService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1alpha1/src/index.ts b/owl-bot-staging/v1alpha1/src/index.ts deleted file mode 100644 index c3052ee..0000000 --- a/owl-bot-staging/v1alpha1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1alpha1 from './v1alpha1'; -const HubServiceClient = v1alpha1.HubServiceClient; -type HubServiceClient = v1alpha1.HubServiceClient; -export {v1alpha1, HubServiceClient}; -export default {v1alpha1, HubServiceClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1alpha1/src/v1alpha1/gapic_metadata.json b/owl-bot-staging/v1alpha1/src/v1alpha1/gapic_metadata.json deleted file mode 100644 index c9dd97f..0000000 --- a/owl-bot-staging/v1alpha1/src/v1alpha1/gapic_metadata.json +++ /dev/null @@ -1,131 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.networkconnectivity.v1alpha1", - "libraryPackage": "@google-cloud/network-connectivity", - "services": { - "HubService": { - "clients": { - "grpc": { - "libraryClient": "HubServiceClient", - "rpcs": { - "GetHub": { - "methods": [ - "getHub" - ] - }, - "GetSpoke": { - "methods": [ - "getSpoke" - ] - }, - "CreateHub": { - "methods": [ - "createHub" - ] - }, - "UpdateHub": { - "methods": [ - "updateHub" - ] - }, - "DeleteHub": { - "methods": [ - "deleteHub" - ] - }, - "CreateSpoke": { - "methods": [ - "createSpoke" - ] - }, - "UpdateSpoke": { - "methods": [ - "updateSpoke" - ] - }, - "DeleteSpoke": { - "methods": [ - "deleteSpoke" - ] - }, - "ListHubs": { - "methods": [ - "listHubs", - "listHubsStream", - "listHubsAsync" - ] - }, - "ListSpokes": { - "methods": [ - "listSpokes", - "listSpokesStream", - "listSpokesAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "HubServiceClient", - "rpcs": { - "GetHub": { - "methods": [ - "getHub" - ] - }, - "GetSpoke": { - "methods": [ - "getSpoke" - ] - }, - "CreateHub": { - "methods": [ - "createHub" - ] - }, - "UpdateHub": { - "methods": [ - "updateHub" - ] - }, - "DeleteHub": { - "methods": [ - "deleteHub" - ] - }, - "CreateSpoke": { - "methods": [ - "createSpoke" - ] - }, - "UpdateSpoke": { - "methods": [ - "updateSpoke" - ] - }, - "DeleteSpoke": { - "methods": [ - "deleteSpoke" - ] - }, - "ListHubs": { - "methods": [ - "listHubs", - "listHubsStream", - "listHubsAsync" - ] - }, - "ListSpokes": { - "methods": [ - "listSpokes", - "listSpokesStream", - "listSpokesAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_client.ts b/owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_client.ts deleted file mode 100644 index ce69481..0000000 --- a/owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_client.ts +++ /dev/null @@ -1,1837 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -/* global window */ -import * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, GrpcClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1alpha1/hub_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './hub_service_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * Network Connectivity Center is a hub-and-spoke abstraction for - * network connectivity management in Google Cloud. It reduces - * operational complexity through a simple, centralized connectivity management - * model. - * @class - * @memberof v1alpha1 - */ -export class HubServiceClient { - 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; - hubServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of HubServiceClient. - * - * @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}. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof HubServiceClient; - const servicePath = opts?.servicePath || opts?.apiEndpoint || staticMembers.servicePath; - this._providedCustomServicePath = !!(opts?.servicePath || opts?.apiEndpoint); - const port = opts?.port || staticMembers.port; - const clientConfig = opts?.clientConfig ?? {}; - const fallback = opts?.fallback ?? (typeof window !== 'undefined' && typeof window?.fetch === 'function'); - opts = Object.assign({servicePath, port, clientConfig, fallback}, opts); - - // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. - if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { - opts['scopes'] = staticMembers.scopes; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - hubPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/global/hubs/{hub}' - ), - instancePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/zones/{zone}/instances/{instance}' - ), - interconnectAttachmentPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/interconnectAttachments/{resource_id}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - spokePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/spokes/{spoke}' - ), - vpnTunnelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/regions/{region}/vpnTunnels/{resource_id}' - ), - }; - - // 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 = { - listHubs: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'hubs'), - listSpokes: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'spokes') - }; - - 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.iam.v1.IAMPolicy.GetIamPolicy',get: '/v1alpha1/{resource=projects/*/locations/global/hubs/*}:getIamPolicy',additional_bindings: [{get: '/v1alpha1/{resource=projects/*/locations/*/spokes/*}:getIamPolicy',}], - },{selector: 'google.iam.v1.IAMPolicy.SetIamPolicy',post: '/v1alpha1/{resource=projects/*/locations/global/hubs/*}:setIamPolicy',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/spokes/*}:setIamPolicy',body: '*',}], - },{selector: 'google.iam.v1.IAMPolicy.TestIamPermissions',post: '/v1alpha1/{resource=projects/*/locations/global/hubs/*}:testIamPermissions',body: '*',additional_bindings: [{post: '/v1alpha1/{resource=projects/*/locations/*/spokes/*}:testIamPermissions',body: '*',}], - },{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 createHubResponse = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.Hub') as gax.protobuf.Type; - const createHubMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const updateHubResponse = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.Hub') as gax.protobuf.Type; - const updateHubMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const deleteHubResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteHubMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const createSpokeResponse = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.Spoke') as gax.protobuf.Type; - const createSpokeMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const updateSpokeResponse = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.Spoke') as gax.protobuf.Type; - const updateSpokeMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; - const deleteSpokeResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteSpokeMetadata = protoFilesRoot.lookup( - '.google.cloud.networkconnectivity.v1alpha1.OperationMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createHub: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createHubResponse.decode.bind(createHubResponse), - createHubMetadata.decode.bind(createHubMetadata)), - updateHub: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateHubResponse.decode.bind(updateHubResponse), - updateHubMetadata.decode.bind(updateHubMetadata)), - deleteHub: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteHubResponse.decode.bind(deleteHubResponse), - deleteHubMetadata.decode.bind(deleteHubMetadata)), - createSpoke: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createSpokeResponse.decode.bind(createSpokeResponse), - createSpokeMetadata.decode.bind(createSpokeMetadata)), - updateSpoke: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - updateSpokeResponse.decode.bind(updateSpokeResponse), - updateSpokeMetadata.decode.bind(updateSpokeMetadata)), - deleteSpoke: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteSpokeResponse.decode.bind(deleteSpokeResponse), - deleteSpokeMetadata.decode.bind(deleteSpokeMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.networkconnectivity.v1alpha1.HubService', gapicConfig as gax.ClientConfig, - opts.clientConfig || {}, {'x-goog-api-client': clientHeader.join(' ')}); - - // Set up a dictionary of "inner API calls"; the core implementation - // of calling the API is handled in `google-gax`, with this code - // merely providing the destination and request information. - this.innerApiCalls = {}; - - // Add a warn function to the client constructor so it can be easily tested. - this.warn = gax.warn; - } - - /** - * Initialize the client. - * Performs asynchronous operations (such as authentication) and prepares the client. - * This function will be called automatically when any class method is called for the - * first time, but if you need to initialize it before calling an actual method, - * feel free to call initialize() directly. - * - * You can await on this method if you want to make sure the client is initialized. - * - * @returns {Promise} A promise that resolves to an authenticated service stub. - */ - initialize() { - // If the client stub promise is already initialized, return immediately. - if (this.hubServiceStub) { - return this.hubServiceStub; - } - - // Put together the "service stub" for - // google.cloud.networkconnectivity.v1alpha1.HubService. - this.hubServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.networkconnectivity.v1alpha1.HubService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.networkconnectivity.v1alpha1.HubService, - 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 hubServiceStubMethods = - ['listHubs', 'getHub', 'createHub', 'updateHub', 'deleteHub', 'listSpokes', 'getSpoke', 'createSpoke', 'updateSpoke', 'deleteSpoke']; - for (const methodName of hubServiceStubMethods) { - const callPromise = this.hubServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - this.descriptors.longrunning[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.hubServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'networkconnectivity.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 'networkconnectivity.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Gets details of a single Hub. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. Name of the Hub 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 [Hub]{@link google.cloud.networkconnectivity.v1alpha1.Hub}. - * 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/hub_service.get_hub.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_GetHub_async - */ - getHub( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkconnectivity.v1alpha1.IHub, - protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|undefined, {}|undefined - ]>; - getHub( - request: protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networkconnectivity.v1alpha1.IHub, - protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|null|undefined, - {}|null|undefined>): void; - getHub( - request: protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest, - callback: Callback< - protos.google.cloud.networkconnectivity.v1alpha1.IHub, - protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|null|undefined, - {}|null|undefined>): void; - getHub( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networkconnectivity.v1alpha1.IHub, - protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.networkconnectivity.v1alpha1.IHub, - protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networkconnectivity.v1alpha1.IHub, - protos.google.cloud.networkconnectivity.v1alpha1.IGetHubRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getHub(request, options, callback); - } -/** - * Gets details of a single Spoke. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of Spoke resource. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Spoke]{@link google.cloud.networkconnectivity.v1alpha1.Spoke}. - * 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/hub_service.get_spoke.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_GetSpoke_async - */ - getSpoke( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, - protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|undefined, {}|undefined - ]>; - getSpoke( - request: protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, - protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|null|undefined, - {}|null|undefined>): void; - getSpoke( - request: protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest, - callback: Callback< - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, - protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|null|undefined, - {}|null|undefined>): void; - getSpoke( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, - protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, - protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke, - protos.google.cloud.networkconnectivity.v1alpha1.IGetSpokeRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getSpoke(request, options, callback); - } - -/** - * Creates a new Hub in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource's name of the Hub. - * @param {string} [request.hubId] - * Optional. Unique id for the Hub to create. - * @param {google.cloud.networkconnectivity.v1alpha1.Hub} request.hub - * Required. Initial values for a new Hub. - * @param {string} [request.requestId] - * Optional. An optional 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 t - * he 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/hub_service.create_hub.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_CreateHub_async - */ - createHub( - request?: protos.google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createHub( - request: protos.google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createHub( - request: protos.google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createHub( - request?: protos.google.cloud.networkconnectivity.v1alpha1.ICreateHubRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createHub(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createHub()`. - * @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/hub_service.create_hub.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_CreateHub_async - */ - async checkCreateHubProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createHub, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the parameters of a single Hub. - * - * @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 - * Hub 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.networkconnectivity.v1alpha1.Hub} request.hub - * Required. The state that the Hub should be in after the update. - * @param {string} [request.requestId] - * Optional. An optional 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 t - * he 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/hub_service.update_hub.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_UpdateHub_async - */ - updateHub( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateHubRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateHub( - request: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateHubRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateHub( - request: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateHubRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateHub( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateHubRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'hub.name': request.hub!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateHub(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateHub()`. - * @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/hub_service.update_hub.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_UpdateHub_async - */ - async checkUpdateHubProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateHub, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single Hub. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Hub to delete. - * @param {string} [request.requestId] - * Optional. An optional 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 t - * he 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/hub_service.delete_hub.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_DeleteHub_async - */ - deleteHub( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteHubRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteHub( - request: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteHubRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteHub( - request: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteHubRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteHub( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteHubRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteHub(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteHub()`. - * @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/hub_service.delete_hub.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_DeleteHub_async - */ - async checkDeleteHubProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteHub, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates a new Spoke in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent's resource name of the Spoke. - * @param {string} [request.spokeId] - * Optional. Unique id for the Spoke to create. - * @param {google.cloud.networkconnectivity.v1alpha1.Spoke} request.spoke - * Required. Initial values for a new Hub. - * @param {string} [request.requestId] - * Optional. An optional 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 t - * he 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/hub_service.create_spoke.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_async - */ - createSpoke( - request?: protos.google.cloud.networkconnectivity.v1alpha1.ICreateSpokeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createSpoke( - request: protos.google.cloud.networkconnectivity.v1alpha1.ICreateSpokeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createSpoke( - request: protos.google.cloud.networkconnectivity.v1alpha1.ICreateSpokeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createSpoke( - request?: protos.google.cloud.networkconnectivity.v1alpha1.ICreateSpokeRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createSpoke(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createSpoke()`. - * @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/hub_service.create_spoke.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_CreateSpoke_async - */ - async checkCreateSpokeProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createSpoke, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Updates the parameters of a single Spoke. - * - * @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 - * Spoke 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.networkconnectivity.v1alpha1.Spoke} request.spoke - * Required. The state that the Spoke should be in after the update. - * @param {string} [request.requestId] - * Optional. An optional 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 t - * he 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/hub_service.update_spoke.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_async - */ - updateSpoke( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateSpokeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - updateSpoke( - request: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateSpokeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateSpoke( - request: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateSpokeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - updateSpoke( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IUpdateSpokeRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'spoke.name': request.spoke!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateSpoke(request, options, callback); - } -/** - * Check the status of the long running operation returned by `updateSpoke()`. - * @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/hub_service.update_spoke.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_UpdateSpoke_async - */ - async checkUpdateSpokeProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.updateSpoke, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes a single Spoke. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the Spoke to delete. - * @param {string} [request.requestId] - * Optional. An optional 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 t - * he 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/hub_service.delete_spoke.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_async - */ - deleteSpoke( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteSpokeRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteSpoke( - request: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteSpokeRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteSpoke( - request: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteSpokeRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteSpoke( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IDeleteSpokeRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteSpoke(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteSpoke()`. - * @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/hub_service.delete_spoke.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_DeleteSpoke_async - */ - async checkDeleteSpokeProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteSpoke, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists Hubs in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource's name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * A filter expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Hub]{@link google.cloud.networkconnectivity.v1alpha1.Hub}. - * 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 `listHubsAsync()` - * 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. - */ - listHubs( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkconnectivity.v1alpha1.IHub[], - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest|null, - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse - ]>; - listHubs( - request: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1alpha1.IHub>): void; - listHubs( - request: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - callback: PaginationCallback< - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1alpha1.IHub>): void; - listHubs( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1alpha1.IHub>, - callback?: PaginationCallback< - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1alpha1.IHub>): - Promise<[ - protos.google.cloud.networkconnectivity.v1alpha1.IHub[], - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest|null, - protos.google.cloud.networkconnectivity.v1alpha1.IListHubsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listHubs(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource's name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * A filter expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @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 [Hub]{@link google.cloud.networkconnectivity.v1alpha1.Hub} 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 `listHubsAsync()` - * 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. - */ - listHubsStream( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listHubs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listHubs.createStream( - this.innerApiCalls.listHubs as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listHubs`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource's name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * A filter expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @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 - * [Hub]{@link google.cloud.networkconnectivity.v1alpha1.Hub}. 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/hub_service.list_hubs.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_ListHubs_async - */ - listHubsAsync( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IListHubsRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listHubs']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listHubs.asyncIterate( - this.innerApiCalls['listHubs'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists Spokes in a given project and location. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent's resource name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * A filter expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Spoke]{@link google.cloud.networkconnectivity.v1alpha1.Spoke}. - * 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 `listSpokesAsync()` - * 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. - */ - listSpokes( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[], - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest|null, - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse - ]>; - listSpokes( - request: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke>): void; - listSpokes( - request: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - callback: PaginationCallback< - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke>): void; - listSpokes( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke>, - callback?: PaginationCallback< - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse|null|undefined, - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke>): - Promise<[ - protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[], - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest|null, - protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listSpokes(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's resource name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * A filter expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @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 [Spoke]{@link google.cloud.networkconnectivity.v1alpha1.Spoke} 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 `listSpokesAsync()` - * 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. - */ - listSpokesStream( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listSpokes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSpokes.createStream( - this.innerApiCalls.listSpokes as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSpokes`, 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's resource name. - * @param {number} request.pageSize - * The maximum number of results per page that should be returned. - * @param {string} request.pageToken - * The page token. - * @param {string} request.filter - * A filter expression that filters the results listed in the response. - * @param {string} request.orderBy - * Sort the results by a certain order. - * @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 - * [Spoke]{@link google.cloud.networkconnectivity.v1alpha1.Spoke}. 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/hub_service.list_spokes.js - * region_tag:networkconnectivity_v1alpha1_generated_HubService_ListSpokes_async - */ - listSpokesAsync( - request?: protos.google.cloud.networkconnectivity.v1alpha1.IListSpokesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listSpokes']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSpokes.asyncIterate( - this.innerApiCalls['listSpokes'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified hub resource name string. - * - * @param {string} project - * @param {string} hub - * @returns {string} Resource name string. - */ - hubPath(project:string,hub:string) { - return this.pathTemplates.hubPathTemplate.render({ - project: project, - hub: hub, - }); - } - - /** - * Parse the project from Hub resource. - * - * @param {string} hubName - * A fully-qualified path representing Hub resource. - * @returns {string} A string representing the project. - */ - matchProjectFromHubName(hubName: string) { - return this.pathTemplates.hubPathTemplate.match(hubName).project; - } - - /** - * Parse the hub from Hub resource. - * - * @param {string} hubName - * A fully-qualified path representing Hub resource. - * @returns {string} A string representing the hub. - */ - matchHubFromHubName(hubName: string) { - return this.pathTemplates.hubPathTemplate.match(hubName).hub; - } - - /** - * Return a fully-qualified instance resource name string. - * - * @param {string} project - * @param {string} zone - * @param {string} instance - * @returns {string} Resource name string. - */ - instancePath(project:string,zone:string,instance:string) { - return this.pathTemplates.instancePathTemplate.render({ - project: project, - zone: zone, - instance: instance, - }); - } - - /** - * Parse the project from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).project; - } - - /** - * Parse the zone from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the zone. - */ - matchZoneFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).zone; - } - - /** - * Parse the instance from Instance resource. - * - * @param {string} instanceName - * A fully-qualified path representing Instance resource. - * @returns {string} A string representing the instance. - */ - matchInstanceFromInstanceName(instanceName: string) { - return this.pathTemplates.instancePathTemplate.match(instanceName).instance; - } - - /** - * Return a fully-qualified interconnectAttachment resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} resource_id - * @returns {string} Resource name string. - */ - interconnectAttachmentPath(project:string,region:string,resourceId:string) { - return this.pathTemplates.interconnectAttachmentPathTemplate.render({ - project: project, - region: region, - resource_id: resourceId, - }); - } - - /** - * Parse the project from InterconnectAttachment resource. - * - * @param {string} interconnectAttachmentName - * A fully-qualified path representing InterconnectAttachment resource. - * @returns {string} A string representing the project. - */ - matchProjectFromInterconnectAttachmentName(interconnectAttachmentName: string) { - return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).project; - } - - /** - * Parse the region from InterconnectAttachment resource. - * - * @param {string} interconnectAttachmentName - * A fully-qualified path representing InterconnectAttachment resource. - * @returns {string} A string representing the region. - */ - matchRegionFromInterconnectAttachmentName(interconnectAttachmentName: string) { - return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).region; - } - - /** - * Parse the resource_id from InterconnectAttachment resource. - * - * @param {string} interconnectAttachmentName - * A fully-qualified path representing InterconnectAttachment resource. - * @returns {string} A string representing the resource_id. - */ - matchResourceIdFromInterconnectAttachmentName(interconnectAttachmentName: string) { - return this.pathTemplates.interconnectAttachmentPathTemplate.match(interconnectAttachmentName).resource_id; - } - - /** - * 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 spoke resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} spoke - * @returns {string} Resource name string. - */ - spokePath(project:string,location:string,spoke:string) { - return this.pathTemplates.spokePathTemplate.render({ - project: project, - location: location, - spoke: spoke, - }); - } - - /** - * Parse the project from Spoke resource. - * - * @param {string} spokeName - * A fully-qualified path representing Spoke resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSpokeName(spokeName: string) { - return this.pathTemplates.spokePathTemplate.match(spokeName).project; - } - - /** - * Parse the location from Spoke resource. - * - * @param {string} spokeName - * A fully-qualified path representing Spoke resource. - * @returns {string} A string representing the location. - */ - matchLocationFromSpokeName(spokeName: string) { - return this.pathTemplates.spokePathTemplate.match(spokeName).location; - } - - /** - * Parse the spoke from Spoke resource. - * - * @param {string} spokeName - * A fully-qualified path representing Spoke resource. - * @returns {string} A string representing the spoke. - */ - matchSpokeFromSpokeName(spokeName: string) { - return this.pathTemplates.spokePathTemplate.match(spokeName).spoke; - } - - /** - * Return a fully-qualified vpnTunnel resource name string. - * - * @param {string} project - * @param {string} region - * @param {string} resource_id - * @returns {string} Resource name string. - */ - vpnTunnelPath(project:string,region:string,resourceId:string) { - return this.pathTemplates.vpnTunnelPathTemplate.render({ - project: project, - region: region, - resource_id: resourceId, - }); - } - - /** - * Parse the project from VpnTunnel resource. - * - * @param {string} vpnTunnelName - * A fully-qualified path representing VpnTunnel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromVpnTunnelName(vpnTunnelName: string) { - return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).project; - } - - /** - * Parse the region from VpnTunnel resource. - * - * @param {string} vpnTunnelName - * A fully-qualified path representing VpnTunnel resource. - * @returns {string} A string representing the region. - */ - matchRegionFromVpnTunnelName(vpnTunnelName: string) { - return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).region; - } - - /** - * Parse the resource_id from VpnTunnel resource. - * - * @param {string} vpnTunnelName - * A fully-qualified path representing VpnTunnel resource. - * @returns {string} A string representing the resource_id. - */ - matchResourceIdFromVpnTunnelName(vpnTunnelName: string) { - return this.pathTemplates.vpnTunnelPathTemplate.match(vpnTunnelName).resource_id; - } - - /** - * 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.hubServiceStub && !this._terminated) { - return this.hubServiceStub.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_client_config.json b/owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_client_config.json deleted file mode 100644 index ac38b3f..0000000 --- a/owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_client_config.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "interfaces": { - "google.cloud.networkconnectivity.v1alpha1.HubService": { - "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": { - "ListHubs": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetHub": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateHub": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateHub": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteHub": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListSpokes": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetSpoke": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateSpoke": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSpoke": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteSpoke": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_proto_list.json b/owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_proto_list.json deleted file mode 100644 index af2e832..0000000 --- a/owl-bot-staging/v1alpha1/src/v1alpha1/hub_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/networkconnectivity/v1alpha1/common.proto", - "../../protos/google/cloud/networkconnectivity/v1alpha1/hub.proto" -] diff --git a/owl-bot-staging/v1alpha1/src/v1alpha1/index.ts b/owl-bot-staging/v1alpha1/src/v1alpha1/index.ts deleted file mode 100644 index ae38769..0000000 --- a/owl-bot-staging/v1alpha1/src/v1alpha1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -export {HubServiceClient} from './hub_service_client'; diff --git a/owl-bot-staging/v1alpha1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1alpha1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 672a15d..0000000 --- a/owl-bot-staging/v1alpha1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -/* eslint-disable node/no-missing-require, no-unused-vars */ -const networkconnectivity = require('@google-cloud/network-connectivity'); - -function main() { - const hubServiceClient = new networkconnectivity.HubServiceClient(); -} - -main(); diff --git a/owl-bot-staging/v1alpha1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1alpha1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 5a5e64b..0000000 --- a/owl-bot-staging/v1alpha1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import {HubServiceClient} from '@google-cloud/network-connectivity'; - -// check that the client class type name can be used -function doStuffWithHubServiceClient(client: HubServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const hubServiceClient = new HubServiceClient(); - doStuffWithHubServiceClient(hubServiceClient); -} - -main(); diff --git a/owl-bot-staging/v1alpha1/system-test/install.ts b/owl-bot-staging/v1alpha1/system-test/install.ts deleted file mode 100644 index 8ec4522..0000000 --- a/owl-bot-staging/v1alpha1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import { packNTest } from 'pack-n-play'; -import { readFileSync } from 'fs'; -import { describe, it } from 'mocha'; - -describe('📦 pack-n-play test', () => { - - it('TypeScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'TypeScript user can use the type definitions', - ts: readFileSync('./system-test/fixtures/sample/src/index.ts').toString() - } - }; - await packNTest(options); - }); - - it('JavaScript code', async function() { - this.timeout(300000); - const options = { - packageDir: process.cwd(), - sample: { - description: 'JavaScript user can use the library', - ts: readFileSync('./system-test/fixtures/sample/src/index.js').toString() - } - }; - await packNTest(options); - }); - -}); diff --git a/owl-bot-staging/v1alpha1/test/gapic_hub_service_v1alpha1.ts b/owl-bot-staging/v1alpha1/test/gapic_hub_service_v1alpha1.ts deleted file mode 100644 index 93594ef..0000000 --- a/owl-bot-staging/v1alpha1/test/gapic_hub_service_v1alpha1.ts +++ /dev/null @@ -1,1973 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as protos from '../protos/protos'; -import * as assert from 'assert'; -import * as sinon from 'sinon'; -import {SinonStub} from 'sinon'; -import { describe, it } from 'mocha'; -import * as hubserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1alpha1.HubServiceClient', () => { - it('has servicePath', () => { - const servicePath = hubserviceModule.v1alpha1.HubServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = hubserviceModule.v1alpha1.HubServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = hubserviceModule.v1alpha1.HubServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.hubServiceStub, undefined); - await client.initialize(); - assert(client.hubServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.hubServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.hubServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - 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 hubserviceModule.v1alpha1.HubServiceClient({ - 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('getHub', () => { - it('invokes getHub without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.GetHubRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()); - client.innerApiCalls.getHub = stubSimpleCall(expectedResponse); - const [response] = await client.getHub(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getHub without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.GetHubRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()); - client.innerApiCalls.getHub = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getHub( - request, - (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1alpha1.IHub|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getHub with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.GetHubRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getHub = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getHub(request), expectedError); - assert((client.innerApiCalls.getHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getHub with closed client', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.GetHubRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getHub(request), expectedError); - }); - }); - - describe('getSpoke', () => { - it('invokes getSpoke without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()); - client.innerApiCalls.getSpoke = stubSimpleCall(expectedResponse); - const [response] = await client.getSpoke(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getSpoke without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()); - client.innerApiCalls.getSpoke = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSpoke( - request, - (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getSpoke with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getSpoke = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSpoke(request), expectedError); - assert((client.innerApiCalls.getSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getSpoke with closed client', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.GetSpokeRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSpoke(request), expectedError); - }); - }); - - describe('createHub', () => { - it('invokes createHub without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createHub = stubLongRunningCall(expectedResponse); - const [operation] = await client.createHub(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createHub without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createHub = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createHub( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createHub with call error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createHub = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createHub(request), expectedError); - assert((client.innerApiCalls.createHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createHub with LRO error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.CreateHubRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createHub = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createHub(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateHubProgress without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - 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.checkCreateHubProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateHubProgress with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - 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.checkCreateHubProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateHub', () => { - it('invokes updateHub without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest()); - request.hub = {}; - request.hub.name = ''; - const expectedHeaderRequestParams = "hub.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateHub = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateHub(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateHub without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest()); - request.hub = {}; - request.hub.name = ''; - const expectedHeaderRequestParams = "hub.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateHub = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateHub( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateHub with call error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest()); - request.hub = {}; - request.hub.name = ''; - const expectedHeaderRequestParams = "hub.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateHub = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateHub(request), expectedError); - assert((client.innerApiCalls.updateHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateHub with LRO error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.UpdateHubRequest()); - request.hub = {}; - request.hub.name = ''; - const expectedHeaderRequestParams = "hub.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateHub = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateHub(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateHubProgress without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - 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.checkUpdateHubProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateHubProgress with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - 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.checkUpdateHubProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteHub', () => { - it('invokes deleteHub without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteHub = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteHub(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteHub without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteHub = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteHub( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteHub with call error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteHub = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteHub(request), expectedError); - assert((client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteHub with LRO error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.DeleteHubRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteHub = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteHub(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteHub as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteHubProgress without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - 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.checkDeleteHubProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteHubProgress with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - 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.checkDeleteHubProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createSpoke', () => { - it('invokes createSpoke without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createSpoke = stubLongRunningCall(expectedResponse); - const [operation] = await client.createSpoke(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createSpoke without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createSpoke = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSpoke( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createSpoke with call error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createSpoke = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createSpoke(request), expectedError); - assert((client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createSpoke with LRO error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.CreateSpokeRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createSpoke = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createSpoke(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateSpokeProgress without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - 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.checkCreateSpokeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateSpokeProgress with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - 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.checkCreateSpokeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('updateSpoke', () => { - it('invokes updateSpoke without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest()); - request.spoke = {}; - request.spoke.name = ''; - const expectedHeaderRequestParams = "spoke.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateSpoke = stubLongRunningCall(expectedResponse); - const [operation] = await client.updateSpoke(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateSpoke without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest()); - request.spoke = {}; - request.spoke.name = ''; - const expectedHeaderRequestParams = "spoke.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.updateSpoke = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSpoke( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateSpoke with call error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest()); - request.spoke = {}; - request.spoke.name = ''; - const expectedHeaderRequestParams = "spoke.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSpoke = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.updateSpoke(request), expectedError); - assert((client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateSpoke with LRO error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.UpdateSpokeRequest()); - request.spoke = {}; - request.spoke.name = ''; - const expectedHeaderRequestParams = "spoke.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSpoke = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.updateSpoke(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.updateSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUpdateSpokeProgress without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - 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.checkUpdateSpokeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUpdateSpokeProgress with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - 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.checkUpdateSpokeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteSpoke', () => { - it('invokes deleteSpoke without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteSpoke = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteSpoke(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteSpoke without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteSpoke = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSpoke( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteSpoke with call error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSpoke = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteSpoke(request), expectedError); - assert((client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteSpoke with LRO error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.DeleteSpokeRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSpoke = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteSpoke(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteSpoke as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteSpokeProgress without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - 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.checkDeleteSpokeProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteSpokeProgress with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - 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.checkDeleteSpokeProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listHubs', () => { - it('invokes listHubs without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - ]; - client.innerApiCalls.listHubs = stubSimpleCall(expectedResponse); - const [response] = await client.listHubs(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listHubs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listHubs without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - ]; - client.innerApiCalls.listHubs = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listHubs( - request, - (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1alpha1.IHub[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listHubs as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listHubs with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listHubs = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listHubs(request), expectedError); - assert((client.innerApiCalls.listHubs as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listHubsStream without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - ]; - client.descriptors.page.listHubs.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listHubsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1alpha1.Hub[] = []; - stream.on('data', (response: protos.google.cloud.networkconnectivity.v1alpha1.Hub) => { - 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.listHubs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listHubs, request)); - assert.strictEqual( - (client.descriptors.page.listHubs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listHubsStream with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listHubs.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listHubsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1alpha1.Hub[] = []; - stream.on('data', (response: protos.google.cloud.networkconnectivity.v1alpha1.Hub) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listHubs.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listHubs, request)); - assert.strictEqual( - (client.descriptors.page.listHubs.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listHubs without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Hub()), - ]; - client.descriptors.page.listHubs.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networkconnectivity.v1alpha1.IHub[] = []; - const iterable = client.listHubsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listHubs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listHubs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listHubs with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListHubsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listHubs.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listHubsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networkconnectivity.v1alpha1.IHub[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listHubs.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listHubs.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listSpokes', () => { - it('invokes listSpokes without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - ]; - client.innerApiCalls.listSpokes = stubSimpleCall(expectedResponse); - const [response] = await client.listSpokes(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSpokes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSpokes without error using callback', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - ]; - client.innerApiCalls.listSpokes = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSpokes( - request, - (err?: Error|null, result?: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSpokes as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listSpokes with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listSpokes = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSpokes(request), expectedError); - assert((client.innerApiCalls.listSpokes as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSpokesStream without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - ]; - client.descriptors.page.listSpokes.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSpokesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1alpha1.Spoke[] = []; - stream.on('data', (response: protos.google.cloud.networkconnectivity.v1alpha1.Spoke) => { - 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.listSpokes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSpokes, request)); - assert.strictEqual( - (client.descriptors.page.listSpokes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listSpokesStream with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listSpokes.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSpokesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.networkconnectivity.v1alpha1.Spoke[] = []; - stream.on('data', (response: protos.google.cloud.networkconnectivity.v1alpha1.Spoke) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSpokes.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSpokes, request)); - assert.strictEqual( - (client.descriptors.page.listSpokes.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSpokes without error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.Spoke()), - ]; - client.descriptors.page.listSpokes.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[] = []; - const iterable = client.listSpokesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSpokes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSpokes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSpokes with error', async () => { - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.networkconnectivity.v1alpha1.ListSpokesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listSpokes.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSpokesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.networkconnectivity.v1alpha1.ISpoke[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSpokes.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSpokes.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('hub', () => { - const fakePath = "/rendered/path/hub"; - const expectedParameters = { - project: "projectValue", - hub: "hubValue", - }; - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.hubPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.hubPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('hubPath', () => { - const result = client.hubPath("projectValue", "hubValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.hubPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromHubName', () => { - const result = client.matchProjectFromHubName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.hubPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchHubFromHubName', () => { - const result = client.matchHubFromHubName(fakePath); - assert.strictEqual(result, "hubValue"); - assert((client.pathTemplates.hubPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('instance', () => { - const fakePath = "/rendered/path/instance"; - const expectedParameters = { - project: "projectValue", - zone: "zoneValue", - instance: "instanceValue", - }; - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.instancePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.instancePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('instancePath', () => { - const result = client.instancePath("projectValue", "zoneValue", "instanceValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.instancePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInstanceName', () => { - const result = client.matchProjectFromInstanceName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchZoneFromInstanceName', () => { - const result = client.matchZoneFromInstanceName(fakePath); - assert.strictEqual(result, "zoneValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchInstanceFromInstanceName', () => { - const result = client.matchInstanceFromInstanceName(fakePath); - assert.strictEqual(result, "instanceValue"); - assert((client.pathTemplates.instancePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('interconnectAttachment', () => { - const fakePath = "/rendered/path/interconnectAttachment"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - resource_id: "resourceIdValue", - }; - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.interconnectAttachmentPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.interconnectAttachmentPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('interconnectAttachmentPath', () => { - const result = client.interconnectAttachmentPath("projectValue", "regionValue", "resourceIdValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.interconnectAttachmentPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromInterconnectAttachmentName', () => { - const result = client.matchProjectFromInterconnectAttachmentName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromInterconnectAttachmentName', () => { - const result = client.matchRegionFromInterconnectAttachmentName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchResourceIdFromInterconnectAttachmentName', () => { - const result = client.matchResourceIdFromInterconnectAttachmentName(fakePath); - assert.strictEqual(result, "resourceIdValue"); - assert((client.pathTemplates.interconnectAttachmentPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - 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('spoke', () => { - const fakePath = "/rendered/path/spoke"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - spoke: "spokeValue", - }; - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.spokePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.spokePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('spokePath', () => { - const result = client.spokePath("projectValue", "locationValue", "spokeValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.spokePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSpokeName', () => { - const result = client.matchProjectFromSpokeName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.spokePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSpokeName', () => { - const result = client.matchLocationFromSpokeName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.spokePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSpokeFromSpokeName', () => { - const result = client.matchSpokeFromSpokeName(fakePath); - assert.strictEqual(result, "spokeValue"); - assert((client.pathTemplates.spokePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('vpnTunnel', () => { - const fakePath = "/rendered/path/vpnTunnel"; - const expectedParameters = { - project: "projectValue", - region: "regionValue", - resource_id: "resourceIdValue", - }; - const client = new hubserviceModule.v1alpha1.HubServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.vpnTunnelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.vpnTunnelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('vpnTunnelPath', () => { - const result = client.vpnTunnelPath("projectValue", "regionValue", "resourceIdValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.vpnTunnelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromVpnTunnelName', () => { - const result = client.matchProjectFromVpnTunnelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchRegionFromVpnTunnelName', () => { - const result = client.matchRegionFromVpnTunnelName(fakePath); - assert.strictEqual(result, "regionValue"); - assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchResourceIdFromVpnTunnelName', () => { - const result = client.matchResourceIdFromVpnTunnelName(fakePath); - assert.strictEqual(result, "resourceIdValue"); - assert((client.pathTemplates.vpnTunnelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1alpha1/tsconfig.json b/owl-bot-staging/v1alpha1/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/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/v1alpha1/webpack.config.js b/owl-bot-staging/v1alpha1/webpack.config.js deleted file mode 100644 index 2412b4e..0000000 --- a/owl-bot-staging/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: 'HubService', - filename: './hub-service.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/src/v1/hub_service_client.ts b/src/v1/hub_service_client.ts index d775b11..13fbf4d 100644 --- a/src/v1/hub_service_client.ts +++ b/src/v1/hub_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, PaginationCallback, GaxCall, @@ -74,7 +75,7 @@ export class HubServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * 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] @@ -97,11 +98,10 @@ export class HubServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @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}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -208,16 +208,87 @@ export class HubServiceClient { }; 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.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1/{resource=projects/*/locations/global/hubs/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1/{resource=projects/*/locations/*/spokes/*}:getIamPolicy', + }, + { + get: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1/{resource=projects/*/locations/global/hubs/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=projects/*/locations/*/spokes/*}:setIamPolicy', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1/{resource=projects/*/locations/global/hubs/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1/{resource=projects/*/locations/*/spokes/*}:testIamPermissions', + body: '*', + }, + { + post: '/v1/{resource=projects/*/locations/global/policyBasedRoutes/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + 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({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const createHubResponse = protoFilesRoot.lookup( '.google.cloud.networkconnectivity.v1.Hub' diff --git a/src/v1alpha1/hub_service_client.ts b/src/v1alpha1/hub_service_client.ts index 2e6689e..19bb4f7 100644 --- a/src/v1alpha1/hub_service_client.ts +++ b/src/v1alpha1/hub_service_client.ts @@ -23,6 +23,7 @@ import { CallOptions, Descriptors, ClientOptions, + GrpcClientOptions, LROperation, PaginationCallback, GaxCall, @@ -75,7 +76,7 @@ export class HubServiceClient { * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail - * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). + * 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] @@ -98,11 +99,10 @@ export class HubServiceClient { * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. - * @param {boolean} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. + * @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}. */ constructor(opts?: ClientOptions) { // Ensure that options include all the required fields. @@ -206,16 +206,76 @@ export class HubServiceClient { }; 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.iam.v1.IAMPolicy.GetIamPolicy', + get: '/v1alpha1/{resource=projects/*/locations/global/hubs/*}:getIamPolicy', + additional_bindings: [ + { + get: '/v1alpha1/{resource=projects/*/locations/*/spokes/*}:getIamPolicy', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.SetIamPolicy', + post: '/v1alpha1/{resource=projects/*/locations/global/hubs/*}:setIamPolicy', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{resource=projects/*/locations/*/spokes/*}:setIamPolicy', + body: '*', + }, + ], + }, + { + selector: 'google.iam.v1.IAMPolicy.TestIamPermissions', + post: '/v1alpha1/{resource=projects/*/locations/global/hubs/*}:testIamPermissions', + body: '*', + additional_bindings: [ + { + post: '/v1alpha1/{resource=projects/*/locations/*/spokes/*}:testIamPermissions', + body: '*', + }, + ], + }, + { + 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({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, - }) + .lro(lroOptions) .operationsClient(opts); const createHubResponse = protoFilesRoot.lookup( '.google.cloud.networkconnectivity.v1alpha1.Hub'