pagerduty-0.0.1.1: Client library for PagerDuty Integration and REST APIs.

Safe HaskellNone
LanguageHaskell2010

Network.PagerDuty.REST.Incidents

Contents

Description

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

Synopsis

List Incidents

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.

See: Network.PagerDuty.Integration

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

Instances

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.

See: Network.PagerDuty.Integration

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

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.

Resolve Incident

resolveIncidentBasic :: IncidentId -> Request Empty s Empty

A version of resolveIncident which uses HTTP Basic authentication and doesn't require a RequesterId.

Acknowledge Incident

acknowledgeIncidentBasic :: IncidentId -> Request Empty s Empty

A version of acknowledgeIncident which uses HTTP Basic authentication and doesn't require a RequesterId.

Reassign Incident

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 Sort a

Constructors

Desc a 
Asc a 

Instances

Eq a => Eq (Sort a) 
Show a => Show (Sort a) 

_Desc :: forall a. Prism' (Sort a) a

_Asc :: forall a. Prism' (Sort a) a

data Field

Constructors

IncidentNumber

The number of your incident.

CreatedOn

The date/time the incident was triggered.

ResolvedOn

The date/time the incident was resolved.

Instances

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.

uiUrl :: Lens' UpdatedIncidents Text

uiError :: Lens' UpdatedIncidents (Maybe Object)

data Assignee

Instances

Eq Assignee 
Show Assignee 
ToJSON Assignee 
FromJSON Assignee 

aAt :: Lens' Assignee Date

aObject :: Lens' Assignee Object

class HasIncident a where

Minimal complete definition

incident

Methods

incident :: Lens' a Incident

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.)