From 2cfee3673bc9d8e35444afc7a8673dd4c1d6691c Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 Jun 2022 10:04:18 +0000 Subject: [PATCH 1/3] 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/secretmanager/v1/resources.proto | 346 +++ .../cloud/secretmanager/v1/service.proto | 455 ++++ ...t_manager_service.access_secret_version.js | 61 + ...cret_manager_service.add_secret_version.js | 64 + .../secret_manager_service.create_secret.js | 72 + .../secret_manager_service.delete_secret.js | 65 + ..._manager_service.destroy_secret_version.js | 65 + ..._manager_service.disable_secret_version.js | 65 + ...t_manager_service.enable_secret_version.js | 65 + .../secret_manager_service.get_iam_policy.js | 64 + .../v1/secret_manager_service.get_secret.js | 58 + ...cret_manager_service.get_secret_version.js | 61 + ...et_manager_service.list_secret_versions.js | 81 + .../v1/secret_manager_service.list_secrets.js | 80 + .../secret_manager_service.set_iam_policy.js | 74 + ...et_manager_service.test_iam_permissions.js | 67 + .../secret_manager_service.update_secret.js | 63 + ...etadata.google.cloud.secretmanager.v1.json | 687 ++++++ owl-bot-staging/v1/src/index.ts | 25 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 181 ++ owl-bot-staging/v1/src/v1/index.ts | 19 + .../src/v1/secret_manager_service_client.ts | 1902 +++++++++++++++ .../secret_manager_service_client_config.json | 114 + .../v1/secret_manager_service_proto_list.json | 4 + .../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 + .../test/gapic_secret_manager_service_v1.ts | 2048 +++++++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 + 39 files changed, 7192 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/secretmanager/v1/resources.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/secretmanager/v1/service.proto create mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.access_secret_version.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.add_secret_version.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.create_secret.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.delete_secret.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.destroy_secret_version.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.disable_secret_version.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.enable_secret_version.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.get_iam_policy.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.get_secret.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.get_secret_version.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.list_secret_versions.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.list_secrets.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.set_iam_policy.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.test_iam_permissions.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.update_secret.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.secretmanager.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/index.ts create mode 100644 owl-bot-staging/v1/src/v1/secret_manager_service_client.ts create mode 100644 owl-bot-staging/v1/src/v1/secret_manager_service_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/secret_manager_service_proto_list.json 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_secret_manager_service_v1.ts create mode 100644 owl-bot-staging/v1/tsconfig.json create mode 100644 owl-bot-staging/v1/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..1fc37b1 --- /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/secret-manager', + 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..55c13a0 --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Secretmanager: 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..c1867e7 --- /dev/null +++ b/owl-bot-staging/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/secret-manager", + "version": "0.1.0", + "description": "Secretmanager client for Node.js", + "repository": "googleapis/nodejs-secretmanager", + "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 secretmanager", + "secretmanager", + "secret manager 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/secretmanager/v1/resources.proto b/owl-bot-staging/v1/protos/google/cloud/secretmanager/v1/resources.proto new file mode 100644 index 0000000..5e2322e --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/secretmanager/v1/resources.proto @@ -0,0 +1,346 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.secretmanager.v1; + +import "google/api/annotations.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.SecretManager.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/secretmanager/v1;secretmanager"; +option java_multiple_files = true; +option java_outer_classname = "ResourcesProto"; +option java_package = "com.google.cloud.secretmanager.v1"; +option objc_class_prefix = "GSM"; +option php_namespace = "Google\\Cloud\\SecretManager\\V1"; +option ruby_package = "Google::Cloud::SecretManager::V1"; + +// A [Secret][google.cloud.secretmanager.v1.Secret] is a logical secret whose value and versions can +// be accessed. +// +// A [Secret][google.cloud.secretmanager.v1.Secret] is made up of zero or more [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] that +// represent the secret data. +message Secret { + option (google.api.resource) = { + type: "secretmanager.googleapis.com/Secret" + pattern: "projects/{project}/secrets/{secret}" + }; + + // Output only. The resource name of the [Secret][google.cloud.secretmanager.v1.Secret] in the format `projects/*/secrets/*`. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Required. Immutable. The replication policy of the secret data attached to the [Secret][google.cloud.secretmanager.v1.Secret]. + // + // The replication policy cannot be changed after the Secret has been created. + Replication replication = 2 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = REQUIRED + ]; + + // Output only. The time at which the [Secret][google.cloud.secretmanager.v1.Secret] was created. + google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The labels assigned to this Secret. + // + // Label keys must be between 1 and 63 characters long, have a UTF-8 encoding + // of maximum 128 bytes, and must conform to the following PCRE regular + // expression: `[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}` + // + // Label values must be between 0 and 63 characters long, have a UTF-8 + // encoding of maximum 128 bytes, and must conform to the following PCRE + // regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}` + // + // No more than 64 labels can be assigned to a given resource. + map labels = 4; + + // Optional. A list of up to 10 Pub/Sub topics to which messages are published when + // control plane operations are called on the secret or its versions. + repeated Topic topics = 5 [(google.api.field_behavior) = OPTIONAL]; + + // Expiration policy attached to the [Secret][google.cloud.secretmanager.v1.Secret]. If specified the [Secret][google.cloud.secretmanager.v1.Secret] + // and all [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] will be automatically deleted at + // expiration. Expired secrets are irreversibly deleted. + // + // Expiration is *not* the recommended way to set time-based permissions. [IAM + // Conditions](https://cloud.google.com/secret-manager/docs/access-control#conditions) + // is recommended for granting time-based permissions because the operation + // can be reversed. + oneof expiration { + // Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is + // always provided on output, regardless of what was sent on input. + google.protobuf.Timestamp expire_time = 6 [(google.api.field_behavior) = OPTIONAL]; + + // Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret]. + google.protobuf.Duration ttl = 7 [(google.api.field_behavior) = INPUT_ONLY]; + } + + // Optional. Etag of the currently stored [Secret][google.cloud.secretmanager.v1.Secret]. + string etag = 8 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Rotation policy attached to the [Secret][google.cloud.secretmanager.v1.Secret]. May be excluded if there is no + // rotation policy. + Rotation rotation = 9 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Mapping from version alias to version name. + // + // A version alias is a string with a maximum length of 63 characters and can + // contain uppercase and lowercase letters, numerals, and the hyphen (`-`) + // and underscore ('_') characters. An alias string must start with a + // letter and cannot be the string 'latest' or 'NEW'. + // No more than 50 aliases can be assigned to a given secret. + // + // Version-Alias pairs will be viewable via GetSecret and modifiable via + // UpdateSecret. At launch access by alias will only be supported on + // GetSecretVersion and AccessSecretVersion. + map version_aliases = 11 [(google.api.field_behavior) = OPTIONAL]; +} + +// A secret version resource in the Secret Manager API. +message SecretVersion { + option (google.api.resource) = { + type: "secretmanager.googleapis.com/SecretVersion" + pattern: "projects/{project}/secrets/{secret}/versions/{secret_version}" + }; + + // The state of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion], indicating if it can be accessed. + enum State { + // Not specified. This value is unused and invalid. + STATE_UNSPECIFIED = 0; + + // The [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] may be accessed. + ENABLED = 1; + + // The [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] may not be accessed, but the secret data + // is still available and can be placed back into the [ENABLED][google.cloud.secretmanager.v1.SecretVersion.State.ENABLED] + // state. + DISABLED = 2; + + // The [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] is destroyed and the secret data is no longer + // stored. A version may not leave this state once entered. + DESTROYED = 3; + } + + // Output only. The resource name of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the + // format `projects/*/secrets/*/versions/*`. + // + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] IDs in a [Secret][google.cloud.secretmanager.v1.Secret] start at 1 and + // are incremented for each subsequent version of the secret. + string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] was created. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time this [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] was destroyed. + // Only present if [state][google.cloud.secretmanager.v1.SecretVersion.state] is + // [DESTROYED][google.cloud.secretmanager.v1.SecretVersion.State.DESTROYED]. + google.protobuf.Timestamp destroy_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The current state of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The replication status of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + ReplicationStatus replication_status = 5; + + // Output only. Etag of the currently stored [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + string etag = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. True if payload checksum specified in [SecretPayload][google.cloud.secretmanager.v1.SecretPayload] object has been + // received by [SecretManagerService][google.cloud.secretmanager.v1.SecretManagerService] on + // [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion]. + bool client_specified_payload_checksum = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A policy that defines the replication and encryption configuration of data. +message Replication { + // A replication policy that replicates the [Secret][google.cloud.secretmanager.v1.Secret] payload without any + // restrictions. + message Automatic { + // Optional. The customer-managed encryption configuration of the [Secret][google.cloud.secretmanager.v1.Secret]. If no + // configuration is provided, Google-managed default encryption is used. + // + // Updates to the [Secret][google.cloud.secretmanager.v1.Secret] encryption configuration only apply to + // [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] added afterwards. They do not apply + // retroactively to existing [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]. + CustomerManagedEncryption customer_managed_encryption = 1 [(google.api.field_behavior) = OPTIONAL]; + } + + // A replication policy that replicates the [Secret][google.cloud.secretmanager.v1.Secret] payload into the + // locations specified in [Secret.replication.user_managed.replicas][] + message UserManaged { + // Represents a Replica for this [Secret][google.cloud.secretmanager.v1.Secret]. + message Replica { + // The canonical IDs of the location to replicate data. + // For example: `"us-east1"`. + string location = 1; + + // Optional. The customer-managed encryption configuration of the [User-Managed + // Replica][Replication.UserManaged.Replica]. If no configuration is + // provided, Google-managed default encryption is used. + // + // Updates to the [Secret][google.cloud.secretmanager.v1.Secret] encryption configuration only apply to + // [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] added afterwards. They do not apply + // retroactively to existing [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]. + CustomerManagedEncryption customer_managed_encryption = 2 [(google.api.field_behavior) = OPTIONAL]; + } + + // Required. The list of Replicas for this [Secret][google.cloud.secretmanager.v1.Secret]. + // + // Cannot be empty. + repeated Replica replicas = 1 [(google.api.field_behavior) = REQUIRED]; + } + + // The replication policy for this secret. + oneof replication { + // The [Secret][google.cloud.secretmanager.v1.Secret] will automatically be replicated without any restrictions. + Automatic automatic = 1; + + // The [Secret][google.cloud.secretmanager.v1.Secret] will only be replicated into the locations specified. + UserManaged user_managed = 2; + } +} + +// Configuration for encrypting secret payloads using customer-managed +// encryption keys (CMEK). +message CustomerManagedEncryption { + // Required. The resource name of the Cloud KMS CryptoKey used to encrypt secret + // payloads. + // + // For secrets using the [UserManaged][google.cloud.secretmanager.v1.Replication.UserManaged] replication + // policy type, Cloud KMS CryptoKeys must reside in the same location as the + // [replica location][Secret.UserManaged.Replica.location]. + // + // For secrets using the [Automatic][google.cloud.secretmanager.v1.Replication.Automatic] replication policy + // type, Cloud KMS CryptoKeys must reside in `global`. + // + // The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. + string kms_key_name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. +message ReplicationStatus { + // The replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] using automatic replication. + // + // Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret] has an automatic replication + // policy. + message AutomaticStatus { + // Output only. The customer-managed encryption status of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Only + // populated if customer-managed encryption is used. + CustomerManagedEncryptionStatus customer_managed_encryption = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // The replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] using user-managed + // replication. + // + // Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret] has a user-managed replication + // policy. + message UserManagedStatus { + // Describes the status of a user-managed replica for the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + message ReplicaStatus { + // Output only. The canonical ID of the replica location. + // For example: `"us-east1"`. + string location = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The customer-managed encryption status of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Only + // populated if customer-managed encryption is used. + CustomerManagedEncryptionStatus customer_managed_encryption = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // Output only. The list of replica statuses for the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + repeated ReplicaStatus replicas = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + } + + // The replication status of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + oneof replication_status { + // Describes the replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] with + // automatic replication. + // + // Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret] has an automatic replication + // policy. + AutomaticStatus automatic = 1; + + // Describes the replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] with + // user-managed replication. + // + // Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret] has a user-managed replication + // policy. + UserManagedStatus user_managed = 2; + } +} + +// Describes the status of customer-managed encryption. +message CustomerManagedEncryptionStatus { + // Required. The resource name of the Cloud KMS CryptoKeyVersion used to encrypt the + // secret payload, in the following format: + // `projects/*/locations/*/keyRings/*/cryptoKeys/*/versions/*`. + string kms_key_version_name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// A Pub/Sub topic which Secret Manager will publish to when control plane +// events occur on this secret. +message Topic { + option (google.api.resource) = { + type: "pubsub.googleapis.com/Topic" + pattern: "projects/{project}/topics/{topic}" + }; + + // Required. The resource name of the Pub/Sub topic that will be published to, in the + // following format: `projects/*/topics/*`. For publication to succeed, the + // Secret Manager P4SA must have `pubsub.publisher` permissions on the topic. + string name = 1 [(google.api.field_behavior) = REQUIRED]; +} + +// The rotation time and period for a [Secret][google.cloud.secretmanager.v1.Secret]. At next_rotation_time, Secret +// Manager will send a Pub/Sub notification to the topics configured on the +// Secret. [Secret.topics][google.cloud.secretmanager.v1.Secret.topics] must be set to configure rotation. +message Rotation { + // Optional. Timestamp in UTC at which the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to rotate. Cannot be + // set to less than 300s (5 min) in the future and at most 3153600000s (100 + // years). + // + // [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time] MUST be set if [rotation_period][google.cloud.secretmanager.v1.Rotation.rotation_period] is set. + google.protobuf.Timestamp next_rotation_time = 1 [(google.api.field_behavior) = OPTIONAL]; + + // Input only. The Duration between rotation notifications. Must be in seconds + // and at least 3600s (1h) and at most 3153600000s (100 years). + // + // If [rotation_period][google.cloud.secretmanager.v1.Rotation.rotation_period] is set, [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time] must be set. + // [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time] will be advanced by this period when the service + // automatically sends rotation notifications. + google.protobuf.Duration rotation_period = 2 [(google.api.field_behavior) = INPUT_ONLY]; +} + +// A secret payload resource in the Secret Manager API. This contains the +// sensitive secret payload that is associated with a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. +message SecretPayload { + // The secret data. Must be no larger than 64KiB. + bytes data = 1; + + // Optional. If specified, [SecretManagerService][google.cloud.secretmanager.v1.SecretManagerService] will verify the integrity of the + // received [data][google.cloud.secretmanager.v1.SecretPayload.data] on [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion] calls using + // the crc32c checksum and store it to include in future + // [SecretManagerService.AccessSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion] responses. If a checksum is + // not provided in the [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion] request, the + // [SecretManagerService][google.cloud.secretmanager.v1.SecretManagerService] will generate and store one for you. + // + // The CRC32C value is encoded as a Int64 for compatibility, and can be + // safely downconverted to uint32 in languages that support this type. + // https://cloud.google.com/apis/design/design_patterns#integer_types + optional int64 data_crc32c = 2 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/secretmanager/v1/service.proto b/owl-bot-staging/v1/protos/google/cloud/secretmanager/v1/service.proto new file mode 100644 index 0000000..52b3b09 --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/secretmanager/v1/service.proto @@ -0,0 +1,455 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +syntax = "proto3"; + +package google.cloud.secretmanager.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/secretmanager/v1/resources.proto"; +import "google/iam/v1/iam_policy.proto"; +import "google/iam/v1/policy.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; + +option cc_enable_arenas = true; +option csharp_namespace = "Google.Cloud.SecretManager.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/secretmanager/v1;secretmanager"; +option java_multiple_files = true; +option java_outer_classname = "ServiceProto"; +option java_package = "com.google.cloud.secretmanager.v1"; +option objc_class_prefix = "GSM"; +option php_namespace = "Google\\Cloud\\SecretManager\\V1"; +option ruby_package = "Google::Cloud::SecretManager::V1"; + +// Secret Manager Service +// +// Manages secrets and operations using those secrets. Implements a REST +// model with the following objects: +// +// * [Secret][google.cloud.secretmanager.v1.Secret] +// * [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] +service SecretManagerService { + option (google.api.default_host) = "secretmanager.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Lists [Secrets][google.cloud.secretmanager.v1.Secret]. + rpc ListSecrets(ListSecretsRequest) returns (ListSecretsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*}/secrets" + }; + option (google.api.method_signature) = "parent"; + } + + // Creates a new [Secret][google.cloud.secretmanager.v1.Secret] containing no [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]. + rpc CreateSecret(CreateSecretRequest) returns (Secret) { + option (google.api.http) = { + post: "/v1/{parent=projects/*}/secrets" + body: "secret" + }; + option (google.api.method_signature) = "parent,secret_id,secret"; + } + + // Creates a new [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] containing secret data and attaches + // it to an existing [Secret][google.cloud.secretmanager.v1.Secret]. + rpc AddSecretVersion(AddSecretVersionRequest) returns (SecretVersion) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/secrets/*}:addVersion" + body: "*" + }; + option (google.api.method_signature) = "parent,payload"; + } + + // Gets metadata for a given [Secret][google.cloud.secretmanager.v1.Secret]. + rpc GetSecret(GetSecretRequest) returns (Secret) { + option (google.api.http) = { + get: "/v1/{name=projects/*/secrets/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates metadata of an existing [Secret][google.cloud.secretmanager.v1.Secret]. + rpc UpdateSecret(UpdateSecretRequest) returns (Secret) { + option (google.api.http) = { + patch: "/v1/{secret.name=projects/*/secrets/*}" + body: "secret" + }; + option (google.api.method_signature) = "secret,update_mask"; + } + + // Deletes a [Secret][google.cloud.secretmanager.v1.Secret]. + rpc DeleteSecret(DeleteSecretRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/secrets/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]. This call does not return secret + // data. + rpc ListSecretVersions(ListSecretVersionsRequest) returns (ListSecretVersionsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/secrets/*}/versions" + }; + option (google.api.method_signature) = "parent"; + } + + // Gets metadata for a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + // + // `projects/*/secrets/*/versions/latest` is an alias to the most recently + // created [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + rpc GetSecretVersion(GetSecretVersionRequest) returns (SecretVersion) { + option (google.api.http) = { + get: "/v1/{name=projects/*/secrets/*/versions/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Accesses a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. This call returns the secret data. + // + // `projects/*/secrets/*/versions/latest` is an alias to the most recently + // created [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + rpc AccessSecretVersion(AccessSecretVersionRequest) returns (AccessSecretVersionResponse) { + option (google.api.http) = { + get: "/v1/{name=projects/*/secrets/*/versions/*}:access" + }; + option (google.api.method_signature) = "name"; + } + + // Disables a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + // + // Sets the [state][google.cloud.secretmanager.v1.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to + // [DISABLED][google.cloud.secretmanager.v1.SecretVersion.State.DISABLED]. + rpc DisableSecretVersion(DisableSecretVersionRequest) returns (SecretVersion) { + option (google.api.http) = { + post: "/v1/{name=projects/*/secrets/*/versions/*}:disable" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Enables a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + // + // Sets the [state][google.cloud.secretmanager.v1.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to + // [ENABLED][google.cloud.secretmanager.v1.SecretVersion.State.ENABLED]. + rpc EnableSecretVersion(EnableSecretVersionRequest) returns (SecretVersion) { + option (google.api.http) = { + post: "/v1/{name=projects/*/secrets/*/versions/*}:enable" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Destroys a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + // + // Sets the [state][google.cloud.secretmanager.v1.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to + // [DESTROYED][google.cloud.secretmanager.v1.SecretVersion.State.DESTROYED] and irrevocably destroys the + // secret data. + rpc DestroySecretVersion(DestroySecretVersionRequest) returns (SecretVersion) { + option (google.api.http) = { + post: "/v1/{name=projects/*/secrets/*/versions/*}:destroy" + body: "*" + }; + option (google.api.method_signature) = "name"; + } + + // Sets the access control policy on the specified secret. Replaces any + // existing policy. + // + // Permissions on [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] are enforced according + // to the policy set on the associated [Secret][google.cloud.secretmanager.v1.Secret]. + rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/secrets/*}:setIamPolicy" + body: "*" + }; + } + + // Gets the access control policy for a secret. + // Returns empty policy if the secret exists and does not have a policy set. + rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { + option (google.api.http) = { + get: "/v1/{resource=projects/*/secrets/*}:getIamPolicy" + }; + } + + // Returns permissions that a caller has for the specified secret. + // If the secret does not exist, this call returns an empty set of + // permissions, not a NOT_FOUND error. + // + // Note: This operation is designed to be used for building permission-aware + // UIs and command-line tools, not for authorization checking. This operation + // may "fail open" without warning. + rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { + option (google.api.http) = { + post: "/v1/{resource=projects/*/secrets/*}:testIamPermissions" + body: "*" + }; + } +} + +// Request message for [SecretManagerService.ListSecrets][google.cloud.secretmanager.v1.SecretManagerService.ListSecrets]. +message ListSecretsRequest { + // Required. The resource name of the project associated with the + // [Secrets][google.cloud.secretmanager.v1.Secret], in the format `projects/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Optional. The maximum number of results to be returned in a single page. If + // set to 0, the server decides the number of results to return. If the + // number is greater than 25000, it is capped at 25000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Pagination token, returned earlier via + // [ListSecretsResponse.next_page_token][google.cloud.secretmanager.v1.ListSecretsResponse.next_page_token]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Filter string, adhering to the rules in + // [List-operation + // filtering](https://cloud.google.com/secret-manager/docs/filtering). List + // only secrets matching the filter. If filter is empty, all secrets are + // listed. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for [SecretManagerService.ListSecrets][google.cloud.secretmanager.v1.SecretManagerService.ListSecrets]. +message ListSecretsResponse { + // The list of [Secrets][google.cloud.secretmanager.v1.Secret] sorted in reverse by create_time (newest + // first). + repeated Secret secrets = 1; + + // A token to retrieve the next page of results. Pass this value in + // [ListSecretsRequest.page_token][google.cloud.secretmanager.v1.ListSecretsRequest.page_token] to retrieve the next page. + string next_page_token = 2; + + // The total number of [Secrets][google.cloud.secretmanager.v1.Secret]. + int32 total_size = 3; +} + +// Request message for [SecretManagerService.CreateSecret][google.cloud.secretmanager.v1.SecretManagerService.CreateSecret]. +message CreateSecretRequest { + // Required. The resource name of the project to associate with the + // [Secret][google.cloud.secretmanager.v1.Secret], in the format `projects/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "cloudresourcemanager.googleapis.com/Project" + } + ]; + + // Required. This must be unique within the project. + // + // A secret ID is a string with a maximum length of 255 characters and can + // contain uppercase and lowercase letters, numerals, and the hyphen (`-`) and + // underscore (`_`) characters. + string secret_id = 2 [(google.api.field_behavior) = REQUIRED]; + + // Required. A [Secret][google.cloud.secretmanager.v1.Secret] with initial field values. + Secret secret = 3 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion]. +message AddSecretVersionRequest { + // Required. The resource name of the [Secret][google.cloud.secretmanager.v1.Secret] to associate with the + // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the format `projects/*/secrets/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "secretmanager.googleapis.com/Secret" + } + ]; + + // Required. The secret payload of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + SecretPayload payload = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for [SecretManagerService.GetSecret][google.cloud.secretmanager.v1.SecretManagerService.GetSecret]. +message GetSecretRequest { + // Required. The resource name of the [Secret][google.cloud.secretmanager.v1.Secret], in the format `projects/*/secrets/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "secretmanager.googleapis.com/Secret" + } + ]; +} + +// Request message for [SecretManagerService.ListSecretVersions][google.cloud.secretmanager.v1.SecretManagerService.ListSecretVersions]. +message ListSecretVersionsRequest { + // Required. The resource name of the [Secret][google.cloud.secretmanager.v1.Secret] associated with the + // [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] to list, in the format + // `projects/*/secrets/*`. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "secretmanager.googleapis.com/Secret" + } + ]; + + // Optional. The maximum number of results to be returned in a single page. If + // set to 0, the server decides the number of results to return. If the + // number is greater than 25000, it is capped at 25000. + int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Pagination token, returned earlier via + // ListSecretVersionsResponse.next_page_token][]. + string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; + + // Optional. Filter string, adhering to the rules in + // [List-operation + // filtering](https://cloud.google.com/secret-manager/docs/filtering). List + // only secret versions matching the filter. If filter is empty, all secret + // versions are listed. + string filter = 4 [(google.api.field_behavior) = OPTIONAL]; +} + +// Response message for [SecretManagerService.ListSecretVersions][google.cloud.secretmanager.v1.SecretManagerService.ListSecretVersions]. +message ListSecretVersionsResponse { + // The list of [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] sorted in reverse by + // create_time (newest first). + repeated SecretVersion versions = 1; + + // A token to retrieve the next page of results. Pass this value in + // [ListSecretVersionsRequest.page_token][google.cloud.secretmanager.v1.ListSecretVersionsRequest.page_token] to retrieve the next page. + string next_page_token = 2; + + // The total number of [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]. + int32 total_size = 3; +} + +// Request message for [SecretManagerService.GetSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.GetSecretVersion]. +message GetSecretVersionRequest { + // Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the format + // `projects/*/secrets/*/versions/*`. + // + // `projects/*/secrets/*/versions/latest` is an alias to the most recently + // created [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + } + ]; +} + +// Request message for [SecretManagerService.UpdateSecret][google.cloud.secretmanager.v1.SecretManagerService.UpdateSecret]. +message UpdateSecretRequest { + // Required. [Secret][google.cloud.secretmanager.v1.Secret] with updated field values. + Secret secret = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. Specifies the fields to be updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request message for [SecretManagerService.AccessSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion]. +message AccessSecretVersionRequest { + // Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the format + // `projects/*/secrets/*/versions/*`. + // + // `projects/*/secrets/*/versions/latest` is an alias to the most recently + // created [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + } + ]; +} + +// Response message for [SecretManagerService.AccessSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion]. +message AccessSecretVersionResponse { + // The resource name of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the format + // `projects/*/secrets/*/versions/*`. + string name = 1 [(google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + }]; + + // Secret payload + SecretPayload payload = 2; +} + +// Request message for [SecretManagerService.DeleteSecret][google.cloud.secretmanager.v1.SecretManagerService.DeleteSecret]. +message DeleteSecretRequest { + // Required. The resource name of the [Secret][google.cloud.secretmanager.v1.Secret] to delete in the format + // `projects/*/secrets/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "secretmanager.googleapis.com/Secret" + } + ]; + + // Optional. Etag of the [Secret][google.cloud.secretmanager.v1.Secret]. The request succeeds if it matches + // the etag of the currently stored secret object. If the etag is omitted, + // the request succeeds. + string etag = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [SecretManagerService.DisableSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.DisableSecretVersion]. +message DisableSecretVersionRequest { + // Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to disable in the format + // `projects/*/secrets/*/versions/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + } + ]; + + // Optional. Etag of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. The request succeeds if it matches + // the etag of the currently stored secret version object. If the etag is + // omitted, the request succeeds. + string etag = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [SecretManagerService.EnableSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.EnableSecretVersion]. +message EnableSecretVersionRequest { + // Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to enable in the format + // `projects/*/secrets/*/versions/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + } + ]; + + // Optional. Etag of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. The request succeeds if it matches + // the etag of the currently stored secret version object. If the etag is + // omitted, the request succeeds. + string etag = 2 [(google.api.field_behavior) = OPTIONAL]; +} + +// Request message for [SecretManagerService.DestroySecretVersion][google.cloud.secretmanager.v1.SecretManagerService.DestroySecretVersion]. +message DestroySecretVersionRequest { + // Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to destroy in the format + // `projects/*/secrets/*/versions/*`. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "secretmanager.googleapis.com/SecretVersion" + } + ]; + + // Optional. Etag of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. The request succeeds if it matches + // the etag of the currently stored secret version object. If the etag is + // omitted, the request succeeds. + string etag = 2 [(google.api.field_behavior) = OPTIONAL]; +} diff --git a/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.access_secret_version.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.access_secret_version.js new file mode 100644 index 0000000..5c7243b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.access_secret_version.js @@ -0,0 +1,61 @@ +// 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 secretmanager_v1_generated_SecretManagerService_AccessSecretVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the SecretVersion google.cloud.secretmanager.v1.SecretVersion in the format + * `projects/* /secrets/* /versions/*`. + * `projects/* /secrets/* /versions/latest` is an alias to the most recently + * created SecretVersion google.cloud.secretmanager.v1.SecretVersion. + */ + // const name = 'abc123' + + // Imports the Secretmanager library + const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; + + // Instantiates a client + const secretmanagerClient = new SecretManagerServiceClient(); + + async function callAccessSecretVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await secretmanagerClient.accessSecretVersion(request); + console.log(response); + } + + callAccessSecretVersion(); + // [END secretmanager_v1_generated_SecretManagerService_AccessSecretVersion_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/secret_manager_service.add_secret_version.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.add_secret_version.js new file mode 100644 index 0000000..84b15ff --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.add_secret_version.js @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent, payload) { + // [START secretmanager_v1_generated_SecretManagerService_AddSecretVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Secret google.cloud.secretmanager.v1.Secret to associate with the + * SecretVersion google.cloud.secretmanager.v1.SecretVersion in the format `projects/* /secrets/*`. + */ + // const parent = 'abc123' + /** + * Required. The secret payload of the SecretVersion google.cloud.secretmanager.v1.SecretVersion. + */ + // const payload = {} + + // Imports the Secretmanager library + const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; + + // Instantiates a client + const secretmanagerClient = new SecretManagerServiceClient(); + + async function callAddSecretVersion() { + // Construct request + const request = { + parent, + payload, + }; + + // Run request + const response = await secretmanagerClient.addSecretVersion(request); + console.log(response); + } + + callAddSecretVersion(); + // [END secretmanager_v1_generated_SecretManagerService_AddSecretVersion_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/secret_manager_service.create_secret.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.create_secret.js new file mode 100644 index 0000000..4dd3345 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.create_secret.js @@ -0,0 +1,72 @@ +// 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, secretId, secret) { + // [START secretmanager_v1_generated_SecretManagerService_CreateSecret_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the project to associate with the + * Secret google.cloud.secretmanager.v1.Secret, in the format `projects/*`. + */ + // const parent = 'abc123' + /** + * Required. This must be unique within the project. + * A secret ID is a string with a maximum length of 255 characters and can + * contain uppercase and lowercase letters, numerals, and the hyphen (`-`) and + * underscore (`_`) characters. + */ + // const secretId = 'abc123' + /** + * Required. A Secret google.cloud.secretmanager.v1.Secret with initial field values. + */ + // const secret = {} + + // Imports the Secretmanager library + const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; + + // Instantiates a client + const secretmanagerClient = new SecretManagerServiceClient(); + + async function callCreateSecret() { + // Construct request + const request = { + parent, + secretId, + secret, + }; + + // Run request + const response = await secretmanagerClient.createSecret(request); + console.log(response); + } + + callCreateSecret(); + // [END secretmanager_v1_generated_SecretManagerService_CreateSecret_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/secret_manager_service.delete_secret.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.delete_secret.js new file mode 100644 index 0000000..70e2e76 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.delete_secret.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START secretmanager_v1_generated_SecretManagerService_DeleteSecret_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Secret google.cloud.secretmanager.v1.Secret to delete in the format + * `projects/* /secrets/*`. + */ + // const name = 'abc123' + /** + * Optional. Etag of the Secret google.cloud.secretmanager.v1.Secret. The request succeeds if it matches + * the etag of the currently stored secret object. If the etag is omitted, + * the request succeeds. + */ + // const etag = 'abc123' + + // Imports the Secretmanager library + const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; + + // Instantiates a client + const secretmanagerClient = new SecretManagerServiceClient(); + + async function callDeleteSecret() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await secretmanagerClient.deleteSecret(request); + console.log(response); + } + + callDeleteSecret(); + // [END secretmanager_v1_generated_SecretManagerService_DeleteSecret_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/secret_manager_service.destroy_secret_version.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.destroy_secret_version.js new file mode 100644 index 0000000..efbd6b5 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.destroy_secret_version.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START secretmanager_v1_generated_SecretManagerService_DestroySecretVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the SecretVersion google.cloud.secretmanager.v1.SecretVersion to destroy in the format + * `projects/* /secrets/* /versions/*`. + */ + // const name = 'abc123' + /** + * Optional. Etag of the SecretVersion google.cloud.secretmanager.v1.SecretVersion. The request succeeds if it matches + * the etag of the currently stored secret version object. If the etag is + * omitted, the request succeeds. + */ + // const etag = 'abc123' + + // Imports the Secretmanager library + const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; + + // Instantiates a client + const secretmanagerClient = new SecretManagerServiceClient(); + + async function callDestroySecretVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await secretmanagerClient.destroySecretVersion(request); + console.log(response); + } + + callDestroySecretVersion(); + // [END secretmanager_v1_generated_SecretManagerService_DestroySecretVersion_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/secret_manager_service.disable_secret_version.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.disable_secret_version.js new file mode 100644 index 0000000..ad8b2f3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.disable_secret_version.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START secretmanager_v1_generated_SecretManagerService_DisableSecretVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the SecretVersion google.cloud.secretmanager.v1.SecretVersion to disable in the format + * `projects/* /secrets/* /versions/*`. + */ + // const name = 'abc123' + /** + * Optional. Etag of the SecretVersion google.cloud.secretmanager.v1.SecretVersion. The request succeeds if it matches + * the etag of the currently stored secret version object. If the etag is + * omitted, the request succeeds. + */ + // const etag = 'abc123' + + // Imports the Secretmanager library + const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; + + // Instantiates a client + const secretmanagerClient = new SecretManagerServiceClient(); + + async function callDisableSecretVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await secretmanagerClient.disableSecretVersion(request); + console.log(response); + } + + callDisableSecretVersion(); + // [END secretmanager_v1_generated_SecretManagerService_DisableSecretVersion_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/secret_manager_service.enable_secret_version.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.enable_secret_version.js new file mode 100644 index 0000000..59c3a56 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.enable_secret_version.js @@ -0,0 +1,65 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(name) { + // [START secretmanager_v1_generated_SecretManagerService_EnableSecretVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the SecretVersion google.cloud.secretmanager.v1.SecretVersion to enable in the format + * `projects/* /secrets/* /versions/*`. + */ + // const name = 'abc123' + /** + * Optional. Etag of the SecretVersion google.cloud.secretmanager.v1.SecretVersion. The request succeeds if it matches + * the etag of the currently stored secret version object. If the etag is + * omitted, the request succeeds. + */ + // const etag = 'abc123' + + // Imports the Secretmanager library + const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; + + // Instantiates a client + const secretmanagerClient = new SecretManagerServiceClient(); + + async function callEnableSecretVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await secretmanagerClient.enableSecretVersion(request); + console.log(response); + } + + callEnableSecretVersion(); + // [END secretmanager_v1_generated_SecretManagerService_EnableSecretVersion_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/secret_manager_service.get_iam_policy.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.get_iam_policy.js new file mode 100644 index 0000000..6a8b533 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.get_iam_policy.js @@ -0,0 +1,64 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource) { + // [START secretmanager_v1_generated_SecretManagerService_GetIamPolicy_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + */ + // const options = {} + + // Imports the Secretmanager library + const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; + + // Instantiates a client + const secretmanagerClient = new SecretManagerServiceClient(); + + async function callGetIamPolicy() { + // Construct request + const request = { + resource, + }; + + // Run request + const response = await secretmanagerClient.getIamPolicy(request); + console.log(response); + } + + callGetIamPolicy(); + // [END secretmanager_v1_generated_SecretManagerService_GetIamPolicy_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/secret_manager_service.get_secret.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.get_secret.js new file mode 100644 index 0000000..cbc23d4 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.get_secret.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 secretmanager_v1_generated_SecretManagerService_GetSecret_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Secret google.cloud.secretmanager.v1.Secret, in the format `projects/* /secrets/*`. + */ + // const name = 'abc123' + + // Imports the Secretmanager library + const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; + + // Instantiates a client + const secretmanagerClient = new SecretManagerServiceClient(); + + async function callGetSecret() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await secretmanagerClient.getSecret(request); + console.log(response); + } + + callGetSecret(); + // [END secretmanager_v1_generated_SecretManagerService_GetSecret_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/secret_manager_service.get_secret_version.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.get_secret_version.js new file mode 100644 index 0000000..3832fe6 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.get_secret_version.js @@ -0,0 +1,61 @@ +// 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 secretmanager_v1_generated_SecretManagerService_GetSecretVersion_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the SecretVersion google.cloud.secretmanager.v1.SecretVersion in the format + * `projects/* /secrets/* /versions/*`. + * `projects/* /secrets/* /versions/latest` is an alias to the most recently + * created SecretVersion google.cloud.secretmanager.v1.SecretVersion. + */ + // const name = 'abc123' + + // Imports the Secretmanager library + const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; + + // Instantiates a client + const secretmanagerClient = new SecretManagerServiceClient(); + + async function callGetSecretVersion() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await secretmanagerClient.getSecretVersion(request); + console.log(response); + } + + callGetSecretVersion(); + // [END secretmanager_v1_generated_SecretManagerService_GetSecretVersion_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/secret_manager_service.list_secret_versions.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.list_secret_versions.js new file mode 100644 index 0000000..b8ebf33 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.list_secret_versions.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(parent) { + // [START secretmanager_v1_generated_SecretManagerService_ListSecretVersions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the Secret google.cloud.secretmanager.v1.Secret associated with the + * SecretVersions google.cloud.secretmanager.v1.SecretVersion to list, in the format + * `projects/* /secrets/*`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of results to be returned in a single page. If + * set to 0, the server decides the number of results to return. If the + * number is greater than 25000, it is capped at 25000. + */ + // const pageSize = 1234 + /** + * Optional. Pagination token, returned earlier via + * ListSecretVersionsResponse.next_page_token . + */ + // const pageToken = 'abc123' + /** + * Optional. Filter string, adhering to the rules in + * List-operation + * filtering (https://cloud.google.com/secret-manager/docs/filtering). List + * only secret versions matching the filter. If filter is empty, all secret + * versions are listed. + */ + // const filter = 'abc123' + + // Imports the Secretmanager library + const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; + + // Instantiates a client + const secretmanagerClient = new SecretManagerServiceClient(); + + async function callListSecretVersions() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await secretmanagerClient.listSecretVersionsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSecretVersions(); + // [END secretmanager_v1_generated_SecretManagerService_ListSecretVersions_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/secret_manager_service.list_secrets.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.list_secrets.js new file mode 100644 index 0000000..d7f002b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.list_secrets.js @@ -0,0 +1,80 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(parent) { + // [START secretmanager_v1_generated_SecretManagerService_ListSecrets_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the project associated with the + * Secrets google.cloud.secretmanager.v1.Secret, in the format `projects/*`. + */ + // const parent = 'abc123' + /** + * Optional. The maximum number of results to be returned in a single page. If + * set to 0, the server decides the number of results to return. If the + * number is greater than 25000, it is capped at 25000. + */ + // const pageSize = 1234 + /** + * Optional. Pagination token, returned earlier via + * ListSecretsResponse.next_page_token google.cloud.secretmanager.v1.ListSecretsResponse.next_page_token. + */ + // const pageToken = 'abc123' + /** + * Optional. Filter string, adhering to the rules in + * List-operation + * filtering (https://cloud.google.com/secret-manager/docs/filtering). List + * only secrets matching the filter. If filter is empty, all secrets are + * listed. + */ + // const filter = 'abc123' + + // Imports the Secretmanager library + const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; + + // Instantiates a client + const secretmanagerClient = new SecretManagerServiceClient(); + + async function callListSecrets() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await secretmanagerClient.listSecretsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListSecrets(); + // [END secretmanager_v1_generated_SecretManagerService_ListSecrets_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/secret_manager_service.set_iam_policy.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.set_iam_policy.js new file mode 100644 index 0000000..a4c8f8e --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.set_iam_policy.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(resource, policy) { + // [START secretmanager_v1_generated_SecretManagerService_SetIamPolicy_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + */ + // const policy = {} + /** + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * `paths: "bindings, etag"` + */ + // const updateMask = {} + + // Imports the Secretmanager library + const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; + + // Instantiates a client + const secretmanagerClient = new SecretManagerServiceClient(); + + async function callSetIamPolicy() { + // Construct request + const request = { + resource, + policy, + }; + + // Run request + const response = await secretmanagerClient.setIamPolicy(request); + console.log(response); + } + + callSetIamPolicy(); + // [END secretmanager_v1_generated_SecretManagerService_SetIamPolicy_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/secret_manager_service.test_iam_permissions.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.test_iam_permissions.js new file mode 100644 index 0000000..a4a3207 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.test_iam_permissions.js @@ -0,0 +1,67 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(resource, permissions) { + // [START secretmanager_v1_generated_SecretManagerService_TestIamPermissions_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + */ + // const resource = 'abc123' + /** + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). + */ + // const permissions = 'abc123' + + // Imports the Secretmanager library + const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; + + // Instantiates a client + const secretmanagerClient = new SecretManagerServiceClient(); + + async function callTestIamPermissions() { + // Construct request + const request = { + resource, + permissions, + }; + + // Run request + const response = await secretmanagerClient.testIamPermissions(request); + console.log(response); + } + + callTestIamPermissions(); + // [END secretmanager_v1_generated_SecretManagerService_TestIamPermissions_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/secret_manager_service.update_secret.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.update_secret.js new file mode 100644 index 0000000..96a6fd0 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.update_secret.js @@ -0,0 +1,63 @@ +// Copyright 2022 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + + +'use strict'; + +function main(secret, updateMask) { + // [START secretmanager_v1_generated_SecretManagerService_UpdateSecret_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. Secret google.cloud.secretmanager.v1.Secret with updated field values. + */ + // const secret = {} + /** + * Required. Specifies the fields to be updated. + */ + // const updateMask = {} + + // Imports the Secretmanager library + const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; + + // Instantiates a client + const secretmanagerClient = new SecretManagerServiceClient(); + + async function callUpdateSecret() { + // Construct request + const request = { + secret, + updateMask, + }; + + // Run request + const response = await secretmanagerClient.updateSecret(request); + console.log(response); + } + + callUpdateSecret(); + // [END secretmanager_v1_generated_SecretManagerService_UpdateSecret_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.secretmanager.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.secretmanager.v1.json new file mode 100644 index 0000000..2ad6667 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.secretmanager.v1.json @@ -0,0 +1,687 @@ +{ + "clientLibrary": { + "name": "nodejs-secretmanager", + "version": "0.1.0", + "language": "TYPESCRIPT", + "apis": [ + { + "id": "google.cloud.secretmanager.v1", + "version": "v1" + } + ] + }, + "snippets": [ + { + "regionTag": "secretmanager_v1_generated_SecretManagerService_ListSecrets_async", + "title": "SecretManagerService listSecrets Sample", + "origin": "API_DEFINITION", + "description": " Lists [Secrets][google.cloud.secretmanager.v1.Secret].", + "canonical": true, + "file": "secret_manager_service.list_secrets.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 72, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSecrets", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.ListSecrets", + "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" + } + ], + "resultType": ".google.cloud.secretmanager.v1.ListSecretsResponse", + "client": { + "shortName": "SecretManagerServiceClient", + "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" + }, + "method": { + "shortName": "ListSecrets", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.ListSecrets", + "service": { + "shortName": "SecretManagerService", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService" + } + } + } + }, + { + "regionTag": "secretmanager_v1_generated_SecretManagerService_CreateSecret_async", + "title": "SecretManagerService createSecret Sample", + "origin": "API_DEFINITION", + "description": " Creates a new [Secret][google.cloud.secretmanager.v1.Secret] containing no [SecretVersions][google.cloud.secretmanager.v1.SecretVersion].", + "canonical": true, + "file": "secret_manager_service.create_secret.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 64, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "CreateSecret", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.CreateSecret", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "secret_id", + "type": "TYPE_STRING" + }, + { + "name": "secret", + "type": ".google.cloud.secretmanager.v1.Secret" + } + ], + "resultType": ".google.cloud.secretmanager.v1.Secret", + "client": { + "shortName": "SecretManagerServiceClient", + "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" + }, + "method": { + "shortName": "CreateSecret", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.CreateSecret", + "service": { + "shortName": "SecretManagerService", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService" + } + } + } + }, + { + "regionTag": "secretmanager_v1_generated_SecretManagerService_AddSecretVersion_async", + "title": "SecretManagerService addSecretVersion Sample", + "origin": "API_DEFINITION", + "description": " Creates a new [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] containing secret data and attaches it to an existing [Secret][google.cloud.secretmanager.v1.Secret].", + "canonical": true, + "file": "secret_manager_service.add_secret_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AddSecretVersion", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion", + "async": true, + "parameters": [ + { + "name": "parent", + "type": "TYPE_STRING" + }, + { + "name": "payload", + "type": ".google.cloud.secretmanager.v1.SecretPayload" + } + ], + "resultType": ".google.cloud.secretmanager.v1.SecretVersion", + "client": { + "shortName": "SecretManagerServiceClient", + "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" + }, + "method": { + "shortName": "AddSecretVersion", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion", + "service": { + "shortName": "SecretManagerService", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService" + } + } + } + }, + { + "regionTag": "secretmanager_v1_generated_SecretManagerService_GetSecret_async", + "title": "SecretManagerService getSecret Sample", + "origin": "API_DEFINITION", + "description": " Gets metadata for a given [Secret][google.cloud.secretmanager.v1.Secret].", + "canonical": true, + "file": "secret_manager_service.get_secret.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 50, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSecret", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.GetSecret", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.secretmanager.v1.Secret", + "client": { + "shortName": "SecretManagerServiceClient", + "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" + }, + "method": { + "shortName": "GetSecret", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.GetSecret", + "service": { + "shortName": "SecretManagerService", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService" + } + } + } + }, + { + "regionTag": "secretmanager_v1_generated_SecretManagerService_UpdateSecret_async", + "title": "SecretManagerService updateSecret Sample", + "origin": "API_DEFINITION", + "description": " Updates metadata of an existing [Secret][google.cloud.secretmanager.v1.Secret].", + "canonical": true, + "file": "secret_manager_service.update_secret.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 55, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "UpdateSecret", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.UpdateSecret", + "async": true, + "parameters": [ + { + "name": "secret", + "type": ".google.cloud.secretmanager.v1.Secret" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.cloud.secretmanager.v1.Secret", + "client": { + "shortName": "SecretManagerServiceClient", + "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" + }, + "method": { + "shortName": "UpdateSecret", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.UpdateSecret", + "service": { + "shortName": "SecretManagerService", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService" + } + } + } + }, + { + "regionTag": "secretmanager_v1_generated_SecretManagerService_DeleteSecret_async", + "title": "SecretManagerService deleteSecret Sample", + "origin": "API_DEFINITION", + "description": " Deletes a [Secret][google.cloud.secretmanager.v1.Secret].", + "canonical": true, + "file": "secret_manager_service.delete_secret.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DeleteSecret", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.DeleteSecret", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.protobuf.Empty", + "client": { + "shortName": "SecretManagerServiceClient", + "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" + }, + "method": { + "shortName": "DeleteSecret", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.DeleteSecret", + "service": { + "shortName": "SecretManagerService", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService" + } + } + } + }, + { + "regionTag": "secretmanager_v1_generated_SecretManagerService_ListSecretVersions_async", + "title": "SecretManagerService listSecretVersions Sample", + "origin": "API_DEFINITION", + "description": " Lists [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]. This call does not return secret data.", + "canonical": true, + "file": "secret_manager_service.list_secret_versions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 73, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "ListSecretVersions", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.ListSecretVersions", + "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" + } + ], + "resultType": ".google.cloud.secretmanager.v1.ListSecretVersionsResponse", + "client": { + "shortName": "SecretManagerServiceClient", + "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" + }, + "method": { + "shortName": "ListSecretVersions", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.ListSecretVersions", + "service": { + "shortName": "SecretManagerService", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService" + } + } + } + }, + { + "regionTag": "secretmanager_v1_generated_SecretManagerService_GetSecretVersion_async", + "title": "SecretManagerService getSecretVersion Sample", + "origin": "API_DEFINITION", + "description": " Gets metadata for a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. `projects/*/secrets/*/versions/latest` is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].", + "canonical": true, + "file": "secret_manager_service.get_secret_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetSecretVersion", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.GetSecretVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.secretmanager.v1.SecretVersion", + "client": { + "shortName": "SecretManagerServiceClient", + "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" + }, + "method": { + "shortName": "GetSecretVersion", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.GetSecretVersion", + "service": { + "shortName": "SecretManagerService", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService" + } + } + } + }, + { + "regionTag": "secretmanager_v1_generated_SecretManagerService_AccessSecretVersion_async", + "title": "SecretManagerService accessSecretVersion Sample", + "origin": "API_DEFINITION", + "description": " Accesses a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. This call returns the secret data. `projects/*/secrets/*/versions/latest` is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].", + "canonical": true, + "file": "secret_manager_service.access_secret_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 53, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "AccessSecretVersion", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.secretmanager.v1.AccessSecretVersionResponse", + "client": { + "shortName": "SecretManagerServiceClient", + "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" + }, + "method": { + "shortName": "AccessSecretVersion", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion", + "service": { + "shortName": "SecretManagerService", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService" + } + } + } + }, + { + "regionTag": "secretmanager_v1_generated_SecretManagerService_DisableSecretVersion_async", + "title": "SecretManagerService disableSecretVersion Sample", + "origin": "API_DEFINITION", + "description": " Disables a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Sets the [state][google.cloud.secretmanager.v1.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to [DISABLED][google.cloud.secretmanager.v1.SecretVersion.State.DISABLED].", + "canonical": true, + "file": "secret_manager_service.disable_secret_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DisableSecretVersion", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.DisableSecretVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.secretmanager.v1.SecretVersion", + "client": { + "shortName": "SecretManagerServiceClient", + "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" + }, + "method": { + "shortName": "DisableSecretVersion", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.DisableSecretVersion", + "service": { + "shortName": "SecretManagerService", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService" + } + } + } + }, + { + "regionTag": "secretmanager_v1_generated_SecretManagerService_EnableSecretVersion_async", + "title": "SecretManagerService enableSecretVersion Sample", + "origin": "API_DEFINITION", + "description": " Enables a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Sets the [state][google.cloud.secretmanager.v1.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to [ENABLED][google.cloud.secretmanager.v1.SecretVersion.State.ENABLED].", + "canonical": true, + "file": "secret_manager_service.enable_secret_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "EnableSecretVersion", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.EnableSecretVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.secretmanager.v1.SecretVersion", + "client": { + "shortName": "SecretManagerServiceClient", + "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" + }, + "method": { + "shortName": "EnableSecretVersion", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.EnableSecretVersion", + "service": { + "shortName": "SecretManagerService", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService" + } + } + } + }, + { + "regionTag": "secretmanager_v1_generated_SecretManagerService_DestroySecretVersion_async", + "title": "SecretManagerService destroySecretVersion Sample", + "origin": "API_DEFINITION", + "description": " Destroys a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Sets the [state][google.cloud.secretmanager.v1.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to [DESTROYED][google.cloud.secretmanager.v1.SecretVersion.State.DESTROYED] and irrevocably destroys the secret data.", + "canonical": true, + "file": "secret_manager_service.destroy_secret_version.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 57, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "DestroySecretVersion", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.DestroySecretVersion", + "async": true, + "parameters": [ + { + "name": "name", + "type": "TYPE_STRING" + }, + { + "name": "etag", + "type": "TYPE_STRING" + } + ], + "resultType": ".google.cloud.secretmanager.v1.SecretVersion", + "client": { + "shortName": "SecretManagerServiceClient", + "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" + }, + "method": { + "shortName": "DestroySecretVersion", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.DestroySecretVersion", + "service": { + "shortName": "SecretManagerService", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService" + } + } + } + }, + { + "regionTag": "secretmanager_v1_generated_SecretManagerService_SetIamPolicy_async", + "title": "SecretManagerService setIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Sets the access control policy on the specified secret. Replaces any existing policy. Permissions on [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] are enforced according to the policy set on the associated [Secret][google.cloud.secretmanager.v1.Secret].", + "canonical": true, + "file": "secret_manager_service.set_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 66, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.SetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "policy", + "type": ".google.iam.v1.Policy" + }, + { + "name": "update_mask", + "type": ".google.protobuf.FieldMask" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "SecretManagerServiceClient", + "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" + }, + "method": { + "shortName": "SetIamPolicy", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.SetIamPolicy", + "service": { + "shortName": "SecretManagerService", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService" + } + } + } + }, + { + "regionTag": "secretmanager_v1_generated_SecretManagerService_GetIamPolicy_async", + "title": "SecretManagerService getIamPolicy Sample", + "origin": "API_DEFINITION", + "description": " Gets the access control policy for a secret. Returns empty policy if the secret exists and does not have a policy set.", + "canonical": true, + "file": "secret_manager_service.get_iam_policy.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 56, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.GetIamPolicy", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "options", + "type": ".google.iam.v1.GetPolicyOptions" + } + ], + "resultType": ".google.iam.v1.Policy", + "client": { + "shortName": "SecretManagerServiceClient", + "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" + }, + "method": { + "shortName": "GetIamPolicy", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.GetIamPolicy", + "service": { + "shortName": "SecretManagerService", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService" + } + } + } + }, + { + "regionTag": "secretmanager_v1_generated_SecretManagerService_TestIamPermissions_async", + "title": "SecretManagerService testIamPermissions Sample", + "origin": "API_DEFINITION", + "description": " Returns permissions that a caller has for the specified secret. If the secret does not exist, this call returns an empty set of permissions, not a NOT_FOUND error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may \"fail open\" without warning.", + "canonical": true, + "file": "secret_manager_service.test_iam_permissions.js", + "language": "JAVASCRIPT", + "segments": [ + { + "start": 25, + "end": 59, + "type": "FULL" + } + ], + "clientMethod": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.TestIamPermissions", + "async": true, + "parameters": [ + { + "name": "resource", + "type": "TYPE_STRING" + }, + { + "name": "permissions", + "type": "TYPE_STRING[]" + } + ], + "resultType": ".google.iam.v1.TestIamPermissionsResponse", + "client": { + "shortName": "SecretManagerServiceClient", + "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" + }, + "method": { + "shortName": "TestIamPermissions", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService.TestIamPermissions", + "service": { + "shortName": "SecretManagerService", + "fullName": "google.cloud.secretmanager.v1.SecretManagerService" + } + } + } + } + ] +} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 0000000..0fbe99b --- /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 SecretManagerServiceClient = v1.SecretManagerServiceClient; +type SecretManagerServiceClient = v1.SecretManagerServiceClient; +export {v1, SecretManagerServiceClient}; +export default {v1, SecretManagerServiceClient}; +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..077d68e --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,181 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.secretmanager.v1", + "libraryPackage": "@google-cloud/secret-manager", + "services": { + "SecretManagerService": { + "clients": { + "grpc": { + "libraryClient": "SecretManagerServiceClient", + "rpcs": { + "CreateSecret": { + "methods": [ + "createSecret" + ] + }, + "AddSecretVersion": { + "methods": [ + "addSecretVersion" + ] + }, + "GetSecret": { + "methods": [ + "getSecret" + ] + }, + "UpdateSecret": { + "methods": [ + "updateSecret" + ] + }, + "DeleteSecret": { + "methods": [ + "deleteSecret" + ] + }, + "GetSecretVersion": { + "methods": [ + "getSecretVersion" + ] + }, + "AccessSecretVersion": { + "methods": [ + "accessSecretVersion" + ] + }, + "DisableSecretVersion": { + "methods": [ + "disableSecretVersion" + ] + }, + "EnableSecretVersion": { + "methods": [ + "enableSecretVersion" + ] + }, + "DestroySecretVersion": { + "methods": [ + "destroySecretVersion" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "ListSecrets": { + "methods": [ + "listSecrets", + "listSecretsStream", + "listSecretsAsync" + ] + }, + "ListSecretVersions": { + "methods": [ + "listSecretVersions", + "listSecretVersionsStream", + "listSecretVersionsAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "SecretManagerServiceClient", + "rpcs": { + "CreateSecret": { + "methods": [ + "createSecret" + ] + }, + "AddSecretVersion": { + "methods": [ + "addSecretVersion" + ] + }, + "GetSecret": { + "methods": [ + "getSecret" + ] + }, + "UpdateSecret": { + "methods": [ + "updateSecret" + ] + }, + "DeleteSecret": { + "methods": [ + "deleteSecret" + ] + }, + "GetSecretVersion": { + "methods": [ + "getSecretVersion" + ] + }, + "AccessSecretVersion": { + "methods": [ + "accessSecretVersion" + ] + }, + "DisableSecretVersion": { + "methods": [ + "disableSecretVersion" + ] + }, + "EnableSecretVersion": { + "methods": [ + "enableSecretVersion" + ] + }, + "DestroySecretVersion": { + "methods": [ + "destroySecretVersion" + ] + }, + "SetIamPolicy": { + "methods": [ + "setIamPolicy" + ] + }, + "GetIamPolicy": { + "methods": [ + "getIamPolicy" + ] + }, + "TestIamPermissions": { + "methods": [ + "testIamPermissions" + ] + }, + "ListSecrets": { + "methods": [ + "listSecrets", + "listSecretsStream", + "listSecretsAsync" + ] + }, + "ListSecretVersions": { + "methods": [ + "listSecretVersions", + "listSecretVersionsStream", + "listSecretVersionsAsync" + ] + } + } + } + } + } + } +} 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..25c17ec --- /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 {SecretManagerServiceClient} from './secret_manager_service_client'; diff --git a/owl-bot-staging/v1/src/v1/secret_manager_service_client.ts b/owl-bot-staging/v1/src/v1/secret_manager_service_client.ts new file mode 100644 index 0000000..4de538a --- /dev/null +++ b/owl-bot-staging/v1/src/v1/secret_manager_service_client.ts @@ -0,0 +1,1902 @@ +// 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, 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/secret_manager_service_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './secret_manager_service_client_config.json'; + +const version = require('../../../package.json').version; + +/** + * Secret Manager Service + * + * Manages secrets and operations using those secrets. Implements a REST + * model with the following objects: + * + * * {@link google.cloud.secretmanager.v1.Secret|Secret} + * * {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} + * @class + * @memberof v1 + */ +export class SecretManagerServiceClient { + 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}; + secretManagerServiceStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of SecretManagerServiceClient. + * + * @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 SecretManagerServiceClient; + 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 = { + projectPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}' + ), + secretPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/secrets/{secret}' + ), + secretVersionPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/secrets/{secret}/versions/{secret_version}' + ), + topicPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/topics/{topic}' + ), + }; + + // 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 = { + listSecrets: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'secrets'), + listSecretVersions: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'versions') + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.secretmanager.v1.SecretManagerService', 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.secretManagerServiceStub) { + return this.secretManagerServiceStub; + } + + // Put together the "service stub" for + // google.cloud.secretmanager.v1.SecretManagerService. + this.secretManagerServiceStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.secretmanager.v1.SecretManagerService') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.secretmanager.v1.SecretManagerService, + 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 secretManagerServiceStubMethods = + ['listSecrets', 'createSecret', 'addSecretVersion', 'getSecret', 'updateSecret', 'deleteSecret', 'listSecretVersions', 'getSecretVersion', 'accessSecretVersion', 'disableSecretVersion', 'enableSecretVersion', 'destroySecretVersion', 'setIamPolicy', 'getIamPolicy', 'testIamPermissions']; + for (const methodName of secretManagerServiceStubMethods) { + const callPromise = this.secretManagerServiceStub.then( + stub => (...args: Array<{}>) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, + (err: Error|null|undefined) => () => { + throw err; + }); + + const descriptor = + this.descriptors.page[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall( + callPromise, + this._defaults[methodName], + descriptor + ); + + this.innerApiCalls[methodName] = apiCall; + } + + return this.secretManagerServiceStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'secretmanager.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 'secretmanager.googleapis.com'; + } + + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform' + ]; + } + + getProjectId(): Promise; + getProjectId(callback: Callback): void; + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback?: Callback): + Promise|void { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + + // ------------------- + // -- Service calls -- + // ------------------- +/** + * Creates a new {@link google.cloud.secretmanager.v1.Secret|Secret} containing no {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersions}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the project to associate with the + * {@link google.cloud.secretmanager.v1.Secret|Secret}, in the format `projects/*`. + * @param {string} request.secretId + * Required. This must be unique within the project. + * + * A secret ID is a string with a maximum length of 255 characters and can + * contain uppercase and lowercase letters, numerals, and the hyphen (`-`) and + * underscore (`_`) characters. + * @param {google.cloud.secretmanager.v1.Secret} request.secret + * Required. A {@link google.cloud.secretmanager.v1.Secret|Secret} with initial field values. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Secret]{@link google.cloud.secretmanager.v1.Secret}. + * 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/secret_manager_service.create_secret.js + * region_tag:secretmanager_v1_generated_SecretManagerService_CreateSecret_async + */ + createSecret( + request?: protos.google.cloud.secretmanager.v1.ICreateSecretRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecret, + protos.google.cloud.secretmanager.v1.ICreateSecretRequest|undefined, {}|undefined + ]>; + createSecret( + request: protos.google.cloud.secretmanager.v1.ICreateSecretRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.secretmanager.v1.ISecret, + protos.google.cloud.secretmanager.v1.ICreateSecretRequest|null|undefined, + {}|null|undefined>): void; + createSecret( + request: protos.google.cloud.secretmanager.v1.ICreateSecretRequest, + callback: Callback< + protos.google.cloud.secretmanager.v1.ISecret, + protos.google.cloud.secretmanager.v1.ICreateSecretRequest|null|undefined, + {}|null|undefined>): void; + createSecret( + request?: protos.google.cloud.secretmanager.v1.ICreateSecretRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.secretmanager.v1.ISecret, + protos.google.cloud.secretmanager.v1.ICreateSecretRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.secretmanager.v1.ISecret, + protos.google.cloud.secretmanager.v1.ICreateSecretRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecret, + protos.google.cloud.secretmanager.v1.ICreateSecretRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.createSecret(request, options, callback); + } +/** + * Creates a new {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} containing secret data and attaches + * it to an existing {@link google.cloud.secretmanager.v1.Secret|Secret}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link google.cloud.secretmanager.v1.Secret|Secret} to associate with the + * {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} in the format `projects/* /secrets/*`. + * @param {google.cloud.secretmanager.v1.SecretPayload} request.payload + * Required. The secret payload of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SecretVersion]{@link google.cloud.secretmanager.v1.SecretVersion}. + * 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/secret_manager_service.add_secret_version.js + * region_tag:secretmanager_v1_generated_SecretManagerService_AddSecretVersion_async + */ + addSecretVersion( + request?: protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest|undefined, {}|undefined + ]>; + addSecretVersion( + request: protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest|null|undefined, + {}|null|undefined>): void; + addSecretVersion( + request: protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest, + callback: Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest|null|undefined, + {}|null|undefined>): void; + addSecretVersion( + request?: protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.addSecretVersion(request, options, callback); + } +/** + * Gets metadata for a given {@link google.cloud.secretmanager.v1.Secret|Secret}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the {@link google.cloud.secretmanager.v1.Secret|Secret}, in the format `projects/* /secrets/*`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Secret]{@link google.cloud.secretmanager.v1.Secret}. + * 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/secret_manager_service.get_secret.js + * region_tag:secretmanager_v1_generated_SecretManagerService_GetSecret_async + */ + getSecret( + request?: protos.google.cloud.secretmanager.v1.IGetSecretRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecret, + protos.google.cloud.secretmanager.v1.IGetSecretRequest|undefined, {}|undefined + ]>; + getSecret( + request: protos.google.cloud.secretmanager.v1.IGetSecretRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.secretmanager.v1.ISecret, + protos.google.cloud.secretmanager.v1.IGetSecretRequest|null|undefined, + {}|null|undefined>): void; + getSecret( + request: protos.google.cloud.secretmanager.v1.IGetSecretRequest, + callback: Callback< + protos.google.cloud.secretmanager.v1.ISecret, + protos.google.cloud.secretmanager.v1.IGetSecretRequest|null|undefined, + {}|null|undefined>): void; + getSecret( + request?: protos.google.cloud.secretmanager.v1.IGetSecretRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.secretmanager.v1.ISecret, + protos.google.cloud.secretmanager.v1.IGetSecretRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.secretmanager.v1.ISecret, + protos.google.cloud.secretmanager.v1.IGetSecretRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecret, + protos.google.cloud.secretmanager.v1.IGetSecretRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.getSecret(request, options, callback); + } +/** + * Updates metadata of an existing {@link google.cloud.secretmanager.v1.Secret|Secret}. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.secretmanager.v1.Secret} request.secret + * Required. {@link google.cloud.secretmanager.v1.Secret|Secret} with updated field values. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. Specifies the fields to be updated. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Secret]{@link google.cloud.secretmanager.v1.Secret}. + * 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/secret_manager_service.update_secret.js + * region_tag:secretmanager_v1_generated_SecretManagerService_UpdateSecret_async + */ + updateSecret( + request?: protos.google.cloud.secretmanager.v1.IUpdateSecretRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecret, + protos.google.cloud.secretmanager.v1.IUpdateSecretRequest|undefined, {}|undefined + ]>; + updateSecret( + request: protos.google.cloud.secretmanager.v1.IUpdateSecretRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.secretmanager.v1.ISecret, + protos.google.cloud.secretmanager.v1.IUpdateSecretRequest|null|undefined, + {}|null|undefined>): void; + updateSecret( + request: protos.google.cloud.secretmanager.v1.IUpdateSecretRequest, + callback: Callback< + protos.google.cloud.secretmanager.v1.ISecret, + protos.google.cloud.secretmanager.v1.IUpdateSecretRequest|null|undefined, + {}|null|undefined>): void; + updateSecret( + request?: protos.google.cloud.secretmanager.v1.IUpdateSecretRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.secretmanager.v1.ISecret, + protos.google.cloud.secretmanager.v1.IUpdateSecretRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.secretmanager.v1.ISecret, + protos.google.cloud.secretmanager.v1.IUpdateSecretRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecret, + protos.google.cloud.secretmanager.v1.IUpdateSecretRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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({ + 'secret.name': request.secret!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateSecret(request, options, callback); + } +/** + * Deletes a {@link google.cloud.secretmanager.v1.Secret|Secret}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the {@link google.cloud.secretmanager.v1.Secret|Secret} to delete in the format + * `projects/* /secrets/*`. + * @param {string} [request.etag] + * Optional. Etag of the {@link google.cloud.secretmanager.v1.Secret|Secret}. The request succeeds if it matches + * the etag of the currently stored secret object. If the etag is omitted, + * the request succeeds. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/secret_manager_service.delete_secret.js + * region_tag:secretmanager_v1_generated_SecretManagerService_DeleteSecret_async + */ + deleteSecret( + request?: protos.google.cloud.secretmanager.v1.IDeleteSecretRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.secretmanager.v1.IDeleteSecretRequest|undefined, {}|undefined + ]>; + deleteSecret( + request: protos.google.cloud.secretmanager.v1.IDeleteSecretRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.secretmanager.v1.IDeleteSecretRequest|null|undefined, + {}|null|undefined>): void; + deleteSecret( + request: protos.google.cloud.secretmanager.v1.IDeleteSecretRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.secretmanager.v1.IDeleteSecretRequest|null|undefined, + {}|null|undefined>): void; + deleteSecret( + request?: protos.google.cloud.secretmanager.v1.IDeleteSecretRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.secretmanager.v1.IDeleteSecretRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.secretmanager.v1.IDeleteSecretRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.secretmanager.v1.IDeleteSecretRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.deleteSecret(request, options, callback); + } +/** + * Gets metadata for a {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. + * + * `projects/* /secrets/* /versions/latest` is an alias to the most recently + * created {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} in the format + * `projects/* /secrets/* /versions/*`. + * + * `projects/* /secrets/* /versions/latest` is an alias to the most recently + * created {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SecretVersion]{@link google.cloud.secretmanager.v1.SecretVersion}. + * 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/secret_manager_service.get_secret_version.js + * region_tag:secretmanager_v1_generated_SecretManagerService_GetSecretVersion_async + */ + getSecretVersion( + request?: protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest|undefined, {}|undefined + ]>; + getSecretVersion( + request: protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest|null|undefined, + {}|null|undefined>): void; + getSecretVersion( + request: protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest, + callback: Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest|null|undefined, + {}|null|undefined>): void; + getSecretVersion( + request?: protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.getSecretVersion(request, options, callback); + } +/** + * Accesses a {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. This call returns the secret data. + * + * `projects/* /secrets/* /versions/latest` is an alias to the most recently + * created {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} in the format + * `projects/* /secrets/* /versions/*`. + * + * `projects/* /secrets/* /versions/latest` is an alias to the most recently + * created {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [AccessSecretVersionResponse]{@link google.cloud.secretmanager.v1.AccessSecretVersionResponse}. + * 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/secret_manager_service.access_secret_version.js + * region_tag:secretmanager_v1_generated_SecretManagerService_AccessSecretVersion_async + */ + accessSecretVersion( + request?: protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.secretmanager.v1.IAccessSecretVersionResponse, + protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest|undefined, {}|undefined + ]>; + accessSecretVersion( + request: protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.secretmanager.v1.IAccessSecretVersionResponse, + protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest|null|undefined, + {}|null|undefined>): void; + accessSecretVersion( + request: protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest, + callback: Callback< + protos.google.cloud.secretmanager.v1.IAccessSecretVersionResponse, + protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest|null|undefined, + {}|null|undefined>): void; + accessSecretVersion( + request?: protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.secretmanager.v1.IAccessSecretVersionResponse, + protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.secretmanager.v1.IAccessSecretVersionResponse, + protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.secretmanager.v1.IAccessSecretVersionResponse, + protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.accessSecretVersion(request, options, callback); + } +/** + * Disables a {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. + * + * Sets the {@link google.cloud.secretmanager.v1.SecretVersion.state|state} of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} to + * {@link google.cloud.secretmanager.v1.SecretVersion.State.DISABLED|DISABLED}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} to disable in the format + * `projects/* /secrets/* /versions/*`. + * @param {string} [request.etag] + * Optional. Etag of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. The request succeeds if it matches + * the etag of the currently stored secret version object. If the etag is + * omitted, the request succeeds. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SecretVersion]{@link google.cloud.secretmanager.v1.SecretVersion}. + * 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/secret_manager_service.disable_secret_version.js + * region_tag:secretmanager_v1_generated_SecretManagerService_DisableSecretVersion_async + */ + disableSecretVersion( + request?: protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest|undefined, {}|undefined + ]>; + disableSecretVersion( + request: protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest|null|undefined, + {}|null|undefined>): void; + disableSecretVersion( + request: protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest, + callback: Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest|null|undefined, + {}|null|undefined>): void; + disableSecretVersion( + request?: protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.disableSecretVersion(request, options, callback); + } +/** + * Enables a {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. + * + * Sets the {@link google.cloud.secretmanager.v1.SecretVersion.state|state} of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} to + * {@link google.cloud.secretmanager.v1.SecretVersion.State.ENABLED|ENABLED}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} to enable in the format + * `projects/* /secrets/* /versions/*`. + * @param {string} [request.etag] + * Optional. Etag of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. The request succeeds if it matches + * the etag of the currently stored secret version object. If the etag is + * omitted, the request succeeds. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SecretVersion]{@link google.cloud.secretmanager.v1.SecretVersion}. + * 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/secret_manager_service.enable_secret_version.js + * region_tag:secretmanager_v1_generated_SecretManagerService_EnableSecretVersion_async + */ + enableSecretVersion( + request?: protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest|undefined, {}|undefined + ]>; + enableSecretVersion( + request: protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest|null|undefined, + {}|null|undefined>): void; + enableSecretVersion( + request: protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest, + callback: Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest|null|undefined, + {}|null|undefined>): void; + enableSecretVersion( + request?: protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.enableSecretVersion(request, options, callback); + } +/** + * Destroys a {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. + * + * Sets the {@link google.cloud.secretmanager.v1.SecretVersion.state|state} of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} to + * {@link google.cloud.secretmanager.v1.SecretVersion.State.DESTROYED|DESTROYED} and irrevocably destroys the + * secret data. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The resource name of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} to destroy in the format + * `projects/* /secrets/* /versions/*`. + * @param {string} [request.etag] + * Optional. Etag of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. The request succeeds if it matches + * the etag of the currently stored secret version object. If the etag is + * omitted, the request succeeds. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [SecretVersion]{@link google.cloud.secretmanager.v1.SecretVersion}. + * 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/secret_manager_service.destroy_secret_version.js + * region_tag:secretmanager_v1_generated_SecretManagerService_DestroySecretVersion_async + */ + destroySecretVersion( + request?: protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest|undefined, {}|undefined + ]>; + destroySecretVersion( + request: protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest|null|undefined, + {}|null|undefined>): void; + destroySecretVersion( + request: protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest, + callback: Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest|null|undefined, + {}|null|undefined>): void; + destroySecretVersion( + request?: protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecretVersion, + protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.destroySecretVersion(request, options, callback); + } +/** + * Sets the access control policy on the specified secret. Replaces any + * existing policy. + * + * Permissions on {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersions} are enforced according + * to the policy set on the associated {@link google.cloud.secretmanager.v1.Secret|Secret}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being specified. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.Policy} request.policy + * REQUIRED: The complete policy to be applied to the `resource`. The size of + * the policy is limited to a few 10s of KB. An empty policy is a + * valid policy but certain Cloud Platform services (such as Projects) + * might reject them. + * @param {google.protobuf.FieldMask} request.updateMask + * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only + * the fields in the mask will be modified. If no mask is provided, the + * following default mask is used: + * + * `paths: "bindings, etag"` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/secret_manager_service.set_iam_policy.js + * region_tag:secretmanager_v1_generated_SecretManagerService_SetIamPolicy_async + */ + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request: protos.google.iam.v1.ISetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + setIamPolicy( + request?: protos.google.iam.v1.ISetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.setIamPolicy(request, options, callback); + } +/** + * Gets the access control policy for a secret. + * Returns empty policy if the secret exists and does not have a policy set. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {google.iam.v1.GetPolicyOptions} request.options + * OPTIONAL: A `GetPolicyOptions` object for specifying options to + * `GetIamPolicy`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/secret_manager_service.get_iam_policy.js + * region_tag:secretmanager_v1_generated_SecretManagerService_GetIamPolicy_async + */ + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request: protos.google.iam.v1.IGetIamPolicyRequest, + callback: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): void; + getIamPolicy( + request?: protos.google.iam.v1.IGetIamPolicyRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.IPolicy, + protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.getIamPolicy(request, options, callback); + } +/** + * Returns permissions that a caller has for the specified secret. + * If the secret does not exist, this call returns an empty set of + * permissions, not a NOT_FOUND error. + * + * Note: This operation is designed to be used for building permission-aware + * UIs and command-line tools, not for authorization checking. This operation + * may "fail open" without warning. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.resource + * REQUIRED: The resource for which the policy detail is being requested. + * See the operation documentation for the appropriate value for this field. + * @param {string[]} request.permissions + * The set of permissions to check for the `resource`. Permissions with + * wildcards (such as '*' or 'storage.*') are not allowed. For more + * information see + * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/secret_manager_service.test_iam_permissions.js + * region_tag:secretmanager_v1_generated_SecretManagerService_TestIamPermissions_async + */ + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + options?: CallOptions): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + options: CallOptions, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request: protos.google.iam.v1.ITestIamPermissionsRequest, + callback: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): void; + testIamPermissions( + request?: protos.google.iam.v1.ITestIamPermissionsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.iam.v1.ITestIamPermissionsResponse, + protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback as CallOptions; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'resource': request.resource || '', + }); + this.initialize(); + return this.innerApiCalls.testIamPermissions(request, options, callback); + } + + /** + * Lists {@link google.cloud.secretmanager.v1.Secret|Secrets}. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the project associated with the + * {@link google.cloud.secretmanager.v1.Secret|Secrets}, in the format `projects/*`. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to be returned in a single page. If + * set to 0, the server decides the number of results to return. If the + * number is greater than 25000, it is capped at 25000. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.secretmanager.v1.ListSecretsResponse.next_page_token|ListSecretsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Filter string, adhering to the rules in + * [List-operation + * filtering](https://cloud.google.com/secret-manager/docs/filtering). List + * only secrets matching the filter. If filter is empty, all secrets are + * listed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Secret]{@link google.cloud.secretmanager.v1.Secret}. + * 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 `listSecretsAsync()` + * 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. + */ + listSecrets( + request?: protos.google.cloud.secretmanager.v1.IListSecretsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecret[], + protos.google.cloud.secretmanager.v1.IListSecretsRequest|null, + protos.google.cloud.secretmanager.v1.IListSecretsResponse + ]>; + listSecrets( + request: protos.google.cloud.secretmanager.v1.IListSecretsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.secretmanager.v1.IListSecretsRequest, + protos.google.cloud.secretmanager.v1.IListSecretsResponse|null|undefined, + protos.google.cloud.secretmanager.v1.ISecret>): void; + listSecrets( + request: protos.google.cloud.secretmanager.v1.IListSecretsRequest, + callback: PaginationCallback< + protos.google.cloud.secretmanager.v1.IListSecretsRequest, + protos.google.cloud.secretmanager.v1.IListSecretsResponse|null|undefined, + protos.google.cloud.secretmanager.v1.ISecret>): void; + listSecrets( + request?: protos.google.cloud.secretmanager.v1.IListSecretsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.secretmanager.v1.IListSecretsRequest, + protos.google.cloud.secretmanager.v1.IListSecretsResponse|null|undefined, + protos.google.cloud.secretmanager.v1.ISecret>, + callback?: PaginationCallback< + protos.google.cloud.secretmanager.v1.IListSecretsRequest, + protos.google.cloud.secretmanager.v1.IListSecretsResponse|null|undefined, + protos.google.cloud.secretmanager.v1.ISecret>): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecret[], + protos.google.cloud.secretmanager.v1.IListSecretsRequest|null, + protos.google.cloud.secretmanager.v1.IListSecretsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listSecrets(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the project associated with the + * {@link google.cloud.secretmanager.v1.Secret|Secrets}, in the format `projects/*`. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to be returned in a single page. If + * set to 0, the server decides the number of results to return. If the + * number is greater than 25000, it is capped at 25000. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.secretmanager.v1.ListSecretsResponse.next_page_token|ListSecretsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Filter string, adhering to the rules in + * [List-operation + * filtering](https://cloud.google.com/secret-manager/docs/filtering). List + * only secrets matching the filter. If filter is empty, all secrets are + * listed. + * @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 [Secret]{@link google.cloud.secretmanager.v1.Secret} 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 `listSecretsAsync()` + * 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. + */ + listSecretsStream( + request?: protos.google.cloud.secretmanager.v1.IListSecretsRequest, + 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['listSecrets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSecrets.createStream( + this.innerApiCalls.listSecrets as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSecrets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the project associated with the + * {@link google.cloud.secretmanager.v1.Secret|Secrets}, in the format `projects/*`. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to be returned in a single page. If + * set to 0, the server decides the number of results to return. If the + * number is greater than 25000, it is capped at 25000. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * {@link google.cloud.secretmanager.v1.ListSecretsResponse.next_page_token|ListSecretsResponse.next_page_token}. + * @param {string} [request.filter] + * Optional. Filter string, adhering to the rules in + * [List-operation + * filtering](https://cloud.google.com/secret-manager/docs/filtering). List + * only secrets matching the filter. If filter is empty, all secrets are + * listed. + * @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 + * [Secret]{@link google.cloud.secretmanager.v1.Secret}. 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/secret_manager_service.list_secrets.js + * region_tag:secretmanager_v1_generated_SecretManagerService_ListSecrets_async + */ + listSecretsAsync( + request?: protos.google.cloud.secretmanager.v1.IListSecretsRequest, + 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['listSecrets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSecrets.asyncIterate( + this.innerApiCalls['listSecrets'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersions}. This call does not return secret + * data. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link google.cloud.secretmanager.v1.Secret|Secret} associated with the + * {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersions} to list, in the format + * `projects/* /secrets/*`. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to be returned in a single page. If + * set to 0, the server decides the number of results to return. If the + * number is greater than 25000, it is capped at 25000. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * ListSecretVersionsResponse.next_page_token][]. + * @param {string} [request.filter] + * Optional. Filter string, adhering to the rules in + * [List-operation + * filtering](https://cloud.google.com/secret-manager/docs/filtering). List + * only secret versions matching the filter. If filter is empty, all secret + * versions are listed. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [SecretVersion]{@link google.cloud.secretmanager.v1.SecretVersion}. + * 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 `listSecretVersionsAsync()` + * 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. + */ + listSecretVersions( + request?: protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecretVersion[], + protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest|null, + protos.google.cloud.secretmanager.v1.IListSecretVersionsResponse + ]>; + listSecretVersions( + request: protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, + protos.google.cloud.secretmanager.v1.IListSecretVersionsResponse|null|undefined, + protos.google.cloud.secretmanager.v1.ISecretVersion>): void; + listSecretVersions( + request: protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, + callback: PaginationCallback< + protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, + protos.google.cloud.secretmanager.v1.IListSecretVersionsResponse|null|undefined, + protos.google.cloud.secretmanager.v1.ISecretVersion>): void; + listSecretVersions( + request?: protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, + protos.google.cloud.secretmanager.v1.IListSecretVersionsResponse|null|undefined, + protos.google.cloud.secretmanager.v1.ISecretVersion>, + callback?: PaginationCallback< + protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, + protos.google.cloud.secretmanager.v1.IListSecretVersionsResponse|null|undefined, + protos.google.cloud.secretmanager.v1.ISecretVersion>): + Promise<[ + protos.google.cloud.secretmanager.v1.ISecretVersion[], + protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest|null, + protos.google.cloud.secretmanager.v1.IListSecretVersionsResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + 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.listSecretVersions(request, options, callback); + } + +/** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link google.cloud.secretmanager.v1.Secret|Secret} associated with the + * {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersions} to list, in the format + * `projects/* /secrets/*`. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to be returned in a single page. If + * set to 0, the server decides the number of results to return. If the + * number is greater than 25000, it is capped at 25000. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * ListSecretVersionsResponse.next_page_token][]. + * @param {string} [request.filter] + * Optional. Filter string, adhering to the rules in + * [List-operation + * filtering](https://cloud.google.com/secret-manager/docs/filtering). List + * only secret versions matching the filter. If filter is empty, all secret + * versions are listed. + * @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 [SecretVersion]{@link google.cloud.secretmanager.v1.SecretVersion} 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 `listSecretVersionsAsync()` + * 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. + */ + listSecretVersionsStream( + request?: protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, + 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['listSecretVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSecretVersions.createStream( + this.innerApiCalls.listSecretVersions as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listSecretVersions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name of the {@link google.cloud.secretmanager.v1.Secret|Secret} associated with the + * {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersions} to list, in the format + * `projects/* /secrets/*`. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to be returned in a single page. If + * set to 0, the server decides the number of results to return. If the + * number is greater than 25000, it is capped at 25000. + * @param {string} [request.pageToken] + * Optional. Pagination token, returned earlier via + * ListSecretVersionsResponse.next_page_token][]. + * @param {string} [request.filter] + * Optional. Filter string, adhering to the rules in + * [List-operation + * filtering](https://cloud.google.com/secret-manager/docs/filtering). List + * only secret versions matching the filter. If filter is empty, all secret + * versions are listed. + * @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 + * [SecretVersion]{@link google.cloud.secretmanager.v1.SecretVersion}. 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/secret_manager_service.list_secret_versions.js + * region_tag:secretmanager_v1_generated_SecretManagerService_ListSecretVersions_async + */ + listSecretVersionsAsync( + request?: protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, + 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['listSecretVersions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSecretVersions.asyncIterate( + this.innerApiCalls['listSecretVersions'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project:string) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName: string) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + + /** + * Return a fully-qualified secret resource name string. + * + * @param {string} project + * @param {string} secret + * @returns {string} Resource name string. + */ + secretPath(project:string,secret:string) { + return this.pathTemplates.secretPathTemplate.render({ + project: project, + secret: secret, + }); + } + + /** + * Parse the project from Secret resource. + * + * @param {string} secretName + * A fully-qualified path representing Secret resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSecretName(secretName: string) { + return this.pathTemplates.secretPathTemplate.match(secretName).project; + } + + /** + * Parse the secret from Secret resource. + * + * @param {string} secretName + * A fully-qualified path representing Secret resource. + * @returns {string} A string representing the secret. + */ + matchSecretFromSecretName(secretName: string) { + return this.pathTemplates.secretPathTemplate.match(secretName).secret; + } + + /** + * Return a fully-qualified secretVersion resource name string. + * + * @param {string} project + * @param {string} secret + * @param {string} secret_version + * @returns {string} Resource name string. + */ + secretVersionPath(project:string,secret:string,secretVersion:string) { + return this.pathTemplates.secretVersionPathTemplate.render({ + project: project, + secret: secret, + secret_version: secretVersion, + }); + } + + /** + * Parse the project from SecretVersion resource. + * + * @param {string} secretVersionName + * A fully-qualified path representing SecretVersion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSecretVersionName(secretVersionName: string) { + return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).project; + } + + /** + * Parse the secret from SecretVersion resource. + * + * @param {string} secretVersionName + * A fully-qualified path representing SecretVersion resource. + * @returns {string} A string representing the secret. + */ + matchSecretFromSecretVersionName(secretVersionName: string) { + return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).secret; + } + + /** + * Parse the secret_version from SecretVersion resource. + * + * @param {string} secretVersionName + * A fully-qualified path representing SecretVersion resource. + * @returns {string} A string representing the secret_version. + */ + matchSecretVersionFromSecretVersionName(secretVersionName: string) { + return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).secret_version; + } + + /** + * Return a fully-qualified topic resource name string. + * + * @param {string} project + * @param {string} topic + * @returns {string} Resource name string. + */ + topicPath(project:string,topic:string) { + return this.pathTemplates.topicPathTemplate.render({ + project: project, + topic: topic, + }); + } + + /** + * Parse the project from Topic resource. + * + * @param {string} topicName + * A fully-qualified path representing Topic resource. + * @returns {string} A string representing the project. + */ + matchProjectFromTopicName(topicName: string) { + return this.pathTemplates.topicPathTemplate.match(topicName).project; + } + + /** + * Parse the topic from Topic resource. + * + * @param {string} topicName + * A fully-qualified path representing Topic resource. + * @returns {string} A string representing the topic. + */ + matchTopicFromTopicName(topicName: string) { + return this.pathTemplates.topicPathTemplate.match(topicName).topic; + } + + /** + * 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.secretManagerServiceStub && !this._terminated) { + return this.secretManagerServiceStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/secret_manager_service_client_config.json b/owl-bot-staging/v1/src/v1/secret_manager_service_client_config.json new file mode 100644 index 0000000..0ad578c --- /dev/null +++ b/owl-bot-staging/v1/src/v1/secret_manager_service_client_config.json @@ -0,0 +1,114 @@ +{ + "interfaces": { + "google.cloud.secretmanager.v1.SecretManagerService": { + "retry_codes": { + "non_idempotent": [], + "idempotent": [ + "DEADLINE_EXCEEDED", + "UNAVAILABLE" + ], + "resource_exhausted_unavailable": [ + "RESOURCE_EXHAUSTED", + "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 + }, + "dd71b8c1d82d51c18ce5ba426d9acc4c44e7746e": { + "initial_retry_delay_millis": 2000, + "retry_delay_multiplier": 2, + "max_retry_delay_millis": 60000, + "initial_rpc_timeout_millis": 60000, + "rpc_timeout_multiplier": 1, + "max_rpc_timeout_millis": 60000, + "total_timeout_millis": 600000 + } + }, + "methods": { + "ListSecrets": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "CreateSecret": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AddSecretVersion": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetSecret": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "UpdateSecret": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DeleteSecret": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "ListSecretVersions": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetSecretVersion": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "AccessSecretVersion": { + "timeout_millis": 60000, + "retry_codes_name": "resource_exhausted_unavailable", + "retry_params_name": "dd71b8c1d82d51c18ce5ba426d9acc4c44e7746e" + }, + "DisableSecretVersion": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "EnableSecretVersion": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "DestroySecretVersion": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "SetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "GetIamPolicy": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + }, + "TestIamPermissions": { + "timeout_millis": 60000, + "retry_codes_name": "non_idempotent", + "retry_params_name": "default" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/secret_manager_service_proto_list.json b/owl-bot-staging/v1/src/v1/secret_manager_service_proto_list.json new file mode 100644 index 0000000..47a1283 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/secret_manager_service_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/secretmanager/v1/resources.proto", + "../../protos/google/cloud/secretmanager/v1/service.proto" +] 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..125b3d0 --- /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 secretmanager = require('@google-cloud/secret-manager'); + +function main() { + const secretManagerServiceClient = new secretmanager.SecretManagerServiceClient(); +} + +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..fba4421 --- /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 {SecretManagerServiceClient} from '@google-cloud/secret-manager'; + +// check that the client class type name can be used +function doStuffWithSecretManagerServiceClient(client: SecretManagerServiceClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const secretManagerServiceClient = new SecretManagerServiceClient(); + doStuffWithSecretManagerServiceClient(secretManagerServiceClient); +} + +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_secret_manager_service_v1.ts b/owl-bot-staging/v1/test/gapic_secret_manager_service_v1.ts new file mode 100644 index 0000000..c2116a1 --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_secret_manager_service_v1.ts @@ -0,0 +1,2048 @@ +// 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 secretmanagerserviceModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function 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.SecretManagerServiceClient', () => { + it('has servicePath', () => { + const servicePath = secretmanagerserviceModule.v1.SecretManagerServiceClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = secretmanagerserviceModule.v1.SecretManagerServiceClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = secretmanagerserviceModule.v1.SecretManagerServiceClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.secretManagerServiceStub, undefined); + await client.initialize(); + assert(client.secretManagerServiceStub); + }); + + it('has close method for the initialized client', done => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + assert(client.secretManagerServiceStub); + client.close().then(() => { + done(); + }); + }); + + it('has close method for the non-initialized client', done => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.secretManagerServiceStub, undefined); + client.close().then(() => { + done(); + }); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + 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 secretmanagerserviceModule.v1.SecretManagerServiceClient({ + 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('createSecret', () => { + it('invokes createSecret without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.CreateSecretRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()); + client.innerApiCalls.createSecret = stubSimpleCall(expectedResponse); + const [response] = await client.createSecret(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSecret as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createSecret without error using callback', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.CreateSecretRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()); + client.innerApiCalls.createSecret = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createSecret( + request, + (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecret|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createSecret as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createSecret with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.CreateSecretRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createSecret = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createSecret(request), expectedError); + assert((client.innerApiCalls.createSecret as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createSecret with closed client', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.CreateSecretRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSecret(request), expectedError); + }); + }); + + describe('addSecretVersion', () => { + it('invokes addSecretVersion without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AddSecretVersionRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); + client.innerApiCalls.addSecretVersion = stubSimpleCall(expectedResponse); + const [response] = await client.addSecretVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.addSecretVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes addSecretVersion without error using callback', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AddSecretVersionRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); + client.innerApiCalls.addSecretVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.addSecretVersion( + request, + (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecretVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.addSecretVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes addSecretVersion with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AddSecretVersionRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.addSecretVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.addSecretVersion(request), expectedError); + assert((client.innerApiCalls.addSecretVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes addSecretVersion with closed client', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AddSecretVersionRequest()); + request.parent = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.addSecretVersion(request), expectedError); + }); + }); + + describe('getSecret', () => { + it('invokes getSecret without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.GetSecretRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()); + client.innerApiCalls.getSecret = stubSimpleCall(expectedResponse); + const [response] = await client.getSecret(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSecret as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSecret without error using callback', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.GetSecretRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()); + client.innerApiCalls.getSecret = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSecret( + request, + (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecret|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSecret as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getSecret with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.GetSecretRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getSecret = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSecret(request), expectedError); + assert((client.innerApiCalls.getSecret as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSecret with closed client', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.GetSecretRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSecret(request), expectedError); + }); + }); + + describe('updateSecret', () => { + it('invokes updateSecret without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.UpdateSecretRequest()); + request.secret = {}; + request.secret.name = ''; + const expectedHeaderRequestParams = "secret.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()); + client.innerApiCalls.updateSecret = stubSimpleCall(expectedResponse); + const [response] = await client.updateSecret(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSecret as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateSecret without error using callback', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.UpdateSecretRequest()); + request.secret = {}; + request.secret.name = ''; + const expectedHeaderRequestParams = "secret.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()); + client.innerApiCalls.updateSecret = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSecret( + request, + (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecret|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSecret as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateSecret with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.UpdateSecretRequest()); + request.secret = {}; + request.secret.name = ''; + const expectedHeaderRequestParams = "secret.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSecret = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSecret(request), expectedError); + assert((client.innerApiCalls.updateSecret as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateSecret with closed client', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.UpdateSecretRequest()); + request.secret = {}; + request.secret.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSecret(request), expectedError); + }); + }); + + describe('deleteSecret', () => { + it('invokes deleteSecret without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DeleteSecretRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteSecret = stubSimpleCall(expectedResponse); + const [response] = await client.deleteSecret(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteSecret as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteSecret without error using callback', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DeleteSecretRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteSecret = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteSecret( + request, + (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteSecret as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteSecret with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DeleteSecretRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteSecret = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteSecret(request), expectedError); + assert((client.innerApiCalls.deleteSecret as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteSecret with closed client', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DeleteSecretRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteSecret(request), expectedError); + }); + }); + + describe('getSecretVersion', () => { + it('invokes getSecretVersion without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.GetSecretVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); + client.innerApiCalls.getSecretVersion = stubSimpleCall(expectedResponse); + const [response] = await client.getSecretVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSecretVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSecretVersion without error using callback', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.GetSecretVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); + client.innerApiCalls.getSecretVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSecretVersion( + request, + (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecretVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSecretVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getSecretVersion with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.GetSecretVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getSecretVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSecretVersion(request), expectedError); + assert((client.innerApiCalls.getSecretVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSecretVersion with closed client', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.GetSecretVersionRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSecretVersion(request), expectedError); + }); + }); + + describe('accessSecretVersion', () => { + it('invokes accessSecretVersion without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AccessSecretVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AccessSecretVersionResponse()); + client.innerApiCalls.accessSecretVersion = stubSimpleCall(expectedResponse); + const [response] = await client.accessSecretVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.accessSecretVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes accessSecretVersion without error using callback', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AccessSecretVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AccessSecretVersionResponse()); + client.innerApiCalls.accessSecretVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.accessSecretVersion( + request, + (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.IAccessSecretVersionResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.accessSecretVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes accessSecretVersion with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AccessSecretVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.accessSecretVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.accessSecretVersion(request), expectedError); + assert((client.innerApiCalls.accessSecretVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes accessSecretVersion with closed client', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AccessSecretVersionRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.accessSecretVersion(request), expectedError); + }); + }); + + describe('disableSecretVersion', () => { + it('invokes disableSecretVersion without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DisableSecretVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); + client.innerApiCalls.disableSecretVersion = stubSimpleCall(expectedResponse); + const [response] = await client.disableSecretVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.disableSecretVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes disableSecretVersion without error using callback', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DisableSecretVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); + client.innerApiCalls.disableSecretVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.disableSecretVersion( + request, + (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecretVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.disableSecretVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes disableSecretVersion with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DisableSecretVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.disableSecretVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.disableSecretVersion(request), expectedError); + assert((client.innerApiCalls.disableSecretVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes disableSecretVersion with closed client', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DisableSecretVersionRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.disableSecretVersion(request), expectedError); + }); + }); + + describe('enableSecretVersion', () => { + it('invokes enableSecretVersion without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.EnableSecretVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); + client.innerApiCalls.enableSecretVersion = stubSimpleCall(expectedResponse); + const [response] = await client.enableSecretVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.enableSecretVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes enableSecretVersion without error using callback', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.EnableSecretVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); + client.innerApiCalls.enableSecretVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.enableSecretVersion( + request, + (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecretVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.enableSecretVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes enableSecretVersion with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.EnableSecretVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.enableSecretVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.enableSecretVersion(request), expectedError); + assert((client.innerApiCalls.enableSecretVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes enableSecretVersion with closed client', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.EnableSecretVersionRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.enableSecretVersion(request), expectedError); + }); + }); + + describe('destroySecretVersion', () => { + it('invokes destroySecretVersion without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DestroySecretVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); + client.innerApiCalls.destroySecretVersion = stubSimpleCall(expectedResponse); + const [response] = await client.destroySecretVersion(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.destroySecretVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes destroySecretVersion without error using callback', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DestroySecretVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); + client.innerApiCalls.destroySecretVersion = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.destroySecretVersion( + request, + (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecretVersion|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.destroySecretVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes destroySecretVersion with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DestroySecretVersionRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.destroySecretVersion = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.destroySecretVersion(request), expectedError); + assert((client.innerApiCalls.destroySecretVersion as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes destroySecretVersion with closed client', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DestroySecretVersionRequest()); + request.name = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.destroySecretVersion(request), expectedError); + }); + }); + + describe('setIamPolicy', () => { + it('invokes setIamPolicy without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.setIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setIamPolicy without error using callback', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.setIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes setIamPolicy with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.setIamPolicy(request), expectedError); + assert((client.innerApiCalls.setIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes setIamPolicy with closed client', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); + request.resource = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setIamPolicy(request), expectedError); + }); + }); + + describe('getIamPolicy', () => { + it('invokes getIamPolicy without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); + const [response] = await client.getIamPolicy(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getIamPolicy without error using callback', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); + client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIamPolicy( + request, + (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getIamPolicy with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIamPolicy(request), expectedError); + assert((client.innerApiCalls.getIamPolicy as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getIamPolicy with closed client', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); + request.resource = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIamPolicy(request), expectedError); + }); + }); + + describe('testIamPermissions', () => { + it('invokes testIamPermissions without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); + const [response] = await client.testIamPermissions(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes testIamPermissions without error using callback', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); + client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.testIamPermissions( + request, + (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes testIamPermissions with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedHeaderRequestParams = "resource="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.testIamPermissions(request), expectedError); + assert((client.innerApiCalls.testIamPermissions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes testIamPermissions with closed client', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); + request.resource = ''; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.testIamPermissions(request), expectedError); + }); + }); + + describe('listSecrets', () => { + it('invokes listSecrets without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), + generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), + generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), + ]; + client.innerApiCalls.listSecrets = stubSimpleCall(expectedResponse); + const [response] = await client.listSecrets(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSecrets as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSecrets without error using callback', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), + generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), + generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), + ]; + client.innerApiCalls.listSecrets = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSecrets( + request, + (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecret[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSecrets as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listSecrets with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listSecrets = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSecrets(request), expectedError); + assert((client.innerApiCalls.listSecrets as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSecretsStream without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), + generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), + generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), + ]; + client.descriptors.page.listSecrets.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSecretsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.secretmanager.v1.Secret[] = []; + stream.on('data', (response: protos.google.cloud.secretmanager.v1.Secret) => { + 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.listSecrets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSecrets, request)); + assert.strictEqual( + (client.descriptors.page.listSecrets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listSecretsStream with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listSecrets.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSecretsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.secretmanager.v1.Secret[] = []; + stream.on('data', (response: protos.google.cloud.secretmanager.v1.Secret) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSecrets.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSecrets, request)); + assert.strictEqual( + (client.descriptors.page.listSecrets.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSecrets without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), + generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), + generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), + ]; + client.descriptors.page.listSecrets.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.secretmanager.v1.ISecret[] = []; + const iterable = client.listSecretsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSecrets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSecrets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSecrets with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listSecrets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSecretsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.secretmanager.v1.ISecret[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSecrets.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSecrets.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listSecretVersions', () => { + it('invokes listSecretVersions without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), + generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), + generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), + ]; + client.innerApiCalls.listSecretVersions = stubSimpleCall(expectedResponse); + const [response] = await client.listSecretVersions(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSecretVersions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSecretVersions without error using callback', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), + generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), + generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), + ]; + client.innerApiCalls.listSecretVersions = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listSecretVersions( + request, + (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecretVersion[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listSecretVersions as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listSecretVersions with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listSecretVersions = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listSecretVersions(request), expectedError); + assert((client.innerApiCalls.listSecretVersions as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listSecretVersionsStream without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), + generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), + generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), + ]; + client.descriptors.page.listSecretVersions.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listSecretVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.secretmanager.v1.SecretVersion[] = []; + stream.on('data', (response: protos.google.cloud.secretmanager.v1.SecretVersion) => { + 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.listSecretVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSecretVersions, request)); + assert.strictEqual( + (client.descriptors.page.listSecretVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listSecretVersionsStream with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listSecretVersions.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listSecretVersionsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.secretmanager.v1.SecretVersion[] = []; + stream.on('data', (response: protos.google.cloud.secretmanager.v1.SecretVersion) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listSecretVersions.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listSecretVersions, request)); + assert.strictEqual( + (client.descriptors.page.listSecretVersions.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSecretVersions without error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), + generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), + generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), + ]; + client.descriptors.page.listSecretVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.secretmanager.v1.ISecretVersion[] = []; + const iterable = client.listSecretVersionsAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listSecretVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSecretVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listSecretVersions with error', async () => { + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretVersionsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listSecretVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listSecretVersionsAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.secretmanager.v1.ISecretVersion[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listSecretVersions.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listSecretVersions.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('project', () => { + const fakePath = "/rendered/path/project"; + const expectedParameters = { + project: "projectValue", + }; + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.projectPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.projectPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('projectPath', () => { + const result = client.projectPath("projectValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.projectPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromProjectName', () => { + const result = client.matchProjectFromProjectName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.projectPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('secret', () => { + const fakePath = "/rendered/path/secret"; + const expectedParameters = { + project: "projectValue", + secret: "secretValue", + }; + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.secretPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.secretPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('secretPath', () => { + const result = client.secretPath("projectValue", "secretValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.secretPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSecretName', () => { + const result = client.matchProjectFromSecretName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.secretPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSecretFromSecretName', () => { + const result = client.matchSecretFromSecretName(fakePath); + assert.strictEqual(result, "secretValue"); + assert((client.pathTemplates.secretPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('secretVersion', () => { + const fakePath = "/rendered/path/secretVersion"; + const expectedParameters = { + project: "projectValue", + secret: "secretValue", + secret_version: "secretVersionValue", + }; + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.secretVersionPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.secretVersionPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('secretVersionPath', () => { + const result = client.secretVersionPath("projectValue", "secretValue", "secretVersionValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.secretVersionPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSecretVersionName', () => { + const result = client.matchProjectFromSecretVersionName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSecretFromSecretVersionName', () => { + const result = client.matchSecretFromSecretVersionName(fakePath); + assert.strictEqual(result, "secretValue"); + assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchSecretVersionFromSecretVersionName', () => { + const result = client.matchSecretVersionFromSecretVersionName(fakePath); + assert.strictEqual(result, "secretVersionValue"); + assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('topic', () => { + const fakePath = "/rendered/path/topic"; + const expectedParameters = { + project: "projectValue", + topic: "topicValue", + }; + const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.topicPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.topicPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('topicPath', () => { + const result = client.topicPath("projectValue", "topicValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.topicPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromTopicName', () => { + const result = client.matchProjectFromTopicName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.topicPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchTopicFromTopicName', () => { + const result = client.matchTopicFromTopicName(fakePath); + assert.strictEqual(result, "topicValue"); + assert((client.pathTemplates.topicPathTemplate.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..84c2bf0 --- /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: 'SecretManagerService', + filename: './secret-manager-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 93890702920cfd913100d80fb0d509cc0137d2d8 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 Jun 2022 10:05:49 +0000 Subject: [PATCH 2/3] =?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/secretmanager/v1/resources.proto | 346 --- .../cloud/secretmanager/v1/service.proto | 455 ---- ...t_manager_service.access_secret_version.js | 61 - ...cret_manager_service.add_secret_version.js | 64 - .../secret_manager_service.create_secret.js | 72 - .../secret_manager_service.delete_secret.js | 65 - ..._manager_service.destroy_secret_version.js | 65 - ..._manager_service.disable_secret_version.js | 65 - ...t_manager_service.enable_secret_version.js | 65 - .../secret_manager_service.get_iam_policy.js | 64 - .../v1/secret_manager_service.get_secret.js | 58 - ...cret_manager_service.get_secret_version.js | 61 - ...et_manager_service.list_secret_versions.js | 81 - .../v1/secret_manager_service.list_secrets.js | 80 - .../secret_manager_service.set_iam_policy.js | 74 - ...et_manager_service.test_iam_permissions.js | 67 - .../secret_manager_service.update_secret.js | 63 - ...etadata.google.cloud.secretmanager.v1.json | 687 ------ owl-bot-staging/v1/src/index.ts | 25 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 181 -- owl-bot-staging/v1/src/v1/index.ts | 19 - .../src/v1/secret_manager_service_client.ts | 1902 --------------- .../secret_manager_service_client_config.json | 114 - .../v1/secret_manager_service_proto_list.json | 4 - .../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 - .../test/gapic_secret_manager_service_v1.ts | 2048 ----------------- owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 - src/index.ts | 5 +- src/v1/secret_manager_service_client.ts | 11 +- 41 files changed, 7 insertions(+), 7201 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/secretmanager/v1/resources.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/secretmanager/v1/service.proto delete mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.access_secret_version.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.add_secret_version.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.create_secret.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.delete_secret.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.destroy_secret_version.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.disable_secret_version.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.enable_secret_version.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.get_iam_policy.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.get_secret.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.get_secret_version.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.list_secret_versions.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.list_secrets.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.set_iam_policy.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.test_iam_permissions.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/secret_manager_service.update_secret.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.secretmanager.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/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/secret_manager_service_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/secret_manager_service_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/secret_manager_service_proto_list.json 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_secret_manager_service_v1.ts delete mode 100644 owl-bot-staging/v1/tsconfig.json delete mode 100644 owl-bot-staging/v1/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 1fc37b1..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/secret-manager', - 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 55c13a0..0000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Secretmanager: 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 c1867e7..0000000 --- a/owl-bot-staging/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/secret-manager", - "version": "0.1.0", - "description": "Secretmanager client for Node.js", - "repository": "googleapis/nodejs-secretmanager", - "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 secretmanager", - "secretmanager", - "secret manager 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/secretmanager/v1/resources.proto b/owl-bot-staging/v1/protos/google/cloud/secretmanager/v1/resources.proto deleted file mode 100644 index 5e2322e..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/secretmanager/v1/resources.proto +++ /dev/null @@ -1,346 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.secretmanager.v1; - -import "google/api/annotations.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.SecretManager.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/secretmanager/v1;secretmanager"; -option java_multiple_files = true; -option java_outer_classname = "ResourcesProto"; -option java_package = "com.google.cloud.secretmanager.v1"; -option objc_class_prefix = "GSM"; -option php_namespace = "Google\\Cloud\\SecretManager\\V1"; -option ruby_package = "Google::Cloud::SecretManager::V1"; - -// A [Secret][google.cloud.secretmanager.v1.Secret] is a logical secret whose value and versions can -// be accessed. -// -// A [Secret][google.cloud.secretmanager.v1.Secret] is made up of zero or more [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] that -// represent the secret data. -message Secret { - option (google.api.resource) = { - type: "secretmanager.googleapis.com/Secret" - pattern: "projects/{project}/secrets/{secret}" - }; - - // Output only. The resource name of the [Secret][google.cloud.secretmanager.v1.Secret] in the format `projects/*/secrets/*`. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Required. Immutable. The replication policy of the secret data attached to the [Secret][google.cloud.secretmanager.v1.Secret]. - // - // The replication policy cannot be changed after the Secret has been created. - Replication replication = 2 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = REQUIRED - ]; - - // Output only. The time at which the [Secret][google.cloud.secretmanager.v1.Secret] was created. - google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The labels assigned to this Secret. - // - // Label keys must be between 1 and 63 characters long, have a UTF-8 encoding - // of maximum 128 bytes, and must conform to the following PCRE regular - // expression: `[\p{Ll}\p{Lo}][\p{Ll}\p{Lo}\p{N}_-]{0,62}` - // - // Label values must be between 0 and 63 characters long, have a UTF-8 - // encoding of maximum 128 bytes, and must conform to the following PCRE - // regular expression: `[\p{Ll}\p{Lo}\p{N}_-]{0,63}` - // - // No more than 64 labels can be assigned to a given resource. - map labels = 4; - - // Optional. A list of up to 10 Pub/Sub topics to which messages are published when - // control plane operations are called on the secret or its versions. - repeated Topic topics = 5 [(google.api.field_behavior) = OPTIONAL]; - - // Expiration policy attached to the [Secret][google.cloud.secretmanager.v1.Secret]. If specified the [Secret][google.cloud.secretmanager.v1.Secret] - // and all [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] will be automatically deleted at - // expiration. Expired secrets are irreversibly deleted. - // - // Expiration is *not* the recommended way to set time-based permissions. [IAM - // Conditions](https://cloud.google.com/secret-manager/docs/access-control#conditions) - // is recommended for granting time-based permissions because the operation - // can be reversed. - oneof expiration { - // Optional. Timestamp in UTC when the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to expire. This is - // always provided on output, regardless of what was sent on input. - google.protobuf.Timestamp expire_time = 6 [(google.api.field_behavior) = OPTIONAL]; - - // Input only. The TTL for the [Secret][google.cloud.secretmanager.v1.Secret]. - google.protobuf.Duration ttl = 7 [(google.api.field_behavior) = INPUT_ONLY]; - } - - // Optional. Etag of the currently stored [Secret][google.cloud.secretmanager.v1.Secret]. - string etag = 8 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Rotation policy attached to the [Secret][google.cloud.secretmanager.v1.Secret]. May be excluded if there is no - // rotation policy. - Rotation rotation = 9 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Mapping from version alias to version name. - // - // A version alias is a string with a maximum length of 63 characters and can - // contain uppercase and lowercase letters, numerals, and the hyphen (`-`) - // and underscore ('_') characters. An alias string must start with a - // letter and cannot be the string 'latest' or 'NEW'. - // No more than 50 aliases can be assigned to a given secret. - // - // Version-Alias pairs will be viewable via GetSecret and modifiable via - // UpdateSecret. At launch access by alias will only be supported on - // GetSecretVersion and AccessSecretVersion. - map version_aliases = 11 [(google.api.field_behavior) = OPTIONAL]; -} - -// A secret version resource in the Secret Manager API. -message SecretVersion { - option (google.api.resource) = { - type: "secretmanager.googleapis.com/SecretVersion" - pattern: "projects/{project}/secrets/{secret}/versions/{secret_version}" - }; - - // The state of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion], indicating if it can be accessed. - enum State { - // Not specified. This value is unused and invalid. - STATE_UNSPECIFIED = 0; - - // The [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] may be accessed. - ENABLED = 1; - - // The [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] may not be accessed, but the secret data - // is still available and can be placed back into the [ENABLED][google.cloud.secretmanager.v1.SecretVersion.State.ENABLED] - // state. - DISABLED = 2; - - // The [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] is destroyed and the secret data is no longer - // stored. A version may not leave this state once entered. - DESTROYED = 3; - } - - // Output only. The resource name of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the - // format `projects/*/secrets/*/versions/*`. - // - // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] IDs in a [Secret][google.cloud.secretmanager.v1.Secret] start at 1 and - // are incremented for each subsequent version of the secret. - string name = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] was created. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time this [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] was destroyed. - // Only present if [state][google.cloud.secretmanager.v1.SecretVersion.state] is - // [DESTROYED][google.cloud.secretmanager.v1.SecretVersion.State.DESTROYED]. - google.protobuf.Timestamp destroy_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The current state of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. - State state = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The replication status of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. - ReplicationStatus replication_status = 5; - - // Output only. Etag of the currently stored [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. - string etag = 6 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. True if payload checksum specified in [SecretPayload][google.cloud.secretmanager.v1.SecretPayload] object has been - // received by [SecretManagerService][google.cloud.secretmanager.v1.SecretManagerService] on - // [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion]. - bool client_specified_payload_checksum = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A policy that defines the replication and encryption configuration of data. -message Replication { - // A replication policy that replicates the [Secret][google.cloud.secretmanager.v1.Secret] payload without any - // restrictions. - message Automatic { - // Optional. The customer-managed encryption configuration of the [Secret][google.cloud.secretmanager.v1.Secret]. If no - // configuration is provided, Google-managed default encryption is used. - // - // Updates to the [Secret][google.cloud.secretmanager.v1.Secret] encryption configuration only apply to - // [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] added afterwards. They do not apply - // retroactively to existing [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]. - CustomerManagedEncryption customer_managed_encryption = 1 [(google.api.field_behavior) = OPTIONAL]; - } - - // A replication policy that replicates the [Secret][google.cloud.secretmanager.v1.Secret] payload into the - // locations specified in [Secret.replication.user_managed.replicas][] - message UserManaged { - // Represents a Replica for this [Secret][google.cloud.secretmanager.v1.Secret]. - message Replica { - // The canonical IDs of the location to replicate data. - // For example: `"us-east1"`. - string location = 1; - - // Optional. The customer-managed encryption configuration of the [User-Managed - // Replica][Replication.UserManaged.Replica]. If no configuration is - // provided, Google-managed default encryption is used. - // - // Updates to the [Secret][google.cloud.secretmanager.v1.Secret] encryption configuration only apply to - // [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] added afterwards. They do not apply - // retroactively to existing [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]. - CustomerManagedEncryption customer_managed_encryption = 2 [(google.api.field_behavior) = OPTIONAL]; - } - - // Required. The list of Replicas for this [Secret][google.cloud.secretmanager.v1.Secret]. - // - // Cannot be empty. - repeated Replica replicas = 1 [(google.api.field_behavior) = REQUIRED]; - } - - // The replication policy for this secret. - oneof replication { - // The [Secret][google.cloud.secretmanager.v1.Secret] will automatically be replicated without any restrictions. - Automatic automatic = 1; - - // The [Secret][google.cloud.secretmanager.v1.Secret] will only be replicated into the locations specified. - UserManaged user_managed = 2; - } -} - -// Configuration for encrypting secret payloads using customer-managed -// encryption keys (CMEK). -message CustomerManagedEncryption { - // Required. The resource name of the Cloud KMS CryptoKey used to encrypt secret - // payloads. - // - // For secrets using the [UserManaged][google.cloud.secretmanager.v1.Replication.UserManaged] replication - // policy type, Cloud KMS CryptoKeys must reside in the same location as the - // [replica location][Secret.UserManaged.Replica.location]. - // - // For secrets using the [Automatic][google.cloud.secretmanager.v1.Replication.Automatic] replication policy - // type, Cloud KMS CryptoKeys must reside in `global`. - // - // The expected format is `projects/*/locations/*/keyRings/*/cryptoKeys/*`. - string kms_key_name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. -message ReplicationStatus { - // The replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] using automatic replication. - // - // Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret] has an automatic replication - // policy. - message AutomaticStatus { - // Output only. The customer-managed encryption status of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Only - // populated if customer-managed encryption is used. - CustomerManagedEncryptionStatus customer_managed_encryption = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // The replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] using user-managed - // replication. - // - // Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret] has a user-managed replication - // policy. - message UserManagedStatus { - // Describes the status of a user-managed replica for the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. - message ReplicaStatus { - // Output only. The canonical ID of the replica location. - // For example: `"us-east1"`. - string location = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The customer-managed encryption status of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Only - // populated if customer-managed encryption is used. - CustomerManagedEncryptionStatus customer_managed_encryption = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // Output only. The list of replica statuses for the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. - repeated ReplicaStatus replicas = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - } - - // The replication status of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. - oneof replication_status { - // Describes the replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] with - // automatic replication. - // - // Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret] has an automatic replication - // policy. - AutomaticStatus automatic = 1; - - // Describes the replication status of a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] with - // user-managed replication. - // - // Only populated if the parent [Secret][google.cloud.secretmanager.v1.Secret] has a user-managed replication - // policy. - UserManagedStatus user_managed = 2; - } -} - -// Describes the status of customer-managed encryption. -message CustomerManagedEncryptionStatus { - // Required. The resource name of the Cloud KMS CryptoKeyVersion used to encrypt the - // secret payload, in the following format: - // `projects/*/locations/*/keyRings/*/cryptoKeys/*/versions/*`. - string kms_key_version_name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// A Pub/Sub topic which Secret Manager will publish to when control plane -// events occur on this secret. -message Topic { - option (google.api.resource) = { - type: "pubsub.googleapis.com/Topic" - pattern: "projects/{project}/topics/{topic}" - }; - - // Required. The resource name of the Pub/Sub topic that will be published to, in the - // following format: `projects/*/topics/*`. For publication to succeed, the - // Secret Manager P4SA must have `pubsub.publisher` permissions on the topic. - string name = 1 [(google.api.field_behavior) = REQUIRED]; -} - -// The rotation time and period for a [Secret][google.cloud.secretmanager.v1.Secret]. At next_rotation_time, Secret -// Manager will send a Pub/Sub notification to the topics configured on the -// Secret. [Secret.topics][google.cloud.secretmanager.v1.Secret.topics] must be set to configure rotation. -message Rotation { - // Optional. Timestamp in UTC at which the [Secret][google.cloud.secretmanager.v1.Secret] is scheduled to rotate. Cannot be - // set to less than 300s (5 min) in the future and at most 3153600000s (100 - // years). - // - // [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time] MUST be set if [rotation_period][google.cloud.secretmanager.v1.Rotation.rotation_period] is set. - google.protobuf.Timestamp next_rotation_time = 1 [(google.api.field_behavior) = OPTIONAL]; - - // Input only. The Duration between rotation notifications. Must be in seconds - // and at least 3600s (1h) and at most 3153600000s (100 years). - // - // If [rotation_period][google.cloud.secretmanager.v1.Rotation.rotation_period] is set, [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time] must be set. - // [next_rotation_time][google.cloud.secretmanager.v1.Rotation.next_rotation_time] will be advanced by this period when the service - // automatically sends rotation notifications. - google.protobuf.Duration rotation_period = 2 [(google.api.field_behavior) = INPUT_ONLY]; -} - -// A secret payload resource in the Secret Manager API. This contains the -// sensitive secret payload that is associated with a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. -message SecretPayload { - // The secret data. Must be no larger than 64KiB. - bytes data = 1; - - // Optional. If specified, [SecretManagerService][google.cloud.secretmanager.v1.SecretManagerService] will verify the integrity of the - // received [data][google.cloud.secretmanager.v1.SecretPayload.data] on [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion] calls using - // the crc32c checksum and store it to include in future - // [SecretManagerService.AccessSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion] responses. If a checksum is - // not provided in the [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion] request, the - // [SecretManagerService][google.cloud.secretmanager.v1.SecretManagerService] will generate and store one for you. - // - // The CRC32C value is encoded as a Int64 for compatibility, and can be - // safely downconverted to uint32 in languages that support this type. - // https://cloud.google.com/apis/design/design_patterns#integer_types - optional int64 data_crc32c = 2 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/secretmanager/v1/service.proto b/owl-bot-staging/v1/protos/google/cloud/secretmanager/v1/service.proto deleted file mode 100644 index 52b3b09..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/secretmanager/v1/service.proto +++ /dev/null @@ -1,455 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -syntax = "proto3"; - -package google.cloud.secretmanager.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/secretmanager/v1/resources.proto"; -import "google/iam/v1/iam_policy.proto"; -import "google/iam/v1/policy.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; - -option cc_enable_arenas = true; -option csharp_namespace = "Google.Cloud.SecretManager.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/secretmanager/v1;secretmanager"; -option java_multiple_files = true; -option java_outer_classname = "ServiceProto"; -option java_package = "com.google.cloud.secretmanager.v1"; -option objc_class_prefix = "GSM"; -option php_namespace = "Google\\Cloud\\SecretManager\\V1"; -option ruby_package = "Google::Cloud::SecretManager::V1"; - -// Secret Manager Service -// -// Manages secrets and operations using those secrets. Implements a REST -// model with the following objects: -// -// * [Secret][google.cloud.secretmanager.v1.Secret] -// * [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] -service SecretManagerService { - option (google.api.default_host) = "secretmanager.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Lists [Secrets][google.cloud.secretmanager.v1.Secret]. - rpc ListSecrets(ListSecretsRequest) returns (ListSecretsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*}/secrets" - }; - option (google.api.method_signature) = "parent"; - } - - // Creates a new [Secret][google.cloud.secretmanager.v1.Secret] containing no [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]. - rpc CreateSecret(CreateSecretRequest) returns (Secret) { - option (google.api.http) = { - post: "/v1/{parent=projects/*}/secrets" - body: "secret" - }; - option (google.api.method_signature) = "parent,secret_id,secret"; - } - - // Creates a new [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] containing secret data and attaches - // it to an existing [Secret][google.cloud.secretmanager.v1.Secret]. - rpc AddSecretVersion(AddSecretVersionRequest) returns (SecretVersion) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/secrets/*}:addVersion" - body: "*" - }; - option (google.api.method_signature) = "parent,payload"; - } - - // Gets metadata for a given [Secret][google.cloud.secretmanager.v1.Secret]. - rpc GetSecret(GetSecretRequest) returns (Secret) { - option (google.api.http) = { - get: "/v1/{name=projects/*/secrets/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates metadata of an existing [Secret][google.cloud.secretmanager.v1.Secret]. - rpc UpdateSecret(UpdateSecretRequest) returns (Secret) { - option (google.api.http) = { - patch: "/v1/{secret.name=projects/*/secrets/*}" - body: "secret" - }; - option (google.api.method_signature) = "secret,update_mask"; - } - - // Deletes a [Secret][google.cloud.secretmanager.v1.Secret]. - rpc DeleteSecret(DeleteSecretRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/secrets/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]. This call does not return secret - // data. - rpc ListSecretVersions(ListSecretVersionsRequest) returns (ListSecretVersionsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/secrets/*}/versions" - }; - option (google.api.method_signature) = "parent"; - } - - // Gets metadata for a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. - // - // `projects/*/secrets/*/versions/latest` is an alias to the most recently - // created [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. - rpc GetSecretVersion(GetSecretVersionRequest) returns (SecretVersion) { - option (google.api.http) = { - get: "/v1/{name=projects/*/secrets/*/versions/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Accesses a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. This call returns the secret data. - // - // `projects/*/secrets/*/versions/latest` is an alias to the most recently - // created [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. - rpc AccessSecretVersion(AccessSecretVersionRequest) returns (AccessSecretVersionResponse) { - option (google.api.http) = { - get: "/v1/{name=projects/*/secrets/*/versions/*}:access" - }; - option (google.api.method_signature) = "name"; - } - - // Disables a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. - // - // Sets the [state][google.cloud.secretmanager.v1.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to - // [DISABLED][google.cloud.secretmanager.v1.SecretVersion.State.DISABLED]. - rpc DisableSecretVersion(DisableSecretVersionRequest) returns (SecretVersion) { - option (google.api.http) = { - post: "/v1/{name=projects/*/secrets/*/versions/*}:disable" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Enables a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. - // - // Sets the [state][google.cloud.secretmanager.v1.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to - // [ENABLED][google.cloud.secretmanager.v1.SecretVersion.State.ENABLED]. - rpc EnableSecretVersion(EnableSecretVersionRequest) returns (SecretVersion) { - option (google.api.http) = { - post: "/v1/{name=projects/*/secrets/*/versions/*}:enable" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Destroys a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. - // - // Sets the [state][google.cloud.secretmanager.v1.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to - // [DESTROYED][google.cloud.secretmanager.v1.SecretVersion.State.DESTROYED] and irrevocably destroys the - // secret data. - rpc DestroySecretVersion(DestroySecretVersionRequest) returns (SecretVersion) { - option (google.api.http) = { - post: "/v1/{name=projects/*/secrets/*/versions/*}:destroy" - body: "*" - }; - option (google.api.method_signature) = "name"; - } - - // Sets the access control policy on the specified secret. Replaces any - // existing policy. - // - // Permissions on [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] are enforced according - // to the policy set on the associated [Secret][google.cloud.secretmanager.v1.Secret]. - rpc SetIamPolicy(google.iam.v1.SetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - post: "/v1/{resource=projects/*/secrets/*}:setIamPolicy" - body: "*" - }; - } - - // Gets the access control policy for a secret. - // Returns empty policy if the secret exists and does not have a policy set. - rpc GetIamPolicy(google.iam.v1.GetIamPolicyRequest) returns (google.iam.v1.Policy) { - option (google.api.http) = { - get: "/v1/{resource=projects/*/secrets/*}:getIamPolicy" - }; - } - - // Returns permissions that a caller has for the specified secret. - // If the secret does not exist, this call returns an empty set of - // permissions, not a NOT_FOUND error. - // - // Note: This operation is designed to be used for building permission-aware - // UIs and command-line tools, not for authorization checking. This operation - // may "fail open" without warning. - rpc TestIamPermissions(google.iam.v1.TestIamPermissionsRequest) returns (google.iam.v1.TestIamPermissionsResponse) { - option (google.api.http) = { - post: "/v1/{resource=projects/*/secrets/*}:testIamPermissions" - body: "*" - }; - } -} - -// Request message for [SecretManagerService.ListSecrets][google.cloud.secretmanager.v1.SecretManagerService.ListSecrets]. -message ListSecretsRequest { - // Required. The resource name of the project associated with the - // [Secrets][google.cloud.secretmanager.v1.Secret], in the format `projects/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Optional. The maximum number of results to be returned in a single page. If - // set to 0, the server decides the number of results to return. If the - // number is greater than 25000, it is capped at 25000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Pagination token, returned earlier via - // [ListSecretsResponse.next_page_token][google.cloud.secretmanager.v1.ListSecretsResponse.next_page_token]. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Filter string, adhering to the rules in - // [List-operation - // filtering](https://cloud.google.com/secret-manager/docs/filtering). List - // only secrets matching the filter. If filter is empty, all secrets are - // listed. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for [SecretManagerService.ListSecrets][google.cloud.secretmanager.v1.SecretManagerService.ListSecrets]. -message ListSecretsResponse { - // The list of [Secrets][google.cloud.secretmanager.v1.Secret] sorted in reverse by create_time (newest - // first). - repeated Secret secrets = 1; - - // A token to retrieve the next page of results. Pass this value in - // [ListSecretsRequest.page_token][google.cloud.secretmanager.v1.ListSecretsRequest.page_token] to retrieve the next page. - string next_page_token = 2; - - // The total number of [Secrets][google.cloud.secretmanager.v1.Secret]. - int32 total_size = 3; -} - -// Request message for [SecretManagerService.CreateSecret][google.cloud.secretmanager.v1.SecretManagerService.CreateSecret]. -message CreateSecretRequest { - // Required. The resource name of the project to associate with the - // [Secret][google.cloud.secretmanager.v1.Secret], in the format `projects/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "cloudresourcemanager.googleapis.com/Project" - } - ]; - - // Required. This must be unique within the project. - // - // A secret ID is a string with a maximum length of 255 characters and can - // contain uppercase and lowercase letters, numerals, and the hyphen (`-`) and - // underscore (`_`) characters. - string secret_id = 2 [(google.api.field_behavior) = REQUIRED]; - - // Required. A [Secret][google.cloud.secretmanager.v1.Secret] with initial field values. - Secret secret = 3 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for [SecretManagerService.AddSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion]. -message AddSecretVersionRequest { - // Required. The resource name of the [Secret][google.cloud.secretmanager.v1.Secret] to associate with the - // [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the format `projects/*/secrets/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "secretmanager.googleapis.com/Secret" - } - ]; - - // Required. The secret payload of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. - SecretPayload payload = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for [SecretManagerService.GetSecret][google.cloud.secretmanager.v1.SecretManagerService.GetSecret]. -message GetSecretRequest { - // Required. The resource name of the [Secret][google.cloud.secretmanager.v1.Secret], in the format `projects/*/secrets/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "secretmanager.googleapis.com/Secret" - } - ]; -} - -// Request message for [SecretManagerService.ListSecretVersions][google.cloud.secretmanager.v1.SecretManagerService.ListSecretVersions]. -message ListSecretVersionsRequest { - // Required. The resource name of the [Secret][google.cloud.secretmanager.v1.Secret] associated with the - // [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] to list, in the format - // `projects/*/secrets/*`. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "secretmanager.googleapis.com/Secret" - } - ]; - - // Optional. The maximum number of results to be returned in a single page. If - // set to 0, the server decides the number of results to return. If the - // number is greater than 25000, it is capped at 25000. - int32 page_size = 2 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Pagination token, returned earlier via - // ListSecretVersionsResponse.next_page_token][]. - string page_token = 3 [(google.api.field_behavior) = OPTIONAL]; - - // Optional. Filter string, adhering to the rules in - // [List-operation - // filtering](https://cloud.google.com/secret-manager/docs/filtering). List - // only secret versions matching the filter. If filter is empty, all secret - // versions are listed. - string filter = 4 [(google.api.field_behavior) = OPTIONAL]; -} - -// Response message for [SecretManagerService.ListSecretVersions][google.cloud.secretmanager.v1.SecretManagerService.ListSecretVersions]. -message ListSecretVersionsResponse { - // The list of [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] sorted in reverse by - // create_time (newest first). - repeated SecretVersion versions = 1; - - // A token to retrieve the next page of results. Pass this value in - // [ListSecretVersionsRequest.page_token][google.cloud.secretmanager.v1.ListSecretVersionsRequest.page_token] to retrieve the next page. - string next_page_token = 2; - - // The total number of [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]. - int32 total_size = 3; -} - -// Request message for [SecretManagerService.GetSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.GetSecretVersion]. -message GetSecretVersionRequest { - // Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the format - // `projects/*/secrets/*/versions/*`. - // - // `projects/*/secrets/*/versions/latest` is an alias to the most recently - // created [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - } - ]; -} - -// Request message for [SecretManagerService.UpdateSecret][google.cloud.secretmanager.v1.SecretManagerService.UpdateSecret]. -message UpdateSecretRequest { - // Required. [Secret][google.cloud.secretmanager.v1.Secret] with updated field values. - Secret secret = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. Specifies the fields to be updated. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request message for [SecretManagerService.AccessSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion]. -message AccessSecretVersionRequest { - // Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the format - // `projects/*/secrets/*/versions/*`. - // - // `projects/*/secrets/*/versions/latest` is an alias to the most recently - // created [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - } - ]; -} - -// Response message for [SecretManagerService.AccessSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion]. -message AccessSecretVersionResponse { - // The resource name of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] in the format - // `projects/*/secrets/*/versions/*`. - string name = 1 [(google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - }]; - - // Secret payload - SecretPayload payload = 2; -} - -// Request message for [SecretManagerService.DeleteSecret][google.cloud.secretmanager.v1.SecretManagerService.DeleteSecret]. -message DeleteSecretRequest { - // Required. The resource name of the [Secret][google.cloud.secretmanager.v1.Secret] to delete in the format - // `projects/*/secrets/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "secretmanager.googleapis.com/Secret" - } - ]; - - // Optional. Etag of the [Secret][google.cloud.secretmanager.v1.Secret]. The request succeeds if it matches - // the etag of the currently stored secret object. If the etag is omitted, - // the request succeeds. - string etag = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [SecretManagerService.DisableSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.DisableSecretVersion]. -message DisableSecretVersionRequest { - // Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to disable in the format - // `projects/*/secrets/*/versions/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - } - ]; - - // Optional. Etag of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. The request succeeds if it matches - // the etag of the currently stored secret version object. If the etag is - // omitted, the request succeeds. - string etag = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [SecretManagerService.EnableSecretVersion][google.cloud.secretmanager.v1.SecretManagerService.EnableSecretVersion]. -message EnableSecretVersionRequest { - // Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to enable in the format - // `projects/*/secrets/*/versions/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - } - ]; - - // Optional. Etag of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. The request succeeds if it matches - // the etag of the currently stored secret version object. If the etag is - // omitted, the request succeeds. - string etag = 2 [(google.api.field_behavior) = OPTIONAL]; -} - -// Request message for [SecretManagerService.DestroySecretVersion][google.cloud.secretmanager.v1.SecretManagerService.DestroySecretVersion]. -message DestroySecretVersionRequest { - // Required. The resource name of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to destroy in the format - // `projects/*/secrets/*/versions/*`. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "secretmanager.googleapis.com/SecretVersion" - } - ]; - - // Optional. Etag of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. The request succeeds if it matches - // the etag of the currently stored secret version object. If the etag is - // omitted, the request succeeds. - string etag = 2 [(google.api.field_behavior) = OPTIONAL]; -} diff --git a/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.access_secret_version.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.access_secret_version.js deleted file mode 100644 index 5c7243b..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.access_secret_version.js +++ /dev/null @@ -1,61 +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 secretmanager_v1_generated_SecretManagerService_AccessSecretVersion_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the SecretVersion google.cloud.secretmanager.v1.SecretVersion in the format - * `projects/* /secrets/* /versions/*`. - * `projects/* /secrets/* /versions/latest` is an alias to the most recently - * created SecretVersion google.cloud.secretmanager.v1.SecretVersion. - */ - // const name = 'abc123' - - // Imports the Secretmanager library - const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; - - // Instantiates a client - const secretmanagerClient = new SecretManagerServiceClient(); - - async function callAccessSecretVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await secretmanagerClient.accessSecretVersion(request); - console.log(response); - } - - callAccessSecretVersion(); - // [END secretmanager_v1_generated_SecretManagerService_AccessSecretVersion_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/secret_manager_service.add_secret_version.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.add_secret_version.js deleted file mode 100644 index 84b15ff..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.add_secret_version.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent, payload) { - // [START secretmanager_v1_generated_SecretManagerService_AddSecretVersion_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the Secret google.cloud.secretmanager.v1.Secret to associate with the - * SecretVersion google.cloud.secretmanager.v1.SecretVersion in the format `projects/* /secrets/*`. - */ - // const parent = 'abc123' - /** - * Required. The secret payload of the SecretVersion google.cloud.secretmanager.v1.SecretVersion. - */ - // const payload = {} - - // Imports the Secretmanager library - const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; - - // Instantiates a client - const secretmanagerClient = new SecretManagerServiceClient(); - - async function callAddSecretVersion() { - // Construct request - const request = { - parent, - payload, - }; - - // Run request - const response = await secretmanagerClient.addSecretVersion(request); - console.log(response); - } - - callAddSecretVersion(); - // [END secretmanager_v1_generated_SecretManagerService_AddSecretVersion_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/secret_manager_service.create_secret.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.create_secret.js deleted file mode 100644 index 4dd3345..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.create_secret.js +++ /dev/null @@ -1,72 +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, secretId, secret) { - // [START secretmanager_v1_generated_SecretManagerService_CreateSecret_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the project to associate with the - * Secret google.cloud.secretmanager.v1.Secret, in the format `projects/*`. - */ - // const parent = 'abc123' - /** - * Required. This must be unique within the project. - * A secret ID is a string with a maximum length of 255 characters and can - * contain uppercase and lowercase letters, numerals, and the hyphen (`-`) and - * underscore (`_`) characters. - */ - // const secretId = 'abc123' - /** - * Required. A Secret google.cloud.secretmanager.v1.Secret with initial field values. - */ - // const secret = {} - - // Imports the Secretmanager library - const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; - - // Instantiates a client - const secretmanagerClient = new SecretManagerServiceClient(); - - async function callCreateSecret() { - // Construct request - const request = { - parent, - secretId, - secret, - }; - - // Run request - const response = await secretmanagerClient.createSecret(request); - console.log(response); - } - - callCreateSecret(); - // [END secretmanager_v1_generated_SecretManagerService_CreateSecret_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/secret_manager_service.delete_secret.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.delete_secret.js deleted file mode 100644 index 70e2e76..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.delete_secret.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START secretmanager_v1_generated_SecretManagerService_DeleteSecret_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the Secret google.cloud.secretmanager.v1.Secret to delete in the format - * `projects/* /secrets/*`. - */ - // const name = 'abc123' - /** - * Optional. Etag of the Secret google.cloud.secretmanager.v1.Secret. The request succeeds if it matches - * the etag of the currently stored secret object. If the etag is omitted, - * the request succeeds. - */ - // const etag = 'abc123' - - // Imports the Secretmanager library - const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; - - // Instantiates a client - const secretmanagerClient = new SecretManagerServiceClient(); - - async function callDeleteSecret() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await secretmanagerClient.deleteSecret(request); - console.log(response); - } - - callDeleteSecret(); - // [END secretmanager_v1_generated_SecretManagerService_DeleteSecret_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/secret_manager_service.destroy_secret_version.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.destroy_secret_version.js deleted file mode 100644 index efbd6b5..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.destroy_secret_version.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START secretmanager_v1_generated_SecretManagerService_DestroySecretVersion_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the SecretVersion google.cloud.secretmanager.v1.SecretVersion to destroy in the format - * `projects/* /secrets/* /versions/*`. - */ - // const name = 'abc123' - /** - * Optional. Etag of the SecretVersion google.cloud.secretmanager.v1.SecretVersion. The request succeeds if it matches - * the etag of the currently stored secret version object. If the etag is - * omitted, the request succeeds. - */ - // const etag = 'abc123' - - // Imports the Secretmanager library - const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; - - // Instantiates a client - const secretmanagerClient = new SecretManagerServiceClient(); - - async function callDestroySecretVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await secretmanagerClient.destroySecretVersion(request); - console.log(response); - } - - callDestroySecretVersion(); - // [END secretmanager_v1_generated_SecretManagerService_DestroySecretVersion_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/secret_manager_service.disable_secret_version.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.disable_secret_version.js deleted file mode 100644 index ad8b2f3..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.disable_secret_version.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START secretmanager_v1_generated_SecretManagerService_DisableSecretVersion_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the SecretVersion google.cloud.secretmanager.v1.SecretVersion to disable in the format - * `projects/* /secrets/* /versions/*`. - */ - // const name = 'abc123' - /** - * Optional. Etag of the SecretVersion google.cloud.secretmanager.v1.SecretVersion. The request succeeds if it matches - * the etag of the currently stored secret version object. If the etag is - * omitted, the request succeeds. - */ - // const etag = 'abc123' - - // Imports the Secretmanager library - const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; - - // Instantiates a client - const secretmanagerClient = new SecretManagerServiceClient(); - - async function callDisableSecretVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await secretmanagerClient.disableSecretVersion(request); - console.log(response); - } - - callDisableSecretVersion(); - // [END secretmanager_v1_generated_SecretManagerService_DisableSecretVersion_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/secret_manager_service.enable_secret_version.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.enable_secret_version.js deleted file mode 100644 index 59c3a56..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.enable_secret_version.js +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(name) { - // [START secretmanager_v1_generated_SecretManagerService_EnableSecretVersion_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the SecretVersion google.cloud.secretmanager.v1.SecretVersion to enable in the format - * `projects/* /secrets/* /versions/*`. - */ - // const name = 'abc123' - /** - * Optional. Etag of the SecretVersion google.cloud.secretmanager.v1.SecretVersion. The request succeeds if it matches - * the etag of the currently stored secret version object. If the etag is - * omitted, the request succeeds. - */ - // const etag = 'abc123' - - // Imports the Secretmanager library - const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; - - // Instantiates a client - const secretmanagerClient = new SecretManagerServiceClient(); - - async function callEnableSecretVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await secretmanagerClient.enableSecretVersion(request); - console.log(response); - } - - callEnableSecretVersion(); - // [END secretmanager_v1_generated_SecretManagerService_EnableSecretVersion_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/secret_manager_service.get_iam_policy.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.get_iam_policy.js deleted file mode 100644 index 6a8b533..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.get_iam_policy.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resource) { - // [START secretmanager_v1_generated_SecretManagerService_GetIamPolicy_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - */ - // const options = {} - - // Imports the Secretmanager library - const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; - - // Instantiates a client - const secretmanagerClient = new SecretManagerServiceClient(); - - async function callGetIamPolicy() { - // Construct request - const request = { - resource, - }; - - // Run request - const response = await secretmanagerClient.getIamPolicy(request); - console.log(response); - } - - callGetIamPolicy(); - // [END secretmanager_v1_generated_SecretManagerService_GetIamPolicy_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/secret_manager_service.get_secret.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.get_secret.js deleted file mode 100644 index cbc23d4..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.get_secret.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 secretmanager_v1_generated_SecretManagerService_GetSecret_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the Secret google.cloud.secretmanager.v1.Secret, in the format `projects/* /secrets/*`. - */ - // const name = 'abc123' - - // Imports the Secretmanager library - const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; - - // Instantiates a client - const secretmanagerClient = new SecretManagerServiceClient(); - - async function callGetSecret() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await secretmanagerClient.getSecret(request); - console.log(response); - } - - callGetSecret(); - // [END secretmanager_v1_generated_SecretManagerService_GetSecret_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/secret_manager_service.get_secret_version.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.get_secret_version.js deleted file mode 100644 index 3832fe6..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.get_secret_version.js +++ /dev/null @@ -1,61 +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 secretmanager_v1_generated_SecretManagerService_GetSecretVersion_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the SecretVersion google.cloud.secretmanager.v1.SecretVersion in the format - * `projects/* /secrets/* /versions/*`. - * `projects/* /secrets/* /versions/latest` is an alias to the most recently - * created SecretVersion google.cloud.secretmanager.v1.SecretVersion. - */ - // const name = 'abc123' - - // Imports the Secretmanager library - const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; - - // Instantiates a client - const secretmanagerClient = new SecretManagerServiceClient(); - - async function callGetSecretVersion() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await secretmanagerClient.getSecretVersion(request); - console.log(response); - } - - callGetSecretVersion(); - // [END secretmanager_v1_generated_SecretManagerService_GetSecretVersion_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/secret_manager_service.list_secret_versions.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.list_secret_versions.js deleted file mode 100644 index b8ebf33..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.list_secret_versions.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(parent) { - // [START secretmanager_v1_generated_SecretManagerService_ListSecretVersions_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the Secret google.cloud.secretmanager.v1.Secret associated with the - * SecretVersions google.cloud.secretmanager.v1.SecretVersion to list, in the format - * `projects/* /secrets/*`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of results to be returned in a single page. If - * set to 0, the server decides the number of results to return. If the - * number is greater than 25000, it is capped at 25000. - */ - // const pageSize = 1234 - /** - * Optional. Pagination token, returned earlier via - * ListSecretVersionsResponse.next_page_token . - */ - // const pageToken = 'abc123' - /** - * Optional. Filter string, adhering to the rules in - * List-operation - * filtering (https://cloud.google.com/secret-manager/docs/filtering). List - * only secret versions matching the filter. If filter is empty, all secret - * versions are listed. - */ - // const filter = 'abc123' - - // Imports the Secretmanager library - const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; - - // Instantiates a client - const secretmanagerClient = new SecretManagerServiceClient(); - - async function callListSecretVersions() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await secretmanagerClient.listSecretVersionsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSecretVersions(); - // [END secretmanager_v1_generated_SecretManagerService_ListSecretVersions_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/secret_manager_service.list_secrets.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.list_secrets.js deleted file mode 100644 index d7f002b..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.list_secrets.js +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(parent) { - // [START secretmanager_v1_generated_SecretManagerService_ListSecrets_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the project associated with the - * Secrets google.cloud.secretmanager.v1.Secret, in the format `projects/*`. - */ - // const parent = 'abc123' - /** - * Optional. The maximum number of results to be returned in a single page. If - * set to 0, the server decides the number of results to return. If the - * number is greater than 25000, it is capped at 25000. - */ - // const pageSize = 1234 - /** - * Optional. Pagination token, returned earlier via - * ListSecretsResponse.next_page_token google.cloud.secretmanager.v1.ListSecretsResponse.next_page_token. - */ - // const pageToken = 'abc123' - /** - * Optional. Filter string, adhering to the rules in - * List-operation - * filtering (https://cloud.google.com/secret-manager/docs/filtering). List - * only secrets matching the filter. If filter is empty, all secrets are - * listed. - */ - // const filter = 'abc123' - - // Imports the Secretmanager library - const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; - - // Instantiates a client - const secretmanagerClient = new SecretManagerServiceClient(); - - async function callListSecrets() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await secretmanagerClient.listSecretsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListSecrets(); - // [END secretmanager_v1_generated_SecretManagerService_ListSecrets_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/secret_manager_service.set_iam_policy.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.set_iam_policy.js deleted file mode 100644 index a4c8f8e..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.set_iam_policy.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(resource, policy) { - // [START secretmanager_v1_generated_SecretManagerService_SetIamPolicy_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - */ - // const policy = {} - /** - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * `paths: "bindings, etag"` - */ - // const updateMask = {} - - // Imports the Secretmanager library - const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; - - // Instantiates a client - const secretmanagerClient = new SecretManagerServiceClient(); - - async function callSetIamPolicy() { - // Construct request - const request = { - resource, - policy, - }; - - // Run request - const response = await secretmanagerClient.setIamPolicy(request); - console.log(response); - } - - callSetIamPolicy(); - // [END secretmanager_v1_generated_SecretManagerService_SetIamPolicy_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/secret_manager_service.test_iam_permissions.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.test_iam_permissions.js deleted file mode 100644 index a4a3207..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.test_iam_permissions.js +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(resource, permissions) { - // [START secretmanager_v1_generated_SecretManagerService_TestIamPermissions_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - */ - // const resource = 'abc123' - /** - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * IAM Overview (https://cloud.google.com/iam/docs/overview#permissions). - */ - // const permissions = 'abc123' - - // Imports the Secretmanager library - const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; - - // Instantiates a client - const secretmanagerClient = new SecretManagerServiceClient(); - - async function callTestIamPermissions() { - // Construct request - const request = { - resource, - permissions, - }; - - // Run request - const response = await secretmanagerClient.testIamPermissions(request); - console.log(response); - } - - callTestIamPermissions(); - // [END secretmanager_v1_generated_SecretManagerService_TestIamPermissions_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/secret_manager_service.update_secret.js b/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.update_secret.js deleted file mode 100644 index 96a6fd0..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/secret_manager_service.update_secret.js +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2022 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - - -'use strict'; - -function main(secret, updateMask) { - // [START secretmanager_v1_generated_SecretManagerService_UpdateSecret_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. Secret google.cloud.secretmanager.v1.Secret with updated field values. - */ - // const secret = {} - /** - * Required. Specifies the fields to be updated. - */ - // const updateMask = {} - - // Imports the Secretmanager library - const {SecretManagerServiceClient} = require('@google-cloud/secret-manager').v1; - - // Instantiates a client - const secretmanagerClient = new SecretManagerServiceClient(); - - async function callUpdateSecret() { - // Construct request - const request = { - secret, - updateMask, - }; - - // Run request - const response = await secretmanagerClient.updateSecret(request); - console.log(response); - } - - callUpdateSecret(); - // [END secretmanager_v1_generated_SecretManagerService_UpdateSecret_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.secretmanager.v1.json b/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.secretmanager.v1.json deleted file mode 100644 index 2ad6667..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/snippet_metadata.google.cloud.secretmanager.v1.json +++ /dev/null @@ -1,687 +0,0 @@ -{ - "clientLibrary": { - "name": "nodejs-secretmanager", - "version": "0.1.0", - "language": "TYPESCRIPT", - "apis": [ - { - "id": "google.cloud.secretmanager.v1", - "version": "v1" - } - ] - }, - "snippets": [ - { - "regionTag": "secretmanager_v1_generated_SecretManagerService_ListSecrets_async", - "title": "SecretManagerService listSecrets Sample", - "origin": "API_DEFINITION", - "description": " Lists [Secrets][google.cloud.secretmanager.v1.Secret].", - "canonical": true, - "file": "secret_manager_service.list_secrets.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 72, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSecrets", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.ListSecrets", - "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" - } - ], - "resultType": ".google.cloud.secretmanager.v1.ListSecretsResponse", - "client": { - "shortName": "SecretManagerServiceClient", - "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" - }, - "method": { - "shortName": "ListSecrets", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.ListSecrets", - "service": { - "shortName": "SecretManagerService", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService" - } - } - } - }, - { - "regionTag": "secretmanager_v1_generated_SecretManagerService_CreateSecret_async", - "title": "SecretManagerService createSecret Sample", - "origin": "API_DEFINITION", - "description": " Creates a new [Secret][google.cloud.secretmanager.v1.Secret] containing no [SecretVersions][google.cloud.secretmanager.v1.SecretVersion].", - "canonical": true, - "file": "secret_manager_service.create_secret.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 64, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "CreateSecret", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.CreateSecret", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "secret_id", - "type": "TYPE_STRING" - }, - { - "name": "secret", - "type": ".google.cloud.secretmanager.v1.Secret" - } - ], - "resultType": ".google.cloud.secretmanager.v1.Secret", - "client": { - "shortName": "SecretManagerServiceClient", - "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" - }, - "method": { - "shortName": "CreateSecret", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.CreateSecret", - "service": { - "shortName": "SecretManagerService", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService" - } - } - } - }, - { - "regionTag": "secretmanager_v1_generated_SecretManagerService_AddSecretVersion_async", - "title": "SecretManagerService addSecretVersion Sample", - "origin": "API_DEFINITION", - "description": " Creates a new [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] containing secret data and attaches it to an existing [Secret][google.cloud.secretmanager.v1.Secret].", - "canonical": true, - "file": "secret_manager_service.add_secret_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AddSecretVersion", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion", - "async": true, - "parameters": [ - { - "name": "parent", - "type": "TYPE_STRING" - }, - { - "name": "payload", - "type": ".google.cloud.secretmanager.v1.SecretPayload" - } - ], - "resultType": ".google.cloud.secretmanager.v1.SecretVersion", - "client": { - "shortName": "SecretManagerServiceClient", - "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" - }, - "method": { - "shortName": "AddSecretVersion", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.AddSecretVersion", - "service": { - "shortName": "SecretManagerService", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService" - } - } - } - }, - { - "regionTag": "secretmanager_v1_generated_SecretManagerService_GetSecret_async", - "title": "SecretManagerService getSecret Sample", - "origin": "API_DEFINITION", - "description": " Gets metadata for a given [Secret][google.cloud.secretmanager.v1.Secret].", - "canonical": true, - "file": "secret_manager_service.get_secret.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 50, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSecret", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.GetSecret", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.secretmanager.v1.Secret", - "client": { - "shortName": "SecretManagerServiceClient", - "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" - }, - "method": { - "shortName": "GetSecret", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.GetSecret", - "service": { - "shortName": "SecretManagerService", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService" - } - } - } - }, - { - "regionTag": "secretmanager_v1_generated_SecretManagerService_UpdateSecret_async", - "title": "SecretManagerService updateSecret Sample", - "origin": "API_DEFINITION", - "description": " Updates metadata of an existing [Secret][google.cloud.secretmanager.v1.Secret].", - "canonical": true, - "file": "secret_manager_service.update_secret.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 55, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "UpdateSecret", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.UpdateSecret", - "async": true, - "parameters": [ - { - "name": "secret", - "type": ".google.cloud.secretmanager.v1.Secret" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.cloud.secretmanager.v1.Secret", - "client": { - "shortName": "SecretManagerServiceClient", - "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" - }, - "method": { - "shortName": "UpdateSecret", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.UpdateSecret", - "service": { - "shortName": "SecretManagerService", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService" - } - } - } - }, - { - "regionTag": "secretmanager_v1_generated_SecretManagerService_DeleteSecret_async", - "title": "SecretManagerService deleteSecret Sample", - "origin": "API_DEFINITION", - "description": " Deletes a [Secret][google.cloud.secretmanager.v1.Secret].", - "canonical": true, - "file": "secret_manager_service.delete_secret.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DeleteSecret", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.DeleteSecret", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.protobuf.Empty", - "client": { - "shortName": "SecretManagerServiceClient", - "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" - }, - "method": { - "shortName": "DeleteSecret", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.DeleteSecret", - "service": { - "shortName": "SecretManagerService", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService" - } - } - } - }, - { - "regionTag": "secretmanager_v1_generated_SecretManagerService_ListSecretVersions_async", - "title": "SecretManagerService listSecretVersions Sample", - "origin": "API_DEFINITION", - "description": " Lists [SecretVersions][google.cloud.secretmanager.v1.SecretVersion]. This call does not return secret data.", - "canonical": true, - "file": "secret_manager_service.list_secret_versions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 73, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "ListSecretVersions", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.ListSecretVersions", - "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" - } - ], - "resultType": ".google.cloud.secretmanager.v1.ListSecretVersionsResponse", - "client": { - "shortName": "SecretManagerServiceClient", - "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" - }, - "method": { - "shortName": "ListSecretVersions", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.ListSecretVersions", - "service": { - "shortName": "SecretManagerService", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService" - } - } - } - }, - { - "regionTag": "secretmanager_v1_generated_SecretManagerService_GetSecretVersion_async", - "title": "SecretManagerService getSecretVersion Sample", - "origin": "API_DEFINITION", - "description": " Gets metadata for a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. `projects/*/secrets/*/versions/latest` is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].", - "canonical": true, - "file": "secret_manager_service.get_secret_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetSecretVersion", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.GetSecretVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.secretmanager.v1.SecretVersion", - "client": { - "shortName": "SecretManagerServiceClient", - "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" - }, - "method": { - "shortName": "GetSecretVersion", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.GetSecretVersion", - "service": { - "shortName": "SecretManagerService", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService" - } - } - } - }, - { - "regionTag": "secretmanager_v1_generated_SecretManagerService_AccessSecretVersion_async", - "title": "SecretManagerService accessSecretVersion Sample", - "origin": "API_DEFINITION", - "description": " Accesses a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. This call returns the secret data. `projects/*/secrets/*/versions/latest` is an alias to the most recently created [SecretVersion][google.cloud.secretmanager.v1.SecretVersion].", - "canonical": true, - "file": "secret_manager_service.access_secret_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 53, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "AccessSecretVersion", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.secretmanager.v1.AccessSecretVersionResponse", - "client": { - "shortName": "SecretManagerServiceClient", - "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" - }, - "method": { - "shortName": "AccessSecretVersion", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.AccessSecretVersion", - "service": { - "shortName": "SecretManagerService", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService" - } - } - } - }, - { - "regionTag": "secretmanager_v1_generated_SecretManagerService_DisableSecretVersion_async", - "title": "SecretManagerService disableSecretVersion Sample", - "origin": "API_DEFINITION", - "description": " Disables a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Sets the [state][google.cloud.secretmanager.v1.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to [DISABLED][google.cloud.secretmanager.v1.SecretVersion.State.DISABLED].", - "canonical": true, - "file": "secret_manager_service.disable_secret_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DisableSecretVersion", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.DisableSecretVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.secretmanager.v1.SecretVersion", - "client": { - "shortName": "SecretManagerServiceClient", - "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" - }, - "method": { - "shortName": "DisableSecretVersion", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.DisableSecretVersion", - "service": { - "shortName": "SecretManagerService", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService" - } - } - } - }, - { - "regionTag": "secretmanager_v1_generated_SecretManagerService_EnableSecretVersion_async", - "title": "SecretManagerService enableSecretVersion Sample", - "origin": "API_DEFINITION", - "description": " Enables a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Sets the [state][google.cloud.secretmanager.v1.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to [ENABLED][google.cloud.secretmanager.v1.SecretVersion.State.ENABLED].", - "canonical": true, - "file": "secret_manager_service.enable_secret_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "EnableSecretVersion", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.EnableSecretVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.secretmanager.v1.SecretVersion", - "client": { - "shortName": "SecretManagerServiceClient", - "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" - }, - "method": { - "shortName": "EnableSecretVersion", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.EnableSecretVersion", - "service": { - "shortName": "SecretManagerService", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService" - } - } - } - }, - { - "regionTag": "secretmanager_v1_generated_SecretManagerService_DestroySecretVersion_async", - "title": "SecretManagerService destroySecretVersion Sample", - "origin": "API_DEFINITION", - "description": " Destroys a [SecretVersion][google.cloud.secretmanager.v1.SecretVersion]. Sets the [state][google.cloud.secretmanager.v1.SecretVersion.state] of the [SecretVersion][google.cloud.secretmanager.v1.SecretVersion] to [DESTROYED][google.cloud.secretmanager.v1.SecretVersion.State.DESTROYED] and irrevocably destroys the secret data.", - "canonical": true, - "file": "secret_manager_service.destroy_secret_version.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 57, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "DestroySecretVersion", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.DestroySecretVersion", - "async": true, - "parameters": [ - { - "name": "name", - "type": "TYPE_STRING" - }, - { - "name": "etag", - "type": "TYPE_STRING" - } - ], - "resultType": ".google.cloud.secretmanager.v1.SecretVersion", - "client": { - "shortName": "SecretManagerServiceClient", - "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" - }, - "method": { - "shortName": "DestroySecretVersion", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.DestroySecretVersion", - "service": { - "shortName": "SecretManagerService", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService" - } - } - } - }, - { - "regionTag": "secretmanager_v1_generated_SecretManagerService_SetIamPolicy_async", - "title": "SecretManagerService setIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Sets the access control policy on the specified secret. Replaces any existing policy. Permissions on [SecretVersions][google.cloud.secretmanager.v1.SecretVersion] are enforced according to the policy set on the associated [Secret][google.cloud.secretmanager.v1.Secret].", - "canonical": true, - "file": "secret_manager_service.set_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 66, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.SetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "policy", - "type": ".google.iam.v1.Policy" - }, - { - "name": "update_mask", - "type": ".google.protobuf.FieldMask" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "SecretManagerServiceClient", - "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" - }, - "method": { - "shortName": "SetIamPolicy", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.SetIamPolicy", - "service": { - "shortName": "SecretManagerService", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService" - } - } - } - }, - { - "regionTag": "secretmanager_v1_generated_SecretManagerService_GetIamPolicy_async", - "title": "SecretManagerService getIamPolicy Sample", - "origin": "API_DEFINITION", - "description": " Gets the access control policy for a secret. Returns empty policy if the secret exists and does not have a policy set.", - "canonical": true, - "file": "secret_manager_service.get_iam_policy.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 56, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.GetIamPolicy", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "options", - "type": ".google.iam.v1.GetPolicyOptions" - } - ], - "resultType": ".google.iam.v1.Policy", - "client": { - "shortName": "SecretManagerServiceClient", - "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" - }, - "method": { - "shortName": "GetIamPolicy", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.GetIamPolicy", - "service": { - "shortName": "SecretManagerService", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService" - } - } - } - }, - { - "regionTag": "secretmanager_v1_generated_SecretManagerService_TestIamPermissions_async", - "title": "SecretManagerService testIamPermissions Sample", - "origin": "API_DEFINITION", - "description": " Returns permissions that a caller has for the specified secret. If the secret does not exist, this call returns an empty set of permissions, not a NOT_FOUND error. Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may \"fail open\" without warning.", - "canonical": true, - "file": "secret_manager_service.test_iam_permissions.js", - "language": "JAVASCRIPT", - "segments": [ - { - "start": 25, - "end": 59, - "type": "FULL" - } - ], - "clientMethod": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.TestIamPermissions", - "async": true, - "parameters": [ - { - "name": "resource", - "type": "TYPE_STRING" - }, - { - "name": "permissions", - "type": "TYPE_STRING[]" - } - ], - "resultType": ".google.iam.v1.TestIamPermissionsResponse", - "client": { - "shortName": "SecretManagerServiceClient", - "fullName": "google.cloud.secretmanager.v1.SecretManagerServiceClient" - }, - "method": { - "shortName": "TestIamPermissions", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService.TestIamPermissions", - "service": { - "shortName": "SecretManagerService", - "fullName": "google.cloud.secretmanager.v1.SecretManagerService" - } - } - } - } - ] -} diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index 0fbe99b..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 SecretManagerServiceClient = v1.SecretManagerServiceClient; -type SecretManagerServiceClient = v1.SecretManagerServiceClient; -export {v1, SecretManagerServiceClient}; -export default {v1, SecretManagerServiceClient}; -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 077d68e..0000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,181 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.secretmanager.v1", - "libraryPackage": "@google-cloud/secret-manager", - "services": { - "SecretManagerService": { - "clients": { - "grpc": { - "libraryClient": "SecretManagerServiceClient", - "rpcs": { - "CreateSecret": { - "methods": [ - "createSecret" - ] - }, - "AddSecretVersion": { - "methods": [ - "addSecretVersion" - ] - }, - "GetSecret": { - "methods": [ - "getSecret" - ] - }, - "UpdateSecret": { - "methods": [ - "updateSecret" - ] - }, - "DeleteSecret": { - "methods": [ - "deleteSecret" - ] - }, - "GetSecretVersion": { - "methods": [ - "getSecretVersion" - ] - }, - "AccessSecretVersion": { - "methods": [ - "accessSecretVersion" - ] - }, - "DisableSecretVersion": { - "methods": [ - "disableSecretVersion" - ] - }, - "EnableSecretVersion": { - "methods": [ - "enableSecretVersion" - ] - }, - "DestroySecretVersion": { - "methods": [ - "destroySecretVersion" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "ListSecrets": { - "methods": [ - "listSecrets", - "listSecretsStream", - "listSecretsAsync" - ] - }, - "ListSecretVersions": { - "methods": [ - "listSecretVersions", - "listSecretVersionsStream", - "listSecretVersionsAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "SecretManagerServiceClient", - "rpcs": { - "CreateSecret": { - "methods": [ - "createSecret" - ] - }, - "AddSecretVersion": { - "methods": [ - "addSecretVersion" - ] - }, - "GetSecret": { - "methods": [ - "getSecret" - ] - }, - "UpdateSecret": { - "methods": [ - "updateSecret" - ] - }, - "DeleteSecret": { - "methods": [ - "deleteSecret" - ] - }, - "GetSecretVersion": { - "methods": [ - "getSecretVersion" - ] - }, - "AccessSecretVersion": { - "methods": [ - "accessSecretVersion" - ] - }, - "DisableSecretVersion": { - "methods": [ - "disableSecretVersion" - ] - }, - "EnableSecretVersion": { - "methods": [ - "enableSecretVersion" - ] - }, - "DestroySecretVersion": { - "methods": [ - "destroySecretVersion" - ] - }, - "SetIamPolicy": { - "methods": [ - "setIamPolicy" - ] - }, - "GetIamPolicy": { - "methods": [ - "getIamPolicy" - ] - }, - "TestIamPermissions": { - "methods": [ - "testIamPermissions" - ] - }, - "ListSecrets": { - "methods": [ - "listSecrets", - "listSecretsStream", - "listSecretsAsync" - ] - }, - "ListSecretVersions": { - "methods": [ - "listSecretVersions", - "listSecretVersionsStream", - "listSecretVersionsAsync" - ] - } - } - } - } - } - } -} 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 25c17ec..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 {SecretManagerServiceClient} from './secret_manager_service_client'; diff --git a/owl-bot-staging/v1/src/v1/secret_manager_service_client.ts b/owl-bot-staging/v1/src/v1/secret_manager_service_client.ts deleted file mode 100644 index 4de538a..0000000 --- a/owl-bot-staging/v1/src/v1/secret_manager_service_client.ts +++ /dev/null @@ -1,1902 +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, 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/secret_manager_service_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './secret_manager_service_client_config.json'; - -const version = require('../../../package.json').version; - -/** - * Secret Manager Service - * - * Manages secrets and operations using those secrets. Implements a REST - * model with the following objects: - * - * * {@link google.cloud.secretmanager.v1.Secret|Secret} - * * {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} - * @class - * @memberof v1 - */ -export class SecretManagerServiceClient { - 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}; - secretManagerServiceStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of SecretManagerServiceClient. - * - * @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 SecretManagerServiceClient; - 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 = { - projectPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}' - ), - secretPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/secrets/{secret}' - ), - secretVersionPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/secrets/{secret}/versions/{secret_version}' - ), - topicPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/topics/{topic}' - ), - }; - - // 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 = { - listSecrets: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'secrets'), - listSecretVersions: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'versions') - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.secretmanager.v1.SecretManagerService', 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.secretManagerServiceStub) { - return this.secretManagerServiceStub; - } - - // Put together the "service stub" for - // google.cloud.secretmanager.v1.SecretManagerService. - this.secretManagerServiceStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.secretmanager.v1.SecretManagerService') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.secretmanager.v1.SecretManagerService, - 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 secretManagerServiceStubMethods = - ['listSecrets', 'createSecret', 'addSecretVersion', 'getSecret', 'updateSecret', 'deleteSecret', 'listSecretVersions', 'getSecretVersion', 'accessSecretVersion', 'disableSecretVersion', 'enableSecretVersion', 'destroySecretVersion', 'setIamPolicy', 'getIamPolicy', 'testIamPermissions']; - for (const methodName of secretManagerServiceStubMethods) { - const callPromise = this.secretManagerServiceStub.then( - stub => (...args: Array<{}>) => { - if (this._terminated) { - return Promise.reject('The client has already been closed.'); - } - const func = stub[methodName]; - return func.apply(stub, args); - }, - (err: Error|null|undefined) => () => { - throw err; - }); - - const descriptor = - this.descriptors.page[methodName] || - undefined; - const apiCall = this._gaxModule.createApiCall( - callPromise, - this._defaults[methodName], - descriptor - ); - - this.innerApiCalls[methodName] = apiCall; - } - - return this.secretManagerServiceStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'secretmanager.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 'secretmanager.googleapis.com'; - } - - /** - * The port for this API service. - * @returns {number} The default port for this service. - */ - static get port() { - return 443; - } - - /** - * The scopes needed to make gRPC calls for every method defined - * in this service. - * @returns {string[]} List of default scopes. - */ - static get scopes() { - return [ - 'https://www.googleapis.com/auth/cloud-platform' - ]; - } - - getProjectId(): Promise; - getProjectId(callback: Callback): void; - /** - * Return the project ID used by this class. - * @returns {Promise} A promise that resolves to string containing the project ID. - */ - getProjectId(callback?: Callback): - Promise|void { - if (callback) { - this.auth.getProjectId(callback); - return; - } - return this.auth.getProjectId(); - } - - // ------------------- - // -- Service calls -- - // ------------------- -/** - * Creates a new {@link google.cloud.secretmanager.v1.Secret|Secret} containing no {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersions}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the project to associate with the - * {@link google.cloud.secretmanager.v1.Secret|Secret}, in the format `projects/*`. - * @param {string} request.secretId - * Required. This must be unique within the project. - * - * A secret ID is a string with a maximum length of 255 characters and can - * contain uppercase and lowercase letters, numerals, and the hyphen (`-`) and - * underscore (`_`) characters. - * @param {google.cloud.secretmanager.v1.Secret} request.secret - * Required. A {@link google.cloud.secretmanager.v1.Secret|Secret} with initial field values. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Secret]{@link google.cloud.secretmanager.v1.Secret}. - * 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/secret_manager_service.create_secret.js - * region_tag:secretmanager_v1_generated_SecretManagerService_CreateSecret_async - */ - createSecret( - request?: protos.google.cloud.secretmanager.v1.ICreateSecretRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecret, - protos.google.cloud.secretmanager.v1.ICreateSecretRequest|undefined, {}|undefined - ]>; - createSecret( - request: protos.google.cloud.secretmanager.v1.ICreateSecretRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.secretmanager.v1.ISecret, - protos.google.cloud.secretmanager.v1.ICreateSecretRequest|null|undefined, - {}|null|undefined>): void; - createSecret( - request: protos.google.cloud.secretmanager.v1.ICreateSecretRequest, - callback: Callback< - protos.google.cloud.secretmanager.v1.ISecret, - protos.google.cloud.secretmanager.v1.ICreateSecretRequest|null|undefined, - {}|null|undefined>): void; - createSecret( - request?: protos.google.cloud.secretmanager.v1.ICreateSecretRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.secretmanager.v1.ISecret, - protos.google.cloud.secretmanager.v1.ICreateSecretRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.secretmanager.v1.ISecret, - protos.google.cloud.secretmanager.v1.ICreateSecretRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecret, - protos.google.cloud.secretmanager.v1.ICreateSecretRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.createSecret(request, options, callback); - } -/** - * Creates a new {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} containing secret data and attaches - * it to an existing {@link google.cloud.secretmanager.v1.Secret|Secret}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link google.cloud.secretmanager.v1.Secret|Secret} to associate with the - * {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} in the format `projects/* /secrets/*`. - * @param {google.cloud.secretmanager.v1.SecretPayload} request.payload - * Required. The secret payload of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [SecretVersion]{@link google.cloud.secretmanager.v1.SecretVersion}. - * 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/secret_manager_service.add_secret_version.js - * region_tag:secretmanager_v1_generated_SecretManagerService_AddSecretVersion_async - */ - addSecretVersion( - request?: protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest|undefined, {}|undefined - ]>; - addSecretVersion( - request: protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest|null|undefined, - {}|null|undefined>): void; - addSecretVersion( - request: protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest, - callback: Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest|null|undefined, - {}|null|undefined>): void; - addSecretVersion( - request?: protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IAddSecretVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.addSecretVersion(request, options, callback); - } -/** - * Gets metadata for a given {@link google.cloud.secretmanager.v1.Secret|Secret}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the {@link google.cloud.secretmanager.v1.Secret|Secret}, in the format `projects/* /secrets/*`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Secret]{@link google.cloud.secretmanager.v1.Secret}. - * 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/secret_manager_service.get_secret.js - * region_tag:secretmanager_v1_generated_SecretManagerService_GetSecret_async - */ - getSecret( - request?: protos.google.cloud.secretmanager.v1.IGetSecretRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecret, - protos.google.cloud.secretmanager.v1.IGetSecretRequest|undefined, {}|undefined - ]>; - getSecret( - request: protos.google.cloud.secretmanager.v1.IGetSecretRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.secretmanager.v1.ISecret, - protos.google.cloud.secretmanager.v1.IGetSecretRequest|null|undefined, - {}|null|undefined>): void; - getSecret( - request: protos.google.cloud.secretmanager.v1.IGetSecretRequest, - callback: Callback< - protos.google.cloud.secretmanager.v1.ISecret, - protos.google.cloud.secretmanager.v1.IGetSecretRequest|null|undefined, - {}|null|undefined>): void; - getSecret( - request?: protos.google.cloud.secretmanager.v1.IGetSecretRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.secretmanager.v1.ISecret, - protos.google.cloud.secretmanager.v1.IGetSecretRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.secretmanager.v1.ISecret, - protos.google.cloud.secretmanager.v1.IGetSecretRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecret, - protos.google.cloud.secretmanager.v1.IGetSecretRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.getSecret(request, options, callback); - } -/** - * Updates metadata of an existing {@link google.cloud.secretmanager.v1.Secret|Secret}. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.secretmanager.v1.Secret} request.secret - * Required. {@link google.cloud.secretmanager.v1.Secret|Secret} with updated field values. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. Specifies the fields to be updated. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Secret]{@link google.cloud.secretmanager.v1.Secret}. - * 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/secret_manager_service.update_secret.js - * region_tag:secretmanager_v1_generated_SecretManagerService_UpdateSecret_async - */ - updateSecret( - request?: protos.google.cloud.secretmanager.v1.IUpdateSecretRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecret, - protos.google.cloud.secretmanager.v1.IUpdateSecretRequest|undefined, {}|undefined - ]>; - updateSecret( - request: protos.google.cloud.secretmanager.v1.IUpdateSecretRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.secretmanager.v1.ISecret, - protos.google.cloud.secretmanager.v1.IUpdateSecretRequest|null|undefined, - {}|null|undefined>): void; - updateSecret( - request: protos.google.cloud.secretmanager.v1.IUpdateSecretRequest, - callback: Callback< - protos.google.cloud.secretmanager.v1.ISecret, - protos.google.cloud.secretmanager.v1.IUpdateSecretRequest|null|undefined, - {}|null|undefined>): void; - updateSecret( - request?: protos.google.cloud.secretmanager.v1.IUpdateSecretRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.secretmanager.v1.ISecret, - protos.google.cloud.secretmanager.v1.IUpdateSecretRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.secretmanager.v1.ISecret, - protos.google.cloud.secretmanager.v1.IUpdateSecretRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecret, - protos.google.cloud.secretmanager.v1.IUpdateSecretRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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({ - 'secret.name': request.secret!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateSecret(request, options, callback); - } -/** - * Deletes a {@link google.cloud.secretmanager.v1.Secret|Secret}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the {@link google.cloud.secretmanager.v1.Secret|Secret} to delete in the format - * `projects/* /secrets/*`. - * @param {string} [request.etag] - * Optional. Etag of the {@link google.cloud.secretmanager.v1.Secret|Secret}. The request succeeds if it matches - * the etag of the currently stored secret object. If the etag is omitted, - * the request succeeds. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/secret_manager_service.delete_secret.js - * region_tag:secretmanager_v1_generated_SecretManagerService_DeleteSecret_async - */ - deleteSecret( - request?: protos.google.cloud.secretmanager.v1.IDeleteSecretRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.secretmanager.v1.IDeleteSecretRequest|undefined, {}|undefined - ]>; - deleteSecret( - request: protos.google.cloud.secretmanager.v1.IDeleteSecretRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.secretmanager.v1.IDeleteSecretRequest|null|undefined, - {}|null|undefined>): void; - deleteSecret( - request: protos.google.cloud.secretmanager.v1.IDeleteSecretRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.secretmanager.v1.IDeleteSecretRequest|null|undefined, - {}|null|undefined>): void; - deleteSecret( - request?: protos.google.cloud.secretmanager.v1.IDeleteSecretRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.secretmanager.v1.IDeleteSecretRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.secretmanager.v1.IDeleteSecretRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.secretmanager.v1.IDeleteSecretRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.deleteSecret(request, options, callback); - } -/** - * Gets metadata for a {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. - * - * `projects/* /secrets/* /versions/latest` is an alias to the most recently - * created {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} in the format - * `projects/* /secrets/* /versions/*`. - * - * `projects/* /secrets/* /versions/latest` is an alias to the most recently - * created {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [SecretVersion]{@link google.cloud.secretmanager.v1.SecretVersion}. - * 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/secret_manager_service.get_secret_version.js - * region_tag:secretmanager_v1_generated_SecretManagerService_GetSecretVersion_async - */ - getSecretVersion( - request?: protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest|undefined, {}|undefined - ]>; - getSecretVersion( - request: protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest|null|undefined, - {}|null|undefined>): void; - getSecretVersion( - request: protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest, - callback: Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest|null|undefined, - {}|null|undefined>): void; - getSecretVersion( - request?: protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IGetSecretVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.getSecretVersion(request, options, callback); - } -/** - * Accesses a {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. This call returns the secret data. - * - * `projects/* /secrets/* /versions/latest` is an alias to the most recently - * created {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} in the format - * `projects/* /secrets/* /versions/*`. - * - * `projects/* /secrets/* /versions/latest` is an alias to the most recently - * created {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [AccessSecretVersionResponse]{@link google.cloud.secretmanager.v1.AccessSecretVersionResponse}. - * 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/secret_manager_service.access_secret_version.js - * region_tag:secretmanager_v1_generated_SecretManagerService_AccessSecretVersion_async - */ - accessSecretVersion( - request?: protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.secretmanager.v1.IAccessSecretVersionResponse, - protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest|undefined, {}|undefined - ]>; - accessSecretVersion( - request: protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.secretmanager.v1.IAccessSecretVersionResponse, - protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest|null|undefined, - {}|null|undefined>): void; - accessSecretVersion( - request: protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest, - callback: Callback< - protos.google.cloud.secretmanager.v1.IAccessSecretVersionResponse, - protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest|null|undefined, - {}|null|undefined>): void; - accessSecretVersion( - request?: protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.secretmanager.v1.IAccessSecretVersionResponse, - protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.secretmanager.v1.IAccessSecretVersionResponse, - protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.secretmanager.v1.IAccessSecretVersionResponse, - protos.google.cloud.secretmanager.v1.IAccessSecretVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.accessSecretVersion(request, options, callback); - } -/** - * Disables a {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. - * - * Sets the {@link google.cloud.secretmanager.v1.SecretVersion.state|state} of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} to - * {@link google.cloud.secretmanager.v1.SecretVersion.State.DISABLED|DISABLED}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} to disable in the format - * `projects/* /secrets/* /versions/*`. - * @param {string} [request.etag] - * Optional. Etag of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. The request succeeds if it matches - * the etag of the currently stored secret version object. If the etag is - * omitted, the request succeeds. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [SecretVersion]{@link google.cloud.secretmanager.v1.SecretVersion}. - * 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/secret_manager_service.disable_secret_version.js - * region_tag:secretmanager_v1_generated_SecretManagerService_DisableSecretVersion_async - */ - disableSecretVersion( - request?: protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest|undefined, {}|undefined - ]>; - disableSecretVersion( - request: protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest|null|undefined, - {}|null|undefined>): void; - disableSecretVersion( - request: protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest, - callback: Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest|null|undefined, - {}|null|undefined>): void; - disableSecretVersion( - request?: protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IDisableSecretVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.disableSecretVersion(request, options, callback); - } -/** - * Enables a {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. - * - * Sets the {@link google.cloud.secretmanager.v1.SecretVersion.state|state} of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} to - * {@link google.cloud.secretmanager.v1.SecretVersion.State.ENABLED|ENABLED}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} to enable in the format - * `projects/* /secrets/* /versions/*`. - * @param {string} [request.etag] - * Optional. Etag of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. The request succeeds if it matches - * the etag of the currently stored secret version object. If the etag is - * omitted, the request succeeds. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [SecretVersion]{@link google.cloud.secretmanager.v1.SecretVersion}. - * 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/secret_manager_service.enable_secret_version.js - * region_tag:secretmanager_v1_generated_SecretManagerService_EnableSecretVersion_async - */ - enableSecretVersion( - request?: protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest|undefined, {}|undefined - ]>; - enableSecretVersion( - request: protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest|null|undefined, - {}|null|undefined>): void; - enableSecretVersion( - request: protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest, - callback: Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest|null|undefined, - {}|null|undefined>): void; - enableSecretVersion( - request?: protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IEnableSecretVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.enableSecretVersion(request, options, callback); - } -/** - * Destroys a {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. - * - * Sets the {@link google.cloud.secretmanager.v1.SecretVersion.state|state} of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} to - * {@link google.cloud.secretmanager.v1.SecretVersion.State.DESTROYED|DESTROYED} and irrevocably destroys the - * secret data. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The resource name of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion} to destroy in the format - * `projects/* /secrets/* /versions/*`. - * @param {string} [request.etag] - * Optional. Etag of the {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersion}. The request succeeds if it matches - * the etag of the currently stored secret version object. If the etag is - * omitted, the request succeeds. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [SecretVersion]{@link google.cloud.secretmanager.v1.SecretVersion}. - * 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/secret_manager_service.destroy_secret_version.js - * region_tag:secretmanager_v1_generated_SecretManagerService_DestroySecretVersion_async - */ - destroySecretVersion( - request?: protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest|undefined, {}|undefined - ]>; - destroySecretVersion( - request: protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest|null|undefined, - {}|null|undefined>): void; - destroySecretVersion( - request: protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest, - callback: Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest|null|undefined, - {}|null|undefined>): void; - destroySecretVersion( - request?: protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecretVersion, - protos.google.cloud.secretmanager.v1.IDestroySecretVersionRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.destroySecretVersion(request, options, callback); - } -/** - * Sets the access control policy on the specified secret. Replaces any - * existing policy. - * - * Permissions on {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersions} are enforced according - * to the policy set on the associated {@link google.cloud.secretmanager.v1.Secret|Secret}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being specified. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.Policy} request.policy - * REQUIRED: The complete policy to be applied to the `resource`. The size of - * the policy is limited to a few 10s of KB. An empty policy is a - * valid policy but certain Cloud Platform services (such as Projects) - * might reject them. - * @param {google.protobuf.FieldMask} request.updateMask - * OPTIONAL: A FieldMask specifying which fields of the policy to modify. Only - * the fields in the mask will be modified. If no mask is provided, the - * following default mask is used: - * - * `paths: "bindings, etag"` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/secret_manager_service.set_iam_policy.js - * region_tag:secretmanager_v1_generated_SecretManagerService_SetIamPolicy_async - */ - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request: protos.google.iam.v1.ISetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - setIamPolicy( - request?: protos.google.iam.v1.ISetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.ISetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'resource': request.resource || '', - }); - this.initialize(); - return this.innerApiCalls.setIamPolicy(request, options, callback); - } -/** - * Gets the access control policy for a secret. - * Returns empty policy if the secret exists and does not have a policy set. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {google.iam.v1.GetPolicyOptions} request.options - * OPTIONAL: A `GetPolicyOptions` object for specifying options to - * `GetIamPolicy`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Policy]{@link google.iam.v1.Policy}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/secret_manager_service.get_iam_policy.js - * region_tag:secretmanager_v1_generated_SecretManagerService_GetIamPolicy_async - */ - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request: protos.google.iam.v1.IGetIamPolicyRequest, - callback: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): void; - getIamPolicy( - request?: protos.google.iam.v1.IGetIamPolicyRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.IPolicy, - protos.google.iam.v1.IGetIamPolicyRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'resource': request.resource || '', - }); - this.initialize(); - return this.innerApiCalls.getIamPolicy(request, options, callback); - } -/** - * Returns permissions that a caller has for the specified secret. - * If the secret does not exist, this call returns an empty set of - * permissions, not a NOT_FOUND error. - * - * Note: This operation is designed to be used for building permission-aware - * UIs and command-line tools, not for authorization checking. This operation - * may "fail open" without warning. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.resource - * REQUIRED: The resource for which the policy detail is being requested. - * See the operation documentation for the appropriate value for this field. - * @param {string[]} request.permissions - * The set of permissions to check for the `resource`. Permissions with - * wildcards (such as '*' or 'storage.*') are not allowed. For more - * information see - * [IAM Overview](https://cloud.google.com/iam/docs/overview#permissions). - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [TestIamPermissionsResponse]{@link google.iam.v1.TestIamPermissionsResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/secret_manager_service.test_iam_permissions.js - * region_tag:secretmanager_v1_generated_SecretManagerService_TestIamPermissions_async - */ - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - options?: CallOptions): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - options: CallOptions, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request: protos.google.iam.v1.ITestIamPermissionsRequest, - callback: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): void; - testIamPermissions( - request?: protos.google.iam.v1.ITestIamPermissionsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.iam.v1.ITestIamPermissionsResponse, - protos.google.iam.v1.ITestIamPermissionsRequest|undefined, {}|undefined - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - else { - options = optionsOrCallback as CallOptions; - } - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'resource': request.resource || '', - }); - this.initialize(); - return this.innerApiCalls.testIamPermissions(request, options, callback); - } - - /** - * Lists {@link google.cloud.secretmanager.v1.Secret|Secrets}. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the project associated with the - * {@link google.cloud.secretmanager.v1.Secret|Secrets}, in the format `projects/*`. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to be returned in a single page. If - * set to 0, the server decides the number of results to return. If the - * number is greater than 25000, it is capped at 25000. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.secretmanager.v1.ListSecretsResponse.next_page_token|ListSecretsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Filter string, adhering to the rules in - * [List-operation - * filtering](https://cloud.google.com/secret-manager/docs/filtering). List - * only secrets matching the filter. If filter is empty, all secrets are - * listed. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Secret]{@link google.cloud.secretmanager.v1.Secret}. - * 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 `listSecretsAsync()` - * 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. - */ - listSecrets( - request?: protos.google.cloud.secretmanager.v1.IListSecretsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecret[], - protos.google.cloud.secretmanager.v1.IListSecretsRequest|null, - protos.google.cloud.secretmanager.v1.IListSecretsResponse - ]>; - listSecrets( - request: protos.google.cloud.secretmanager.v1.IListSecretsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.secretmanager.v1.IListSecretsRequest, - protos.google.cloud.secretmanager.v1.IListSecretsResponse|null|undefined, - protos.google.cloud.secretmanager.v1.ISecret>): void; - listSecrets( - request: protos.google.cloud.secretmanager.v1.IListSecretsRequest, - callback: PaginationCallback< - protos.google.cloud.secretmanager.v1.IListSecretsRequest, - protos.google.cloud.secretmanager.v1.IListSecretsResponse|null|undefined, - protos.google.cloud.secretmanager.v1.ISecret>): void; - listSecrets( - request?: protos.google.cloud.secretmanager.v1.IListSecretsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.secretmanager.v1.IListSecretsRequest, - protos.google.cloud.secretmanager.v1.IListSecretsResponse|null|undefined, - protos.google.cloud.secretmanager.v1.ISecret>, - callback?: PaginationCallback< - protos.google.cloud.secretmanager.v1.IListSecretsRequest, - protos.google.cloud.secretmanager.v1.IListSecretsResponse|null|undefined, - protos.google.cloud.secretmanager.v1.ISecret>): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecret[], - protos.google.cloud.secretmanager.v1.IListSecretsRequest|null, - protos.google.cloud.secretmanager.v1.IListSecretsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listSecrets(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the project associated with the - * {@link google.cloud.secretmanager.v1.Secret|Secrets}, in the format `projects/*`. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to be returned in a single page. If - * set to 0, the server decides the number of results to return. If the - * number is greater than 25000, it is capped at 25000. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.secretmanager.v1.ListSecretsResponse.next_page_token|ListSecretsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Filter string, adhering to the rules in - * [List-operation - * filtering](https://cloud.google.com/secret-manager/docs/filtering). List - * only secrets matching the filter. If filter is empty, all secrets are - * listed. - * @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 [Secret]{@link google.cloud.secretmanager.v1.Secret} 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 `listSecretsAsync()` - * 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. - */ - listSecretsStream( - request?: protos.google.cloud.secretmanager.v1.IListSecretsRequest, - 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['listSecrets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSecrets.createStream( - this.innerApiCalls.listSecrets as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSecrets`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the project associated with the - * {@link google.cloud.secretmanager.v1.Secret|Secrets}, in the format `projects/*`. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to be returned in a single page. If - * set to 0, the server decides the number of results to return. If the - * number is greater than 25000, it is capped at 25000. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * {@link google.cloud.secretmanager.v1.ListSecretsResponse.next_page_token|ListSecretsResponse.next_page_token}. - * @param {string} [request.filter] - * Optional. Filter string, adhering to the rules in - * [List-operation - * filtering](https://cloud.google.com/secret-manager/docs/filtering). List - * only secrets matching the filter. If filter is empty, all secrets are - * listed. - * @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 - * [Secret]{@link google.cloud.secretmanager.v1.Secret}. 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/secret_manager_service.list_secrets.js - * region_tag:secretmanager_v1_generated_SecretManagerService_ListSecrets_async - */ - listSecretsAsync( - request?: protos.google.cloud.secretmanager.v1.IListSecretsRequest, - 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['listSecrets']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSecrets.asyncIterate( - this.innerApiCalls['listSecrets'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersions}. This call does not return secret - * data. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link google.cloud.secretmanager.v1.Secret|Secret} associated with the - * {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersions} to list, in the format - * `projects/* /secrets/*`. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to be returned in a single page. If - * set to 0, the server decides the number of results to return. If the - * number is greater than 25000, it is capped at 25000. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * ListSecretVersionsResponse.next_page_token][]. - * @param {string} [request.filter] - * Optional. Filter string, adhering to the rules in - * [List-operation - * filtering](https://cloud.google.com/secret-manager/docs/filtering). List - * only secret versions matching the filter. If filter is empty, all secret - * versions are listed. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [SecretVersion]{@link google.cloud.secretmanager.v1.SecretVersion}. - * 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 `listSecretVersionsAsync()` - * 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. - */ - listSecretVersions( - request?: protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecretVersion[], - protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest|null, - protos.google.cloud.secretmanager.v1.IListSecretVersionsResponse - ]>; - listSecretVersions( - request: protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, - protos.google.cloud.secretmanager.v1.IListSecretVersionsResponse|null|undefined, - protos.google.cloud.secretmanager.v1.ISecretVersion>): void; - listSecretVersions( - request: protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, - callback: PaginationCallback< - protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, - protos.google.cloud.secretmanager.v1.IListSecretVersionsResponse|null|undefined, - protos.google.cloud.secretmanager.v1.ISecretVersion>): void; - listSecretVersions( - request?: protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, - protos.google.cloud.secretmanager.v1.IListSecretVersionsResponse|null|undefined, - protos.google.cloud.secretmanager.v1.ISecretVersion>, - callback?: PaginationCallback< - protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, - protos.google.cloud.secretmanager.v1.IListSecretVersionsResponse|null|undefined, - protos.google.cloud.secretmanager.v1.ISecretVersion>): - Promise<[ - protos.google.cloud.secretmanager.v1.ISecretVersion[], - protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest|null, - protos.google.cloud.secretmanager.v1.IListSecretVersionsResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof optionsOrCallback === 'function' && callback === undefined) { - callback = optionsOrCallback; - options = {}; - } - 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.listSecretVersions(request, options, callback); - } - -/** - * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link google.cloud.secretmanager.v1.Secret|Secret} associated with the - * {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersions} to list, in the format - * `projects/* /secrets/*`. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to be returned in a single page. If - * set to 0, the server decides the number of results to return. If the - * number is greater than 25000, it is capped at 25000. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * ListSecretVersionsResponse.next_page_token][]. - * @param {string} [request.filter] - * Optional. Filter string, adhering to the rules in - * [List-operation - * filtering](https://cloud.google.com/secret-manager/docs/filtering). List - * only secret versions matching the filter. If filter is empty, all secret - * versions are listed. - * @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 [SecretVersion]{@link google.cloud.secretmanager.v1.SecretVersion} 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 `listSecretVersionsAsync()` - * 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. - */ - listSecretVersionsStream( - request?: protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, - 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['listSecretVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSecretVersions.createStream( - this.innerApiCalls.listSecretVersions as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listSecretVersions`, but returns an iterable object. - * - * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The resource name of the {@link google.cloud.secretmanager.v1.Secret|Secret} associated with the - * {@link google.cloud.secretmanager.v1.SecretVersion|SecretVersions} to list, in the format - * `projects/* /secrets/*`. - * @param {number} [request.pageSize] - * Optional. The maximum number of results to be returned in a single page. If - * set to 0, the server decides the number of results to return. If the - * number is greater than 25000, it is capped at 25000. - * @param {string} [request.pageToken] - * Optional. Pagination token, returned earlier via - * ListSecretVersionsResponse.next_page_token][]. - * @param {string} [request.filter] - * Optional. Filter string, adhering to the rules in - * [List-operation - * filtering](https://cloud.google.com/secret-manager/docs/filtering). List - * only secret versions matching the filter. If filter is empty, all secret - * versions are listed. - * @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 - * [SecretVersion]{@link google.cloud.secretmanager.v1.SecretVersion}. 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/secret_manager_service.list_secret_versions.js - * region_tag:secretmanager_v1_generated_SecretManagerService_ListSecretVersions_async - */ - listSecretVersionsAsync( - request?: protos.google.cloud.secretmanager.v1.IListSecretVersionsRequest, - 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['listSecretVersions']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listSecretVersions.asyncIterate( - this.innerApiCalls['listSecretVersions'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified project resource name string. - * - * @param {string} project - * @returns {string} Resource name string. - */ - projectPath(project:string) { - return this.pathTemplates.projectPathTemplate.render({ - project: project, - }); - } - - /** - * Parse the project from Project resource. - * - * @param {string} projectName - * A fully-qualified path representing Project resource. - * @returns {string} A string representing the project. - */ - matchProjectFromProjectName(projectName: string) { - return this.pathTemplates.projectPathTemplate.match(projectName).project; - } - - /** - * Return a fully-qualified secret resource name string. - * - * @param {string} project - * @param {string} secret - * @returns {string} Resource name string. - */ - secretPath(project:string,secret:string) { - return this.pathTemplates.secretPathTemplate.render({ - project: project, - secret: secret, - }); - } - - /** - * Parse the project from Secret resource. - * - * @param {string} secretName - * A fully-qualified path representing Secret resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSecretName(secretName: string) { - return this.pathTemplates.secretPathTemplate.match(secretName).project; - } - - /** - * Parse the secret from Secret resource. - * - * @param {string} secretName - * A fully-qualified path representing Secret resource. - * @returns {string} A string representing the secret. - */ - matchSecretFromSecretName(secretName: string) { - return this.pathTemplates.secretPathTemplate.match(secretName).secret; - } - - /** - * Return a fully-qualified secretVersion resource name string. - * - * @param {string} project - * @param {string} secret - * @param {string} secret_version - * @returns {string} Resource name string. - */ - secretVersionPath(project:string,secret:string,secretVersion:string) { - return this.pathTemplates.secretVersionPathTemplate.render({ - project: project, - secret: secret, - secret_version: secretVersion, - }); - } - - /** - * Parse the project from SecretVersion resource. - * - * @param {string} secretVersionName - * A fully-qualified path representing SecretVersion resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSecretVersionName(secretVersionName: string) { - return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).project; - } - - /** - * Parse the secret from SecretVersion resource. - * - * @param {string} secretVersionName - * A fully-qualified path representing SecretVersion resource. - * @returns {string} A string representing the secret. - */ - matchSecretFromSecretVersionName(secretVersionName: string) { - return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).secret; - } - - /** - * Parse the secret_version from SecretVersion resource. - * - * @param {string} secretVersionName - * A fully-qualified path representing SecretVersion resource. - * @returns {string} A string representing the secret_version. - */ - matchSecretVersionFromSecretVersionName(secretVersionName: string) { - return this.pathTemplates.secretVersionPathTemplate.match(secretVersionName).secret_version; - } - - /** - * Return a fully-qualified topic resource name string. - * - * @param {string} project - * @param {string} topic - * @returns {string} Resource name string. - */ - topicPath(project:string,topic:string) { - return this.pathTemplates.topicPathTemplate.render({ - project: project, - topic: topic, - }); - } - - /** - * Parse the project from Topic resource. - * - * @param {string} topicName - * A fully-qualified path representing Topic resource. - * @returns {string} A string representing the project. - */ - matchProjectFromTopicName(topicName: string) { - return this.pathTemplates.topicPathTemplate.match(topicName).project; - } - - /** - * Parse the topic from Topic resource. - * - * @param {string} topicName - * A fully-qualified path representing Topic resource. - * @returns {string} A string representing the topic. - */ - matchTopicFromTopicName(topicName: string) { - return this.pathTemplates.topicPathTemplate.match(topicName).topic; - } - - /** - * 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.secretManagerServiceStub && !this._terminated) { - return this.secretManagerServiceStub.then(stub => { - this._terminated = true; - stub.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/secret_manager_service_client_config.json b/owl-bot-staging/v1/src/v1/secret_manager_service_client_config.json deleted file mode 100644 index 0ad578c..0000000 --- a/owl-bot-staging/v1/src/v1/secret_manager_service_client_config.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "interfaces": { - "google.cloud.secretmanager.v1.SecretManagerService": { - "retry_codes": { - "non_idempotent": [], - "idempotent": [ - "DEADLINE_EXCEEDED", - "UNAVAILABLE" - ], - "resource_exhausted_unavailable": [ - "RESOURCE_EXHAUSTED", - "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 - }, - "dd71b8c1d82d51c18ce5ba426d9acc4c44e7746e": { - "initial_retry_delay_millis": 2000, - "retry_delay_multiplier": 2, - "max_retry_delay_millis": 60000, - "initial_rpc_timeout_millis": 60000, - "rpc_timeout_multiplier": 1, - "max_rpc_timeout_millis": 60000, - "total_timeout_millis": 600000 - } - }, - "methods": { - "ListSecrets": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "CreateSecret": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AddSecretVersion": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSecret": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "UpdateSecret": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DeleteSecret": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "ListSecretVersions": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetSecretVersion": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "AccessSecretVersion": { - "timeout_millis": 60000, - "retry_codes_name": "resource_exhausted_unavailable", - "retry_params_name": "dd71b8c1d82d51c18ce5ba426d9acc4c44e7746e" - }, - "DisableSecretVersion": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "EnableSecretVersion": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "DestroySecretVersion": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "SetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "GetIamPolicy": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - }, - "TestIamPermissions": { - "timeout_millis": 60000, - "retry_codes_name": "non_idempotent", - "retry_params_name": "default" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/secret_manager_service_proto_list.json b/owl-bot-staging/v1/src/v1/secret_manager_service_proto_list.json deleted file mode 100644 index 47a1283..0000000 --- a/owl-bot-staging/v1/src/v1/secret_manager_service_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/secretmanager/v1/resources.proto", - "../../protos/google/cloud/secretmanager/v1/service.proto" -] 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 125b3d0..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 secretmanager = require('@google-cloud/secret-manager'); - -function main() { - const secretManagerServiceClient = new secretmanager.SecretManagerServiceClient(); -} - -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 fba4421..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 {SecretManagerServiceClient} from '@google-cloud/secret-manager'; - -// check that the client class type name can be used -function doStuffWithSecretManagerServiceClient(client: SecretManagerServiceClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const secretManagerServiceClient = new SecretManagerServiceClient(); - doStuffWithSecretManagerServiceClient(secretManagerServiceClient); -} - -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_secret_manager_service_v1.ts b/owl-bot-staging/v1/test/gapic_secret_manager_service_v1.ts deleted file mode 100644 index c2116a1..0000000 --- a/owl-bot-staging/v1/test/gapic_secret_manager_service_v1.ts +++ /dev/null @@ -1,2048 +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 secretmanagerserviceModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function 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.SecretManagerServiceClient', () => { - it('has servicePath', () => { - const servicePath = secretmanagerserviceModule.v1.SecretManagerServiceClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = secretmanagerserviceModule.v1.SecretManagerServiceClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = secretmanagerserviceModule.v1.SecretManagerServiceClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.secretManagerServiceStub, undefined); - await client.initialize(); - assert(client.secretManagerServiceStub); - }); - - it('has close method for the initialized client', done => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - assert(client.secretManagerServiceStub); - client.close().then(() => { - done(); - }); - }); - - it('has close method for the non-initialized client', done => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.secretManagerServiceStub, undefined); - client.close().then(() => { - done(); - }); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - 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 secretmanagerserviceModule.v1.SecretManagerServiceClient({ - 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('createSecret', () => { - it('invokes createSecret without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.CreateSecretRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()); - client.innerApiCalls.createSecret = stubSimpleCall(expectedResponse); - const [response] = await client.createSecret(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createSecret as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createSecret without error using callback', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.CreateSecretRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()); - client.innerApiCalls.createSecret = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createSecret( - request, - (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecret|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createSecret as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createSecret with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.CreateSecretRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createSecret = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createSecret(request), expectedError); - assert((client.innerApiCalls.createSecret as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createSecret with closed client', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.CreateSecretRequest()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.createSecret(request), expectedError); - }); - }); - - describe('addSecretVersion', () => { - it('invokes addSecretVersion without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AddSecretVersionRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); - client.innerApiCalls.addSecretVersion = stubSimpleCall(expectedResponse); - const [response] = await client.addSecretVersion(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.addSecretVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes addSecretVersion without error using callback', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AddSecretVersionRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); - client.innerApiCalls.addSecretVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.addSecretVersion( - request, - (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecretVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.addSecretVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes addSecretVersion with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AddSecretVersionRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.addSecretVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.addSecretVersion(request), expectedError); - assert((client.innerApiCalls.addSecretVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes addSecretVersion with closed client', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AddSecretVersionRequest()); - request.parent = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.addSecretVersion(request), expectedError); - }); - }); - - describe('getSecret', () => { - it('invokes getSecret without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.GetSecretRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()); - client.innerApiCalls.getSecret = stubSimpleCall(expectedResponse); - const [response] = await client.getSecret(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSecret as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getSecret without error using callback', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.GetSecretRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()); - client.innerApiCalls.getSecret = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSecret( - request, - (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecret|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSecret as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getSecret with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.GetSecretRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getSecret = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSecret(request), expectedError); - assert((client.innerApiCalls.getSecret as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getSecret with closed client', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.GetSecretRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSecret(request), expectedError); - }); - }); - - describe('updateSecret', () => { - it('invokes updateSecret without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.UpdateSecretRequest()); - request.secret = {}; - request.secret.name = ''; - const expectedHeaderRequestParams = "secret.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()); - client.innerApiCalls.updateSecret = stubSimpleCall(expectedResponse); - const [response] = await client.updateSecret(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSecret as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateSecret without error using callback', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.UpdateSecretRequest()); - request.secret = {}; - request.secret.name = ''; - const expectedHeaderRequestParams = "secret.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()); - client.innerApiCalls.updateSecret = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSecret( - request, - (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecret|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSecret as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateSecret with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.UpdateSecretRequest()); - request.secret = {}; - request.secret.name = ''; - const expectedHeaderRequestParams = "secret.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSecret = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSecret(request), expectedError); - assert((client.innerApiCalls.updateSecret as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateSecret with closed client', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.UpdateSecretRequest()); - request.secret = {}; - request.secret.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.updateSecret(request), expectedError); - }); - }); - - describe('deleteSecret', () => { - it('invokes deleteSecret without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DeleteSecretRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteSecret = stubSimpleCall(expectedResponse); - const [response] = await client.deleteSecret(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteSecret as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteSecret without error using callback', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DeleteSecretRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteSecret = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteSecret( - request, - (err?: Error|null, result?: protos.google.protobuf.IEmpty|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteSecret as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteSecret with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DeleteSecretRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteSecret = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteSecret(request), expectedError); - assert((client.innerApiCalls.deleteSecret as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteSecret with closed client', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DeleteSecretRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.deleteSecret(request), expectedError); - }); - }); - - describe('getSecretVersion', () => { - it('invokes getSecretVersion without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.GetSecretVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); - client.innerApiCalls.getSecretVersion = stubSimpleCall(expectedResponse); - const [response] = await client.getSecretVersion(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSecretVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getSecretVersion without error using callback', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.GetSecretVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); - client.innerApiCalls.getSecretVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSecretVersion( - request, - (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecretVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSecretVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getSecretVersion with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.GetSecretVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getSecretVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSecretVersion(request), expectedError); - assert((client.innerApiCalls.getSecretVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getSecretVersion with closed client', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.GetSecretVersionRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getSecretVersion(request), expectedError); - }); - }); - - describe('accessSecretVersion', () => { - it('invokes accessSecretVersion without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AccessSecretVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AccessSecretVersionResponse()); - client.innerApiCalls.accessSecretVersion = stubSimpleCall(expectedResponse); - const [response] = await client.accessSecretVersion(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.accessSecretVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes accessSecretVersion without error using callback', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AccessSecretVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AccessSecretVersionResponse()); - client.innerApiCalls.accessSecretVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.accessSecretVersion( - request, - (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.IAccessSecretVersionResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.accessSecretVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes accessSecretVersion with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AccessSecretVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.accessSecretVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.accessSecretVersion(request), expectedError); - assert((client.innerApiCalls.accessSecretVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes accessSecretVersion with closed client', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.AccessSecretVersionRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.accessSecretVersion(request), expectedError); - }); - }); - - describe('disableSecretVersion', () => { - it('invokes disableSecretVersion without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DisableSecretVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); - client.innerApiCalls.disableSecretVersion = stubSimpleCall(expectedResponse); - const [response] = await client.disableSecretVersion(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.disableSecretVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes disableSecretVersion without error using callback', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DisableSecretVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); - client.innerApiCalls.disableSecretVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.disableSecretVersion( - request, - (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecretVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.disableSecretVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes disableSecretVersion with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DisableSecretVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.disableSecretVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.disableSecretVersion(request), expectedError); - assert((client.innerApiCalls.disableSecretVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes disableSecretVersion with closed client', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DisableSecretVersionRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.disableSecretVersion(request), expectedError); - }); - }); - - describe('enableSecretVersion', () => { - it('invokes enableSecretVersion without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.EnableSecretVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); - client.innerApiCalls.enableSecretVersion = stubSimpleCall(expectedResponse); - const [response] = await client.enableSecretVersion(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.enableSecretVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes enableSecretVersion without error using callback', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.EnableSecretVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); - client.innerApiCalls.enableSecretVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.enableSecretVersion( - request, - (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecretVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.enableSecretVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes enableSecretVersion with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.EnableSecretVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.enableSecretVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.enableSecretVersion(request), expectedError); - assert((client.innerApiCalls.enableSecretVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes enableSecretVersion with closed client', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.EnableSecretVersionRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.enableSecretVersion(request), expectedError); - }); - }); - - describe('destroySecretVersion', () => { - it('invokes destroySecretVersion without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DestroySecretVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); - client.innerApiCalls.destroySecretVersion = stubSimpleCall(expectedResponse); - const [response] = await client.destroySecretVersion(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.destroySecretVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes destroySecretVersion without error using callback', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DestroySecretVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()); - client.innerApiCalls.destroySecretVersion = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.destroySecretVersion( - request, - (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecretVersion|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.destroySecretVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes destroySecretVersion with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DestroySecretVersionRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.destroySecretVersion = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.destroySecretVersion(request), expectedError); - assert((client.innerApiCalls.destroySecretVersion as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes destroySecretVersion with closed client', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.DestroySecretVersionRequest()); - request.name = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.destroySecretVersion(request), expectedError); - }); - }); - - describe('setIamPolicy', () => { - it('invokes setIamPolicy without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.setIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.setIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes setIamPolicy without error using callback', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.setIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.setIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes setIamPolicy with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.setIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.setIamPolicy(request), expectedError); - assert((client.innerApiCalls.setIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes setIamPolicy with closed client', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.SetIamPolicyRequest()); - request.resource = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.setIamPolicy(request), expectedError); - }); - }); - - describe('getIamPolicy', () => { - it('invokes getIamPolicy without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.getIamPolicy = stubSimpleCall(expectedResponse); - const [response] = await client.getIamPolicy(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getIamPolicy without error using callback', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.Policy()); - client.innerApiCalls.getIamPolicy = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIamPolicy( - request, - (err?: Error|null, result?: protos.google.iam.v1.IPolicy|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getIamPolicy with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getIamPolicy = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIamPolicy(request), expectedError); - assert((client.innerApiCalls.getIamPolicy as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getIamPolicy with closed client', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.GetIamPolicyRequest()); - request.resource = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.getIamPolicy(request), expectedError); - }); - }); - - describe('testIamPermissions', () => { - it('invokes testIamPermissions without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); - client.innerApiCalls.testIamPermissions = stubSimpleCall(expectedResponse); - const [response] = await client.testIamPermissions(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes testIamPermissions without error using callback', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsResponse()); - client.innerApiCalls.testIamPermissions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.testIamPermissions( - request, - (err?: Error|null, result?: protos.google.iam.v1.ITestIamPermissionsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes testIamPermissions with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedHeaderRequestParams = "resource="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.testIamPermissions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.testIamPermissions(request), expectedError); - assert((client.innerApiCalls.testIamPermissions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes testIamPermissions with closed client', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.iam.v1.TestIamPermissionsRequest()); - request.resource = ''; - const expectedError = new Error('The client has already been closed.'); - client.close(); - await assert.rejects(client.testIamPermissions(request), expectedError); - }); - }); - - describe('listSecrets', () => { - it('invokes listSecrets without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), - generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), - generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), - ]; - client.innerApiCalls.listSecrets = stubSimpleCall(expectedResponse); - const [response] = await client.listSecrets(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSecrets as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSecrets without error using callback', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), - generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), - generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), - ]; - client.innerApiCalls.listSecrets = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSecrets( - request, - (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecret[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSecrets as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listSecrets with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listSecrets = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSecrets(request), expectedError); - assert((client.innerApiCalls.listSecrets as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSecretsStream without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), - generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), - generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), - ]; - client.descriptors.page.listSecrets.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSecretsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.secretmanager.v1.Secret[] = []; - stream.on('data', (response: protos.google.cloud.secretmanager.v1.Secret) => { - 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.listSecrets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSecrets, request)); - assert.strictEqual( - (client.descriptors.page.listSecrets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listSecretsStream with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listSecrets.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSecretsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.secretmanager.v1.Secret[] = []; - stream.on('data', (response: protos.google.cloud.secretmanager.v1.Secret) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSecrets.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSecrets, request)); - assert.strictEqual( - (client.descriptors.page.listSecrets.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSecrets without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), - generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), - generateSampleMessage(new protos.google.cloud.secretmanager.v1.Secret()), - ]; - client.descriptors.page.listSecrets.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.secretmanager.v1.ISecret[] = []; - const iterable = client.listSecretsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSecrets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSecrets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSecrets with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listSecrets.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSecretsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.secretmanager.v1.ISecret[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSecrets.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSecrets.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listSecretVersions', () => { - it('invokes listSecretVersions without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), - generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), - generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), - ]; - client.innerApiCalls.listSecretVersions = stubSimpleCall(expectedResponse); - const [response] = await client.listSecretVersions(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSecretVersions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSecretVersions without error using callback', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), - generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), - generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), - ]; - client.innerApiCalls.listSecretVersions = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listSecretVersions( - request, - (err?: Error|null, result?: protos.google.cloud.secretmanager.v1.ISecretVersion[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listSecretVersions as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listSecretVersions with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listSecretVersions = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listSecretVersions(request), expectedError); - assert((client.innerApiCalls.listSecretVersions as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listSecretVersionsStream without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), - generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), - generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), - ]; - client.descriptors.page.listSecretVersions.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listSecretVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.secretmanager.v1.SecretVersion[] = []; - stream.on('data', (response: protos.google.cloud.secretmanager.v1.SecretVersion) => { - 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.listSecretVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSecretVersions, request)); - assert.strictEqual( - (client.descriptors.page.listSecretVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listSecretVersionsStream with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listSecretVersions.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listSecretVersionsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.secretmanager.v1.SecretVersion[] = []; - stream.on('data', (response: protos.google.cloud.secretmanager.v1.SecretVersion) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listSecretVersions.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listSecretVersions, request)); - assert.strictEqual( - (client.descriptors.page.listSecretVersions.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSecretVersions without error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), - generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), - generateSampleMessage(new protos.google.cloud.secretmanager.v1.SecretVersion()), - ]; - client.descriptors.page.listSecretVersions.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.secretmanager.v1.ISecretVersion[] = []; - const iterable = client.listSecretVersionsAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listSecretVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSecretVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listSecretVersions with error', async () => { - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.secretmanager.v1.ListSecretVersionsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listSecretVersions.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listSecretVersionsAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.secretmanager.v1.ISecretVersion[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listSecretVersions.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listSecretVersions.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('project', () => { - const fakePath = "/rendered/path/project"; - const expectedParameters = { - project: "projectValue", - }; - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.projectPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.projectPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('projectPath', () => { - const result = client.projectPath("projectValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.projectPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromProjectName', () => { - const result = client.matchProjectFromProjectName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.projectPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('secret', () => { - const fakePath = "/rendered/path/secret"; - const expectedParameters = { - project: "projectValue", - secret: "secretValue", - }; - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.secretPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.secretPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('secretPath', () => { - const result = client.secretPath("projectValue", "secretValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.secretPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSecretName', () => { - const result = client.matchProjectFromSecretName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.secretPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecretFromSecretName', () => { - const result = client.matchSecretFromSecretName(fakePath); - assert.strictEqual(result, "secretValue"); - assert((client.pathTemplates.secretPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('secretVersion', () => { - const fakePath = "/rendered/path/secretVersion"; - const expectedParameters = { - project: "projectValue", - secret: "secretValue", - secret_version: "secretVersionValue", - }; - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.secretVersionPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.secretVersionPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('secretVersionPath', () => { - const result = client.secretVersionPath("projectValue", "secretValue", "secretVersionValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.secretVersionPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSecretVersionName', () => { - const result = client.matchProjectFromSecretVersionName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecretFromSecretVersionName', () => { - const result = client.matchSecretFromSecretVersionName(fakePath); - assert.strictEqual(result, "secretValue"); - assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchSecretVersionFromSecretVersionName', () => { - const result = client.matchSecretVersionFromSecretVersionName(fakePath); - assert.strictEqual(result, "secretVersionValue"); - assert((client.pathTemplates.secretVersionPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('topic', () => { - const fakePath = "/rendered/path/topic"; - const expectedParameters = { - project: "projectValue", - topic: "topicValue", - }; - const client = new secretmanagerserviceModule.v1.SecretManagerServiceClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.topicPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.topicPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('topicPath', () => { - const result = client.topicPath("projectValue", "topicValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.topicPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromTopicName', () => { - const result = client.matchProjectFromTopicName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.topicPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchTopicFromTopicName', () => { - const result = client.matchTopicFromTopicName(fakePath); - assert.strictEqual(result, "topicValue"); - assert((client.pathTemplates.topicPathTemplate.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 84c2bf0..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: 'SecretManagerService', - filename: './secret-manager-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/index.ts b/src/index.ts index 00d9fc6..2020565 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,12 +17,11 @@ // ** All changes to this file may be overwritten. ** import * as v1 from './v1'; -import * as v1beta1 from './v1beta1'; const SecretManagerServiceClient = v1.SecretManagerServiceClient; type SecretManagerServiceClient = v1.SecretManagerServiceClient; -export {v1, v1beta1, SecretManagerServiceClient}; -export default {v1, v1beta1, SecretManagerServiceClient}; +export {v1, SecretManagerServiceClient}; +export default {v1, SecretManagerServiceClient}; import * as protos from '../protos/protos'; export {protos}; diff --git a/src/v1/secret_manager_service_client.ts b/src/v1/secret_manager_service_client.ts index f39ef9d..5561624 100644 --- a/src/v1/secret_manager_service_client.ts +++ b/src/v1/secret_manager_service_client.ts @@ -76,7 +76,7 @@ export class SecretManagerServiceClient { * * @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] @@ -99,11 +99,10 @@ export class SecretManagerServiceClient { * 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. From f17b375ec27aad0835894e927e2899a642a7fa4b Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 24 Jun 2022 10:07:08 +0000 Subject: [PATCH 3/3] =?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 --- src/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index 2020565..00d9fc6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,11 +17,12 @@ // ** All changes to this file may be overwritten. ** import * as v1 from './v1'; +import * as v1beta1 from './v1beta1'; const SecretManagerServiceClient = v1.SecretManagerServiceClient; type SecretManagerServiceClient = v1.SecretManagerServiceClient; -export {v1, SecretManagerServiceClient}; -export default {v1, SecretManagerServiceClient}; +export {v1, v1beta1, SecretManagerServiceClient}; +export default {v1, v1beta1, SecretManagerServiceClient}; import * as protos from '../protos/protos'; export {protos};