* Deletes a specific version of an existing parameter in 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 paramete
(projectId, parameterId, versionId)
| 23 | * @param {string} versionId - The version ID of the parameter to delete. |
| 24 | */ |
| 25 | async function main(projectId, parameterId, versionId) { |
| 26 | // [START parametermanager_delete_param_version] |
| 27 | /** |
| 28 | * TODO(developer): Uncomment these variables before running the sample. |
| 29 | */ |
| 30 | // const projectId = 'my-project'; |
| 31 | // const parameterId = 'my-parameter'; |
| 32 | // const versionId = 'v1'; |
| 33 | |
| 34 | // Imports the Parameter Manager library |
| 35 | const {ParameterManagerClient} = require('@google-cloud/parametermanager'); |
| 36 | |
| 37 | // Instantiates a client |
| 38 | const client = new ParameterManagerClient(); |
| 39 | |
| 40 | async function deleteParamVersion() { |
| 41 | // Construct the fully qualified parameter version name |
| 42 | const name = client.parameterVersionPath( |
| 43 | projectId, |
| 44 | 'global', |
| 45 | parameterId, |
| 46 | versionId |
| 47 | ); |
| 48 | |
| 49 | // Delete the parameter version |
| 50 | await client.deleteParameterVersion({ |
| 51 | name: name, |
| 52 | }); |
| 53 | console.log(`Deleted parameter version: ${name}`); |
| 54 | return name; |
| 55 | } |
| 56 | |
| 57 | return await deleteParamVersion(); |
| 58 | // [END parametermanager_delete_param_version] |
| 59 | } |
| 60 | module.exports.main = main; |
| 61 | |
| 62 | /* c8 ignore next 10 */ |
no test coverage detected