Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
-------
- Introduce File class


1.23.1
-------
- Remove deprecated ingest alert method

1.23.0
-------
- Add notify to Alert class that returns notified channels
Expand Down
2 changes: 1 addition & 1 deletion intezer_sdk/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.23.0'
__version__ = '1.23.1'
24 changes: 0 additions & 24 deletions intezer_sdk/_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,30 +266,6 @@ def create_endpoint_scan(self, scanner_info: dict) -> Dict[str, str]:
raise_for_status(response)
return response.json()['result']

def send_alert(self,
alert: dict,
definition_mapping: dict,
**additional_parameters) -> str:
"""
Send an alert for further investigation.

:param alert: The alert to send.
:param definition_mapping: The definition mapping that is used to extract relevant information from the alert.
:param additional_parameters: Additional parameters to pass to the API.

:raises: :class:`requests.HTTPError` if the request failed for any reason.
:return: The alert id of the submitted alert.
"""
self.assert_any_on_premise('send-alert')
response = self.api.request_with_refresh_expired_access_token(method='POST',
path='/alerts/ingest',
data=dict(alert=alert,
definition_mapping=definition_mapping,
**additional_parameters))
raise_for_status(response, statuses_to_ignore=[HTTPStatus.BAD_REQUEST])
self._assert_alert_response_status_code(response)
return response.json()['alert_id']

def send_binary_alert(self,
alert: io.BytesIO,
file_name: str,
Expand Down
20 changes: 0 additions & 20 deletions tests/unit/test_alerts.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,26 +69,6 @@ def test_get_alerts_by_alerts_ids(self):
self.assertEqual(alerts_amount, 0)
self.assertEqual(alerts_details, [])

def test_ingest_alert_success(self):
# Arrange
alert_id = str(uuid.uuid4())
with responses.RequestsMock() as mock:
mock.add('POST',
url=f'{self.full_url}/alerts/ingest',
status=HTTPStatus.OK,
json={'result': True, 'alert_id': alert_id})
# Act
alert = Alert.send(raw_alert={'alert_id': 'alert_id'},
alert_mapping={'some': 'mapping'},
source='source',
environment='environment',
display_fields=['display_fields'],
alert_sender='alert_sender',
)

# Assert
self.assertEqual(alert.alert_id, alert_id)

def test_alert_from_id(self):
# Arrange
with responses.RequestsMock() as mock:
Expand Down