laceworksdk.api.v2.vulnerability_exceptions

Lacework VulnerabilityExceptions API wrapper.

  1# -*- coding: utf-8 -*-
  2"""
  3Lacework VulnerabilityExceptions API wrapper.
  4"""
  5
  6from laceworksdk.api.crud_endpoint import CrudEndpoint
  7
  8
  9class VulnerabilityExceptionsAPI(CrudEndpoint):
 10
 11    def __init__(self, session):
 12        """
 13        Initializes the VulnerabilityExceptionsAPI object.
 14
 15        :param session: An instance of the HttpSession class
 16
 17        :return VulnerabilityExceptionsAPI object.
 18        """
 19
 20        super().__init__(session, "VulnerabilityExceptions")
 21
 22    def create(self,
 23               exception_name,
 24               exception_reason,
 25               exception_type,
 26               props,
 27               vulnerability_criteria,
 28               resource_scope=None,
 29               expiry_time=None,
 30               state=True,
 31               **request_params):
 32        """
 33        A method to create a new VulnerabilityExceptions object.
 34
 35        :param exception_name: A string representing the name of the exception.
 36        :param exception_reason: A string representing the exception reason.
 37            ("False Positive", "Accepted Risk", "Compensating Controls", "Fix Pending", "Other")
 38        :param exception_type: A string representing the exception type.
 39            ("Container", "Host")
 40        :param props: An object containing properties of the exception.
 41            obj:
 42                :param description: A string representing the exception description.
 43                :param createdBy: A string representing the creator of the exception.
 44                :param updatedBy: A string representing the updator of the exception.
 45        :param vulnerability_criteria: An object containing criteria for excepted vulnerabilities.
 46            obj:
 47                :param cve: A list of strings representing CVEs.
 48                :param package: A list of objects representing packages.
 49                :param severity: A list of strings representing severities.
 50                    ("Info", "Low", "Medium", "High", "Critical")
 51                :param fixable: A list of numbers representing the fixability status.
 52        :param resource_scope: An object containing the scope of resources for which to apply the exception.
 53            obj:
 54                :param imageId: A list of strings representing image IDs.
 55                :param imageTag: A list of strings representing image tags.
 56                :param registry: A list of strings representing container registries.
 57                :param repository: A list of strings representing container repositories.
 58                :param namespace: A list of strings representing package namespaces.
 59        :param expiry_time: A string representing the expiration time for the exception.
 60        :param state: A boolean representing the state of the exception.
 61        :param request_params: Additional request parameters.
 62            (provides support for parameters that may be added in the future)
 63
 64        :return response json
 65        """
 66
 67        return super().create(
 68            exception_name=exception_name,
 69            exception_reason=exception_reason,
 70            exception_type=exception_type,
 71            props=props,
 72            vulnerability_criteria=vulnerability_criteria,
 73            resource_scope=resource_scope,
 74            expiry_time=expiry_time,
 75            state=int(bool(state)),
 76            **request_params
 77        )
 78
 79    def get(self,
 80            guid=None):
 81        """
 82        A method to get VulnerabilityExceptions objects.
 83
 84        :param guid: A string representing the object GUID.
 85
 86        :return response json
 87        """
 88
 89        return super().get(id=guid)
 90
 91    def get_by_guid(self,
 92                    guid):
 93        """
 94        A method to get a VulnerabilityExceptions object by GUID.
 95
 96        :param guid: A string representing the object GUID.
 97
 98        :return response json
 99        """
