Source code for saltext.pagerduty.states.pagerduty_user
"""Manage PagerDuty users.Example: .. code-block:: yaml ensure bruce test user 1: pagerduty.user_present: - name: 'Bruce TestUser1' - email: bruce+test1@lyft.com - requester_id: P1GV5NT"""
[docs]def__virtual__():""" Only load if the pygerduty module is available in __salt__ """if"pagerduty_util.get_resource"in__salt__:return"pagerduty_user"return(False,"pagerduty_util module could not be loaded")
[docs]defpresent(profile="pagerduty",subdomain=None,api_key=None,**kwargs):""" Ensure pagerduty user exists. Arguments match those supported by https://developer.pagerduty.com/documentation/rest/users/create. """return__salt__["pagerduty_util.resource_present"]("users",["email","name","id"],None,profile,subdomain,api_key,**kwargs)
[docs]defabsent(profile="pagerduty",subdomain=None,api_key=None,**kwargs):""" Ensure pagerduty user does not exist. Name can be pagerduty id, email address, or user name. """return__salt__["pagerduty_util.resource_absent"]("users",["email","name","id"],profile,subdomain,api_key,**kwargs)