laceworksdk.api.v2.resource_groups

Lacework ResourceGroups API wrapper.

  1# -*- coding: utf-8 -*-
  2"""
  3Lacework ResourceGroups API wrapper.
  4"""
  5
  6from laceworksdk.api.crud_endpoint import CrudEndpoint
  7
  8
  9class ResourceGroupsAPI(CrudEndpoint):
 10
 11    def __init__(self, session):
 12        """
 13        Initializes the ResourceGroupsAPI object.
 14
 15        :param session: An instance of the HttpSession class
 16
 17        :return ResourceGroupsAPI object.
 18        """
 19
 20        super().__init__(session, "ResourceGroups")
 21
 22    def create(self,
 23               resource_name,
 24               resource_type,
 25               enabled,
 26               props,
 27               **request_params):
 28        """
 29        A method to create a new ResourceGroups object.
 30
 31        :param resource_name: A string representing the object name.
 32        :param resource_type: A string representing the object type.
 33        :param enabled: A boolean/integer representing whether the object is enabled.
 34            (0 or 1)
 35        :param props: A JSON object matching the schema for the specified type.
 36        :param request_params: Additional request parameters.
 37            (provides support for parameters that may be added in the future)
 38
 39        :return response json
 40        """
 41
 42        return super().create(
 43            resource_name=resource_name,
 44            resource_type=resource_type,
 45            enabled=int(bool(enabled)),
 46            props=props,
 47            **request_params
 48        )
 49
 50    def get(self,
 51            guid=None):
 52        """
 53        A method to get ResourceGroups objects.
 54
 55        :param guid: A string representing the object GUID.
 56
 57        :return response json
 58        """
 59
 60        return super().get(id=guid)
 61
 62    def get_by_guid(self,
 63                    guid):
 64        """
 65        A method to get ResourceGroups objects by GUID.
 66
 67        :param guid: A string representing the object GUID.
 68
 69        :return response json
 70        """
 71
 72        return self.get(guid=guid)
 73
 74    def update(self,
 75               guid,
 76               resource_name=None,
 77               resource_type=None,
 78               enabled=None,
 79               props=None,
 80               **request_params):
 81        """
 82        A method to update an ResourceGroups object.
 83
 84        :param guid: A string representing the object GUID.
 85        :param resource_name: A string representing the object name.
 86        :param resource_type: A string representing the object type.
 87        :param enabled: A boolean/integer representing whether the object is enabled.
 88            (0 or 1)
 89        :param props: A JSON object matching the schema for the specified type.
 90        :param request_params: Additional request parameters.
 91            (provides support for parameters that may be added in the future)
 92
 93        :return response json
 94        """
 95
 96        if enabled is not None:
 97            enabled = int(bool(enabled))
 98
 99        return super().update(
100            id=guid,
101            resource_name=resource_name,
102            resource_type=resource_type,
103            enabled=enabled,
104            props=props,
105            **request_params
106        )
107
108    def delete(self,
109               guid):
110        """
111        A method to delete a ResourceGroups object.
112
113        :param guid: A string representing the object GUID.
114
115        :return response json
116        """
117
118        return super().delete(id=guid)
class ResourceGroupsAPI(laceworksdk.api.crud_endpoint.CrudEndpoint):
 10class ResourceGroupsAPI(CrudEndpoint):
 11
 12    def __init__(self, session):
 13        """
 14        Initializes the ResourceGroupsAPI object.
 15
 16        :param session: An instance of the HttpSession class
 17
 18        :return ResourceGroupsAPI object.
 19        """
 20
 21        super().__init__(session, "ResourceGroups")
 22
 23    def create(self,
 24               resource_name,
 25               resource_type,
 26               enabled,
 27               props,
 28               **request_params):
 29        """
 30        A method to create a new ResourceGroups object.
 31
 32        :param resource_name: A string representing the object name.
 33        :param resource_type: A string representing the object type.
 34        :param enabled: A boolean/integer representing whether the object is enabled.
 35            (0 or 1)
 36        :param props: A JSON object matching the schema for the specified type.
 37        :param request_params: Additional request parameters.
 38            (provides support for parameters that may be added in the future)
 39
 40        :return response json
 41        """
 42
 43        return super().create(
 44            resource_name=resource_name,
 45            resource_type=resource_type,
 46            enabled=int(bool(enabled)),
 47            props=props,
 48            **request_params
 49        )
 50
 51    def get(self,
 52            guid=None):
 53        """
 54        A method to get ResourceGroups objects.
 55
 56        :param guid: A string representing the object GUID.
 57
 58        :return response json
 59        """
 60
 61        return super().get(id=guid)
 62
 63    def get_by_guid(self,
 64                    guid):
 65        """
 66        A method to get ResourceGroups objects by GUID.
 67
 68        :param guid: A string representing the object GUID.
 69
 70        :return response json
 71        """
 72
 73        return self.get(guid=guid)
 74
 75    def update(self,
 76               guid,
 77               resource_name=None,
 78               resource_type=None,
 79               enabled=None,
 80               props=None,
 81               **request_params):
 82        """
 83        A method to update an ResourceGroups object.
 84
 85        :param guid: A string representing the object GUID.
 86        :param resource_name: A string representing the object name.
 87        :param resource_type: A string representing the object type.
 88        :param enabled: A boolean/integer representing whether the object is enabled.
 89            (0 or 1)
 90        :param props: A JSON object matching the schema for the specified type.
 91        :param request_params: Additional request parameters.
 92            (provides support for parameters that may be added in the future)
 93
 94        :return response json
 95        """
 96
 97        if enabled is not None:
 98            enabled = int(bool(enabled))
 99
