File manager - Edit - /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/__pycache__/pagerduty.cpython-310.pyc
Back
o ;j� � @ s� d Z ddlZddlZddlZdd� Zddd�Zddd�Zdd d �Zddd�Z dd d�Z ejj� e d�Zddd�Zejj� ed�Z ddd�ZdS )a� 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 minion config, minion pillar, or 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/modules/pagerduty.py�__virtual__ s r c C � t jjjddtd | �|td�S )z� List services belonging to this account CLI Example: .. code-block:: bash salt myminion 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: .. code-block:: bash salt myminion 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: .. code-block:: bash salt myminion pagerduty.list_users my-pagerduty-account Zusersr r r r r r r r � list_users= r r c C r )z� List schedules belonging to this account CLI Example: .. code-block:: bash salt myminion pagerduty.list_schedules my-pagerduty-account Z schedulesr r r r r r r r �list_schedulesL r r c C r )z� List maintenance windows belonging to this account CLI Example: .. code-block:: bash salt myminion pagerduty.list_windows my-pagerduty-account salt myminion pagerduty.list_maintenance_windows my-pagerduty-account Zmaintenance_windowsr r r r r r r r �list_windows[ � �r �list_maintenance_windowsc C r )z� List escalation policies belonging to this account CLI Example: .. code-block:: bash salt myminion pagerduty.list_policies my-pagerduty-account salt myminion pagerduty.list_escalation_policies my-pagerduty-account Zescalation_policiesr r r r r r r r � list_policiesu r r �list_escalation_policiesc C sj d}t |t�rtjj�|�}t |t�rd|i}tjj�tjjj dt d |�| | |d||d�|td��}|S )ae Create an event in PagerDuty. Designed for use in states. CLI Example: .. code-block:: yaml salt myminion 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"