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

Safe HaskellNone
LanguageHaskell2010

Network.PagerDuty.Integration

Contents

Description

The PagerDuty event integration API is how you would add PagerDuty's advanced alerting functionality to any system that can make an HTTP API call. You can now add phone, SMS and email alerting to your monitoring tools, ticketing systems and custom software.

The API was designed to allow you to easily integrate a monitoring system with a Service in PagerDuty. Monitoring systems generally send out events when problems are detected and when these problems have been resolved (fixed). Some more advanced systems also understand the concept of acknowledgements: problems can be acknowledged by an engineer to signal he or she is working on fixing the issue.

Since monitoring systems emit events, the API is based around accepting events. Incoming events (sent via the API) are routed to a PagerDuty service and processed. They may result in a new incident being created, or an existing incident being acknowledged or resolved.

The same event-based API can also be used to integrate a PagerDuty service with ticketing systems and various other software tools.

See: http://developer.pagerduty.com/documentation/integration/events

Synopsis

Sending events

submit :: MonadIO m => Manager -> Event -> m (Either Error Response)

Send an event to the integration API.

submitWith :: MonadIO m => Manager -> Logger -> Event -> m (Either Error Response)

See: submit

Trigger

trigger

Your monitoring tools should send PagerDuty a trigger event to report a new or ongoing problem. When PagerDuty receives a trigger event, it will either open a new incident, or add a new trigger log entry to an existing incident, depending on the provided incident_key.

client :: Lens' Trigger (Maybe Text)

The name of the monitoring client that is triggering this event.

clientUrl :: Lens' Trigger (Maybe Text)

The URL of the monitoring client that is triggering this event.

Acknowledge

acknowledge

Acknowledge events cause the referenced incident to enter the acknowledged state.

While an incident is acknowledged, it won't generate any additional notifications, even if it receives new trigger events. Your monitoring tools should send PagerDuty an acknowledge event when they know someone is presently working on the problem.

Resolve

resolve

Resolve events cause the referenced incident to enter the resolved state.

Once an incident is resolved, it won't generate any additional notifications. New trigger events with the same incident_key as a resolved incident won't re-open the incident. Instead, a new incident will be created. Your monitoring tools should send PagerDuty a resolve event when the problem that caused the initial trigger event has been fixed.

Fields

class HasServiceKey s a | s -> a where

Methods

serviceKey :: Lens' s a

The GUID of one of your "Generic API" services. This is the "service key" listed on a Generic API's service detail page.

class HasIncidentKey s a | s -> a where

Methods

incidentKey :: Lens' s a

Identifies the incident to which this trigger event should be applied. If there's no open (i.e. unresolved) incident with this key, a new one will be created. If there's already an open incident with a matching key, this event will be appended to that incident's log. The event key provides an easy way to "de-dup" problem reports. If this field isn't provided, PagerDuty will automatically open a new incident with a unique key.

class HasDescription s a | s -> a where

Methods

description :: Lens' s a

A short description of the problem that led to this trigger. This field (or a truncated version) will be used when generating phone calls, SMS messages and alert emails. It will also appear on the incidents tables in the PagerDuty UI. The maximum length is 1024 characters.

class HasDetails s a | s -> a where

Methods

details :: Lens' s a

An arbitrary JSON object containing any data you'd like included in the incident log.

Instances

Types

data Response

Instances

Eq Response 
Show Response 
ToJSON Response 
FromJSON Response 

rsStatus :: Lens' Response Text

success.

rsMessage :: Lens' Response Text

Event processed.

rsIncidentKey :: Lens' Response IncidentKey

The key of the incident that will be affected by the request.

Configuration

Environment

data Env s

The environment containing the parameters required to make PagerDuty requests.

Instances

Monad m => MonadReader (Env s) (PagerDutyT s m) 

envDomain :: forall s. Lens' (Env s) SubDomain

envAuth :: forall s s'. Lens (Env s) (Env s') (Auth s) (Auth s')

envManager :: forall s. Lens' (Env s) Manager

envLogger :: forall s. Lens' (Env s) Logger

Logging

data Logger

The log level and associated logger function.

Constructors

None 
Debug (Text -> IO ()) 

debug :: MonadIO m => Logger -> Text -> m ()

Log a message using the debug logger, or if none is specified noop.

Types

Requests

class Paginate a

Exists primarily to obtain a constraint for the paginate function.

data Request a s b

Instances

ToJSON (Request a s b) 
(QueryLike a, ToJSON a, HasUserInfo a) => HasUserInfo (Request a s b) 
(QueryLike a, ToJSON a, HasEmailFilterInfo a) => HasEmailFilterInfo (Request a s b) 

Errors

data Error

Instances

Eq Error 
Show Error 
FromJSON Error 
HasMessage Error Text 
Monad m => MonadError Error (PagerDutyT s m) 

_Internal :: Prism' Error Text

Messages

class HasMessage s a | s -> a where

Methods

message :: Lens' s a

A short human-readable message describing the error.

Fields

class HasErrors s a | s -> a where

Methods

errors :: Lens' s a

A list of human-readable reasons for the error. These values, and even their format, are subject to change.

Instances

Integration

status :: Lens' IntegrationError Text

REST

data Code

Instances

Eq Code 
Num Code 
Show Code 
ToJSON Code 
FromJSON Code 

code :: Lens' RESTError Code

In the case of an error, the PagerDuty error code can give further details on the nature of the error.

See: description

description :: Code -> Text

Authentication

data Security

Constructors

Basic 
Token 

Instances

data Auth a where

Instances

Eq (Auth a) 
Show (Auth a) 

Keys

mkKey :: Text -> Key a

Aliases

type ServiceKey = Key "service"

type IncidentKey = Key "incident"

Identifiers

data Id a

Instances

Eq (Id a) 
Show (Id a) 
IsString (Id a) 
ToJSON (Id a) 
FromJSON (Id a) 
ToByteString (Id a) 
QueryValueLike (Id a) 

mkId :: Text -> Id a

Aliases

type AlertId = Id "alert"

type ContactId = Id "contact"

type EmailFilterId = Id "email-filter"

type EscalationPolicyId = Id "escalation-policy"

type EscalationRuleId = Id "escalation-rule"

type IncidentId = Id "incident"

type LogEntryId = Id "log-entry"

type NoteId = Id "note"

type NotificationRuleId = Id "notification-rule"

type OverrideId = Id "schedule-override"

type RequesterId = Id "requester"

type ScheduleId = Id "schedule"

type ServiceId = Id "service"

type UserId = Id "user"

type VendorId = Id "vendor"

type WebhookId = Id "webhook"

type WindowId = Id "maintenance-window"

SubDomain

Address

data Address

Instances

Eq Address 
Show Address 
IsString Address 
ToJSON Address 
FromJSON Address 
ToByteString Address 

mkAddress :: Text -> Address

Miscellaneous

data Empty

Constructors

Empty 

Instances

ToJSON Empty 
FromJSON Empty 
QueryLike Empty