* Deletes a parameter from the global location of the specified project using the Google Cloud Parameter Manager SDK. * * @param {string} projectId - The Google Cloud project ID where the parameter is located. * @param {string} parameterId - The ID of the parameter to delete.
(projectId, parameterId)
| 21 | * @param {string} parameterId - The ID of the parameter to delete. |
| 22 | */ |
| 23 | async function main(projectId, parameterId) { |
| 24 | // [START parametermanager_delete_param] |
| 25 | /** |
| 26 | * TODO(developer): Uncomment these variables before running the sample. |
| 27 | */ |
| 28 | // const projectId = 'my-project'; |
| 29 | // const parameterId = 'my-parameter'; |
| 30 | |
| 31 | // Imports the Parameter Manager library |
| 32 | const {ParameterManagerClient} = require('@google-cloud/parametermanager'); |
| 33 | |
| 34 | // Instantiates a client |
| 35 | const client = new ParameterManagerClient(); |
| 36 | |
| 37 | async function deleteParam() { |
| 38 | // Construct the fully qualified parameter name |
| 39 | const name = client.parameterPath(projectId, 'global', parameterId); |
| 40 | |
| 41 | // Delete the parameter |
| 42 | await client.deleteParameter({ |
| 43 | name: name, |
| 44 | }); |
| 45 | |
| 46 | console.log(`Deleted parameter: ${name}`); |
| 47 | return name; |
| 48 | } |
| 49 | |
| 50 | return await deleteParam(); |
| 51 | // [END parametermanager_delete_param] |
| 52 | } |
| 53 | module.exports.main = main; |
| 54 | |
| 55 | /* c8 ignore next 10 */ |
no test coverage detected