blob: d31570e0f05b4b788da362aeb370d64562e77e7e [file] [log] [blame]
:py:mod:`airflow.providers.opsgenie.hooks.opsgenie`
===================================================
.. py:module:: airflow.providers.opsgenie.hooks.opsgenie
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.opsgenie.hooks.opsgenie.OpsgenieAlertHook
.. py:class:: OpsgenieAlertHook(opsgenie_conn_id = 'opsgenie_default')
Bases: :py:obj:`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.
:param opsgenie_conn_id: The name of the Opsgenie connection to use
.. py:attribute:: conn_name_attr
:annotation: = opsgenie_conn_id
.. py:attribute:: default_conn_name
:annotation: = opsgenie_default
.. py:attribute:: conn_type
:annotation: = opsgenie
.. py:attribute:: hook_name
:annotation: = Opsgenie
.. py:method:: get_conn(self)
Get the underlying AlertApi client
:return: AlertApi client
:rtype: opsgenie_sdk.AlertApi
.. py:method:: create_alert(self, payload = None)
Create an alert on Opsgenie
:param payload: Opsgenie API Create Alert payload values
See https://docs.opsgenie.com/docs/alert-api#section-create-alert
:return: api response
:rtype: opsgenie_sdk.SuccessResponse
.. py:method:: close_alert(self, identifier, identifier_type = 'id', payload = None, **kwargs)
Close an alert in Opsgenie
:param identifier: Identifier of alert which could be alert id, tiny id or alert alias
:param identifier_type: Type of the identifier that is provided as an in-line parameter.
Possible values are 'id', 'alias' or 'tiny'
:param payload: Request payload of closing alert action.
see https://github.com/opsgenie/opsgenie-python-sdk/blob/master/docs/AlertApi.md#close_alert
:param kwargs: params to pass to the function
:return: SuccessResponse
If the method is called asynchronously,
returns the request thread.
:rtype: opsgenie_sdk.SuccessResponse
.. py:method:: delete_alert(self, identifier, identifier_type = None, user = None, source = None)
Delete an alert in Opsgenie
:param identifier: Identifier of alert which could be alert id, tiny id or alert alias.
:param identifier_type: Type of the identifier that is provided as an in-line parameter.
Possible values are 'id', 'alias' or 'tiny'
:param user: Display name of the request owner.
:param source: Display name of the request source
:return: SuccessResponse
:rtype: opsgenie_sdk.SuccessResponse