def close_alert(self, alert_id): body = opsgenie_sdk.CloseAlertPayload(note='Example Closed') try: close_response = self.alert_api.close_alert( identifier=alert_id, close_alert_payload=body) print(close_response) return close_response except opsgenie_sdk.ApiException as err: print("Exception when calling AlertApi->close_alerts: %s\n" % err)
def test_close_alert_closes_an_alert_correctly( self, opsgenie_api, mock_close_alert) -> None: opsgenie_api = eval(opsgenie_api) mock_close_alert.return_value = opsgenie_sdk.SuccessResponse expected_payload = opsgenie_sdk.CloseAlertPayload() ret = opsgenie_api.close_alert(self.test_alias) mock_close_alert.assert_called_once_with( identifier=self.test_alias, close_alert_payload=expected_payload) self.assertEqual(ret, opsgenie_sdk.SuccessResponse)
def close_alert(self, alert_id: str) -> Optional[SuccessResponse]: payload = opsgenie_sdk.CloseAlertPayload() return self._alert_api.close_alert(identifier=alert_id, close_alert_payload=payload)