laceworksdk.api.v2.report_rules

Lacework ReportRules API wrapper.

  1# -*- coding: utf-8 -*-
  2"""
  3Lacework ReportRules API wrapper.
  4"""
  5
  6from laceworksdk.api.crud_endpoint import CrudEndpoint
  7
  8
  9class ReportRulesAPI(CrudEndpoint):
 10
 11    def __init__(self, session):
 12        """
 13        Initializes the ReportRulesAPI object.
 14
 15        :param session: An instance of the HttpSession class
 16
 17        :return ReportRulesAPI object.
 18        """
 19
 20        super().__init__(session, "ReportRules")
 21
 22    def create(self,
 23               type,
 24               filters,
 25               intg_guid_list,
 26               report_notification_types,
 27               **request_params):
 28        """
 29        A method to create a new ReportRules object.
 30
 31        :param type: A string representing the type of the object.
 32            ('Report')
 33        :param filters: A filter object for the object configuration.
 34            obj:
 35                :param name: A string representing the object name.
 36                :param description: A string representing the object description.
 37                :param enabled: A boolean/integer representing whether the object is enabled.
 38                    (0 or 1)
 39                :param resourceGroups: A list of resource groups to define for the object.
 40                :param severity: A list of alert severities to define for the object.
 41                    (1, 2, 3, 4, 5)
 42        :param intg_guid_list: A list of integration GUIDs representing the report channels to use.
 43        :param report_notification_types: An object of booleans for the types of reports that should be sent.
 44        :param request_params: Additional request parameters.
 45            (provides support for parameters that may be added in the future)
 46
 47        :return response json
 48        """
 49
 50        return super().create(
 51            type=type,
 52            filters=self._format_filters(filters),
 53            intg_guid_list=intg_guid_list,
 54            report_notification_types=report_notification_types,
 55            **request_params
 56        )
 57
 58    def get(self,
 59            guid=None):
 60        """
 61        A method to get ReportRules objects.
 62
 63        :param guid: A string representing the object GUID.
 64
 65        :return response json
 66        """
 67
 68        return super().get(id=guid)
 69
 70    def get_by_guid(self,
 71                    guid):
 72        """
 73        A method to get a ReportRules object by GUID.
 74
 75        :param guid: A string representing the object GUID.
 76
 77        :return response json
 78        """
 79
 80        return self.get(guid=guid)
 81
 82    def update(self,
 83               guid,
 84               type=None,
 85               filters=None,
 86               intg_guid_list=None,
 87               report_notification_types=None,
 88               **request_params):
 89        """
 90        A method to update a ReportRules object.
 91
 92        :param guid: A string representing the object GUID.
 93        :param type: A string representing the type of the object.
 94            ('Report')
 95        :param filters: A filter object for the object configuration.
 96            obj:
 97                :param name: A string representing the object name.
 98                :param description: A string representing the object description.
 99                :param enabled: A boolean/integer representing whether the object is enabled.
100                    (0 or 1)
101                :param resourceGroups: A list of resource groups to define for the object.
102                :param severity: A list of alert severities to define for the object.
103                    (1, 2, 3, 4, 5)
104        :param intg_guid_list: A list of integration GUIDs representing the report channels to use.
105        :param report_notification_types: An object of booleans for the types of reports that should be sent.
106        :param request_params: Additional request parameters.
107            (provides support for parameters that may be added in the future)
108
109        :return response json
110        """
111
112        return super().update(
113            id=guid,
114            type=type,
115            filters=self._format_filters(filters),
116            intg_guid_list=intg_guid_list,
117            report_notification_types=report_notification_types,
118            **request_params
119        )
120
121    def delete(self,
122               guid):
123        """
124        A method to delete a ReportRules object.
125
126        :param guid: A string representing the object GUID.
127
128        :return response json
129        """
130
131        return super().delete(id=guid)
class ReportRulesAPI(laceworksdk.api.crud_endpoint.CrudEndpoint):
 10class ReportRulesAPI(CrudEndpoint):
 11
 12    def __init__(self, session):
 13        """
 14        Initializes the ReportRulesAPI object.
 15
 16        :param session: An instance of the HttpSession class
 17
 18        :return ReportRulesAPI object.
 19        """
 20
 21        super().__init__(session, "ReportRules")
 22
 23    def create(self,
 24               type,
 25               filters,
 26               intg_guid_list,
 27               report_notification_types,
 28               **request_params):
 29        """
 30        A method to create a new ReportRules object.
 31
 32        :param type: A string representing the type of the object.
 33            ('Report')
 34        :param filters: A filter object for the object configuration.
 35            obj:
 36                :param name: A string representing the object name.
 37                :param description: A string representing the object description.
 38                :param enabled: A boolean/integer representing whether the object is enabled.
 39                    (0 or 1)
 40                :param resourceGroups: A list of resource groups to define for the object.
 41                :param severity: A list of alert severities to define for the object.
 42                    (1, 2, 3, 4, 5)
 43        :param intg_guid_list: A list of integration GUIDs representing the report channels to use.
 44        :param report_notification_types: An object of booleans for the types of reports that should be sent.
 45        :param request_params: Additional request parameters.
 46            (provides support for parameters that may be added in the future)
 47
 48        :return response json
 49        """
 50
 51        return super().create(
 52            type=type,
 53            filters=self._format_filters(filters),
 54            intg_guid_list=intg_guid_list,
 55            report_notification_types=report_notification_types,
 56            **request_params
 57        )
 58
 59    def get(self,
 60            guid=None):
 61        """
 62        A method to get ReportRules objects.
 63
 64        :param guid: A string representing the object GUID.
 65
 66        :return response json
 67        """
 68
 69        return super().get(id=guid)
 70
 71    def get_by_guid(self,
 72                    guid):
 73        """
 74        A method to get a ReportRules object by GUID.
 75
 76        :param guid: A string representing the object GUID.
 77
 78        :return response json
 79        """
 80
 81        return self.get(guid=guid)
 82
 83    def update(self,
 84               guid,
 85               type=None,
 86               filters=None,
 87               intg_guid_list=None,
 88               report_notification_types=None,
 89               **request_params):
 90        """
 91        A method to update a ReportRules object.
 92
 93        :param guid: A string representing the object GUID.
 94        :param type: A string representing the type of the object.
 95            ('Report')
 96        :param filters: A filter object for the object configuration.
 97            obj:
 98                :param name: A string representing the object name.
 99                :param description: A string representing the object description.
100                :param enabled: A boolean/integer representing whether the object is enabled.
101                    (0 or 1)
102                :param resourceGroups: A list of resource groups to define for the object.
103                :param severity: A list of alert severities to define for the object.
104                    (1, 2, 3, 4, 5)
105        :param intg_guid_list: A list of integration GUIDs representing the report channels to use.
106        :param report_notification_types: An object of booleans for the types of reports that should be sent.
107        :param request_params: Additional request parameters.
108            (provides support for parameters that may be added in the future)
109
110        :return response json
111        """
112
113        return super().update(
114            id=guid,
115            type=type,
116            filters=self._format_filters(filters),
117            intg_guid_list=intg_guid_list,
118            report_notification_types=report_notification_types,
119            **request_params
120        )
121
122    def delete(self,
123               guid):
124        """
125        A method to delete a ReportRules object.
126
127        :param guid: A string representing the object GUID.
128
129        :return response json
130        """
131
132        return super().delete(id=guid)

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

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

