| 19 | // description: Deletes a specified Note |
| 20 | // usage: node deleteNote.js "project-id" "note-id" |
| 21 | async function main( |
| 22 | projectId = 'your-project-id', // Your GCP Project Id |
| 23 | noteId = 'my-note-id' // Id of the note |
| 24 | ) { |
| 25 | // [START containeranalysis_delete_note] |
| 26 | /** |
| 27 | * TODO(developer): Uncomment these variables before running the sample |
| 28 | */ |
| 29 | // const projectId = 'your-project-id', // Your GCP Project Id |
| 30 | // const noteId = 'my-note-id' // Id of the note |
| 31 | |
| 32 | // Import the library and create a client |
| 33 | const {ContainerAnalysisClient} = require('@google-cloud/containeranalysis'); |
| 34 | const client = new ContainerAnalysisClient(); |
| 35 | |
| 36 | // Get the full path to the note |
| 37 | const formattedName = client.notePath(projectId, noteId); |
| 38 | |
| 39 | // Delete the note |
| 40 | await client.getGrafeasClient().deleteNote({name: formattedName}); |
| 41 | console.log(`Note ${formattedName} deleted.`); |
| 42 | // [END containeranalysis_delete_note] |
| 43 | } |
| 44 | |
| 45 | main(...process.argv.slice(2)); |