git.iko.soy/typeable/pagerduty
on develop help sign in
Adding OnCall for EscalationPolicies and Users APIs
e35cc26Brendan Hay
pagerduty.cabal+1−3
@@ -37,7 +37,6 @@ library
37 -- , Network.PagerDuty.REST.Alerts
37 -- , Network.PagerDuty.REST.Alerts
38 -- , Network.PagerDuty.REST.EscalationPolicies
38 -- , Network.PagerDuty.REST.EscalationPolicies
39-- , Network.PagerDuty.REST.EscalationPolicies.EscalationRules
39-- , Network.PagerDuty.REST.EscalationPolicies.EscalationRules
40−-- , Network.PagerDuty.REST.EscalationPolicies.OnCall
41 -- , Network.PagerDuty.REST.Incidents
40 -- , Network.PagerDuty.REST.Incidents
42 -- , Network.PagerDuty.REST.Incidents.Notes
41 -- , Network.PagerDuty.REST.Incidents.Notes
43 -- , Network.PagerDuty.REST.LogEntries
42 -- , Network.PagerDuty.REST.LogEntries
@@ -47,10 +46,9 @@ library
47-- , Network.PagerDuty.REST.Schedules.Overrides
46-- , Network.PagerDuty.REST.Schedules.Overrides
48 -- , Network.PagerDuty.REST.Services
47 -- , Network.PagerDuty.REST.Services
49-- , Network.PagerDuty.REST.Services.EmailFilters
48-- , Network.PagerDuty.REST.Services.EmailFilters
50− , Network.PagerDuty.REST.Users
49+-- , Network.PagerDuty.REST.Users
51 , Network.PagerDuty.REST.Users.ContactMethods
50 , Network.PagerDuty.REST.Users.ContactMethods
52 , Network.PagerDuty.REST.Users.NotificationRules
51 , Network.PagerDuty.REST.Users.NotificationRules
53− , Network.PagerDuty.REST.Users.OnCall
54 , Network.PagerDuty.REST.Webhooks
52 , Network.PagerDuty.REST.Webhooks
55
53
56 other-modules:
54 other-modules:
src/Network/PagerDuty/REST/EscalationPolicies.hs+14
@@ -23,6 +23,9 @@ module Network.PagerDuty.REST.EscalationPolicies
23 , listPolicies
23 , listPolicies
24 , lpQuery
24 , lpQuery
25
25
26+ -- * List On Call Policies
27+ , listOnCallPolicies
28+
26 -- * Create Policy
29 -- * Create Policy
27 , CreatePolicy
30 , CreatePolicy
28 , createPolicy
31 , createPolicy
@@ -123,6 +126,17 @@ listPolicies =
123 } & path .~ policies
126 } & path .~ policies
124 & unwrap .~ key "escalation_policies"
127 & unwrap .~ key "escalation_policies"
125
128
129+-- | List all the existing escalation policies with currently on-call users.
130+--
131+-- If the start and end of an on-call object are null, then the user is always
132+-- on-call for an escalation policy level.
133+--
134+-- @GET \/escalation_policies\/on_call@
135+--
136+-- /See:/ <http://developer.pagerduty.com/documentation/rest/escalation_policies/on_call>
137+listOnCallPolicies :: Request ListPolicies s [Policy]
138+listOnCallPolicies = listPolicies & path .~ policies % "on_call"
139+
126data CreatePolicy = CreatePolicy
140data CreatePolicy = CreatePolicy
127 { _cpName' :: Text
141 { _cpName' :: Text
128 , _cpRepeatEnabled' :: Bool'
142 , _cpRepeatEnabled' :: Bool'
src/Network/PagerDuty/REST/EscalationPolicies/OnCall.hsdeleted−53
@@ -1,53 +0,0 @@
1−{-# LANGUAGE OverloadedStrings #-}
2−{-# LANGUAGE TemplateHaskell #-}
3−
4−-- Module : Network.PagerDuty.REST.EscalationPolicies.OnCall
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−-- | List escalation policies for currently on-call users.
15−module Network.PagerDuty.REST.EscalationPolicies.OnCall
16− ( ListOnCallPolicies
17− , listOnCallPolicies
18− , locpQuery
19− ) where
20−
21−import Control.Lens
22−import Data.Monoid
23−import Data.Text (Text)
24−import Data.Time
25−import Network.HTTP.Types
26−import Network.PagerDuty.TH
27−import Network.PagerDuty.Types
28−
29−newtype ListOnCallPolicies = ListOnCallPolicies
30− { _locpQuery :: Maybe Text
31− } deriving (Eq, Show)
32−
33−queryRequest ''ListOnCallPolicies
34−
35−instance Paginate ListOnCallPolicies
36−
37−-- | Filters the result, showing only the escalation policies whose names match
38−-- the query.
39−makeLens "_locpQuery" ''ListOnCallPolicies
40−
41−-- | List all the existing escalation policies with currently on-call users.
42−--
43−-- If the start and end of an on-call object are null, then the user is always
44−-- on-call for an escalation policy level.
45−--
46−-- @GET \/escalation_policies\/on_call@
47−--
48−-- /See:/ <http://developer.pagerduty.com/documentation/rest/escalation_policies/on_call>
49−listOnCallPolicies :: Request ListOnCallPolicies s [Policy]
50−listOnCallPolicies =
51− mk ListOnCallPolicies
52− { _locpQuery = Nothing
53− } & path .~ "policies"
src/Network/PagerDuty/REST/Users.hs+14
@@ -28,6 +28,9 @@ module Network.PagerDuty.REST.Users
28 , listUsers
28 , listUsers
29 , luQuery
29 , luQuery
30
30
31+ -- * List On Call Users
32+ , listOnCallUsers
33+
31 -- * Create User
34 -- * Create User
32 , CreateUser
35 , CreateUser
33 , createUser
36 , createUser
@@ -232,6 +235,17 @@ listUsers =
232 } & path .~ users
235 } & path .~ users
233 & query .~ includes
236 & query .~ includes
234
237
238+-- | List all the existing escalation policies with currently on-call users.
239+--
240+-- If the start and end of an on-call object are null, then the user is always
241+-- on-call for an escalation policy level.
242+--
243+-- @GET \/escalation_policies\/on_call@
244+--
245+-- /See:/ <http://developer.pagerduty.com/documentation/rest/escalation_policies/on_call>
246+listOnCallUsers :: Request ListUsers s [User]
247+listOnCallUsers = listUsers & path .~ users % "on_call"
248+
235-- | Get information about an existing user.
249-- | Get information about an existing user.
236--
250--
237-- @GET \/users\/\:id@
251-- @GET \/users\/\:id@
src/Network/PagerDuty/REST/Users/OnCall.hsdeleted−34
@@ -1,34 +0,0 @@
1−{-# LANGUAGE OverloadedStrings #-}
2−{-# LANGUAGE TemplateHaskell #-}
3−
4−-- Module : Network.PagerDuty.REST.Users.OnCall
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−-- | List currently on-call users of your PagerDuty account, optionally
15−-- filtered by a search query.
16−--
17−-- If the start and end of an on-call object are null, then the user is always
18−-- on-call for an escalation policy level.
19−--
20−-- /See:/ <http://developer.pagerduty.com/documentation/rest/users/on_call>
21−module Network.PagerDuty.REST.Users.OnCall
22− (
23− ) where
24−
25−import Control.Lens
26−import Data.Monoid
27−import Data.Text (Text)
28−import Data.Time
29−import Network.HTTP.Types
30−import Network.PagerDuty.TH
31−import Network.PagerDuty.Types
32−
33−users :: Path
34−users = "users"