dxlmarclient.constants module

class dxlmarclient.constants.ConditionConstants

Bases: object

Constants that are used to describe a condition.

The following statement:

conditions={
    "or": [{
        "and": [{
            "name": "HostInfo",
            "output": "ip_address",
            "op": "EQUALS",
            "value": "192.168.1.1"
        }]
    }]
}

Can be rewritten to use ConditionConstants as follows:

conditions={
    ConditionConstants.OR: [{
        ConditionConstants.AND: [{
            ConditionConstants.COND_NAME: "HostInfo",
            ConditionConstants.COND_OUTPUT: "ip_address",
            ConditionConstants.COND_OP: "EQUALS",
            ConditionConstants.COND_VALUE: "192.168.1.1"
        }]
    }]
}
AND = 'and'
COND_NAME = 'name'
COND_OP = 'op'
COND_OUTPUT = 'output'
COND_VALUE = 'value'
OR = 'or'
class dxlmarclient.constants.OperatorConstants

Bases: object

Constants that describe the operator to use within a condition.

The following statement:

conditions={
    "or": [{
        "and": [{
            "name": "HostInfo",
            "output": "ip_address",
            "op": "EQUALS",
            "value": "192.168.1.1"
        }]
    }]
}

Can be rewritten to use OperatorConstants as follows:

 conditions={
     "or": [{
         "and": [{
             "name": "HostInfo",
             "output": "ip_address",
             "op": OperatorConstants.EQUALS,
             "value": "192.168.1.1"
         }]
     }]
}
AFTER = 'AFTER'
BEFORE = 'BEFORE'
CONTAINS = 'CONTAINS'
ENDS_WITH = 'ENDS_WITH'
EQUALS = 'EQUALS'
GREATER_EQUAL_THAN = 'GREATER_EQUAL_THAN'
GREATER_THAN = 'GREATER_THAN'
LESS_EQUAL_THAN = 'LESS_EQUAL_THAN'
LESS_THAN = 'LESS_THAN'
STARTS_WITH = 'STARTS_WITH'
class dxlmarclient.constants.ProjectionConstants

Bases: object

Constants that are used to describe a projection.

The following statement:

projections=[{
    "name": "HostInfo",
    "outputs": ["ip_address"]
}]

Can be rewritten to use ProjectionConstants as follows:

projections=[{
    ProjectionConstants.NAME: "HostInfo",
    ProjectionConstants.OUTPUTS: ["ip_address"]
}]
NAME = 'name'
OUTPUTS = 'outputs'
class dxlmarclient.constants.ResultConstants

Bases: object

Constants that are used access the information contained in the results of a search.

The following statement:

search_result = result_context.get_results(limit=10)
print "Total items: " + str(search_result["totalItems"])
for item in search_result["items"]:
    print "    " + item["output"]['HostInfo|ip_address']

Can be rewritten to use ResultConstants as follows:

search_result = result_context.get_results(limit=10)
print "Total items: " + str(search_result[ResultConstants.TOTAL_ITEMS])
for item in search_result[ResultConstants.ITEMS]:
    print "    " + item[ResultConstants.ITEM_OUTPUT]['HostInfo|ip_address']
CURRENT_ITEM_COUNT = 'currentItemCount'
ITEMS = 'items'
ITEMS_PER_PAGE = 'itemsPerPage'
ITEM_COUNT = 'count'
ITEM_CREATED_AT = 'created_at'
ITEM_ID = 'id'
ITEM_OUTPUT = 'output'
START_INDEX = 'startIndex'
TOTAL_ITEMS = 'totalItems'
class dxlmarclient.constants.SortConstants

Bases: object

Constants that describe the direction the search results should be sorted (ascending vs. descending)

The following statement:

results = results_context.get_results(sort_by="Processes|name",
    sort_direction="asc")

Can be rewritten to use SortConstants as follows:

results = results_context.get_results(sort_by="Processes|name",
    sort_direction=SortConstants.ASC)
ASC = 'asc'
DESC = 'desc'