Skip to content

Commit

Permalink
docs: wrap samples with future prefix (#348)
Browse files Browse the repository at this point in the history
  • Loading branch information
Strykrol authored Jan 27, 2021
1 parent 5377da3 commit 07e2920
Show file tree
Hide file tree
Showing 32 changed files with 64 additions and 0 deletions.
2 changes: 2 additions & 0 deletions security-center/snippets/v1/addDeleteSecurityMarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* marks from an asset.
*/
function main(assetName = 'full asset path to add marks to') {
// [START securitycenter_add_delete_security_marks]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand All @@ -44,6 +45,7 @@ function main(assetName = 'full asset path to add marks to') {
}
addDeleteSecurityMarks();
// [END demo]
// [END securitycenter_add_delete_security_marks]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/addFindingSecurityMarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Demostrates adding security marks to a finding.
*/
function main(findingName = 'full finding path to add marks to') {
// [START securitycenter_add_finding_security_marks]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand Down Expand Up @@ -44,6 +45,7 @@ function main(findingName = 'full finding path to add marks to') {
}
addFindingSecurityMarks();
// [END demo]
// [END securitycenter_add_finding_security_marks]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/addSecurityMarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Demostrates adding security marks to an asset.
*/
function main(assetName = 'full asset path to add marks to') {
// [START securitycenter_add_security_marks]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand All @@ -44,6 +45,7 @@ function main(assetName = 'full asset path to add marks to') {
}
addSecurityMarks();
// [END demo]
// [END securitycenter_add_security_marks]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/createFinding.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Demonstrates how to create a new security finding in CSCC.
*/
function main(sourceName = 'FULL_PATH_TO_SOURCE_FOR_FINDING') {
// [START securitycenter_create_finding]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand Down Expand Up @@ -56,6 +57,7 @@ function main(sourceName = 'FULL_PATH_TO_SOURCE_FOR_FINDING') {
}
createFinding();
// [END demo]
// [END securitycenter_create_finding]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/createFindingSourceProperties.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* properties.
*/
function main(sourceName = 'FULL_PATH_TO_SOURCE_FOR_FINDING') {
// [START securitycenter_create_finding_source_properties]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand Down Expand Up @@ -61,6 +62,7 @@ function main(sourceName = 'FULL_PATH_TO_SOURCE_FOR_FINDING') {
}
createFinding();
// [END demo]
// [END securitycenter_create_finding_source_properties]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/createNotificationConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function main(
configId = 'your-config-name',
pubsubTopic = 'projects/{your-project}/topics/{your-topic}'
) {
// [START securitycenter_create_notification_config]
// [START scc_create_notification_config]
// npm install @google-cloud/security-center/
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand Down Expand Up @@ -46,6 +47,7 @@ function main(

createNotificationConfig();
// [END scc_create_notification_config]
// [END securitycenter_create_notification_config]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/createSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* createSource demonstrates how to create a new security finding source.
*/
function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
// [START securitycenter_create_source]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand All @@ -41,6 +42,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
}
createSource();
// [END demo]
// [END securitycenter_create_source]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/deleteNotificationConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'use strict';

function main(organizationId = 'your-org-id', configId = 'your-config-id') {
// [START securitycenter_delete_notification_config]
// [START scc_delete_notification_config]
// npm install @google-cloud/security-center/
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand All @@ -34,6 +35,7 @@ function main(organizationId = 'your-org-id', configId = 'your-config-id') {

deleteNotificationConfg();
// [END scc_delete_notification_config]
// [END securitycenter_delete_notification_config]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/deleteSecurityMarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Demostrates deleting security marks on an asset.
*/
function main(assetName = 'full asset path to add marks to') {
// [START securitycenter_delete_security_marks]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand All @@ -44,6 +45,7 @@ function main(assetName = 'full asset path to add marks to') {
}
deleteSecurityMarks();
// [END demo]
// [END securitycenter_delete_security_marks]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/enableAssetDiscovery.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Demostrates enabling asset discovery for an organization.
*/
function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
// [START securitycenter_enable_asset_discovery]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand Down Expand Up @@ -45,6 +46,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
}
updateOrgSettings();
// [END demo]
// [END securitycenter_enable_asset_discovery]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/getNotificationConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'use strict';

function main(organizationId = 'your-org-id', configId = 'your-config-id') {
// [START securitycenter_get_notification_configs]
// [START scc_get_notification_configs]
// npm install @google-cloud/security-center/
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand All @@ -36,6 +37,7 @@ function main(organizationId = 'your-org-id', configId = 'your-config-id') {

getNotificationConfg();
// [END scc_get_notification_configs]
// [END securitycenter_get_notification_configs]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/getOrganizationSettings.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* includes the current status of asset recovery.
*/
function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
// [START securitycenter_get_organization_settings]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand All @@ -41,6 +42,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
}
getOrgSettings();
// [END demo]
// [END securitycenter_get_organization_settings]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/getSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* source.
*/
function main(sourceName = 'FULL_PATH_TO_SOURCE') {
// [START securitycenter_get_source]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand All @@ -37,6 +38,7 @@ function main(sourceName = 'FULL_PATH_TO_SOURCE') {

getSource();
// [END demo]
// [END securitycenter_get_source]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/getSourceIam.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Demostrates retrieving the current IAM policy for a source.
*/
function main(sourceName = 'FULL_PATH_TO_SOURCE') {
// [START securitycenter_get_source_iam]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand All @@ -40,6 +41,7 @@ function main(sourceName = 'FULL_PATH_TO_SOURCE') {
}
getSourceIamPolicy();
// [END demo]
// [END securitycenter_get_source_iam]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/listAllAssets.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

/** Prints all assets in an organization. */
function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
// [START securitycenter_list_all_assets]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand Down Expand Up @@ -43,6 +44,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {

listAssets();
// [END demo]
// [END securitycenter_list_all_assets]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/listAllFindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

/** Prints all findings across all sources. */
function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
// [START securitycenter_list_all_findings]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand All @@ -42,6 +43,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
}
listAllFindings();
// [END demo]
// [END securitycenter_list_all_findings]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/listAllSources.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

/** Prints all sources in an organization. */
function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
// [START securitycenter_list_all_sources]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand All @@ -40,6 +41,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {

listSources();
// [END demo]
// [END securitycenter_list_all_sources]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/listAssetsAndChanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
* days ago.
*/
function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
// [START securitycenter_list_assets_and_changes]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand Down Expand Up @@ -51,6 +52,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {

listAssetsAndChanges();
// [END demo]
// [END securitycenter_list_assets_and_changes]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/listAssetsAtTime.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Prints project assets for the organization as of yesterday.
*/
function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
// [START securitycenter_list_assets_at_time]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand Down Expand Up @@ -59,6 +60,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {

listAssetsAtTime();
// [END demo]
// [END securitycenter_list_assets_at_time]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/listAssetsWithSecurityMarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Prints assets with security mark of key_a == value_a.
*/
function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
// [START securitycenter_list_assets_with_security_marks]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand Down Expand Up @@ -49,6 +50,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {

listAssetsWithSecurityMarks();
// [END demo]
// [END securitycenter_list_assets_with_security_marks]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/listFilteredAssets.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* Prints current project assets for the organization.
*/
function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {
// [START securitycenter_list_filtered_assets]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand Down Expand Up @@ -50,6 +51,7 @@ function main(organizationId = 'YOUR_NUMERIC_ORG_ID') {

listFilteredAssets();
// [END demo]
// [END securitycenter_list_filtered_assets]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/listFilteredFindings.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

/** Demonstrates listing only specific findings. */
function main(sourceName = 'YOUR_NUMERIC_ORG_ID') {
// [START securitycenter_list_filtered_findings]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand Down Expand Up @@ -44,6 +45,7 @@ function main(sourceName = 'YOUR_NUMERIC_ORG_ID') {
}
listFilteredFindings();
// [END demo]
// [END securitycenter_list_filtered_findings]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/listFindingsAtTime.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

/** Demonstrates listing findings at a point in time. */
function main(sourceName = 'FULL RESOURCE PATH TO PARENT SOURCE') {
// [START securitycenter_list_findings_at_time]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand Down Expand Up @@ -50,6 +51,7 @@ function main(sourceName = 'FULL RESOURCE PATH TO PARENT SOURCE') {
}
listFindingsAtTime();
// [END demo]
// [END securitycenter_list_findings_at_time]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/listFindingsWithSecurityMarks.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

/** Demonstrates listing findings by filtering on security marks. */
function main(sourceName = 'YOUR_NUMERIC_ORG_ID') {
// [START securitycenter_list_findings_with_security_marks]
// [START demo]
// Imports the Google Cloud client library.
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand Down Expand Up @@ -44,6 +45,7 @@ function main(sourceName = 'YOUR_NUMERIC_ORG_ID') {
}
listFindingsWithSecurityMarks();
// [END demo]
// [END securitycenter_list_findings_with_security_marks]
}

main(...process.argv.slice(2));
2 changes: 2 additions & 0 deletions security-center/snippets/v1/listNotificationConfigs.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
'use strict';

function main(organizationId = 'your-org-id') {
// [START securitycenter_list_notification_configs]
// [START scc_list_notification_configs]
// npm install @google-cloud/security-center/
const {SecurityCenterClient} = require('@google-cloud/security-center');
Expand All @@ -33,6 +34,7 @@ function main(organizationId = 'your-org-id') {

listNotificationConfigs();
// [END scc_list_notification_configs]
// [END securitycenter_list_notification_configs]
}

main(...process.argv.slice(2));
Loading

0 comments on commit 07e2920

Please sign in to comment.