blob: 2b0d264051468740f9917438f7fea264c0d67540 [file] [log] [blame]
:py:mod:`airflow.providers.pagerduty.hooks.pagerduty_events`
============================================================
.. py:module:: airflow.providers.pagerduty.hooks.pagerduty_events
.. autoapi-nested-parse::
Hook for sending or receiving data from PagerDuty as well as creating PagerDuty incidents.
Module Contents
---------------
Classes
~~~~~~~
.. autoapisummary::
airflow.providers.pagerduty.hooks.pagerduty_events.PagerdutyEventsHook
.. py:class:: PagerdutyEventsHook(integration_key = None, pagerduty_events_conn_id = None)
Bases: :py:obj:`airflow.hooks.base.BaseHook`
This class can be used to interact with the Pagerduty Events API.
It takes both an Events API token and a PagerDuty connection with the Events API token
(i.e. Integration key) as the password/Pagerduty API token. If both supplied, the token will be used.
:param integration_key: PagerDuty Events API token
:param pagerduty_conn_id: connection that has PagerDuty integration key in the Pagerduty API token field
.. py:attribute:: conn_name_attr
:annotation: = pagerduty_events_conn_id
.. py:attribute:: default_conn_name
:annotation: = pagerduty_events_default
.. py:attribute:: conn_type
:annotation: = pagerduty_events
.. py:attribute:: hook_name
:annotation: = Pagerduty Events
.. py:method:: get_ui_field_behaviour()
:staticmethod:
Returns custom field behaviour
.. py:method:: create_event(summary, severity, source = 'airflow', action = 'trigger', dedup_key = None, custom_details = None, group = None, component = None, class_type = None, images = None, links = None)
Create event for service integration.
:param summary: Summary for the event
:param severity: Severity for the event, needs to be one of: info, warning, error, critical
:param source: Specific human-readable unique identifier, such as a
hostname, for the system having the problem.
:param action: Event action, needs to be one of: trigger, acknowledge,
resolve. Default to trigger if not specified.
:param dedup_key: A string which identifies the alert triggered for the given event.
Required for the actions acknowledge and resolve.
:param custom_details: Free-form details from the event. Can be a dictionary or a string.
If a dictionary is passed it will show up in PagerDuty as a table.
:param group: A cluster or grouping of sources. For example, sources
"prod-datapipe-02" and "prod-datapipe-03" might both be part of "prod-datapipe"
:param component: The part or component of the affected system that is broken.
:param class_type: The class/type of the event.
:param images: List of images to include. Each dictionary in the list accepts the following keys:
`src`: The source (URL) of the image being attached to the incident. This image must be served via
HTTPS.
`href`: [Optional] URL to make the image a clickable link.
`alt`: [Optional] Alternative text for the image.
:param links: List of links to include. Each dictionary in the list accepts the following keys:
`href`: URL of the link to be attached.
`text`: [Optional] Plain text that describes the purpose of the link, and can be used as the
link's text.
:return: PagerDuty Events API v2 response.
:rtype: dict