File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/__pycache__/pagerduty.cpython-310.pyc
Back
o ;j� � @ s� d Z ddlZddlZddlZddlZdd� Zddd�Zddd�Zdd d �Z ddd�Z dd d�Zejj �ed�Zddd�Zejj �ed�Z ddd�ZdS )al Runner Module for Firing Events via PagerDuty .. versionadded:: 2014.1.0 :configuration: This module can be used by specifying the name of a configuration profile in the master config. For example: .. code-block:: yaml my-pagerduty-account: pagerduty.api_key: F3Rbyjbve43rfFWf2214 pagerduty.subdomain: mysubdomain � Nc C s dS )z> No dependencies outside of what Salt itself requires T� r r r �J/opt/saltstack/salt/lib/python3.10/site-packages/salt/runners/pagerduty.py�__virtual__ s r c C � t jjjddtd | �|td�S )z� List services belonging to this account CLI Example: salt-run pagerduty.list_services my-pagerduty-account Zservices�name� config.option��opts��salt�utils� pagerdutyZ list_items�__salt__�__opts__��profile�api_keyr r r � list_services � �r c C r )z� List incidents belonging to this account CLI Example: salt-run pagerduty.list_incidents my-pagerduty-account Z incidents�idr r r r r r r �list_incidents, r r c C r )z| List users belonging to this account CLI Example: salt-run pagerduty.list_users my-pagerduty-account Zusersr r r r r r r r � list_users9 r r c C r )z� List schedules belonging to this account CLI Example: salt-run pagerduty.list_schedules my-pagerduty-account Z schedulesr r r r r r r r �list_schedulesF r r c C r )z� List maintenance windows belonging to this account CLI Example: salt-run pagerduty.list_windows my-pagerduty-account salt-run pagerduty.list_maintenance_windows my-pagerduty-account Zmaintenance_windowsr r r r r r r r �list_windowsS � �r �list_maintenance_windowsc C r )z� List escalation policies belonging to this account CLI Example: salt-run pagerduty.list_policies my-pagerduty-account salt-run pagerduty.list_escalation_policies my-pagerduty-account Zescalation_policiesr r r r r r r r � list_policiesk r r �list_escalation_policiesc C sj d}t |t�rtjj�|�}t |t�rd|i}tjj�tjjj dt d |�| | |d||d�|td��}|S )a` Create an event in PagerDuty. Designed for use in states. CLI Example: .. code-block:: yaml salt-run pagerduty.create_event <service_key> <description> <details> profile=my-pagerduty-account The following parameters are required: service_key This key can be found by using pagerduty.list_services. description This is a short description of the event. details This can be a more detailed description of the event. profile This refers to the configuration profile to use to connect to the PagerDuty service. zAhttps://events.pagerduty.com/generic/2010-04-15/create_event.json�details�POSTr Ztrigger)�service_key�incident_keyZ event_type�descriptionr )�methodZprofile_dictr �data�urlr )� isinstance�strr r ZyamlZ safe_load�json�loadsr �queryr r )r r"