Views:
The API provides access to many of the Server & Workload Protection system settings. It is useful to automate configurations immediately after deployment.
You use the following SDK classes to interact with system settings:
  • SystemSettings: Defines properties for all of the available system settings. The properties are named after the system setting with which they correspond. For a list of system settings, see System Settings in the Settings Reference.
  • SettingValue: Stores a single string value. Use SettingValue objects to store the values of SystemSettings properties, which are of type SettingValue.
  • SystemSettingsApi: Enables you to list and modify system settings on Server & Workload Protection (using a SystemSettings object), and to get, modify, and reset the value of a specific system setting.

Retrieve, modify, or reset a single system setting Parent topic

When you are working with one or a small number of system settings, use the methods or functions of the SystemSettingsApi class that provide access to a single system setting:
  • To retrieve a setting or to reset it to the default value, create a SystemSettingsApi class and use the describeSystemSetting or resetSystemSetting method or function. Include the setting name as an argument. (See System Settings for a list of settings.)
  • To modify a setting, create a SystemSettingsApi class and use the modifySystemSetting method or function, and include the setting name and setting value as arguments. The value is a SettingValue object.
To modify a system setting, you need the name of the setting, and a SettingValue object that contains the desired value. Note the value of a SettingValue object is a String:
# value for platform_setting_agent_initiated_activation_enabled
allow_value = api.SettingValue()
allow_value.value = str(allow)
Then, use a SystemSettingsApi object to modify the setting:
system_settings_api = api.SystemSettingsApi(api.ApiClient(configuration))

return system_settings_api.modify_system_setting(api.SystemSettings.platform_setting_agent_initiated_activation_enabled, allow_value, api_version)

Example: Modify a single system setting Parent topic

The following example sets the value of the system setting that controls whether agent-initiated activation is allowed.
# Create the setting value
allow_value = api.SettingValue()
allow_value.value = str(allow)

# Modify system setting on Server & Workload Protection
system_settings_api = api.SystemSettingsApi(api.ApiClient(configuration))
return system_settings_api.modify_system_setting(api.SystemSettings.platform_setting_agent_initiated_activation_enabled, allow_value, api_version)
Also see the Modify a System Setting operation in the API Reference.

List or modify multiple system settings Parent topic

When you are working with many system settings, use the methods or functions of the SystemSettingsApi class that provide access to all system settings in a single call:
  • listSystemSettings: Returns a SystemSettings object that contains the values that are set for all system settings on Server & Workload Protection.
  • modifySystemSettings: Modifies all system settings according to the SystemSettings object that is provided as an argument.
Use the following general steps to use an SDK to modify a system setting:

Procedure

  1. Create a SettingValue object for every system setting that you are configuring. Set the value of each object to the value that you want for the corresponding system setting.
  2. Create a SystemSettings object and set the properties to the SettingValue objects.
  3. Create a SystemSettingsApi object and use it to modify the system settings on Server & Workload Protection according to the SystemSettings object.

What to do next

SettingValue values are of type String. The following example creates a SettingValue for a setting that you want to set to 100:
max_sessions = api.SettingValue()
max_sessions.value = "100"
Use the SettingValue as the value of a setting:
system_settings = api.SystemSettings()
system_settings.platform_setting_active_sessions_max_num = max_sessions
Finally, modify the setting on Server & Workload Protection:
settings_api = api.SystemSettingsApi(api.ApiClient(configuration))
return settings_api.modify_system_settings(system_settings, api_version)

Example: Modify multiple system settings Parent topic

The following example sets two system settings: the system setting that controls the maximum number of sessions that a user can create, and the action that the manager takes when the maximum is exceeded.
# Create the SettingValue object and set the max sessions value
max_sessions = api.SettingValue()
max_sessions.value = str(max_allowed)

# Add the SettingValue object to a SystemSettings object
system_settings = api.SystemSettings()
system_settings.platform_setting_active_sessions_max_num = max_sessions

# Repeat for the platform_setting_active_sessions_max_exceeded_action
exceed_action = api.SettingValue()
exceed_action.value = action
system_settings.platform_setting_active_sessions_max_exceeded_action = exceed_action

# Modify system settings on Server & Workload Protection
settings_api = api.SystemSettingsApi(api.ApiClient(configuration))
return settings_api.modify_system_settings(system_settings, api_version)
Also see the Modify System Settings operation in the API Reference. For information about authenticating API calls, see [Authenticate with Server & Workload Protection].(../api-send-request/#authenticate)