forked from brendanhay/amazonka
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Waiters.hs
75 lines (67 loc) · 2.23 KB
/
Waiters.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
-- Derived from AWS service descriptions, licensed under Apache 2.0.
-- |
-- Module : Network.AWS.EMR.Waiters
-- Copyright : (c) 2013-2017 Brendan Hay
-- License : Mozilla Public License, v. 2.0.
-- Maintainer : Brendan Hay <[email protected]>
-- Stability : auto-generated
-- Portability : non-portable (GHC extensions)
--
module Network.AWS.EMR.Waiters where
import Network.AWS.EMR.DescribeCluster
import Network.AWS.EMR.DescribeCluster
import Network.AWS.EMR.Types
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Waiter
-- | Polls 'Network.AWS.EMR.DescribeCluster' every 30 seconds until a successful state is reached. An error is returned after 60 failed checks.
clusterTerminated :: Wait DescribeCluster
clusterTerminated =
Wait
{ _waitName = "ClusterTerminated"
, _waitAttempts = 60
, _waitDelay = 30
, _waitAcceptors =
[ matchAll
"TERMINATED"
AcceptSuccess
(dcrsCluster . cluStatus . csState . _Just . to toTextCI)
, matchAll
"TERMINATED_WITH_ERRORS"
AcceptFailure
(dcrsCluster . cluStatus . csState . _Just . to toTextCI)
]
}
-- | Polls 'Network.AWS.EMR.DescribeCluster' every 30 seconds until a successful state is reached. An error is returned after 60 failed checks.
clusterRunning :: Wait DescribeCluster
clusterRunning =
Wait
{ _waitName = "ClusterRunning"
, _waitAttempts = 60
, _waitDelay = 30
, _waitAcceptors =
[ matchAll
"RUNNING"
AcceptSuccess
(dcrsCluster . cluStatus . csState . _Just . to toTextCI)
, matchAll
"WAITING"
AcceptSuccess
(dcrsCluster . cluStatus . csState . _Just . to toTextCI)
, matchAll
"TERMINATING"
AcceptFailure
(dcrsCluster . cluStatus . csState . _Just . to toTextCI)
, matchAll
"TERMINATED"
AcceptFailure
(dcrsCluster . cluStatus . csState . _Just . to toTextCI)
, matchAll
"TERMINATED_WITH_ERRORS"
AcceptFailure
(dcrsCluster . cluStatus . csState . _Just . to toTextCI)
]
}