100        return super().update(
101            id=guid,
102            resource_name=resource_name,
103            resource_type=resource_type,
104            enabled=enabled,
105            props=props,
106            **request_params
107        )
108
109    def delete(self,
110               guid):
111        """
112        A method to delete a ResourceGroups object.
113
114        :param guid: A string representing the object GUID.
115
116        :return response json
117        """
118
119        return super().delete(id=guid)

A class used to implement CRUD create/read/update/delete functionality for Lacework API Endpoints

ResourceGroupsAPI(session)
12    def __init__(self, session):
13        """
14        Initializes the ResourceGroupsAPI object.
15
16        :param session: An instance of the HttpSession class
17
18        :return ResourceGroupsAPI object.
19        """
20
21        super().__init__(session, "ResourceGroups")

Initializes the ResourceGroupsAPI object.

Parameters
  • session: An instance of the HttpSession class

:return ResourceGroupsAPI object.

def create(self, resource_name, resource_type, enabled, props, **request_params):
23    def create(self,
24               resource_name,
25               resource_type,
26               enabled,
27               props,
28               **request_params):
29        """
30        A method to create a new ResourceGroups object.
31
32        :param resource_name: A string representing the object name.
33        :param resource_type: A string representing the object type.
34        :param enabled: A boolean/integer representing whether the object is enabled.
35            (0 or 1)
36        :param props: A JSON object matching the schema for the specified type.
37        :param request_params: Additional request parameters.
38            (provides support for parameters that may be added in the future)
39
40        :return response json
41        """
42
43        return super().create(
44            resource_name=resource_name,
45            resource_type=resource_type,
46            enabled=int(bool(enabled)),
47            props=props,
48            **request_params
49        )

A method to create a new ResourceGroups object.

Parameters
  • resource_name: A string representing the object name.
  • resource_type: A string representing the object type.
  • enabled: A boolean/integer representing whether the object is enabled. (0 or 1)
  • props: A JSON object matching the schema for the specified type.
  • request_params: Additional request parameters. (provides support for parameters that may be added in the future)

:return response json

def get(self, guid=None):
51    def get(self,
52            guid=None):
53        """
54        A method to get ResourceGroups objects.
55
56        :param guid: A string representing the object GUID.
57
58        :return response json
59        """
60
61        return super().get(id=guid)

A method to get ResourceGroups objects.

Parameters
  • guid: A string representing the object GUID.

:return response json

def get_by_guid(self, guid):
63    def get_by_guid(self,
64                    guid):
65        """
66        A method to get ResourceGroups objects by GUID.
67
68        :param guid: A string representing the object GUID.
69
70        :return response json
71        """
72
73        return self.get(guid=guid)

A method to get ResourceGroups objects by GUID.

Parameters
  • guid: A string representing the object GUID.

:return response json

def update( self, guid, resource_name=None, resource_type=None, enabled=None, props=None, **request_params):
 75    def update(self,
 76               guid,
 77               resource_name=None,
 78               resource_type=None,
 79               enabled=None,
 80               props=None,
 81               **request_params):
 82        """
 83        A method to update an ResourceGroups object.
 84
 85        :param guid: A string representing the object GUID.
 86        :param resource_name: A string representing the object name.
 87        :param resource_type: A string representing the object type.
 88        :param enabled: A boolean/integer representing whether the object is enabled.
 89            (0 or 1)
 90        :param props: A JSON object matching the schema for the specified type.
 91        :param request_params: Additional request parameters.
 92            (provides support for parameters that may be added in the future)
 93
 94        :return response json
 95        """
 96
 97        if enabled is not None:
 98            enabled = int(bool(enabled))
 99
100        return super().update(
101            id=guid,
102            resource_name=resource_name,
103            resource_type=resource_type,
104            enabled=enabled,
105            props=props,
106            **request_params
107        )

A method to update an ResourceGroups object.

Parameters
  • guid: A string representing the object GUID.
  • resource_name: A string representing the object name.
  • resource_type: A string representing the object type.
  • enabled: A boolean/integer representing whether the object is enabled. (0 or 1)
  • props: A JSON object matching the schema for the specified type.
  • request_params: Additional request parameters. (provides support for parameters that may be added in the future)

:return response json

def delete(self, guid):
109    def delete(self,
110               guid):
111        """
112        A method to delete a ResourceGroups object.
113
114        :param guid: A string representing the object GUID.
115
116        :return response json
117        """
118
119        return super().delete(id=guid)

A method to delete a ResourceGroups object.

Parameters
  • guid: A string representing the object GUID.

:return response json