git.iko.soy/typeable/pagerduty
on develop help sign in
Adding additional skeletons for REST API resources
commit0016b924c8b5e9e4751451cd7e672fd6a45aee80 authorBrendan Hay <brendan.g.hay@gmail.com> dateWed 1 Oct 2014, 09:24 (12 years ago) parent76aff7e
9 files changed+306−16
pagerduty.cabal+7−9 src/Control/Monad/Trans/PagerDuty.hs+6−7 src/Network/PagerDuty/REST/Incidents.hs+102 src/Network/PagerDuty/REST/LogEntries.hs+55 src/Network/PagerDuty/REST/MaintenanceWindows.hs+22 src/Network/PagerDuty/REST/Reports.hs+37 src/Network/PagerDuty/REST/Schedules.hs+24 src/Network/PagerDuty/REST/Users.hs+23 src/Network/PagerDuty/REST/Webhooks.hs+30
pagerduty.cabal+7−9
@@ -31,20 +31,18 @@ library
3131
3232 exposed-modules:
3333 Control.Monad.Trans.PagerDuty
34−
3534 , Network.PagerDuty.Integration
36−
3735 , Network.PagerDuty.REST
3836 , Network.PagerDuty.REST.Alerts
3937 , Network.PagerDuty.REST.EscalationPolicies
38+ , Network.PagerDuty.REST.Incidents
39+ , Network.PagerDuty.REST.LogEntries
40+ , Network.PagerDuty.REST.MaintenanceWindows
41+ , Network.PagerDuty.REST.Reports
42+ , Network.PagerDuty.REST.Schedules
4043 , Network.PagerDuty.REST.Services
41−
42− -- , Network.PagerDuty.Incidents
43− -- , Network.PagerDuty.Integration
44− -- , Network.PagerDuty.LogEntries
45− -- , Network.PagerDuty.Reports
46− -- , Network.PagerDuty.Schedules
47− -- , Network.PagerDuty.Users
44+ , Network.PagerDuty.REST.Users
45+ , Network.PagerDuty.REST.Webhooks
4846
4947 other-modules:
5048 Network.PagerDuty.IO
src/Control/Monad/Trans/PagerDuty.hs+6−7
@@ -22,9 +22,8 @@
2222module Control.Monad.Trans.PagerDuty
2323 (
2424 -- * Transformer
25− PDT
26− -- ** Aliases
27− , PD
25+ PD
26+ , PDT
2827
2928 -- * Run
3029 , runPDT
@@ -94,17 +93,17 @@ instance MonadBase b m => MonadBase b (PDT s m) where
9493 {-# INLINE liftBase #-}
9594
9695instance MonadTransControl (PDT s) where
97− newtype StT (PDT s) a = StTPD
98− { unStTPD :: StT (ExceptT Error) (StT (ReaderT (Env s)) a)
96+ newtype StT (PDT s) a = StTAWS
97+ { unStTAWS :: StT (ExceptT Error) (StT (ReaderT (Env s)) a)
9998 }
10099
101100 liftWith f = PDT $
102101 liftWith $ \g ->
103102 liftWith $ \h ->
104− f (liftM StTPD . h . g . unPDT)
103+ f (liftM StTAWS . h . g . unPDT)
105104 {-# INLINE liftWith #-}
106105
107− restoreT = PDT . restoreT . restoreT . liftM unStTPD
106+ restoreT = PDT . restoreT . restoreT . liftM unStTAWS
108107 {-# INLINE restoreT #-}
109108
110109instance MonadBaseControl b m => MonadBaseControl b (PDT s m) where
src/Network/PagerDuty/REST/Incidents.hsnew file+102
@@ -0,0 +1,102 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE TemplateHaskell #-}
3+
4+-- Module : Network.PagerDuty.REST.Incidents
5+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
6+-- License : This Source Code Form is subject to the terms of
7+-- the Mozilla Public License, v. 2.0.
8+-- A copy of the MPL can be found in the LICENSE file or
9+-- you can obtain it at http://mozilla.org/MPL/2.0/.
10+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
11+-- Stability : experimental
12+-- Portability : non-portable (GHC extensions)
13+
14+-- | PagerDuty receives updates (called events) from monitoring systems through
15+-- services (like Nagios, email or generic API calls). Upon receiving an event,
16+-- active services will create a new incident and begin escalating it as
17+-- defined by the service's escalation policy. Events can be de-duplicated into
18+-- existing incidents based on service de-duplication rules to prevent you from
19+-- being overwhelmed by event storms.
20+--
21+-- An incident can be open, acknowledged or resolved. Whenever an incident is
22+-- created, it is assigned to a user (according to the escalation process, as
23+-- described by escalation rules and schedules). The assigned user has a chance
24+-- to either acknowledge that he is working on it, or to resolve it.
25+--
26+-- Resolving an incident closes it, whereas acknowledging it halts the
27+-- escalation process. If the incident is not resolved by the service's
28+-- incident ack timeout it continues up the escalation chain.
29+--
30+-- When an incident is triggered or when it is escalated it creates alerts
31+-- (also known as notifications). Alerts are messages containing the details of
32+-- the incident, and can be sent through SMS, email and phone calls.
33+--
34+-- Incidents and Incident Counts from the last 30 days are returned by
35+-- default. To change this default date range, see the documentation for the
36+-- since, until or date_range parameters.
37+--
38+-- Note: that to create an incident you need to trigger it through the
39+-- "Network.PagerDuty.Integration" API.
40+module Network.PagerDuty.REST.Incidents
41+ (
42+
43+ ) where
44+
45+incidents :: Path
46+incidents = "incidents"
47+
48+-- | The PagerDuty incidents query API can be used to query current and
49+-- historical PagerDuty incidents over a date range, letting you build custom
50+-- dashboards or incident reports. The API allows for searching for incidents
51+-- with multiple filters or query parameters, various sorts, and also supports
52+-- the pagination of results.
53+--
54+-- @GET \/incidents@
55+--
56+-- See: <http://developer.pagerduty.com/documentation/rest/incidents/list>
57+listIncidents = undefined
58+
59+-- | Get detailed information about an incident. Accepts either an incident id,
60+-- or an incident number.
61+--
62+-- @GET \/incidents\/\:id@
63+--
64+-- See: <http://developer.pagerduty.com/documentation/rest/incidents/show>
65+getIncident = undefined
66+
67+-- | Use this query if you are simply looking for the count of incidents that
68+-- match a given query. This should be used if you don't need access to the
69+-- actual incident details.
70+--
71+-- @GET \/incidents\/count@
72+--
73+-- See: <http://developer.pagerduty.com/documentation/rest/incidents/count>
74+countIncidents = undefined
75+
76+-- | Acknowledge, resolve, escalate or reassign one or more incidents.
77+--
78+-- @PUT \/incidents@
79+--
80+-- See: <http://developer.pagerduty.com/documentation/rest/incidents/update>
81+updateIncidents = undefined
82+
83+-- | Resolve an incident.
84+--
85+-- @PUT \/incidents\/\:id\/resolve@
86+--
87+-- See: <http://developer.pagerduty.com/documentation/rest/incidents/resolve>
88+resolveIncident = undefined
89+
90+-- | Acknowledge an incident.
91+--
92+-- @PUT \/incidents\/\:id\/acknowledge@
93+--
94+-- See: <http://developer.pagerduty.com/documentation/rest/incidents/acknowledge>
95+acknowledgeIncident = undefined
96+
97+-- | Reassign an incident.
98+--
99+-- @PUT \/incidents\/\:id\/reassign@
100+--
101+-- See: <http://developer.pagerduty.com/documentation/rest/incidents/reassign>
102+reassignIncident = undefined
src/Network/PagerDuty/REST/LogEntries.hsnew file+55
@@ -0,0 +1,55 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE TemplateHaskell #-}
3+
4+-- Module : Network.PagerDuty.REST.LogEntries
5+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
6+-- License : This Source Code Form is subject to the terms of
7+-- the Mozilla Public License, v. 2.0.
8+-- A copy of the MPL can be found in the LICENSE file or
9+-- you can obtain it at http://mozilla.org/MPL/2.0/.
10+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
11+-- Stability : experimental
12+-- Portability : non-portable (GHC extensions)
13+
14+-- | PagerDuty keeps a log of all the events that happen to an incident. The
15+-- following APIs provide fine-grained access to this incident log entry data to
16+-- give you more insight into how your team or organization is handling your
17+-- incidents. Log entry data includes details about the event(s) that triggered
18+-- the incident, who was notified and when, how they were notified, and who
19+-- acknowledged or resolved it, amongst a few other things.
20+module Network.PagerDuty.REST.LogEntries
21+ (
22+
23+ ) where
24+
25+logs :: Path
26+logs = "log_entries"
27+
28+-- | List all incident log entries across the entire account.
29+--
30+-- @GET \/log_entries@
31+--
32+-- See: <http://developer.pagerduty.com/documentation/rest/log_entries/list>
33+listLogs = undefined
34+
35+-- | List all incident log entries that describe interactions with a specific user.
36+--
37+-- @GET \/users\/\:user_id\/log_entries@
38+--
39+-- See: <http://developer.pagerduty.com/documentation/rest/log_entries/user_log_entries>
40+listUserLogs = undefined
41+
42+-- | List all incident log entries for a specific incident.
43+--
44+-- @GET \/incidents\/\:incident_id\/log_entries@
45+--
46+-- See: <http://developer.pagerduty.com/documentation/rest/log_entries/incident_log_entries>
47+listIncidentLogs = undefined
48+
49+-- | Get details for a specific incident log entry. This method provides additional
50+-- information you can use to get at raw event data.
51+--
52+-- @GET \/log_entries\/\:id@
53+--
54+-- See: <http://developer.pagerduty.com/documentation/rest/log_entries/show>
55+getLog = undefined
src/Network/PagerDuty/REST/MaintenanceWindows.hsnew file+22
@@ -0,0 +1,22 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE TemplateHaskell #-}
3+
4+-- Module : Network.PagerDuty.REST.MaintenanceWindows
5+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
6+-- License : This Source Code Form is subject to the terms of
7+-- the Mozilla Public License, v. 2.0.
8+-- A copy of the MPL can be found in the LICENSE file or
9+-- you can obtain it at http://mozilla.org/MPL/2.0/.
10+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
11+-- Stability : experimental
12+-- Portability : non-portable (GHC extensions)
13+
14+-- | Maintenance windows allow you to schedule service maintenance periods,
15+-- during which no incidents will be created.
16+module Network.PagerDuty.REST.MaintenanceWindows
17+ (
18+
19+ ) where
20+
21+maintenance :: Path
22+maintenance = "maintenance_windows"
src/Network/PagerDuty/REST/Reports.hsnew file+37
@@ -0,0 +1,37 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE TemplateHaskell #-}
3+
4+-- Module : Network.PagerDuty.REST.Reports
5+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
6+-- License : This Source Code Form is subject to the terms of
7+-- the Mozilla Public License, v. 2.0.
8+-- A copy of the MPL can be found in the LICENSE file or
9+-- you can obtain it at http://mozilla.org/MPL/2.0/.
10+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
11+-- Stability : experimental
12+-- Portability : non-portable (GHC extensions)
13+
14+-- | Access high level reports about alerts and incidents. Useful for creating graphs.
15+module Network.PagerDuty.REST.Reports
16+ (
17+
18+ ) where
19+
20+reports :: Path
21+reports = "reports"
22+
23+-- | Get high level statistics about the number of alerts (SMSes, phone calls and
24+-- emails) sent for the desired time period, summed daily, weekly or monthly.
25+--
26+-- @GET \/reports\/alerts_per_time@
27+--
28+-- See: <http://developer.pagerduty.com/documentation/rest/reports/alerts_per_time>
29+alertsPerTime = undefined
30+
31+-- | Get high level statistics about the number of incidents created for the desired
32+-- time period, summed daily, weekly or monthly.
33+--
34+-- @GET \/reports\/incidents_per_time@
35+--
36+-- See: <http://developer.pagerduty.com/documentation/rest/reports/incidents_per_time>
37+incidentsPerTime = undefined
src/Network/PagerDuty/REST/Schedules.hsnew file+24
@@ -0,0 +1,24 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE TemplateHaskell #-}
3+
4+-- Module : Network.PagerDuty.REST.Schedules
5+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
6+-- License : This Source Code Form is subject to the terms of
7+-- the Mozilla Public License, v. 2.0.
8+-- A copy of the MPL can be found in the LICENSE file or
9+-- you can obtain it at http://mozilla.org/MPL/2.0/.
10+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
11+-- Stability : experimental
12+-- Portability : non-portable (GHC extensions)
13+
14+-- | On call schedules determine the time periods that users are on-call. Only when
15+-- a user is on-call he is eligible to receive alerts from incidents.
16+--
17+-- This API allows users to manipulate on-call schedules.
18+module Network.PagerDuty.REST.Schedules
19+ (
20+
21+ ) where
22+
23+schedules :: Path
24+schedules = "schedules"
src/Network/PagerDuty/REST/Users.hsnew file+23
@@ -0,0 +1,23 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE TemplateHaskell #-}
3+
4+-- Module : Network.PagerDuty.REST.Users
5+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
6+-- License : This Source Code Form is subject to the terms of
7+-- the Mozilla Public License, v. 2.0.
8+-- A copy of the MPL can be found in the LICENSE file or
9+-- you can obtain it at http://mozilla.org/MPL/2.0/.
10+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
11+-- Stability : experimental
12+-- Portability : non-portable (GHC extensions)
13+
14+-- | Access and manipulate user data for your PagerDuty account. When a user is
15+-- shown inlined in other resources, a deleted user will have its @html_url@ attribute
16+-- set to null.
17+module Network.PagerDuty.REST.Users
18+ (
19+
20+ ) where
21+
22+users :: Path
23+users = "users"
src/Network/PagerDuty/REST/Webhooks.hsnew file+30
@@ -0,0 +1,30 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE TemplateHaskell #-}
3+
4+-- Module : Network.PagerDuty.REST.Webhooks
5+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
6+-- License : This Source Code Form is subject to the terms of
7+-- the Mozilla Public License, v. 2.0.
8+-- A copy of the MPL can be found in the LICENSE file or
9+-- you can obtain it at http://mozilla.org/MPL/2.0/.
10+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
11+-- Stability : experimental
12+-- Portability : non-portable (GHC extensions)
13+
14+-- | Webhooks let you recieve HTTP callbacks when interesting events happen within
15+-- your PagerDuty account. Details surrounding the interesting event will be sent
16+-- via HTTP to a URL that you specify.
17+--
18+-- PagerDuty currently supports incident-based webhooks. After adding a webhook
19+-- URL to a PagerDuty service, the triggering of new incidents on that service
20+-- will cause outgoing webhook messages to be sent to that URL. In addition,
21+-- certain interesting changes to an incident's state will cause other types of
22+-- incident webhook messages to be sent: Generally, any change to the @status@ or
23+-- @assigned_to_user@ of an incident will cause an outgoing message to be sent.
24+module Network.PagerDuty.REST.Webhooks
25+ (
26+
27+ ) where
28+
29+-- Just create the types + fromJSON instances
30+decodeWebhook = undefined