Skip to content

Commit c330a01

Browse files
committed
re-flake8'd the source
1 parent 33c1687 commit c330a01

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

src/cbapi/psc/query.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -991,31 +991,31 @@ def facets(self, fieldlist, max_rows=0):
991991
resp = self._cb.post_object(url, body=request)
992992
result = resp.json()
993993
return result.get("results", [])
994-
994+
995995
def _update_status(self, status, remediation, comment):
996-
request = { "state": status, "criteria": self._build_criteria(), "query": self._query_builder._collapse()}
996+
request = {"state": status, "criteria": self._build_criteria(), "query": self._query_builder._collapse()}
997997
if remediation is not None:
998998
request["remediation_state"] = remediation
999999
if comment is not None:
10001000
request["comment"] = comment
10011001
resp = self._cb.post_object(self._bulkupdate_url.format(self._cb.credentials.org_key), body=request)
10021002
output = resp.json()
10031003
return output["request_id"]
1004-
1004+
10051005
def update(self, remediation=None, comment=None):
10061006
"""
10071007
Update all alerts matching the given query. The alerts will be left in an OPEN state after this request.
1008-
1008+
10091009
:param remediation str: The remediation state to set for all alerts.
10101010
:param comment str: The comment to set for all alerts.
10111011
:return: The request ID, which may be used to select a WorkflowStatus object.
10121012
"""
10131013
return self._update_status("OPEN", remediation, comment)
1014-
1014+
10151015
def dismiss(self, remediation=None, comment=None):
10161016
"""
10171017
Dismiss all alerts matching the given query. The alerts will be left in a DISMISSED state after this request.
1018-
1018+
10191019
:param remediation str: The remediation state to set for all alerts.
10201020
:param comment str: The comment to set for all alerts.
10211021
:return: The request ID, which may be used to select a WorkflowStatus object.
@@ -1071,7 +1071,7 @@ class CBAnalyticsAlertSearchQuery(BaseAlertSearchQuery):
10711071
valid_sensor_actions = ["POLICY_NOT_APPLIED", "ALLOW", "ALLOW_AND_LOG", "TERMINATE", "DENY"]
10721072
valid_threat_cause_vectors = ["EMAIL", "WEB", "GENERIC_SERVER", "GENERIC_CLIENT", "REMOTE_DRIVE",
10731073
"REMOVABLE_MEDIA", "UNKNOWN", "APP_STORE", "THIRD_PARTY"]
1074-
1074+
10751075
def __init__(self, doc_class, cb):
10761076
super().__init__(doc_class, cb)
10771077
self._bulkupdate_url = "/appservices/v6/orgs/{0}/alerts/cbanalytics/workflow/_criteria"

src/cbapi/psc/rest_api.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,11 @@ def alert_search_suggestions(self, query):
136136
url = "/appservices/v6/orgs/{0}/alerts/search_suggestions".format(self.credentials.org_key)
137137
output = self.get_object(url, query_params)
138138
return output["suggestions"]
139-
139+
140140
def _bulk_threat_update_status(self, threat_ids, status, remediation, comment):
141141
if not all(isinstance(t, str) for t in threat_ids):
142142
raise ApiError("One or more invalid threat ID values")
143-
request = { "state": status, "threat_id": threat_ids}
143+
request = {"state": status, "threat_id": threat_ids}
144144
if remediation is not None:
145145
request["remediation_state"] = remediation
146146
if comment is not None:
@@ -149,28 +149,27 @@ def _bulk_threat_update_status(self, threat_ids, status, remediation, comment):
149149
resp = self.post_object(url, body=request)
150150
output = resp.json()
151151
return output["request_id"]
152-
152+
153153
def bulk_threat_update(self, threat_ids, remediation=None, comment=None):
154154
"""
155155
Update the alert status of alerts associated with multiple threat IDs.
156156
The alerts will be left in an OPEN state after this request.
157-
157+
158158
:param threat_ids list: List of string threat IDs.
159159
:param remediation str: The remediation state to set for all alerts.
160160
:param comment str: The comment to set for all alerts.
161161
:return: The request ID, which may be used to select a WorkflowStatus object.
162162
"""
163163
return self._bulk_threat_update_status(threat_ids, "OPEN", remediation, comment)
164-
164+
165165
def bulk_threat_dismiss(self, threat_ids, remediation=None, comment=None):
166166
"""
167167
Dismiss the alerts associated with multiple threat IDs.
168168
The alerts will be left in a DISMISSED state after this request.
169-
169+
170170
:param threat_ids list: List of string threat IDs.
171171
:param remediation str: The remediation state to set for all alerts.
172172
:param comment str: The comment to set for all alerts.
173173
:return: The request ID, which may be used to select a WorkflowStatus object.
174174
"""
175175
return self._bulk_threat_update_status(threat_ids, "DISMISSED", remediation, comment)
176-

0 commit comments

Comments
 (0)