List or modify multiple system settings

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 Deep Security Manager.
  • 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:

  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 Deep Security Manager according to the SystemSettings object.

SettingValue values are of type String. The following example creates a SettingValue for a setting that you want to set to 100:

  • Python:

    max_sessions = api.SettingValue()
    max_sessions.value = "100"
    
  • JavaScript:

    const maxSessions = new api.SettingValue();
    maxSessions.value = "100";
    
  • Java:

    SettingValue maxSessionsValue = new SettingValue();
    maxSessionsValue.setValue(100);
    

Use the SettingValue as the value of a setting:

  • Python:

    system_settings = api.SystemSettings()
    system_settings.platform_setting_active_sessions_max_num = max_sessions
    
  • JavaScript:

    const systemSettings = new api.SystemSettings();
    systemSettings.platformSettingActiveSessionsMax = maxSessions;
    
  • Java:

    SystemSettings systemSettings = new SystemSettings();
    systemSettings.setPlatformSettingActiveSessionsMax(maxSessionsValue);
    

Finally, modify the setting on Deep Security Manager:

  • Python:

    settings_api = api.SystemSettingsApi(api.ApiClient(configuration))
    return settings_api.modify_system_settings(system_settings, api_version)
    
  • JavaScript:

    const systemSettingsApi = new api.SystemSettingsApi();
    return systemSettingsApi.modifySystemSettings(systemSettings, apiVersion);
    
  • Java:

    SystemSettingsApi settingsApi = new SystemSettingsApi();
    return settingsApi.modifySystemSettings(systemSettings, apiVersion);
    

Example: Modify multiple system settings

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.

Language

Code

Python

View source
# 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 Deep Security Manager
settings_api = api.SystemSettingsApi(api.ApiClient(configuration))

return settings_api.modify_system_settings(system_settings, api_version)

JavaScript

View source
// Create the settings value
const maxSessions = new api.SettingValue();
maxSessions.value = maxValue;

// Create a SystemSettings object and set the setting value
const systemSettings = new api.SystemSettings();
systemSettings.platformSettingActiveSessionsMax = maxSessions;

// Repeat for platformSettingActiveSessionsMaxExceededAction
const exceedAction = new api.SettingValue();
exceedAction.value = action;
systemSettings.platformSettingActiveSessionsMaxExceededAction = exceedAction;

// Modify the settings on Deep Security Manager
const systemSettingsApi = new api.SystemSettingsApi();

return systemSettingsApi.modifySystemSettings(systemSettings, apiVersion);

Java

View source
// Create the setting value for PlatformSettingActiveSessionsMax
SettingValue maxSessionsValue = new SettingValue();
maxSessionsValue.setValue(Integer.toString(maxSessions));

// Create a SystemSettings object and set the property
SystemSettings systemSettings = new SystemSettings();
systemSettings.setPlatformSettingActiveSessionsMax(maxSessionsValue);

// Repeat for platformSettingActiveSessionsMaxExceededAction
SettingValue maxSessionsExceededAction = new SettingValue();
maxSessionsExceededAction.setValue(exceedAction);
systemSettings.setPlatformSettingActiveSessionsMaxExceededAction(maxSessionsExceededAction);

// Modify system settings on Deep Security Manager
SystemSettingsApi settingsApi = new SystemSettingsApi();

return settingsApi.modifySystemSettings(systemSettings, apiVersion);

Also see the Modify System Settings operation in the API Reference. For information about authenticating API calls, see Authenticate with Deep Security Manager.