100
101        return self.get(guid=guid)
102
103    def update(self,
104               guid,
105               exception_name=None,
106               exception_reason=None,
107               props=None,
108               vulnerability_criteria=None,
109               resource_scope=None,
110               expiry_time=None,
111               state=None,
112               **request_params):
113        """
114        A method to update a VulnerabilityExceptions object.
115
116        :param guid: A string representing the object GUID.
117        :param exception_name: A string representing the name of the exception.
118        :param exception_reason: A string representing the exception reason.
119            ("False Positive", "Accepted Risk", "Compensating Controls", "Fix Pending", "Other")
120        :param exception_type: A string representing the exception type.
121            ("Container", "Host")
122        :param props: An object containing properties of the exception.
123            obj:
124                :param description: A string representing the exception description.
125                :param createdBy: A string representing the creator of the exception.
126                :param updatedBy: A string representing the updator of the exception.
127        :param vulnerability_criteria: An object containing criteria for excepted vulnerabilities.
128            obj:
129                :param cve: A list of strings representing CVEs.
130                :param package: A list of objects representing packages.
131                :param severity: A list of strings representing severities.
132                    ("Info", "Low", "Medium", "High", "Critical")
133                :param fixable: A list of numbers representing the fixability status.
134        :param resource_scope: An object containing the scope of resources for which to apply the exception.
135            obj:
136                :param imageId: A list of strings representing image IDs.
137                :param imageTag: A list of strings representing image tags.
138                :param registry: A list of strings representing container registries.
139                :param repository: A list of strings representing container repositories.
140                :param namespace: A list of strings representing package namespaces.
141        :param expiry_time: A string representing the expiration time for the exception.
142        :param state: A boolean representing the state of the exception.
143        :param request_params: Additional request parameters.
144            (provides support for parameters that may be added in the future)
145
146        :return response json
147        """
148
149        if state is not None:
150            state = int(bool(state))
151
152        return super().update(
153            id=guid,
154            exception_name=exception_name,
155            exception_reason=exception_reason,
156            props=props,
157            vulnerability_criteria=vulnerability_criteria,
158            resource_scope=resource_scope,
159            expiry_time=expiry_time,
160            state=state,
161            **request_params
162        )
163
164    def delete(self,
165               guid):
166        """
167        A method to delete a VulnerabilityExceptions object.
168
169        :param guid: A string representing the object GUID.
170
171        :return response json
172        """
173
174        return super().delete(id=guid)
class VulnerabilityExceptionsAPI(laceworksdk.api.crud_endpoint.CrudEndpoint):
 10class VulnerabilityExceptionsAPI(CrudEndpoint):
 11
 12    def __init__(self, session):
 13        """
 14        Initializes the VulnerabilityExceptionsAPI object.
 15
 16        :param session: An instance of the HttpSession class
 17
 18        :return VulnerabilityExceptionsAPI object.
 19        """
 20
 21        super().__init__(session, "VulnerabilityExceptions")
 22
 23    def create(self,
 24               exception_name,
 25               exception_reason,
 26               exception_type,
 27               props,
 28               vulnerability_criteria,
 29               resource_scope=None,
 30               expiry_time=None,
 31               state=True,
 32               **request_params):
 33        """
 34        A method to create a new VulnerabilityExceptions object.
 35
 36        :param exception_name: A string representing the name of the exception.
 37        :param exception_reason: A string representing the exception reason.
 38            ("False Positive", "Accepted Risk", "Compensating Controls", "Fix Pending", "Other")
 39        :param exception_type: A string representing the exception type.
 40            ("Container", "Host")
 41        :param props: An object containing properties of the exception.
 42            obj:
 43                :param description: A string representing the exception description.
 44                :param createdBy: A string representing the creator of the exception.
 45                :param updatedBy: A string representing the updator of the exception.
 46        :param vulnerability_criteria: An object containing criteria for excepted vulnerabilities.
 47            obj:
 48                :param cve: A list of strings representing CVEs.
 49                :param package: A list of objects representing packages.
 50                :param severity: A list of strings representing severities.
 51                    ("Info", "Low", "Medium", "High", "Critical")
 52                :param fixable: A list of numbers representing the fixability status.
 53        :param resource_scope: An object containing the scope of resources for which to apply the exception.
 54            obj:
 55                :param imageId: A list of strings representing image IDs.
 56                :param imageTag: A list of strings representing image tags.
 57                :param registry: A list of strings representing container registries.
 58                :param repository: A list of strings representing container repositories.
 59                :param namespace: A list of strings representing package namespaces.
 60        :param expiry_time: A string representing the expiration time for the exception.
 61        :param state: A boolean representing the state of the exception.
 62        :param request_params: Additional request parameters.
 63            (provides support for parameters that may be added in the future)
 64
 65        :return response json
 66        """
 67
 68        return super().create(
 69            exception_name=exception_name,
 70            exception_reason=exception_reason,
 71            exception_type=exception_type,
 72            props=props,
 73            vulnerability_criteria=vulnerability_criteria,
 74            resource_scope=resource_scope,
 75            expiry_time=expiry_time,
 76            state=int(bool(state)),
 77            **request_params
 78        )
 79
 80    def get(self,
 81            guid=None):
 82        """
 83        A method to get VulnerabilityExceptions objects.
 84
 85        :param guid: A string representing the object GUID.
 86
 87        :return response json
 88        """
 89
 90        return super().get(id=guid)
 91
 92    def get_by_guid(self,
 93                    guid):
 94        """
 95        A method to get a VulnerabilityExceptions object by GUID.
 96
 97        :param guid: A string representing the object GUID.
 98
 99        :return response json
100        """
101
102        return self.get(guid=guid)
103
104    def update(self,
105               guid,
106               exception_name=None,
107               exception_reason=None,
108               props=None,
109               vulnerability_criteria=None,
110               resource_scope=None,
111               expiry_time=None,
112               state=None,
113               **request_params):
114        """
115        A method to update a VulnerabilityExceptions object.
116
117        :param guid: A string representing the object GUID.
118        :param exception_name: A string representing the name of the exception.
119        :param exception_reason: A string representing the exception reason.
120            ("False Positive", "Accepted Risk", "Compensating Controls", "Fix Pending", "Other")
121        :param exception_type: A string representing the exception type.
122            ("Container", "Host")
123        :param props: An object containing properties of the exception.
124            obj:
125                :param description: A string representing the exception description.
126                :param createdBy: A string representing the creator of the exception.
127                :param updatedBy: A string representing the updator of the exception.
128        :param vulnerability_criteria: An object containing criteria for excepted vulnerabilities.
129            obj:
130                :param cve: A list of strings representing CVEs.
131                :param package: A list of objects representing packages.
132                :param severity: A list of strings representing severities.
133                    ("Info", "Low", "Medium", "High", "Critical")
134                :param fixable: A list of numbers representing the fixability status.
135        :param resource_scope: An object containing the scope of resources for which to apply the exception.
136            obj:
137                :param imageId: A list of strings representing image IDs.
138                :param imageTag: A list of strings representing image tags.
139                :param registry: A list of strings representing container registries.
140                :param repository: A list of strings representing container repositories.
141                :param namespace: A list of strings representing package namespaces.
142        :param expiry_time: A string representing the expiration time for the exception.
143        :param state: A boolean representing the state of the exception.
144        :param request_params: Additional request parameters.
145            (provides support for parameters that may be added in the future)
146
147        :return response json
148        """
149
150        if state is not None:
151            state = int(bool(state))
152
153        return super().update(
154            id=guid,
155            exception_name=exception_name,
156            exception_reason=exception_reason,
157            props=props,
158            vulnerability_criteria=vulnerability_criteria,
159            resource_scope=resource_scope,
160            expiry_time=expiry_time,
161            state=state,
162            **request_params
163        )
164
165    def delete(self,
166               guid):
167        """
168        A method to delete a VulnerabilityExceptions object.
169
170        :param guid: A string representing the object GUID.
171
172        :return response json
173        """
174
175        return super().delete(id=guid)

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

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

