Module for manageing PagerDuty resource
This module can be used by specifying the name of a configuration profile in the minion config, minion pillar, or master config. The default configuration profile name is 'pagerduty.'
pagerduty: pagerduty.api_key: F3Rbyjbve43rfFWf2214 pagerduty.subdomain: mysubdomain
For PagerDuty API details, see https://developer.pagerduty.com/documentation/rest
create or update any pagerduty resource Helper method for present().
Determining if two resources are the same is different for different PD resource, so this method accepts a diff function. The diff function will be invoked as diff(state_information, object_returned_from_pagerduty), and should return a dict of data to pass to the PagerDuty update API method, or None if no update is to be performed. If no diff method is provided, the default behavor is to scan the keys in the state_information, comparing the matching values in the object_returned_from_pagerduty, and update any values that differ.
create_or_update_resource("user", ["id","name","email"]) create_or_update_resource("escalation_policies", ["id","name"], diff=my_diff_function)
delete any pagerduty resource
Helper method for absent()
delete_resource("users", key, ["id","name","email"]) # delete by id or name or email
List escalation_policies belonging to this account
salt myminion pagerduty.get_escalation_policies
Get any single pagerduty resource by key.
We allow flexible lookup by any of a list of identifier_fields. So, for example, you can look up users by email address or name by calling:
get_resource('users', key, ['name', 'email'], ...)
This method is mainly used to translate state sls into pagerduty id's for dependent objects. For example, a pagerduty escalation policy contains one or more schedules, which must be passed by their pagerduty id. We look up the schedules by name (using this method), and then translate the names into id's.
This method is implemented by getting all objects of the resource type (cached into __context__), then brute force searching through the list and trying to match any of the identifier_fields. The __context__ cache is purged after any create, update or delete to the resource.
List schedules belonging to this account
salt myminion pagerduty.get_schedules
List services belonging to this account
salt myminion pagerduty.get_services
List users belonging to this account
salt myminion pagerduty.get_users
Generic resource.absent state method. Pagerduty state modules should be a thin wrapper over this method, with a custom diff function.
This method calls delete_resource() and formats the result as a salt state return value.
Generic resource.present state method. Pagerduty state modules should be a thin wrapper over this method, with a custom diff function.
This method calls create_or_update_resource() and formats the result as a salt state return value.