(name = 'projects/my-project/secrets/my-secret')
| 15 | 'use strict'; |
| 16 | |
| 17 | async function main(name = 'projects/my-project/secrets/my-secret') { |
| 18 | // [START secretmanager_update_secret_with_alias] |
| 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 | versionAliases: { |
| 35 | test: 1, |
| 36 | }, |
| 37 | }, |
| 38 | updateMask: { |
| 39 | paths: ['version_aliases'], |
| 40 | }, |
| 41 | }); |
| 42 | |
| 43 | console.info(`Updated secret ${secret.name}`); |
| 44 | } |
| 45 | |
| 46 | updateSecret(); |
| 47 | // [END secretmanager_update_secret_with_alias] |
| 48 | } |
| 49 | |
| 50 | const args = process.argv.slice(2); |
| 51 | main(...args).catch(console.error); |
no test coverage detected