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()[source]¶
Get the underlying AlertApi client.
- Returns
AlertApi client
- Return type
opsgenie_sdk.AlertApi
- create_alert(payload=None)[source]¶
Create an alert on Opsgenie.
- Parameters
payload (dict | None) – 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(identifier, identifier_type='id', payload=None, **kwargs)[source]¶
Close an alert in Opsgenie.
- Parameters
identifier (str) – Identifier of alert which could be alert id, tiny id or alert alias
identifier_type (str | None) – Type of the identifier that is provided as an in-line parameter. Possible values are ‘id’, ‘alias’ or ‘tiny’
payload (dict | None) – Request payload of closing alert action. see https://github.com/opsgenie/opsgenie-python-sdk/blob/master/docs/AlertApi.md#close_alert
kwargs (dict | None) – params to pass to the function
- Returns
SuccessResponse If the method is called asynchronously, returns the request thread.
- Return type
opsgenie_sdk.SuccessResponse
- delete_alert(identifier, identifier_type=None, user=None, source=None)[source]¶
Delete an alert in Opsgenie.
- Parameters
identifier (str) – Identifier of alert which could be alert id, tiny id or alert alias.
identifier_type (str | None) – Type of the identifier that is provided as an in-line parameter. Possible values are ‘id’, ‘alias’ or ‘tiny’
user (str | None) – Display name of the request owner.
source (str | None) – Display name of the request source
- Returns
SuccessResponse
- Return type
opsgenie_sdk.SuccessResponse