1919 *
2020 * @param {string } folderId - Google Cloud folder ID for which floor settings need to be updated.
2121 */
22- async function main ( folderId ) {
22+ async function updateFolderFloorSettings ( folderId ) {
2323 // [START modelarmor_update_folder_floor_settings]
2424 /**
2525 * TODO(developer): Uncomment these variables before running the sample.
@@ -34,40 +34,35 @@ async function main(folderId) {
3434 // Instantiates a client
3535 const client = new ModelArmorClient ( ) ;
3636
37- async function updateFolderFloorSettings ( ) {
38- const floorSettingsName = `folders/${ folderId } /locations/global/floorSetting` ;
37+ const floorSettingsName = `folders/${ folderId } /locations/global/floorSetting` ;
3938
40- // Build the floor settings with your preferred filters
41- // For more details on filters, please refer to the following doc:
42- // https://cloud.google.com/security-command-center/docs/key-concepts-model-armor#ma-filters
43- const floorSetting = {
44- name : floorSettingsName ,
45- filterConfig : {
46- raiSettings : {
47- raiFilters : [
48- {
49- filterType :
50- protos . google . cloud . modelarmor . v1 . RaiFilterType . HATE_SPEECH ,
51- confidenceLevel :
52- protos . google . cloud . modelarmor . v1 . DetectionConfidenceLevel . HIGH ,
53- } ,
54- ] ,
55- } ,
39+ // Build the floor settings with your preferred filters
40+ // For more details on filters, please refer to the following doc:
41+ // https://cloud.google.com/security-command-center/docs/key-concepts-model-armor#ma-filters
42+ const floorSetting = {
43+ name : floorSettingsName ,
44+ filterConfig : {
45+ raiSettings : {
46+ raiFilters : [
47+ {
48+ filterType :
49+ protos . google . cloud . modelarmor . v1 . RaiFilterType . HATE_SPEECH ,
50+ confidenceLevel :
51+ protos . google . cloud . modelarmor . v1 . DetectionConfidenceLevel . HIGH ,
52+ } ,
53+ ] ,
5654 } ,
57- enableFloorSettingEnforcement : true ,
58- } ;
55+ } ,
56+ enableFloorSettingEnforcement : true ,
57+ } ;
5958
60- const request = {
61- floorSetting : floorSetting ,
62- } ;
59+ const request = {
60+ floorSetting : floorSetting ,
61+ } ;
6362
64- const [ response ] = await client . updateFloorSetting ( request ) ;
65- console . log ( 'Updated folder floor settings' , response ) ;
66- }
67-
68- updateFolderFloorSettings ( ) ;
63+ const [ response ] = await client . updateFloorSetting ( request ) ;
64+ return response ;
6965 // [END modelarmor_update_folder_floor_settings]
7066}
7167
72- const args = process . argv . slice ( 2 ) ;
73- main ( ...args ) . catch ( console . error ) ;
68+ module . exports = updateFolderFloorSettings ;
0 commit comments