MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / main

Function main

secret-manager/destroySecretVersion.js:17–40  ·  view source on GitHub ↗
(name = 'projects/my-project/secrets/my-secret/versions/1')

Source from the content-addressed store, hash-verified

15'use strict';
16
17async function main(name = 'projects/my-project/secrets/my-secret/versions/1') {
18 // [START secretmanager_destroy_secret_version]
19 /**
20 * TODO(developer): Uncomment these variables before running the sample.
21 */
22 // const name = 'projects/my-project/secrets/my-secret/versions/5';
23
24 // Imports the Secret Manager library
25 const {SecretManagerServiceClient} = require('@google-cloud/secret-manager');
26
27 // Instantiates a client
28 const client = new SecretManagerServiceClient();
29
30 async function destroySecretVersion() {
31 const [version] = await client.destroySecretVersion({
32 name: name,
33 });
34
35 console.info(`Destroyed ${version.name}`);
36 }
37
38 destroySecretVersion();
39 // [END secretmanager_destroy_secret_version]
40}
41
42const args = process.argv.slice(2);
43main(...args).catch(console.error);

Callers 1

Calls 1

destroySecretVersionFunction · 0.70

Tested by

no test coverage detected