laceworksdk.api.v2.policy_exceptions
Lacework Exceptions API wrapper.
Module Contents
Classes
A class used to represent the Policies Exceptions API endpoint |
- class laceworksdk.api.v2.policy_exceptions.PolicyExceptionsAPI(session)[source]
Bases:
laceworksdk.api.crud_endpoint.CrudEndpoint
A class used to represent the Policies Exceptions API endpoint
Policy exceptions are a mechanism used to maintain the policies but allow you to circumvent one or more restrictions.
- property session
Get the
HttpSession
instance the object is using.
- create(policy_id, description, constraints, **request_params)[source]
A method to create a new Exceptions object.
- Parameters:
policy_id (str) – The object policy ID.
description (str, optional) – The object description.
constraints (list of dicts) – The object constraints. Dict fields are: - field_key (str): A string representing the constraint key. Values are: ‘accountIds’, ‘resourceNames’, ‘regionNames’ and ‘resourceTags’ - field_values (list of str): Constraint values
request_params (dict, optional) – Use to pass any additional parameters the API
- Returns:
The created policy exception
- Return type:
dict
- get(exception_id=None, policy_id=None)[source]
A method to get Exceptions objects.
- Parameters:
exception_id (str, optional) – A string representing the exception ID. (Default value = None)
policy_id – The ID of the policy for which to get the exceptions.
- Returns:
The requested exception(s)
- Return type:
dict
- get_by_id(exception_id, policy_id)[source]
A method to get a Exceptions object by policy ID.
- Parameters:
exception_id (str) – A string representing the exception ID. (Default value = None)
policy_id – The ID of the policy for which to get the exceptions.
- Returns:
The requested exception(s)
- Return type:
dict
- update(exception_id, policy_id, description=None, constraints=None, **request_params)[source]
A method to create a new Exceptions object.
- Parameters:
exception_id (str) – The exception ID to update.
policy_id (str) – The object policy ID.
description (str, optional) – The object description.
constraints (list of dicts, optional) – The object constraints. Dict fields are: - field_key (str): A string representing the constraint key. Values are: ‘accountIds’, ‘resourceNames’, ‘regionNames’ and ‘resourceTags’ - field_values (list of str): Constraint values
request_params (dict, optional) – Use to pass any additional parameters the API
- Returns:
The updated policy exception
- Return type:
dict
- delete(exception_id, policy_id)[source]
A method to delete a policy xception
- Parameters:
exception_id (str) – The exception ID.
policy_id (str) – The policy ID.
- Returns:
a Requests response object containing the response code
- Return type:
requests.models.Response
- search(json=None)
A method to search objects.
See the API documentation for this API endpoint for valid fields to search against.
NOTE: While the “value” and “values” fields are marked as “optional” you must use one of them, depending on the operation you are using.
- Parameters:
json (dict) –
The desired search parameters:
timeFilter (dict, optional): A dict containing the time frame for the search:
startTime (str): The start time for the search
endTime (str): The end time for the search
filters (list of dict, optional): Filters based on field contents:
field (str): The name of the data field to which the condition applies
expression (str): The comparison operator for the filter condition. Valid values are:
”eq”, “ne”, “in”, “not_in”, “like”, “ilike”, “not_like”, “not_ilike”, “not_rlike”, “rlike”, “gt”, “ge”, “lt”, “le”, “between”
value (str, optional): The value that the condition checks for in the specified field. Use this attribute when using an operator that requires a single value.
values (list of str, optional): The values that the condition checks for in the specified field. Use this attribute when using an operator that requires multiple values.
returns (list of str, optional): The fields to return
- Returns:
returns a dict containing the search results
- Return type:
dict