Initializes the VulnerabilityExceptionsAPI object.

Parameters
  • session: An instance of the HttpSession class

:return VulnerabilityExceptionsAPI object.

def create( self, exception_name, exception_reason, exception_type, props, vulnerability_criteria, resource_scope=None, expiry_time=None, state=True, **request_params):
23    def create(self,
24               exception_name,
25               exception_reason,
26               exception_type,
27               props,
28               vulnerability_criteria,
29               resource_scope=None,
30               expiry_time=None,
31               state=True,
32               **request_params):
33        """
34        A method to create a new VulnerabilityExceptions object.
35
36        :param exception_name: A string representing the name of the exception.
37        :param exception_reason: A string representing the exception reason.
38            ("False Positive", "Accepted Risk", "Compensating Controls", "Fix Pending", "Other")
39        :param exception_type: A string representing the exception type.
40            ("Container", "Host")
41        :param props: An object containing properties of the exception.
42            obj:
43                :param description: A string representing the exception description.
44                :param createdBy: A string representing the creator of the exception.
45                :param updatedBy: A string representing the updator of the exception.
46        :param vulnerability_criteria: An object containing criteria for excepted vulnerabilities.
47            obj:
48                :param cve: A list of strings representing CVEs.
49                :param package: A list of objects representing packages.
50                :param severity: A list of strings representing severities.
51                    ("Info", "Low", "Medium", "High", "Critical")
52                :param fixable: A list of numbers representing the fixability status.
53        :param resource_scope: An object containing the scope of resources for which to apply the exception.
54            obj:
55                :param imageId: A list of strings representing image IDs.
56                :param imageTag: A list of strings representing image tags.
57                :param registry: A list of strings representing container registries.
58                :param repository: A list of strings representing container repositories.
59                :param namespace: A list of strings representing package namespaces.
60        :param expiry_time: A string representing the expiration time for the exception.
61        :param state: A boolean representing the state of the exception.
62        :param request_params: Additional request parameters.
63            (provides support for parameters that may be added in the future)
64
65        :return response json
66        """
67
68        return super().create(
69            exception_name=exception_name,
70            exception_reason=exception_reason,
71            exception_type=exception_type,
72            props=props,
73            vulnerability_criteria=vulnerability_criteria,
74            resource_scope=resource_scope,
75            expiry_time=expiry_time,
76            state=int(bool(state)),
77            **request_params
78        )

