コード例 #1
0
ファイル: ops_genie.py プロジェクト: danacr/mi-scale-2-fitbit
 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)
コード例 #2
0
    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)
コード例 #3
0
 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)