* createSource demonstrates how to create a new security finding source.
(organizationId = 'YOUR_NUMERIC_ORG_ID')
| 18 | * createSource demonstrates how to create a new security finding source. |
| 19 | */ |
| 20 | function 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 | |
| 46 | main(...process.argv.slice(2)); |
no test coverage detected