Skip to content

Commit 98ea0a6

Browse files
committed
fix lint issue
1 parent 154520c commit 98ea0a6

File tree

5 files changed

+222
-177
lines changed

5 files changed

+222
-177
lines changed

security-center/snippets/management_api/createSecurityHealthAnalyticsCustomModule.js

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,22 @@
1919
function main(organizationId, customModuleDisplayName, locationId = 'global') {
2020
// [START securitycenter_create_security_health_analytics_custom_module]
2121
// npm install '@google-cloud/securitycentermanagement'
22-
const { SecurityCenterManagementClient, protos } = require('@google-cloud/securitycentermanagement');
22+
const {
23+
SecurityCenterManagementClient,
24+
protos,
25+
} = require('@google-cloud/securitycentermanagement');
2326

2427
const client = new SecurityCenterManagementClient();
2528

26-
const EnablementState = protos.google.cloud.securitycentermanagement.v1.SecurityHealthAnalyticsCustomModule.EnablementState;
27-
const Severity = protos.google.cloud.securitycentermanagement.v1.CustomConfig.Severity;
29+
const EnablementState =
30+
protos.google.cloud.securitycentermanagement.v1
31+
.SecurityHealthAnalyticsCustomModule.EnablementState;
32+
33+
const Severity =
34+
protos.google.cloud.securitycentermanagement.v1.CustomConfig.Severity;
2835

2936
/*
30-
* Required. The name of the parent resource of security health analytics module.
37+
* Required. The name of the parent resource of security health analytics module
3138
* Its format is
3239
* `organizations/[organization_id]/locations/[location_id]`
3340
* `folders/[folder_id]/locations/[location_id]`
@@ -47,14 +54,12 @@ function main(organizationId, customModuleDisplayName, locationId = 'global') {
4754
// define the CEL expression here and this will scans for keys that have not been rotated in
4855
// the last 30 days, change it according to the your requirements
4956
const expr = {
50-
expression: `has(resource.rotationPeriod) && (resource.rotationPeriod > duration('2592000s'))`
57+
expression: `has(resource.rotationPeriod) && (resource.rotationPeriod > duration('2592000s'))`,
5158
};
5259

5360
// define the resource selector
5461
const resourceSelector = {
55-
resourceTypes: [
56-
'cloudkms.googleapis.com/CryptoKey'
57-
]
62+
resourceTypes: ['cloudkms.googleapis.com/CryptoKey'],
5863
};
5964

6065
// define the custom module configuration, update the severity, description,
@@ -64,7 +69,7 @@ function main(organizationId, customModuleDisplayName, locationId = 'global') {
6469
resourceSelector: resourceSelector,
6570
severity: Severity.MEDIUM,
6671
description: 'add your description here',
67-
recommendation: 'add your recommendation here'
72+
recommendation: 'add your recommendation here',
6873
};
6974

7075
// define the security health analytics custom module configuration, update the
@@ -73,19 +78,22 @@ function main(organizationId, customModuleDisplayName, locationId = 'global') {
7378
name: name,
7479
displayName: customModuleDisplayName,
7580
enablementState: EnablementState.ENABLED,
76-
customConfig: customConfig
81+
customConfig: customConfig,
7782
};
7883

7984
async function createSecurityHealthAnalyticsCustomModule() {
8085
const [response] = await client.createSecurityHealthAnalyticsCustomModule({
8186
parent: parent,
82-
securityHealthAnalyticsCustomModule: securityHealthAnalyticsCustomModule
87+
securityHealthAnalyticsCustomModule: securityHealthAnalyticsCustomModule,
8388
});
84-
console.log('Security Health Analytics Custom Module creation succeeded: ', response);
89+
console.log(
90+
'Security Health Analytics Custom Module creation succeeded: ',
91+
response
92+
);
8593
}
8694

8795
createSecurityHealthAnalyticsCustomModule();
8896
// [END securitycenter_create_security_health_analytics_custom_module]
8997
}
9098

91-
main(...process.argv.slice(2));
99+
main(...process.argv.slice(2));

security-center/snippets/management_api/getEffectiveSecurityHealthAnalyticsCustomModule.js

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,36 @@
1717
* Retrieve an existing effective security health analytics custom module
1818
*/
1919
function main(organizationId, customModuleId, locationId = 'global') {
20-
// [START securitycenter_get_effective_security_health_analytics_custom_module]
21-
// npm install '@google-cloud/securitycentermanagement'
22-
const { SecurityCenterManagementClient } = require('@google-cloud/securitycentermanagement');
20+
// [START securitycenter_get_effective_security_health_analytics_custom_module]
21+
// npm install '@google-cloud/securitycentermanagement'
22+
const {
23+
SecurityCenterManagementClient,
24+
} = require('@google-cloud/securitycentermanagement');
2325

24-
const client = new SecurityCenterManagementClient();
26+
const client = new SecurityCenterManagementClient();
2527

26-
/*
27-
* Required. Resource name of security health analytics module.
28-
* Its format is
29-
* `organizations/[organization_id]/locations/[location_id]/effectiveSecurityHealthAnalyticsCustomModules/[custom_module]`
30-
* `folders/[folder_id]/locations/[location_id]/effectiveSecurityHealthAnalyticsCustomModules/[custom_module]`
31-
* `projects/[project_id]/locations/[location_id]/effectiveSecurityHealthAnalyticsCustomModules/[custom_module]`
32-
*/
33-
const name = `organizations/${organizationId}/locations/${locationId}/effectiveSecurityHealthAnalyticsCustomModules/${customModuleId}`;
28+
/*
29+
* Required. Resource name of security health analytics module.
30+
* Its format is
31+
* `organizations/[organization_id]/locations/[location_id]/effectiveSecurityHealthAnalyticsCustomModules/[custom_module]`
32+
* `folders/[folder_id]/locations/[location_id]/effectiveSecurityHealthAnalyticsCustomModules/[custom_module]`
33+
* `projects/[project_id]/locations/[location_id]/effectiveSecurityHealthAnalyticsCustomModules/[custom_module]`
34+
*/
35+
const name = `organizations/${organizationId}/locations/${locationId}/effectiveSecurityHealthAnalyticsCustomModules/${customModuleId}`;
3436

35-
async function getEffectiveSecurityHealthAnalyticsCustomModule() {
36-
const [response] = await client.getEffectiveSecurityHealthAnalyticsCustomModule({
37-
name: name
38-
});
39-
console.log('Security Health Analytics Custom Module get effective succeeded: ', response);
40-
}
37+
async function getEffectiveSecurityHealthAnalyticsCustomModule() {
38+
const [response] =
39+
await client.getEffectiveSecurityHealthAnalyticsCustomModule({
40+
name: name,
41+
});
42+
console.log(
43+
'Security Health Analytics Custom Module get effective succeeded: ',
44+
response
45+
);
46+
}
4147

42-
getEffectiveSecurityHealthAnalyticsCustomModule();
43-
// [END securitycenter_get_effective_security_health_analytics_custom_module]
48+
getEffectiveSecurityHealthAnalyticsCustomModule();
49+
// [END securitycenter_get_effective_security_health_analytics_custom_module]
4450
}
4551

46-
main(...process.argv.slice(2));
52+
main(...process.argv.slice(2));

security-center/snippets/management_api/getSecurityHealthAnalyticsCustomModule.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@
1919
function main(organizationId, customModuleId, locationId = 'global') {
2020
// [START securitycenter_get_security_health_analytics_custom_module]
2121
// npm install '@google-cloud/securitycentermanagement'
22-
const { SecurityCenterManagementClient } = require('@google-cloud/securitycentermanagement');
22+
const {
23+
SecurityCenterManagementClient,
24+
} = require('@google-cloud/securitycentermanagement');
2325

2426
const client = new SecurityCenterManagementClient();
2527

@@ -34,13 +36,16 @@ function main(organizationId, customModuleId, locationId = 'global') {
3436

3537
async function getSecurityHealthAnalyticsCustomModule() {
3638
const [response] = await client.getSecurityHealthAnalyticsCustomModule({
37-
name: name
39+
name: name,
3840
});
39-
console.log('Security Health Analytics Custom Module get succeeded: ', response);
41+
console.log(
42+
'Security Health Analytics Custom Module get succeeded: ',
43+
response
44+
);
4045
}
4146

4247
getSecurityHealthAnalyticsCustomModule();
4348
// [END securitycenter_get_security_health_analytics_custom_module]
4449
}
4550

46-
main(...process.argv.slice(2));
51+
main(...process.argv.slice(2));

security-center/snippets/management_api/updateSecurityHealthAnalyticsCustomModule.js

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,16 @@
1919
function main(organizationId, customModuleId, locationId = 'global') {
2020
// [START securitycenter_update_security_health_analytics_custom_module]
2121
// npm install '@google-cloud/securitycentermanagement'
22-
const { SecurityCenterManagementClient, protos } = require('@google-cloud/securitycentermanagement');
22+
const {
23+
SecurityCenterManagementClient,
24+
protos,
25+
} = require('@google-cloud/securitycentermanagement');
2326

2427
const client = new SecurityCenterManagementClient();
2528

26-
const EnablementState = protos.google.cloud.securitycentermanagement.v1.SecurityHealthAnalyticsCustomModule.EnablementState;
29+
const EnablementState =
30+
protos.google.cloud.securitycentermanagement.v1
31+
.SecurityHealthAnalyticsCustomModule.EnablementState;
2732

2833
/*
2934
* Required. Resource name of security health analytics module.
@@ -38,26 +43,27 @@ function main(organizationId, customModuleId, locationId = 'global') {
3843
// EnablementState below
3944
const securityHealthAnalyticsCustomModule = {
4045
name: name,
41-
enablementState: EnablementState.DISABLED
46+
enablementState: EnablementState.DISABLED,
4247
};
4348

4449
// Set the field mask to specify which properties should be updated.
4550
const fieldMask = {
46-
paths: [
47-
'enablement_state'
48-
]
49-
}
51+
paths: ['enablement_state'],
52+
};
5053

5154
async function updateSecurityHealthAnalyticsCustomModule() {
5255
const [response] = await client.updateSecurityHealthAnalyticsCustomModule({
5356
updateMask: fieldMask,
54-
securityHealthAnalyticsCustomModule: securityHealthAnalyticsCustomModule
57+
securityHealthAnalyticsCustomModule: securityHealthAnalyticsCustomModule,
5558
});
56-
console.log('Security Health Analytics Custom Module update succeeded: ', response);
59+
console.log(
60+
'Security Health Analytics Custom Module update succeeded: ',
61+
response
62+
);
5763
}
5864

5965
updateSecurityHealthAnalyticsCustomModule();
6066
// [END securitycenter_update_security_health_analytics_custom_module]
6167
}
6268

63-
main(...process.argv.slice(2));
69+
main(...process.argv.slice(2));

0 commit comments

Comments
 (0)