MCPcopy Create free account
hub / github.com/GoogleCloudPlatform/nodejs-docs-samples / main

Function main

security-center/snippets/v1/updateSource.js:21–48  ·  view source on GitHub ↗

* updateSource demonstrates how to update fields on a security findings * source.

(sourceName = 'FULL_PATH_TO_SOURCE')

Source from the content-addressed store, hash-verified

19 * source.
20 */
21function 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
50main(...process.argv.slice(2));

Callers 1

updateSource.jsFile · 0.70

Calls 1

updateSourceFunction · 0.70

Tested by

no test coverage detected