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

Function main

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

Source from the content-addressed store, hash-verified

15'use strict';
16
17async function main(name = 'projects/my-project/secrets/my-secret') {
18 // [START secretmanager_update_secret]
19 /**
20 * TODO(developer): Uncomment these variables before running the sample.
21 */
22 // const name = 'projects/my-project/secrets/my-secret';
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 updateSecret() {
31 const [secret] = await client.updateSecret({
32 secret: {
33 name: name,
34 labels: {
35 secretmanager: 'rocks',
36 },
37 },
38 updateMask: {
39 paths: ['labels'],
40 },
41 });
42
43 console.info(`Updated secret ${secret.name}`);
44 }
45
46 updateSecret();
47 // [END secretmanager_update_secret]
48}
49
50const args = process.argv.slice(2);
51main(...args).catch(console.error);

Callers 1

updateSecret.jsFile · 0.70

Calls 1

updateSecretFunction · 0.70

Tested by

no test coverage detected