From 7996c5fa50bc77c49c20794192bfc0e2c8cc7741 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Fri, 18 Feb 2022 00:56:52 +0000 Subject: [PATCH] docs(samples): include metadata file, add exclusions for samples to handwritten libraries (#339) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 429395631 Source-Link: https://github.com/googleapis/googleapis/commit/84594b35af0c38efcd6967e8179d801702ad96ff Source-Link: https://github.com/googleapis/googleapis-gen/commit/ed74f970fd82914874e6b27b04763cfa66bafe9b Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZWQ3NGY5NzBmZDgyOTE0ODc0ZTZiMjdiMDQ3NjNjZmE2NmJhZmU5YiJ9 --- ...t_manager_service.access_secret_version.js | 9 +- ...cret_manager_service.add_secret_version.js | 9 +- .../secret_manager_service.create_secret.js | 9 +- .../secret_manager_service.delete_secret.js | 9 +- ..._manager_service.destroy_secret_version.js | 9 +- ..._manager_service.disable_secret_version.js | 9 +- ...t_manager_service.enable_secret_version.js | 9 +- .../secret_manager_service.get_iam_policy.js | 9 +- .../v1/secret_manager_service.get_secret.js | 9 +- ...cret_manager_service.get_secret_version.js | 9 +- ...et_manager_service.list_secret_versions.js | 9 +- .../v1/secret_manager_service.list_secrets.js | 9 +- .../secret_manager_service.set_iam_policy.js | 9 +- ...et_manager_service.test_iam_permissions.js | 9 +- .../secret_manager_service.update_secret.js | 9 +- ...etadata.google.cloud.secretmanager.v1.json | 683 ++++++++++++++++++ .../src/v1/secret_manager_service_client.ts | 5 +- .../test/gapic_secret_manager_service_v1.ts | 243 ++++++- 18 files changed, 1031 insertions(+), 35 deletions(-) create mode 100644 packages/google-cloud-secretmanager/samples/generated/v1/snippet_metadata.google.cloud.secretmanager.v1.json diff --git a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.access_secret_version.js b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.access_secret_version.js index c4bca7381c1..5c7243bdede 100644 --- a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.access_secret_version.js +++ b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.access_secret_version.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.add_secret_version.js b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.add_secret_version.js index 1058238425e..84b15ff2a2d 100644 --- a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.add_secret_version.js +++ b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.add_secret_version.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.create_secret.js b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.create_secret.js index e9e26c5c119..4dd3345ab20 100644 --- a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.create_secret.js +++ b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.create_secret.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.delete_secret.js b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.delete_secret.js index 6ee46ed4bad..70e2e765a49 100644 --- a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.delete_secret.js +++ b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.delete_secret.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.destroy_secret_version.js b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.destroy_secret_version.js index 9c4e1db1de3..efbd6b54f65 100644 --- a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.destroy_secret_version.js +++ b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.destroy_secret_version.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.disable_secret_version.js b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.disable_secret_version.js index 40ea6199173..ad8b2f39c43 100644 --- a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.disable_secret_version.js +++ b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.disable_secret_version.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.enable_secret_version.js b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.enable_secret_version.js index f6a08b00970..59c3a56aced 100644 --- a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.enable_secret_version.js +++ b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.enable_secret_version.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.get_iam_policy.js b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.get_iam_policy.js index 681645ae475..3f6b21a9a3d 100644 --- a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.get_iam_policy.js +++ b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.get_iam_policy.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.get_secret.js b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.get_secret.js index d1e2a5069f5..cbc23d43881 100644 --- a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.get_secret.js +++ b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.get_secret.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.get_secret_version.js b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.get_secret_version.js index 9c90362b916..3832fe6e3d1 100644 --- a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.get_secret_version.js +++ b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.get_secret_version.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.list_secret_versions.js b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.list_secret_versions.js index 24e3b45d575..b8ebf33961f 100644 --- a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.list_secret_versions.js +++ b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.list_secret_versions.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.list_secrets.js b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.list_secrets.js index 8ed0fb476e9..d7f002ba7d7 100644 --- a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.list_secrets.js +++ b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.list_secrets.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.set_iam_policy.js b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.set_iam_policy.js index 236c353fc1a..c0e7c681da6 100644 --- a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.set_iam_policy.js +++ b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.set_iam_policy.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.test_iam_permissions.js b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.test_iam_permissions.js index 2c394401885..a4a32071fdd 100644 --- a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.test_iam_permissions.js +++ b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.test_iam_permissions.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.update_secret.js b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.update_secret.js index 89f016df193..96a6fd00a0d 100644 --- a/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.update_secret.js +++ b/packages/google-cloud-secretmanager/samples/generated/v1/secret_manager_service.update_secret.js @@ -1,16 +1,21 @@ -// Copyright 2021 Google LLC +// Copyright 2022 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // -// http://www.apache.org/licenses/LICENSE-2.0 +// https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + 'use strict'; diff --git a/packages/google-cloud-secretmanager/samples/generated/v1/snippet_metadata.google.cloud.secretmanager.v1.json b/packages/google-cloud-secretmanager/samples/generated/v1/snippet_metadata.google.cloud.secretmanager.v1.json new file mode 100644 index 00000000000..c892e9950eb --- /dev/null +++ b/packages/google-cloud-secretmanager/samples/generated/v1/snippet_metadata.google.cloud.secretmanager.v1.json @@ -0,0 +1,683 @@ +{ + "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": 59, + "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" + } + ], + "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/packages/google-cloud-secretmanager/src/v1/secret_manager_service_client.ts b/packages/google-cloud-secretmanager/src/v1/secret_manager_service_client.ts index 86bc24dbc0b..8f25624b77e 100644 --- a/packages/google-cloud-secretmanager/src/v1/secret_manager_service_client.ts +++ b/packages/google-cloud-secretmanager/src/v1/secret_manager_service_client.ts @@ -2212,9 +2212,8 @@ export class SecretManagerServiceClient { * @returns {Promise} A promise that resolves when the client is closed. */ close(): Promise { - this.initialize(); - if (!this._terminated) { - return this.secretManagerServiceStub!.then(stub => { + if (this.secretManagerServiceStub && !this._terminated) { + return this.secretManagerServiceStub.then(stub => { this._terminated = true; stub.close(); }); diff --git a/packages/google-cloud-secretmanager/test/gapic_secret_manager_service_v1.ts b/packages/google-cloud-secretmanager/test/gapic_secret_manager_service_v1.ts index 2a70d20f200..bd3ac1d203d 100644 --- a/packages/google-cloud-secretmanager/test/gapic_secret_manager_service_v1.ts +++ b/packages/google-cloud-secretmanager/test/gapic_secret_manager_service_v1.ts @@ -158,14 +158,31 @@ describe('v1.SecretManagerServiceClient', () => { assert(client.secretManagerServiceStub); }); - it('has close method', () => { + 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.close(); + 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 () => { @@ -318,6 +335,23 @@ describe('v1.SecretManagerServiceClient', () => { .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 expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.createSecret(request), expectedError); + }); }); describe('addSecretVersion', () => { @@ -432,6 +466,23 @@ describe('v1.SecretManagerServiceClient', () => { .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 expectedHeaderRequestParams = 'parent='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.addSecretVersion(request), expectedError); + }); }); describe('getSecret', () => { @@ -543,6 +594,23 @@ describe('v1.SecretManagerServiceClient', () => { .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 expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSecret(request), expectedError); + }); }); describe('updateSecret', () => { @@ -660,6 +728,24 @@ describe('v1.SecretManagerServiceClient', () => { .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 expectedHeaderRequestParams = 'secret.name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.updateSecret(request), expectedError); + }); }); describe('deleteSecret', () => { @@ -774,6 +860,23 @@ describe('v1.SecretManagerServiceClient', () => { .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 expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.deleteSecret(request), expectedError); + }); }); describe('getSecretVersion', () => { @@ -888,6 +991,23 @@ describe('v1.SecretManagerServiceClient', () => { .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 expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getSecretVersion(request), expectedError); + }); }); describe('accessSecretVersion', () => { @@ -1003,6 +1123,23 @@ describe('v1.SecretManagerServiceClient', () => { .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 expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.accessSecretVersion(request), expectedError); + }); }); describe('disableSecretVersion', () => { @@ -1118,6 +1255,23 @@ describe('v1.SecretManagerServiceClient', () => { .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 expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.disableSecretVersion(request), expectedError); + }); }); describe('enableSecretVersion', () => { @@ -1233,6 +1387,23 @@ describe('v1.SecretManagerServiceClient', () => { .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 expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.enableSecretVersion(request), expectedError); + }); }); describe('destroySecretVersion', () => { @@ -1348,6 +1519,23 @@ describe('v1.SecretManagerServiceClient', () => { .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 expectedHeaderRequestParams = 'name='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.destroySecretVersion(request), expectedError); + }); }); describe('setIamPolicy', () => { @@ -1462,6 +1650,23 @@ describe('v1.SecretManagerServiceClient', () => { .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 expectedHeaderRequestParams = 'resource='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.setIamPolicy(request), expectedError); + }); }); describe('getIamPolicy', () => { @@ -1576,6 +1781,23 @@ describe('v1.SecretManagerServiceClient', () => { .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 expectedHeaderRequestParams = 'resource='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.getIamPolicy(request), expectedError); + }); }); describe('testIamPermissions', () => { @@ -1691,6 +1913,23 @@ describe('v1.SecretManagerServiceClient', () => { .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 expectedHeaderRequestParams = 'resource='; + const expectedError = new Error('The client has already been closed.'); + client.close(); + await assert.rejects(client.testIamPermissions(request), expectedError); + }); }); describe('listSecrets', () => {