1919 *
2020 * @param {string } organizationId - Google Cloud organization ID for which floor settings need to be updated.
2121 */
22- async function updateOrganizationFloorSettings ( organizationId ) {
22+ async function main ( organizationId ) {
2323 // [START modelarmor_update_organization_floor_settings]
2424 /**
2525 * TODO(developer): Uncomment these variables before running the sample.
@@ -32,42 +32,59 @@ async function updateOrganizationFloorSettings(organizationId) {
3232
3333 const client = new ModelArmorClient ( ) ;
3434
35- const floorSettingsName = `organizations/${ organizationId } /locations/global/floorSetting` ;
35+ async function updateOrganizationFloorSettings ( ) {
36+ const floorSettingsName = `organizations/${ organizationId } /locations/global/floorSetting` ;
3637
37- // Build the floor settings with your preferred filters
38- // For more details on filters, please refer to the following doc:
39- // https://cloud.google.com/security-command-center/docs/key-concepts-model-armor#ma-filters
40- const floorSetting = {
41- name : floorSettingsName ,
42- filterConfig : {
43- raiSettings : {
44- raiFilters : [
45- {
46- filterType :
47- protos . google . cloud . modelarmor . v1 . RaiFilterType . HARASSMENT ,
48- confidenceLevel :
49- protos . google . cloud . modelarmor . v1 . DetectionConfidenceLevel
50- . LOW_AND_ABOVE ,
51- } ,
52- {
53- filterType :
54- protos . google . cloud . modelarmor . v1 . RaiFilterType . SEXUALLY_EXPLICIT ,
55- confidenceLevel :
56- protos . google . cloud . modelarmor . v1 . DetectionConfidenceLevel . HIGH ,
57- } ,
58- ] ,
38+ // Build the floor settings with your preferred filters
39+ // For more details on filters, please refer to the following doc:
40+ // https://cloud.google.com/security-command-center/docs/key-concepts-model-armor#ma-filters
41+ const floorSetting = {
42+ name : floorSettingsName ,
43+ filterConfig : {
44+ raiSettings : {
45+ raiFilters : [
46+ {
47+ filterType :
48+ protos . google . cloud . modelarmor . v1 . RaiFilterType . HARASSMENT ,
49+ confidenceLevel :
50+ protos . google . cloud . modelarmor . v1 . DetectionConfidenceLevel
51+ . LOW_AND_ABOVE ,
52+ } ,
53+ {
54+ filterType :
55+ protos . google . cloud . modelarmor . v1 . RaiFilterType
56+ . SEXUALLY_EXPLICIT ,
57+ confidenceLevel :
58+ protos . google . cloud . modelarmor . v1 . DetectionConfidenceLevel . HIGH ,
59+ } ,
60+ ] ,
61+ } ,
5962 } ,
60- } ,
61- enableFloorSettingEnforcement : true ,
62- } ;
63+ enableFloorSettingEnforcement : true ,
64+ } ;
6365
64- const request = {
65- floorSetting : floorSetting ,
66- } ;
66+ const request = {
67+ floorSetting : floorSetting ,
68+ } ;
6769
68- const [ response ] = await client . updateFloorSetting ( request ) ;
69- return response ;
70+ const [ response ] = await client . updateFloorSetting ( request ) ;
71+ return response ;
72+ }
73+
74+ return await updateOrganizationFloorSettings ( ) ;
7075 // [END modelarmor_update_organization_floor_settings]
7176}
7277
73- module . exports = updateOrganizationFloorSettings ;
78+ module . exports . main = main ;
79+
80+ /* c8 ignore next 10 */
81+ if ( require . main === module ) {
82+ main ( ...process . argv . slice ( 2 ) ) . catch ( err => {
83+ console . error ( err . message ) ;
84+ process . exitCode = 1 ;
85+ } ) ;
86+ process . on ( 'unhandledRejection' , err => {
87+ console . error ( err . message ) ;
88+ process . exitCode = 1 ;
89+ } ) ;
90+ }
0 commit comments