laceworksdk.api.v2.schemas

Lacework Schemas API wrapper.

 1# -*- coding: utf-8 -*-
 2"""
 3Lacework Schemas API wrapper.
 4"""
 5
 6from laceworksdk.api.base_endpoint import BaseEndpoint
 7
 8
 9class SchemasAPI(BaseEndpoint):
10    """
11    Lacework Schemas API.
12    """
13
14    def __init__(self, session):
15        """
16        Initializes the SchemasAPI object.
17
18        :param session: An instance of the HttpSession class
19
20        :return SchemasAPI object.
21        """
22
23        super().__init__(session, "schemas")
24
25    def get(self,
26            type=None,
27            subtype=None):
28        """
29        A method to get schema objects.
30
31        :param guid: A string representing the object type.
32        :param type: A string representing the object subtype.
33
34        :return response json
35        """
36
37        response = self._session.get(self.build_url(id=subtype, resource=type))
38
39        return response.json()
40
41    def get_by_subtype(self,
42                       type,
43                       subtype):
44        """
45        A method to fetch a specific subtype schema
46
47        :return response json
48        """
49
50        return self.get(type=type, subtype=subtype)
class SchemasAPI(laceworksdk.api.base_endpoint.BaseEndpoint):
10class SchemasAPI(BaseEndpoint):
11    """
12    Lacework Schemas API.
13    """
14
15    def __init__(self, session):
16        """
17        Initializes the SchemasAPI object.
18
19        :param session: An instance of the HttpSession class
20
21        :return SchemasAPI object.
22        """
23
24        super().__init__(session, "schemas")
25
26    def get(self,
27            type=None,
28            subtype=None):
29        """
30        A method to get schema objects.
31
32        :param guid: A string representing the object type.
33        :param type: A string representing the object subtype.
34
35        :return response json
36        """
37
38        response = self._session.get(self.build_url(id=subtype, resource=type))
39
40        return response.json()
41
42    def get_by_subtype(self,
43                       type,
44                       subtype):
45        """
46        A method to fetch a specific subtype schema
47
48        :return response json
49        """
50
51        return self.get(type=type, subtype=subtype)

Lacework Schemas API.

SchemasAPI(session)
15    def __init__(self, session):
16        """
17        Initializes the SchemasAPI object.
18
19        :param session: An instance of the HttpSession class
20
21        :return SchemasAPI object.
22        """
23
24        super().__init__(session, "schemas")

Initializes the SchemasAPI object.

Parameters
  • session: An instance of the HttpSession class

:return SchemasAPI object.

def get(self, type=None, subtype=None):
26    def get(self,
27            type=None,
28            subtype=None):
29        """
30        A method to get schema objects.
31
32        :param guid: A string representing the object type.
33        :param type: A string representing the object subtype.
34
35        :return response json
36        """
37
38        response = self._session.get(self.build_url(id=subtype, resource=type))
39
40        return response.json()

A method to get schema objects.

Parameters
  • guid: A string representing the object type.
  • type: A string representing the object subtype.

:return response json

def get_by_subtype(self, type, subtype):
42    def get_by_subtype(self,
43                       type,
44                       subtype):
45        """
46        A method to fetch a specific subtype schema
47
48        :return response json
49        """
50
51        return self.get(type=type, subtype=subtype)

A method to fetch a specific subtype schema

:return response json