laceworksdk.api.v2.alert_profiles

Lacework AlertProfiles API wrapper.

  1# -*- coding: utf-8 -*-
  2"""
  3Lacework AlertProfiles API wrapper.
  4"""
  5
  6from laceworksdk.api.crud_endpoint import CrudEndpoint
  7
  8
  9class AlertProfilesAPI(CrudEndpoint):
 10
 11    def __init__(self, session):
 12        """
 13        Initializes the AlertProfilesAPI object.
 14
 15        :param session: An instance of the HttpSession class
 16
 17        :return AlertProfilesAPI object.
 18        """
 19
 20        super().__init__(session, "AlertProfiles")
 21
 22    def create(self,
 23               alert_profile_id,
 24               alerts,
 25               extends,
 26               **request_params):
 27        """
 28        A method to create a new AlertProfiles object.
 29
 30        :param alert_profile_id: A string representing the id of the object.
 31        :param alerts: A list of objects containing alert details for the parent object.
 32            obj:
 33                :param name: A string representing the name of the alert.
 34                :param eventName: A string representing the name to show in Event Triage.
 35                :param description: A string representing the description to show in Event Triage.
 36                :param subject: A string representing the subject to show in the Event Dossier.
 37        :param extends: A string representing the base alert profile object.
 38        :param request_params: Additional request parameters.
 39            (provides support for parameters that may be added in the future)
 40
 41        :return response json
 42        """
 43
 44        return super().create(
 45            alert_profile_id=alert_profile_id,
 46            alerts=alerts,
 47            extends=extends,
 48            **request_params
 49        )
 50
 51    def get(self,
 52            id=None):
 53        """
 54        A method to get AlertProfiles objects.
 55
 56        :param id: A string representing the object ID.
 57
 58        :return response json
 59        """
 60
 61        return super().get(id=id)
 62
 63    def get_by_id(self,
 64                  id):
 65        """
 66        A method to get an AlertProfiles object by ID.
 67
 68        :param id: A string representing the object ID.
 69
 70        :return response json
 71        """
 72
 73        return self.get(id=id)
 74
 75    def search(self, **request_params):
 76        """
 77        A method to 'pass' when attempting to search AlertProfiles objects.
 78
 79        Search functionality is not yet implemented for Alert Profiles.
 80        """
 81        pass
 82
 83    def update(self,
 84               id,
 85               alerts=None,
 86               **request_params):
 87        """
 88        A method to update an AlertProfiles object.
 89
 90        :param id: A string representing the object ID.
 91        :param alerts: A list of objects containing alert details for the parent object.
 92            obj:
 93                :param name: A string representing the name of the alert.
 94                :param eventName: A string representing the name to show in Event Triage.
 95                :param description: A string representing the description to show in Event Triage.
 96                :param subject: A string representing the subject to show in the Event Dossier.
 97        :param request_params: Additional request parameters.
 98            (provides support for parameters that may be added in the future)
 99
100        :return response json
101        """
102
103        return super().update(
104            id=id,
105            alerts=alerts,
106            **request_params
107        )
108
109    def delete(self,
110               id):
111        """
112        A method to delete an AlertProfiles object.
113
114        :param guid: A string representing the object ID.
115
116        :return response json
117        """
118
119        return super().delete(id=id)
class AlertProfilesAPI(laceworksdk.api.crud_endpoint.CrudEndpoint):
 10class AlertProfilesAPI(CrudEndpoint):
 11
 12    def __init__(self, session):
 13        """
 14        Initializes the AlertProfilesAPI object.
 15
 16        :param session: An instance of the HttpSession class
 17
 18        :return AlertProfilesAPI object.
 19        """
 20
 21        super().__init__(session, "AlertProfiles")
 22
 23    def create(self,
 24               alert_profile_id,
 25               alerts,
 26               extends,
 27               **request_params):
 28        """
 29        A method to create a new AlertProfiles object.
 30
 31        :param alert_profile_id: A string representing the id of the object.
 32        :param alerts: A list of objects containing alert details for the parent object.
 33            obj:
 34                :param name: A string representing the name of the alert.
 35                :param eventName: A string representing the name to show in Event Triage.
 36                :param description: A string representing the description to show in Event Triage.
 37                :param subject: A string representing the subject to show in the Event Dossier.
 38        :param extends: A string representing the base alert profile object.
 39        :param request_params: Additional request parameters.
 40            (provides support for parameters that may be added in the future)
 41
 42        :return response json
 43        """
 44
 45        return super().create(
 46            alert_profile_id=alert_profile_id,
 47            alerts=alerts,
 48            extends=extends,
 49            **request_params
 50        )
 51
 52    def get(self,
 53            id=None):
 54        """
 55        A method to get AlertProfiles objects.
 56
 57        :param id: A string representing the object ID.
 58
 59        :return response json
 60        """
 61
 62        return super().get(id=id)
 63
 64    def get_by_id(self,
 65                  id):
 66        """
 67        A method to get an AlertProfiles object by ID.
 68
 69        :param id: A string representing the object ID.
 70
 71        :return response json
 72        """
 73
 74        return self.get(id=id)
 75
 76    def search(self, **request_params):
 77        """
 78        A method to 'pass' when attempting to search AlertProfiles objects.
 79
 80        Search functionality is not yet implemented for Alert Profiles.
 81        """
 82        pass
 83
 84    def update(self,
 85               id,
 86               alerts=None,
 87               **request_params):
 88        """
 89        A method to update an AlertProfiles object.
 90
 91        :param id: A string representing the object ID.
 92        :param alerts: A list of objects containing alert details for the parent object.
 93            obj:
 94                :param name: A string representing the name of the alert.
 95                :param eventName: A string representing the name to show in Event Triage.
 96                :param description: A string representing the description to show in Event Triage.
 97                :param subject: A string representing the subject to show in the Event Dossier.
 98        :param request_params: Additional request parameters.
 99            (provides support for parameters that may be added in the future)
100
101        :return response json
102        """
103
104        return super().update(
105            id=id,
106            alerts=alerts,
107            **request_params
108        )
109
110    def delete(self,
111               id):
112        """
113        A method to delete an AlertProfiles object.
114
115        :param guid: A string representing the object ID.
116
117        :return response json
118        """
119
120        return super().delete(id=id)

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

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