A method to create a new VulnerabilityExceptions object.

Parameters
  • exception_name: A string representing the name of the exception.
  • exception_reason: A string representing the exception reason. ("False Positive", "Accepted Risk", "Compensating Controls", "Fix Pending", "Other")
  • exception_type: A string representing the exception type. ("Container", "Host")
  • props: An object containing properties of the exception. obj: :param description: A string representing the exception description. :param createdBy: A string representing the creator of the exception. :param updatedBy: A string representing the updator of the exception.
  • vulnerability_criteria: An object containing criteria for excepted vulnerabilities. obj: :param cve: A list of strings representing CVEs. :param package: A list of objects representing packages. :param severity: A list of strings representing severities. ("Info", "Low", "Medium", "High", "Critical") :param fixable: A list of numbers representing the fixability status.
  • resource_scope: An object containing the scope of resources for which to apply the exception. obj: :param imageId: A list of strings representing image IDs. :param imageTag: A list of strings representing image tags. :param registry: A list of strings representing container registries. :param repository: A list of strings representing container repositories. :param namespace: A list of strings representing package namespaces.
  • expiry_time: A string representing the expiration time for the exception.
  • state: A boolean representing the state of the exception.
  • request_params: Additional request parameters. (provides support for parameters that may be added in the future)

:return response json

def get(self, guid=None):
80    def get(self,
81            guid=None):
82        """
83        A method to get VulnerabilityExceptions objects.
84
85        :param guid: A string representing the object GUID.
86
87        :return response json
88        """
89
90        return super().get(id=guid)

A method to get VulnerabilityExceptions objects.

Parameters
  • guid: A string representing the object GUID.

:return response json

def get_by_guid(self, guid):
 92    def get_by_guid(self,
 93                    guid):
 94        """
 95        A method to get a VulnerabilityExceptions object by GUID.
 96
 97        :param guid: A string representing the object GUID.
 98
 99        :return response json
100        """
101
102        return self.get(guid=guid)

A method to get a VulnerabilityExceptions object by GUID.

Parameters
  • guid: A string representing the object GUID.

:return response json

