airflow.providers.opsgenie.hooks.opsgenie
¶
Module Contents¶
Classes¶
This hook allows you to post alerts to Opsgenie. |
- class airflow.providers.opsgenie.hooks.opsgenie.OpsgenieAlertHook(opsgenie_conn_id='opsgenie_default')[source]¶
Bases:
airflow.hooks.base.BaseHook
This hook allows you to post alerts to Opsgenie. Accepts a connection that has an Opsgenie API key as the connection's password. This hook sets the domain to conn_id.host, and if not set will default to
https://api.opsgenie.com
.Each Opsgenie API key can be pre-configured to a team integration. You can override these defaults in this hook.
- Parameters
opsgenie_conn_id (str) -- The name of the Opsgenie connection to use
- get_conn(self)[source]¶
Get the underlying AlertApi client
- Returns
AlertApi client
- Return type
opsgenie_sdk.AlertApi
- create_alert(self, payload=None)[source]¶
Create an alert on Opsgenie
- Parameters
payload (Optional[dict]) -- Opsgenie API Create Alert payload values See https://docs.opsgenie.com/docs/alert-api#section-create-alert
- Returns
api response
- Return type
opsgenie_sdk.SuccessResponse
- close_alert(self, identifier, identifier_type='id', payload=None, kwargs=None)[source]¶
Close an alert in Opsgenie
- Parameters
identifier (str) -- Identifier of alert which could be alert id, tiny id or alert alias
identifier_type (Optional[str]) -- Type of the identifier that is provided as an in-line parameter. Possible values are 'id', 'alias' or 'tiny'
payload (Optional[dict]) -- Request payload of closing alert action. see https://github.com/opsgenie/opsgenie-python-sdk/blob/master/docs/AlertApi.md#close_alert
kwargs (Optional[dict]) -- params to pass to the function
- Returns
SuccessResponse If the method is called asynchronously, returns the request thread.
- Return type
opsgenie_sdk.SuccessResponse