* updateSource demonstrates how to update fields on a security findings * source.
(sourceName = 'FULL_PATH_TO_SOURCE')
| 19 | * source. |
| 20 | */ |
| 21 | function main(sourceName = 'FULL_PATH_TO_SOURCE') { |
| 22 | // [START securitycenter_update_source] |
| 23 | // Imports the Google Cloud client library. |
| 24 | const {SecurityCenterClient} = require('@google-cloud/security-center'); |
| 25 | |
| 26 | // Creates a new client. |
| 27 | const client = new SecurityCenterClient(); |
| 28 | // sourceName is the full resource path to the update target. |
| 29 | /* |
| 30 | * TODO(developer): Uncomment the following lines |
| 31 | */ |
| 32 | // const sourceName = "organizations/111122222444/sources/1234"; |
| 33 | async function updateSource() { |
| 34 | const [source] = await client.updateSource({ |
| 35 | source: { |
| 36 | name: sourceName, |
| 37 | displayName: 'New Display Name', |
| 38 | }, |
| 39 | // Only update the display name field (if not set all mutable |
| 40 | // fields of the source will be updated. |
| 41 | updateMask: {paths: ['display_name']}, |
| 42 | }); |
| 43 | console.log('Updated source: %j', source); |
| 44 | } |
| 45 | |
| 46 | updateSource(); |
| 47 | // [END securitycenter_update_source] |
| 48 | } |
| 49 | |
| 50 | main(...process.argv.slice(2)); |
no test coverage detected