git.iko.soy/typeable/pagerduty
on develop help sign in
Adding OnCall for EscalationPolicies and Users APIs
commite35cc2622b64b07d3ad51c58eed74926da07fb78 authorBrendan Hay <brendan.g.hay@gmail.com> dateTue 7 Oct 2014, 19:57 (12 years ago) parentd5ece24
5 files changed+29−90
pagerduty.cabal+1−3 src/Network/PagerDuty/REST/EscalationPolicies.hs+14 src/Network/PagerDuty/REST/EscalationPolicies/OnCall.hs−53 src/Network/PagerDuty/REST/Users.hs+14 src/Network/PagerDuty/REST/Users/OnCall.hs−34
pagerduty.cabal+1−3
@@ -37,7 +37,6 @@ library
3737 -- , Network.PagerDuty.REST.Alerts
3838 -- , Network.PagerDuty.REST.EscalationPolicies
3939-- , Network.PagerDuty.REST.EscalationPolicies.EscalationRules
40−-- , Network.PagerDuty.REST.EscalationPolicies.OnCall
4140 -- , Network.PagerDuty.REST.Incidents
4241 -- , Network.PagerDuty.REST.Incidents.Notes
4342 -- , Network.PagerDuty.REST.LogEntries
@@ -47,10 +46,9 @@ library
4746-- , Network.PagerDuty.REST.Schedules.Overrides
4847 -- , Network.PagerDuty.REST.Services
4948-- , Network.PagerDuty.REST.Services.EmailFilters
50− , Network.PagerDuty.REST.Users
49+-- , Network.PagerDuty.REST.Users
5150 , Network.PagerDuty.REST.Users.ContactMethods
5251 , Network.PagerDuty.REST.Users.NotificationRules
53− , Network.PagerDuty.REST.Users.OnCall
5452 , Network.PagerDuty.REST.Webhooks
5553
5654 other-modules:
src/Network/PagerDuty/REST/EscalationPolicies.hs+14
@@ -23,6 +23,9 @@ module Network.PagerDuty.REST.EscalationPolicies
2323 , listPolicies
2424 , lpQuery
2525
26+ -- * List On Call Policies
27+ , listOnCallPolicies
28+
2629 -- * Create Policy
2730 , CreatePolicy
2831 , createPolicy
@@ -123,6 +126,17 @@ listPolicies =
123126 } & path .~ policies
124127 & unwrap .~ key "escalation_policies"
125128
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+
126140data CreatePolicy = CreatePolicy
127141 { _cpName' :: Text
128142 , _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
2828 , listUsers
2929 , luQuery
3030
31+ -- * List On Call Users
32+ , listOnCallUsers
33+
3134 -- * Create User
3235 , CreateUser
3336 , createUser
@@ -232,6 +235,17 @@ listUsers =
232235 } & path .~ users
233236 & query .~ includes
234237
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+
235249-- | Get information about an existing user.
236250--
237251-- @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"