Safe Haskell | None |
---|---|
Language | Haskell2010 |
PagerDuty receives updates (called events) from monitoring systems through services (like Nagios, email or generic API calls). Upon receiving an event, active services will create a new incident and begin escalating it as defined by the service's escalation policy. Events can be de-duplicated into existing incidents based on service de-duplication rules to prevent you from being overwhelmed by event storms.
An incident can be open, acknowledged or resolved. Whenever an incident is created, it is assigned to a user (according to the escalation process, as described by escalation rules and schedules). The assigned user has a chance to either acknowledge that he is working on it, or to resolve it.
Resolving an incident closes it, whereas acknowledging it halts the escalation process. If the incident is not resolved by the service's incident ack timeout it continues up the escalation chain.
When an incident is triggered or when it is escalated it creates alerts (also known as notifications). Alerts are messages containing the details of the incident, and can be sent through SMS, email and phone calls.
Incidents and Incident Counts from the last 30 days are returned by default. To change this default date range, see the documentation for the since, until or dateRange parameters.
Note: that to create an incident you need to trigger it through the Network.PagerDuty.Integration API.
See: http://developer.pagerduty.com/documentation/rest/incidents
- data ListIncidents
- listIncidents :: Request ListIncidents s [Incident]
- lsSince :: Lens' (Request ListIncidents s b) (Maybe UTCTime)
- lsUntil :: Lens' (Request ListIncidents s b) (Maybe UTCTime)
- lsDateRange :: Lens' (Request ListIncidents s b) Bool
- lsStatus :: Lens' (Request ListIncidents s b) (Maybe [IncidentStatus])
- lsIncidentKey :: Lens' (Request ListIncidents s b) (Maybe IncidentKey)
- lsService :: Lens' (Request ListIncidents s b) (Maybe [ServiceId])
- lsAssignedToUser :: Lens' (Request ListIncidents s b) (Maybe [UserId])
- lsTimeZone :: Lens' (Request ListIncidents s b) TimeZone
- lsSortBy :: Lens' (Request ListIncidents s b) (Maybe (Sort Field))
- data CountIncidents
- countIncidents :: Request CountIncidents s Count
- cSince :: Lens' (Request CountIncidents s b) (Maybe UTCTime)
- cUntil :: Lens' (Request CountIncidents s b) (Maybe UTCTime)
- cDateRange :: Lens' (Request CountIncidents s b) Bool
- cStatus :: Lens' (Request CountIncidents s b) (Maybe [IncidentStatus])
- cIncidentKey :: Lens' (Request CountIncidents s b) (Maybe IncidentKey)
- cService :: Lens' (Request CountIncidents s b) (Maybe [ServiceId])
- cAssignedToUser :: Lens' (Request CountIncidents s b) (Maybe [UserId])
- getIncident :: IncidentId -> Request Empty s Incident
- data UpdateIncidents
- updateIncidents :: RequesterId -> Request UpdateIncidents s [UpdatedIncidents]
- updateIncidentsBasic :: Request UpdateIncidents Basic [UpdatedIncidents]
- uiIncidents :: Lens' (Request UpdateIncidents s b) [UpdateIncident]
- resolveIncident :: IncidentId -> RequesterId -> Request Empty s Empty
- resolveIncidentBasic :: IncidentId -> Request Empty s Empty
- acknowledgeIncident :: IncidentId -> RequesterId -> Request Empty s Empty
- acknowledgeIncidentBasic :: IncidentId -> Request Empty s Empty
- data ReassignIncident
- reassignIncident :: IncidentId -> RequesterId -> Request ReassignIncident s Empty
- riEscalationPolicy :: Lens' (Request ReassignIncident s b) (Maybe EscalationPolicyId)
- riEscalationLevel :: Lens' (Request ReassignIncident s b) (Maybe Int)
- riAssignedToUser :: Lens' (Request ReassignIncident s b) (Maybe [UserId])
- data Sort a
- _Desc :: forall a. Prism' (Sort a) a
- _Asc :: forall a. Prism' (Sort a) a
- data Field
- data IncidentStatus
- = ITriggered
- | IAcknowledged
- | IResolved
- | IOther Text
- data UpdateStatus
- data UpdateIncident
- iiId :: Lens' UpdateIncident IncidentId
- iiStatus :: Lens' UpdateIncident (Maybe UpdateStatus)
- iiEscalationLevel :: Lens' UpdateIncident (Maybe Int)
- iiEscalationPolicy :: Lens' UpdateIncident (Maybe EscalationPolicyId)
- iiAssignedToUser :: Lens' UpdateIncident (Maybe (CSV UserId))
- data UpdatedIncidents
- uiId :: Lens' UpdatedIncidents IncidentId
- uiStatus :: Lens' UpdatedIncidents IncidentStatus
- uiIncidentNumber :: Lens' UpdatedIncidents Int
- uiUrl :: Lens' UpdatedIncidents Text
- uiError :: Lens' UpdatedIncidents (Maybe Object)
- data Assignee
- aAt :: Lens' Assignee Date
- aObject :: Lens' Assignee Object
- class HasIncident a where
- incident :: Lens' a Incident
- iIncidentNumber :: Lens' a Int
- iStatus :: Lens' a IncidentStatus
- iCreatedOn :: Lens' a UTCTime
- iHtmlUrl :: Lens' a Text
- iIncidentKey :: Lens' a (Maybe IncidentKey)
- iService :: Lens' a Object
- iEscalationPolicy :: Lens' a (Maybe Object)
- iAssignedTo :: Lens' a [Assignee]
- iAcknowledgers :: Lens' a [Assignee]
- iLastStatusChangeBy :: Lens' a (Maybe Assignee)
- iLastStatusChangeOn :: Lens' a (Maybe UTCTime)
- iTriggerSummaryData :: Lens' a Object
- iTriggerDetailsHtmlUrl :: Lens' a Text
- data Incident
List Incidents
data ListIncidents
Eq ListIncidents | |
Show ListIncidents | |
ToJSON ListIncidents | |
HasDatatypeInfo ListIncidents | |
Generic ListIncidents | |
QueryLike ListIncidents | |
Paginate ListIncidents | |
type Code ListIncidents |
listIncidents :: Request ListIncidents s [Incident]
The PagerDuty incidents query API can be used to query current and historical PagerDuty incidents over a date range, letting you build custom dashboards or incident reports. The API allows for searching for incidents with multiple filters or query parameters, various sorts, and also supports the pagination of results.
GET /incidents
See: http://developer.pagerduty.com/documentation/rest/incidents/list
lsSince :: Lens' (Request ListIncidents s b) (Maybe UTCTime)
The start of the date range over which you want to search.
lsUntil :: Lens' (Request ListIncidents s b) (Maybe UTCTime)
The end of the date range over which you want to search.
/Note: If you leave off either since or until, a 30 day default range is applied to your open ended range. Not including the since parameter will set the date range to until - 30 days. Likewise, if you leave off until, it is set to since + 30 days.
Defaults to the last 30 days if you leave off both. The size of the date range must be less than 180 days.
lsDateRange :: Lens' (Request ListIncidents s b) Bool
When set, the since and until parameters and defaults are ignored. Use this to get all incidents since the account was created.
lsStatus :: Lens' (Request ListIncidents s b) (Maybe [IncidentStatus])
Returns only the incidents currently in the passed status(es).
lsIncidentKey :: Lens' (Request ListIncidents s b) (Maybe IncidentKey)
Returns only the incidents with the passed de-duplication key.
lsService :: Lens' (Request ListIncidents s b) (Maybe [ServiceId])
Returns only the incidents associated with the passed service(s). This expects one or more service IDs.
lsAssignedToUser :: Lens' (Request ListIncidents s b) (Maybe [UserId])
Returns only the incidents currently assigned to the passed user(s). This expects one or more user IDs.
Note: When using the assignedToUser filter, you will only receive incidents with statuses of triggered or acknowledged. This is because resolved incidents are not assigned to any user.
lsTimeZone :: Lens' (Request ListIncidents s b) TimeZone
Time zone in which dates in the result will be rendered.
Default: UTC
.
lsSortBy :: Lens' (Request ListIncidents s b) (Maybe (Sort Field))
Used to specify both the field you wish to sort the results on, as well as the direction (ascending/descending) of the results.
Count Incidents
data CountIncidents
Eq CountIncidents | |
Show CountIncidents | |
ToJSON CountIncidents | |
HasDatatypeInfo CountIncidents | |
Generic CountIncidents | |
QueryLike CountIncidents | |
type Code CountIncidents |
countIncidents :: Request CountIncidents s Count
Use this query if you are simply looking for the count of incidents that match a given query. This should be used if you don't need access to the actual incident details.
GET /incidents/count
See: http://developer.pagerduty.com/documentation/rest/incidents/count
cSince :: Lens' (Request CountIncidents s b) (Maybe UTCTime)
The start of the date range over which you want to search.
cUntil :: Lens' (Request CountIncidents s b) (Maybe UTCTime)
The end of the date range over which you want to search.
Note: If you leave off either since or until, a 30 day default range is
applied to your open ended range. Not including the since parameter will set
the date range to until -30
days. Likewise, if you leave off until,
it is set to since +30
days.
Default: The last 30 days if you leave off both. The size of the date range must be less than 180 days.
cDateRange :: Lens' (Request CountIncidents s b) Bool
When set, the since and until parameters and defaults are ignored. Use this to get all counts since the account was created.
cStatus :: Lens' (Request CountIncidents s b) (Maybe [IncidentStatus])
Only counts the incidents currently in the passed status(es).
cIncidentKey :: Lens' (Request CountIncidents s b) (Maybe IncidentKey)
Returns only the incidents with the passed de-duplication key.
cService :: Lens' (Request CountIncidents s b) (Maybe [ServiceId])
Only counts the incidents associated with the passed service(s). This is expecting one or more service IDs.
cAssignedToUser :: Lens' (Request CountIncidents s b) (Maybe [UserId])
Only counts the incidents currently assigned to the passed user(s). This is expecting one or more user IDs.
Note: When using the assigned_to_user filter, you will only count incidents with statuses of triggered or acknowledged. This is because resolved incidents are not assigned to any user.
Get Incident
getIncident :: IncidentId -> Request Empty s Incident
Get detailed information about an incident. Accepts either an incident id, or an incident number.
GET /incidents/:id
See: http://developer.pagerduty.com/documentation/rest/incidents/show
Update Incidents
data UpdateIncidents
Eq UpdateIncidents | |
Show UpdateIncidents | |
ToJSON UpdateIncidents | |
FromJSON UpdateIncidents | |
QueryLike UpdateIncidents |
updateIncidents :: RequesterId -> Request UpdateIncidents s [UpdatedIncidents]
Acknowledge, resolve, escalate or reassign one or more incidents.
PUT /incidents
See: http://developer.pagerduty.com/documentation/rest/incidents/update
updateIncidentsBasic :: Request UpdateIncidents Basic [UpdatedIncidents]
A version of updateIncidents
which uses HTTP Basic authentication and
doesn't require a RequesterId
.
uiIncidents :: Lens' (Request UpdateIncidents s b) [UpdateIncident]
Resolve Incident
resolveIncident :: IncidentId -> RequesterId -> Request Empty s Empty
Resolve an incident.
PUT /incidents/:id/resolve
See: http://developer.pagerduty.com/documentation/rest/incidents/resolve
resolveIncidentBasic :: IncidentId -> Request Empty s Empty
A version of resolveIncident
which uses HTTP Basic authentication and
doesn't require a RequesterId
.
Acknowledge Incident
acknowledgeIncident :: IncidentId -> RequesterId -> Request Empty s Empty
Acknowledge an incident.
PUT /incidents/:id/acknowledge
See: http://developer.pagerduty.com/documentation/rest/incidents/acknowledge
acknowledgeIncidentBasic :: IncidentId -> Request Empty s Empty
A version of acknowledgeIncident
which uses HTTP Basic authentication and
doesn't require a RequesterId
.
Reassign Incident
data ReassignIncident
Eq ReassignIncident | |
Show ReassignIncident | |
ToJSON ReassignIncident | |
FromJSON ReassignIncident | |
QueryLike ReassignIncident |
reassignIncident :: IncidentId -> RequesterId -> Request ReassignIncident s Empty
Reassign an incident.
PUT /incidents/:id/reassign
See: http://developer.pagerduty.com/documentation/rest/incidents/reassign
riEscalationPolicy :: Lens' (Request ReassignIncident s b) (Maybe EscalationPolicyId)
The ID of an escalation policy. Delegate the incident to this escalation policy.
riEscalationLevel :: Lens' (Request ReassignIncident s b) (Maybe Int)
Escalate incident to this level in the escalation policy.
riAssignedToUser :: Lens' (Request ReassignIncident s b) (Maybe [UserId])
Comma separated list of user IDs to assign this incident to.
Types
data Field
IncidentNumber | The number of your incident. |
CreatedOn | The date/time the incident was triggered. |
ResolvedOn | The date/time the incident was resolved. |
data IncidentStatus
Eq IncidentStatus | |
Show IncidentStatus | |
ToJSON IncidentStatus | |
FromJSON IncidentStatus | |
ToByteString IncidentStatus |
data UpdateStatus
Eq UpdateStatus | |
Show UpdateStatus | |
ToJSON UpdateStatus | |
FromJSON UpdateStatus |
data UpdateIncident
Eq UpdateIncident | |
Show UpdateIncident | |
ToJSON UpdateIncident | |
FromJSON UpdateIncident |
iiId :: Lens' UpdateIncident IncidentId
The id of the incident to update.
iiStatus :: Lens' UpdateIncident (Maybe UpdateStatus)
The new status of the incident.
iiEscalationLevel :: Lens' UpdateIncident (Maybe Int)
Escalate incident to this level in the escalation policy.
iiEscalationPolicy :: Lens' UpdateIncident (Maybe EscalationPolicyId)
Delegate this incident to the specified escalation policy id. This restarts the incident's escalation following the new policy.
iiAssignedToUser :: Lens' UpdateIncident (Maybe (CSV UserId))
List of user IDs to assign this incident to.
data UpdatedIncidents
Eq UpdatedIncidents | |
Show UpdatedIncidents | |
ToJSON UpdatedIncidents | |
FromJSON UpdatedIncidents |
uiId :: Lens' UpdatedIncidents IncidentId
uiStatus :: Lens' UpdatedIncidents IncidentStatus
uiIncidentNumber :: Lens' UpdatedIncidents Int
uiUrl :: Lens' UpdatedIncidents Text
uiError :: Lens' UpdatedIncidents (Maybe Object)
class HasIncident a where
iIncidentNumber :: Lens' a Int
The number of the incident. This is unique across your account.
iStatus :: Lens' a IncidentStatus
The current status of the incident. Valid statuses are:
iCreatedOn :: Lens' a UTCTime
The date/time the incident was triggered.
iHtmlUrl :: Lens' a Text
The PagerDuty website URL where the incident can be viewed and further actions taken. This is not the resource URL.
iIncidentKey :: Lens' a (Maybe IncidentKey)
The incident's de-duplication key. See the PagerDuty Integration API docs for further details.
iService :: Lens' a Object
The PagerDuty service that the incident belongs to. The service will contain fields of its own.
iEscalationPolicy :: Lens' a (Maybe Object)
The escalation policy that the incident belongs to. The policy will contain fields of its own.
iAssignedTo :: Lens' a [Assignee]
The list of assignments of the incident. An assignment is an object containing the assigned user as well as the date/time the incident was assigned to that user. The user will contain fields of its own. This list is empty if the status of the incident is resolved.
iAcknowledgers :: Lens' a [Assignee]
The list of acknowledgements of the incident. An acknowledgement is an object containing the acknowleding object (either a user or the integration API) as well as the date/time the incident was acknowledged. This field is only present if the status of the incident is acknowledged. This field is sorted in ascending order by acknowledgement time.
iLastStatusChangeBy :: Lens' a (Maybe Assignee)
The user who is responsible for the incident's last status change. If the incident is in the acknowledged or resolved status, this will be the user that took the first acknowledged or resolved action. If the incident was automatically resolved (say through the Event Integration API), or if the incident is in the triggered state, this will be null. User fields are the same as in the assignedToUser field above.
iLastStatusChangeOn :: Lens' a (Maybe UTCTime)
The date/time the incident's status last changed.
iTriggerSummaryData :: Lens' a Object
Some condensed information regarding the initial event that triggered this incident. This data will be a set of key/value pairs that vary depending on what sort of event triggered the incident (email, Event API request, etc). For instance, if an email triggered the incident, then the triggerSummaryData will likely contain a subject. There are no guarantees o nthe full presence of this data for every incident.
iTriggerDetailsHtmlUrl :: Lens' a Text
The PagerDuty website URL where the full details regarding the initial event that triggered this incident can be found. (This is not the resource URL.)