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

Function main

secret-manager/viewSecretAnnotations.js:17–42  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

15'use strict';
16
17async function main(name) {
18 // [START secretmanager_view_secret_annotations]
19 /**
20 * TODO(developer): Uncomment these variables before running the sample.
21 */
22 // const parent = '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 viewSecretAnnotations() {
31 const [secret] = await client.getSecret({
32 name: name,
33 });
34
35 for (const key in secret.annotations) {
36 console.log(`${key} : ${secret.annotations[key]}`);
37 }
38 }
39
40 viewSecretAnnotations();
41 // [END secretmanager_view_secret_annotations]
42}
43
44const args = process.argv.slice(2);
45main(...args).catch(console.error);

Callers 1

Calls 1

viewSecretAnnotationsFunction · 0.85

Tested by

no test coverage detected