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

Function main

security-center/snippets/v1/createSource.js:20–44  ·  view source on GitHub ↗

* createSource demonstrates how to create a new security finding source.

(organizationId = 'YOUR_NUMERIC_ORG_ID')

Source from the content-addressed store, hash-verified

18 * createSource demonstrates how to create a new security finding source.
19 */
20function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
21 // [START securitycenter_create_source]
22 // Imports the Google Cloud client library.
23 const {SecurityCenterClient} = require('@google-cloud/security-center');
24
25 // Creates a new client.
26 const client = new SecurityCenterClient();
27 // organizationId is numeric organization identifier.
28 /*
29 * TODO(developer): Uncomment the following lines
30 */
31 // const organizationId = "1234567777";
32 async function createSource() {
33 const [source] = await client.createSource({
34 source: {
35 displayName: 'Customized Display Name',
36 description: 'A new custom source that does X',
37 },
38 parent: client.organizationPath(organizationId),
39 });
40 console.log('New Source: %j', source);
41 }
42 createSource();
43 // [END securitycenter_create_source]
44}
45
46main(...process.argv.slice(2));

Callers 1

createSource.jsFile · 0.70

Calls 1

createSourceFunction · 0.70

Tested by

no test coverage detected