(parent = 'projects/my-project')
| 15 | 'use strict'; |
| 16 | |
| 17 | async function main(parent = 'projects/my-project') { |
| 18 | // [START secretmanager_list_secrets] |
| 19 | /** |
| 20 | * TODO(developer): Uncomment these variables before running the sample. |
| 21 | */ |
| 22 | // const parent = 'projects/my-project'; |
| 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 listSecrets() { |
| 31 | const [secrets] = await client.listSecrets({ |
| 32 | parent: parent, |
| 33 | }); |
| 34 | |
| 35 | secrets.forEach(secret => { |
| 36 | const policy = secret.replication.userManaged |
| 37 | ? secret.replication.userManaged |
| 38 | : secret.replication.automatic; |
| 39 | console.log(`${secret.name} (${policy})`); |
| 40 | }); |
| 41 | } |
| 42 | |
| 43 | listSecrets(); |
| 44 | // [END secretmanager_list_secrets] |
| 45 | } |
| 46 | |
| 47 | const args = process.argv.slice(2); |
| 48 | main(...args).catch(console.error); |
no test coverage detected