laceworksdk.api.v2.resource_groups

Lacework ResourceGroups API wrapper.

Module Contents

Classes

ResourceGroupsAPI

A class used to represent the Resource Groups API endpoint

class laceworksdk.api.v2.resource_groups.ResourceGroupsAPI(session)[source]

Bases: laceworksdk.api.crud_endpoint.CrudEndpoint

A class used to represent the Resource Groups API endpoint

Resource groups provide a way to categorize Lacework-identifiable assets.

property session

Get the HttpSession instance the object is using.

create(resource_name, resource_type, enabled, props, **request_params)[source]

A method to create a new ResourceGroups object.

Parameters:
  • resource_name (str) – The resource group name.

  • resource_type (str) – The resource group type. See the API docs for a list of types.

  • enabled (bool|int) – Whether the object is enabled.

  • props (dict) –

    The new resource group’s properties. The format varies based on the value of the type arg. See the API docs for valid fields.

  • request_params (dict, optional) – Use to pass any additional parameters the API

Returns:

The newly created resource group

Return type:

dict

get(guid=None)[source]

A method to get resource groups. Using no args will get all resource groups.

Parameters:

guid (str, optional) – The GUID of the resource group to get.

Returns:

The requested resource group(s)

Return type:

dict

get_by_guid(guid)[source]

A method to get resource groups by GUID.

Parameters:

guid (str) – The GUID of the resource group to get.

Returns:

The requested resource group(s)

Return type:

dict

update(guid, resource_name=None, resource_type=None, enabled=None, props=None, **request_params)[source]

A method to update an ResourceGroups object.

Parameters:
  • guid (str) – A string representing the object GUID.

  • resource_name (str, optional) – The resource group name.

  • resource_type (str, optional) –

    The resource group type. See the API docs for a list of types.

  • enabled (bool|int, optional) – Whether the object is enabled.

  • props (dict, optional) –

    The new resource group’s properties. The format varies based on the value of the type arg. See the API docs for valid fields.

  • request_params (dict, optional) – Use to pass any additional parameters the API

Returns:

The newly created resource group

Return type:

dict

delete(guid)[source]

A method to delete a resource groups.

Parameters:

guid (str) – The GUID of the resource group to delete.

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