Initializes the ReportRulesAPI object.

Parameters
  • session: An instance of the HttpSession class

:return ReportRulesAPI object.

def create( self, type, filters, intg_guid_list, report_notification_types, **request_params):
23    def create(self,
24               type,
25               filters,
26               intg_guid_list,
27               report_notification_types,
28               **request_params):
29        """
30        A method to create a new ReportRules object.
31
32        :param type: A string representing the type of the object.
33            ('Report')
34        :param filters: A filter object for the object configuration.
35            obj:
36                :param name: A string representing the object name.
37                :param description: A string representing the object description.
38                :param enabled: A boolean/integer representing whether the object is enabled.
39                    (0 or 1)
40                :param resourceGroups: A list of resource groups to define for the object.
41                :param severity: A list of alert severities to define for the object.
42                    (1, 2, 3, 4, 5)
43        :param intg_guid_list: A list of integration GUIDs representing the report channels to use.
44        :param report_notification_types: An object of booleans for the types of reports that should be sent.
45        :param request_params: Additional request parameters.
46            (provides support for parameters that may be added in the future)
47
48        :return response json
49        """
50
51        return super().create(
52            type=type,
53            filters=self._format_filters(filters),
54            intg_guid_list=intg_guid_list,
55            report_notification_types=report_notification_types,
56            **request_params
57        )