Initializes the AlertProfilesAPI object.

Parameters
  • session: An instance of the HttpSession class

:return AlertProfilesAPI object.

def create(self, alert_profile_id, alerts, extends, **request_params):
23    def create(self,
24               alert_profile_id,
25               alerts,
26               extends,
27               **request_params):
28        """
29        A method to create a new AlertProfiles object.
30
31        :param alert_profile_id: A string representing the id of the object.
32        :param alerts: A list of objects containing alert details for the parent object.
33            obj:
34                :param name: A string representing the name of the alert.
35                :param eventName: A string representing the name to show in Event Triage.
36                :param description: A string representing the description to show in Event Triage.
37                :param subject: A string representing the subject to show in the Event Dossier.
38        :param extends: A string representing the base alert profile object.
39        :param request_params: Additional request parameters.
40            (provides support for parameters that may be added in the future)
41
42        :return response json
43        """
44
45        return super().create(
46            alert_profile_id=alert_profile_id,
47            alerts=alerts,
48            extends=extends,
49            **request_params
50        )

A method to create a new AlertProfiles object.

Parameters
  • alert_profile_id: A string representing the id of the object.
  • alerts: A list of objects containing alert details for the parent object. obj: :param name: A string representing the name of the alert. :param eventName: A string representing the name to show in Event Triage. :param description: A string representing the description to show in Event Triage. :param subject: A string representing the subject to show in the Event Dossier.
  • extends: A string representing the base alert profile object.
  • request_params: Additional request parameters. (provides support for parameters that may be added in the future)

:return response json

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

A method to get AlertProfiles objects.

Parameters
  • id: A string representing the object ID.

:return response json

def get_by_id(self, id):
64    def get_by_id(self,
65                  id):
66        """
67        A method to get an AlertProfiles object by ID.
68
69        :param id: A string representing the object ID.
70
71        :return response json
72        """
73
74        return self.get(id=id)

A method to get an AlertProfiles object by ID.

Parameters
  • id: A string representing the object ID.

:return response json

def search(self, **request_params):
76    def search(self, **request_params):
77        """
78        A method to 'pass' when attempting to search AlertProfiles objects.
79
80        Search functionality is not yet implemented for Alert Profiles.
81        """
82        pass

A method to 'pass' when attempting to search AlertProfiles objects.

Search functionality is not yet implemented for Alert Profiles.

def update(self, id, alerts=None, **request_params):
 84    def update(self,
 85               id,
 86               alerts=None,
 87               **request_params):
 88        """
 89        A method to update an AlertProfiles object.
 90
 91        :param id: A string representing the object ID.
 92        :param alerts: A list of objects containing alert details for the parent object.
 93            obj:
 94                :param name: A string representing the name of the alert.
 95                :param eventName: A string representing the name to show in Event Triage.
 96                :param description: A string representing the description to show in Event Triage.
 97                :param subject: A string representing the subject to show in the Event Dossier.
 98        :param request_params: Additional request parameters.
 99            (provides support for parameters that may be added in the future)
100
101        :return response json
102        """
103
104        return super().update(
105            id=id,
106            alerts=alerts,
107            **request_params
108        )

A method to update an AlertProfiles object.

Parameters
  • id: A string representing the object ID.
  • alerts: A list of objects containing alert details for the parent object. obj: :param name: A string representing the name of the alert. :param eventName: A string representing the name to show in Event Triage. :param description: A string representing the description to show in Event Triage. :param subject: A string representing the subject to show in the Event Dossier.
  • request_params: Additional request parameters. (provides support for parameters that may be added in the future)

:return response json

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

A method to delete an AlertProfiles object.

Parameters
  • guid: A string representing the object ID.

:return response json