Create and Modify Lists

You can create several types of lists that are used to configure protection modules:directory lists, file extension lists, file lists, IP lists, MAC lists, and port lists. The way that you create each list is very similar:

  1. Create the list object.
  2. Set general properties such as the name and description.
  3. Add items to the list. The type of list determines the nature of the item that you add.
  4. Use the API object that is associated with the list object to add the list to Deep Security Manager. For example, you use a DirectoryListsApi object to add a directory list.

To modify a list, you obtain the list, modify it, then update the list. Like any other object, to obtain the list you can search, get the list by ID, or get all lists and cycle through them to find a particular list.

The following example adds a directory to a directory list.

dir_list = api.DirectoryList()
dir_lists_api = api.DirectoryListsApi(api.ApiClient(configuration))

dir_lists = dir_lists_api.list_directory_lists(api_version)

for dir in dir_lists.directory_lists:
    if == dir_list_name:
        dir_list.dir_list = dir

# Create the directory list if dir_list_name was not found
if == None: = dir_list_name
    dir_list = dir_lists_api.create_directory_list(dir_list, api_version)

dir_list_with_directory = api.DirectoryList()
dir_list_with_directory.items = dir_path

return dir_lists_api.modify_directory_list(, dir_list_with_directory, api_version)
exports.addItemToDirectoryList = function(api, dirListID, dirPath, apiVersion) {
  return new Promise((resolve, reject) => {
    getDirList(api, dirListID, apiVersion) // Get the list
      .then(dirList => addDirPath(api, dirList, dirPath, apiVersion)) // Add the path to the list
      .then(data => {
        resolve(data); // Return the response from the addDirPath call
      .catch(error => {

// Gets a directory list
function getDirList(api, dirListID, apiVersion) {
    const directoryListsApi = new api.DirectoryListsApi();
    return directoryListsApi.describeDirectoryList(dirListID, apiVersion);

// Adds a path to a directory list
function addDirPath(api, list, dirPath, apiVersion) {
  // Verify that we have the listID
  try {
    if (!list.ID) {
      throw { error: true, message: "Directory list ID is required" };
  } catch (error) {
    return error;

  // Add the path to the list object
  const dirList = new api.DirectoryList();
  dirList.items = list.items;

  // Add the path to the list on Deep Security Manager
  const directoryListsApi = new api.DirectoryListsApi();
  return directoryListsApi.modifyDirectoryList(list.ID, dirList, apiVersion);
// Obtain the directory list if it exists
DirectoryListsApi dirListsApi = new DirectoryListsApi();
DirectoryList dirList = dirListsApi.describeDirectoryList(dirListID, apiVersion);

// Create a DirectoryList object and add the existing and additional directory
DirectoryList dirListWithDirectory = new DirectoryList();

// Modify the list and update on Deep Security Manager
dirListWithDirectory = dirListsApi.modifyDirectoryList(dirList.getID(), dirListWithDirectory, apiVersion);

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