%PDF- %PDF-
Direktori : /lib/python2.7/site-packages/salt/states/ |
Current File : //lib/python2.7/site-packages/salt/states/pagerduty_service.pyo |
� ���^c @@ s\ d Z d d l m Z m Z m Z d � Z d d d d � Z d d d d � Z d � Z d S( u7 Manage PagerDuty services Escalation policies can be referenced by pagerduty ID or by namea. For example: .. code-block:: yaml ensure test service pagerduty_service.present: - name: 'my service' - escalation_policy_id: 'my escalation policy' - type: nagios i ( t absolute_importt print_functiont unicode_literalsc C@ s d t k r d St S( uD Only load if the pygerduty module is available in __salt__ u pagerduty_util.get_resourceu pagerduty_service( t __salt__t False( ( ( sA /usr/lib/python2.7/site-packages/salt/states/pagerduty_service.pyt __virtual__ s u pagerdutyc K@ s� | d | d d <| d d } t d d | d d g d | d | d | �} | ri | d | d d <n t d d d d g t | | | | � } | S( u� Ensure pagerduty service exists. This method accepts as arguments everything defined in https://developer.pagerduty.com/documentation/rest/services/create Note that many arguments are mutually exclusive, depending on the "type" argument. Examples: .. code-block:: yaml # create a PagerDuty email service at test-email@DOMAIN.pagerduty.com ensure generic email service exists: pagerduty_service.present: - name: my email service - service: description: "email service controlled by salt" escalation_policy_id: "my escalation policy" type: "generic_email" service_key: "test-email" .. code-block:: yaml # create a pagerduty service using cloudwatch integration ensure my cloudwatch service exists: pagerduty_service.present: - name: my cloudwatch service - service: escalation_policy_id: "my escalation policy" type: aws_cloudwatch description: "my cloudwatch service controlled by salt" u nameu serviceu escalation_policy_idu pagerduty_util.get_resourceu escalation_policiesu idt profilet subdomaint api_keyu pagerduty_util.resource_presentu services( R t _diff( R R R t kwargst escalation_policy_idt escalation_policyt r( ( sA /usr/lib/python2.7/site-packages/salt/states/pagerduty_service.pyt present s$ % c K@ s) t d d d d g | | | | � } | S( un Ensure a pagerduty service does not exist. Name can be the service name or pagerduty service id. u pagerduty_util.resource_absentu servicesu nameu id( R ( R R R R R ( ( sA /usr/lib/python2.7/site-packages/salt/states/pagerduty_service.pyt absentW s c C@ s� d } x� | d j � D]� \ } } | d k r@ | d d } nH | d k r~ | d } d | k r� | d | j d � !} q� n | | } | | k r d j | | | � } Pq q W| r� | Si Sd S( u� helper method to compare salt state info with the PagerDuty API json structure, and determine if we need to update. returns the dict to pass to the PD API to perform the update, or empty dict if no update. u serviceu escalation_policy_idu escalation_policyu idu service_keyu @i u {0} {1} {2}N( t Nonet itemst findt format( t state_datat resource_objectt objects_differt kt vt resource_value( ( sA /usr/lib/python2.7/site-packages/salt/states/pagerduty_service.pyR e s N( t __doc__t __future__R R R R R R R R ( ( ( sA /usr/lib/python2.7/site-packages/salt/states/pagerduty_service.pyt <module> s 9