def update( self, guid, exception_name=None, exception_reason=None, props=None, vulnerability_criteria=None, resource_scope=None, expiry_time=None, state=None, **request_params):
104    def update(self,
105               guid,
106               exception_name=None,
107               exception_reason=None,
108               props=None,
109               vulnerability_criteria=None,
110               resource_scope=None,
111               expiry_time=None,
112               state=None,
113               **request_params):
114        """
115        A method to update a VulnerabilityExceptions object.
116
117        :param guid: A string representing the object GUID.
118        :param exception_name: A string representing the name of the exception.
119        :param exception_reason: A string representing the exception reason.
120            ("False Positive", "Accepted Risk", "Compensating Controls", "Fix Pending", "Other")
121        :param exception_type: A string representing the exception type.
122            ("Container", "Host")
123        :param props: An object containing properties of the exception.
124            obj:
125                :param description: A string representing the exception description.
126                :param createdBy: A string representing the creator of the exception.
127                :param updatedBy: A string representing the updator of the exception.
128        :param vulnerability_criteria: An object containing criteria for excepted vulnerabilities.
129            obj:
130                :param cve: A list of strings representing CVEs.
131                :param package: A list of objects representing packages.
132                :param severity: A list of strings representing severities.
133                    ("Info", "Low", "Medium", "High", "Critical")
134                :param fixable: A list of numbers representing the fixability status.
135        :param resource_scope: An object containing the scope of resources for which to apply the exception.
136            obj:
137                :param imageId: A list of strings representing image IDs.
138                :param imageTag: A list of strings representing image tags.
139                :param registry: A list of strings representing container registries.
140                :param repository: A list of strings representing container repositories.
141                :param namespace: A list of strings representing package namespaces.
142        :param expiry_time: A string representing the expiration time for the exception.
143        :param state: A boolean representing the state of the exception.
144        :param request_params: Additional request parameters.
145            (provides support for parameters that may be added in the future)
146
147        :return response json
148        """
149
150        if state is not None:
151            state = int(bool(state))
152
153        return super().update(
154            id=guid,
155            exception_name=exception_name,
156            exception_reason=exception_reason,
157            props=props,
158            vulnerability_criteria=vulnerability_criteria,
159            resource_scope=resource_scope,
160            expiry_time=expiry_time,
161            state=state,
162            **request_params
163        )

A method to update a VulnerabilityExceptions object.

Parameters
  • guid: A string representing the object GUID.
  • exception_name: A string representing the name of the exception.
  • exception_reason: A string representing the exception reason. ("False Positive", "Accepted Risk", "Compensating Controls", "Fix Pending", "Other")
  • exception_type: A string representing the exception type. ("Container", "Host")
  • props: An object containing properties of the exception. obj: :param description: A string representing the exception description. :param createdBy: A string representing the creator of the exception. :param updatedBy: A string representing the updator of the exception.
  • vulnerability_criteria: An object containing criteria for excepted vulnerabilities. obj: :param cve: A list of strings representing CVEs. :param package: A list of objects representing packages. :param severity: A list of strings representing severities. ("Info", "Low", "Medium", "High", "Critical") :param fixable: A list of numbers representing the fixability status.
  • resource_scope: An object containing the scope of resources for which to apply the exception. obj: :param imageId: A list of strings representing image IDs. :param imageTag: A list of strings representing image tags. :param registry: A list of strings representing container registries. :param repository: A list of strings representing container repositories. :param namespace: A list of strings representing package namespaces.
  • expiry_time: A string representing the expiration time for the exception.
  • state: A boolean representing the state of the exception.
  • request_params: Additional request parameters. (provides support for parameters that may be added in the future)

:return response json

def delete(self, guid):
165    def delete(self,
166               guid):
167        """
168        A method to delete a VulnerabilityExceptions object.
169
170        :param guid: A string representing the object GUID.
171
172        :return response json
173        """
174
175        return super().delete(id=guid)

A method to delete a VulnerabilityExceptions object.

Parameters
  • guid: A string representing the object GUID.

:return response json