laceworksdk.api.v2.audit_logs

Lacework AuditLogs API wrapper.

 1# -*- coding: utf-8 -*-
 2"""
 3Lacework AuditLogs API wrapper.
 4"""
 5
 6from laceworksdk.api.base_endpoint import BaseEndpoint
 7
 8
 9class AuditLogsAPI(BaseEndpoint):
10
11    def __init__(self, session):
12        """
13        Initializes the AuditLogsAPI object.
14
15        :param session: An instance of the HttpSession class
16
17        :return AuditLogsAPI object.
18        """
19
20        super().__init__(session, "AuditLogs")
21
22    def get(self,
23            start_time=None,
24            end_time=None,
25            **request_params):
26        """
27        A method to get AuditLogs objects.
28
29        :param start_time: A "%Y-%m-%dT%H:%M:%SZ" structured timestamp to begin from.
30        :param end_time: A "%Y-%m-%dT%H:%M:%S%Z" structured timestamp to end at.
31        :param request_params: Additional request parameters.
32            (provides support for parameters that may be added in the future)
33
34        :return response json
35        """
36
37        params = self.build_dict_from_items(
38            request_params,
39            start_time=start_time,
40            end_time=end_time
41        )
42
43        response = self._session.get(self.build_url(), params=params)
44
45        return response.json()
46
47    def search(self,
48               json=None):
49        """
50        A method to search AuditLogs objects.
51
52        :param json: A dictionary containing the necessary search parameters.
53            (timeFilter, filters, returns)
54
55        :return response json
56        """
57
58        response = self._session.post(self.build_url(action="search"), json=json)
59
60        return response.json()
class AuditLogsAPI(laceworksdk.api.base_endpoint.BaseEndpoint):
10class AuditLogsAPI(BaseEndpoint):
11
12    def __init__(self, session):
13        """
14        Initializes the AuditLogsAPI object.
15
16        :param session: An instance of the HttpSession class
17
18        :return AuditLogsAPI object.
19        """
20
21        super().__init__(session, "AuditLogs")
22
23    def get(self,
24            start_time=None,
25            end_time=None,
26            **request_params):
27        """
28        A method to get AuditLogs objects.
29
30        :param start_time: A "%Y-%m-%dT%H:%M:%SZ" structured timestamp to begin from.
31        :param end_time: A "%Y-%m-%dT%H:%M:%S%Z" structured timestamp to end at.
32        :param request_params: Additional request parameters.
33            (provides support for parameters that may be added in the future)
34
35        :return response json
36        """
37
38        params = self.build_dict_from_items(
39            request_params,
40            start_time=start_time,
41            end_time=end_time
42        )
43
44        response = self._session.get(self.build_url(), params=params)
45
46        return response.json()
47
48    def search(self,
49               json=None):
50        """
51        A method to search AuditLogs objects.
52
53        :param json: A dictionary containing the necessary search parameters.
54            (timeFilter, filters, returns)
55
56        :return response json
57        """
58
59        response = self._session.post(self.build_url(action="search"), json=json)
60
61        return response.json()

A class used to implement base functionality for Lacework API Endpoints

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

Initializes the AuditLogsAPI object.

Parameters
  • session: An instance of the HttpSession class

:return AuditLogsAPI object.

def get(self, start_time=None, end_time=None, **request_params):
23    def get(self,
24            start_time=None,
25            end_time=None,
26            **request_params):
27        """
28        A method to get AuditLogs objects.
29
30        :param start_time: A "%Y-%m-%dT%H:%M:%SZ" structured timestamp to begin from.
31        :param end_time: A "%Y-%m-%dT%H:%M:%S%Z" structured timestamp to end at.
32        :param request_params: Additional request parameters.
33            (provides support for parameters that may be added in the future)
34
35        :return response json
36        """
37
38        params = self.build_dict_from_items(
39            request_params,
40            start_time=start_time,
41            end_time=end_time
42        )
43
44        response = self._session.get(self.build_url(), params=params)
45
46        return response.json()

A method to get AuditLogs objects.

Parameters
  • start_time: A "%Y-%m-%dT%H:%M: %SZ" structured timestamp to begin from.
  • end_time: A "%Y-%m-%dT%H:%M: %S%Z" structured timestamp to end at.
  • request_params: Additional request parameters. (provides support for parameters that may be added in the future)

:return response json

def search(self, json=None):
48    def search(self,
49               json=None):
50        """
51        A method to search AuditLogs objects.
52
53        :param json: A dictionary containing the necessary search parameters.
54            (timeFilter, filters, returns)
55
56        :return response json
57        """
58
59        response = self._session.post(self.build_url(action="search"), json=json)
60
61        return response.json()

A method to search AuditLogs objects.

Parameters
  • json: A dictionary containing the necessary search parameters. (timeFilter, filters, returns)

:return response json