A method to create a new ReportRules object.

Parameters
  • type: A string representing the type of the object. ('Report')
  • filters: A filter object for the object configuration. obj: :param name: A string representing the object name. :param description: A string representing the object description. :param enabled: A boolean/integer representing whether the object is enabled. (0 or 1) :param resourceGroups: A list of resource groups to define for the object. :param severity: A list of alert severities to define for the object. (1, 2, 3, 4, 5)
  • intg_guid_list: A list of integration GUIDs representing the report channels to use.
  • report_notification_types: An object of booleans for the types of reports that should be sent.
  • request_params: Additional request parameters. (provides support for parameters that may be added in the future)

:return response json

def get(self, guid=None):
59    def get(self,
60            guid=None):
61        """
62        A method to get ReportRules objects.
63
64        :param guid: A string representing the object GUID.
65
66        :return response json
67        """
68
69        return super().get(id=guid)

A method to get ReportRules objects.

Parameters
  • guid: A string representing the object GUID.

:return response json

def get_by_guid(self, guid):
71    def get_by_guid(self,
72                    guid):
73        """
74        A method to get a ReportRules object by GUID.
75
76        :param guid: A string representing the object GUID.
77
78        :return response json
79        """
80
81        return self.get(guid=guid)

A method to get a ReportRules object by GUID.

Parameters
  • guid: A string representing the object GUID.

:return response json

def update( self, guid, type=None, filters=None, intg_guid_list=None, report_notification_types=None, **request_params):
 83    def update(self,
 84               guid,
 85               type=None,
 86               filters=None,
 87               intg_guid_list=None,
 88               report_notification_types=None,
 89               **request_params):
 90        """
 91        A method to update a ReportRules object.
 92
 93        :param guid: A string representing the object GUID.
 94        :param type: A string representing the type of the object.
 95            ('Report')
 96        :param filters: A filter object for the object configuration.
 97            obj:
 98                :param name: A string representing the object name.
 99                :param description: A string representing the object description.
100                :param enabled: A boolean/integer representing whether the object is enabled.
101                    (0 or 1)
102                :param resourceGroups: A list of resource groups to define for the object.
103                :param severity: A list of alert severities to define for the object.
104                    (1, 2, 3, 4, 5)
105        :param intg_guid_list: A list of integration GUIDs representing the report channels to use.
106        :param report_notification_types: An object of booleans for the types of reports that should be sent.
107        :param request_params: Additional request parameters.
108            (provides support for parameters that may be added in the future)
109
110        :return response json
111        """
112
113        return super().update(
114            id=guid,
115            type=type,
116            filters=self._format_filters(filters),
117            intg_guid_list=intg_guid_list,
118            report_notification_types=report_notification_types,
119            **request_params
120        )

A method to update a ReportRules object.

Parameters
  • guid: A string representing the object GUID.
  • type: A string representing the type of the object. ('Report')
  • filters: A filter object for the object configuration. obj: :param name: A string representing the object name. :param description: A string representing the object description. :param enabled: A boolean/integer representing whether the object is enabled. (0 or 1) :param resourceGroups: A list of resource groups to define for the object. :param severity: A list of alert severities to define for the object. (1, 2, 3, 4, 5)
  • intg_guid_list: A list of integration GUIDs representing the report channels to use.
  • report_notification_types: An object of booleans for the types of reports that should be sent.
  • request_params: Additional request parameters. (provides support for parameters that may be added in the future)

:return response json

def delete(self, guid):
122    def delete(self,
123               guid):
124        """
125        A method to delete a ReportRules object.
126
127        :param guid: A string representing the object GUID.
128
129        :return response json
130        """
131
132        return super().delete(id=guid)

A method to delete a ReportRules object.

Parameters
  • guid: A string representing the object GUID.

:return response json