airflow.providers.opsgenie.hooks.opsgenie

Module Contents

Classes

OpsgenieAlertHook

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

conn_name_attr = opsgenie_conn_id[source]
default_conn_name = opsgenie_default[source]
conn_type = opsgenie[source]
hook_name = Opsgenie[source]
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)[source]

Close an alert in Opsgenie

Parameters
Returns

SuccessResponse If the method is called asynchronously, returns the request thread.

Return type

opsgenie_sdk.SuccessResponse

delete_alert(self, 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 (Optional[str]) -- Type of the identifier that is provided as an in-line parameter. Possible values are 'id', 'alias' or 'tiny'

  • user (Optional[str]) -- Display name of the request owner.

  • source (Optional[str]) -- Display name of the request source

Returns

SuccessResponse

Return type

opsgenie_sdk.SuccessResponse

Was this entry helpful?