{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
module Amazonka.Lambda.Waiters where
import qualified Amazonka.Core as Core
import Amazonka.Lambda.GetFunction
import Amazonka.Lambda.GetFunctionConfiguration
import Amazonka.Lambda.Lens
import Amazonka.Lambda.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
newFunctionExists :: Core.Wait GetFunction
newFunctionExists :: Wait GetFunction
newFunctionExists =
Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
{ $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"FunctionExists",
$sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
20,
$sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
1,
$sel:_waitAcceptors:Wait :: [Acceptor GetFunction]
Core._waitAcceptors =
[ Int -> Accept -> Acceptor GetFunction
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
200 Accept
Core.AcceptSuccess,
ErrorCode -> Accept -> Acceptor GetFunction
forall a. ErrorCode -> Accept -> Acceptor a
Core.matchError
ErrorCode
"ResourceNotFoundException"
Accept
Core.AcceptRetry
]
}
newFunctionActive :: Core.Wait GetFunctionConfiguration
newFunctionActive :: Wait GetFunctionConfiguration
newFunctionActive =
Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
{ $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"FunctionActive",
$sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
60,
$sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
5,
$sel:_waitAcceptors:Wait :: [Acceptor GetFunctionConfiguration]
Core._waitAcceptors =
[ CI Text
-> Accept
-> Fold (AWSResponse GetFunctionConfiguration) (CI Text)
-> Acceptor GetFunctionConfiguration
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
CI Text
"Active"
Accept
Core.AcceptSuccess
( (Maybe State -> f (Maybe State))
-> FunctionConfiguration -> f FunctionConfiguration
Lens' FunctionConfiguration (Maybe State)
functionConfiguration_state ((Maybe State -> f (Maybe State))
-> FunctionConfiguration -> f FunctionConfiguration)
-> ((CI Text -> f (CI Text)) -> Maybe State -> f (Maybe State))
-> (CI Text -> f (CI Text))
-> FunctionConfiguration
-> f FunctionConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (State -> f State) -> Maybe State -> f (Maybe State)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
((State -> f State) -> Maybe State -> f (Maybe State))
-> ((CI Text -> f (CI Text)) -> State -> f State)
-> (CI Text -> f (CI Text))
-> Maybe State
-> f (Maybe State)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (State -> CI Text) -> (CI Text -> f (CI Text)) -> State -> f State
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to State -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
),
CI Text
-> Accept
-> Fold (AWSResponse GetFunctionConfiguration) (CI Text)
-> Acceptor GetFunctionConfiguration
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
CI Text
"Failed"
Accept
Core.AcceptFailure
( (Maybe State -> f (Maybe State))
-> FunctionConfiguration -> f FunctionConfiguration
Lens' FunctionConfiguration (Maybe State)
functionConfiguration_state ((Maybe State -> f (Maybe State))
-> FunctionConfiguration -> f FunctionConfiguration)
-> ((CI Text -> f (CI Text)) -> Maybe State -> f (Maybe State))
-> (CI Text -> f (CI Text))
-> FunctionConfiguration
-> f FunctionConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (State -> f State) -> Maybe State -> f (Maybe State)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
((State -> f State) -> Maybe State -> f (Maybe State))
-> ((CI Text -> f (CI Text)) -> State -> f State)
-> (CI Text -> f (CI Text))
-> Maybe State
-> f (Maybe State)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (State -> CI Text) -> (CI Text -> f (CI Text)) -> State -> f State
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to State -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
),
CI Text
-> Accept
-> Fold (AWSResponse GetFunctionConfiguration) (CI Text)
-> Acceptor GetFunctionConfiguration
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
CI Text
"Pending"
Accept
Core.AcceptRetry
( (Maybe State -> f (Maybe State))
-> FunctionConfiguration -> f FunctionConfiguration
Lens' FunctionConfiguration (Maybe State)
functionConfiguration_state ((Maybe State -> f (Maybe State))
-> FunctionConfiguration -> f FunctionConfiguration)
-> ((CI Text -> f (CI Text)) -> Maybe State -> f (Maybe State))
-> (CI Text -> f (CI Text))
-> FunctionConfiguration
-> f FunctionConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (State -> f State) -> Maybe State -> f (Maybe State)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
((State -> f State) -> Maybe State -> f (Maybe State))
-> ((CI Text -> f (CI Text)) -> State -> f State)
-> (CI Text -> f (CI Text))
-> Maybe State
-> f (Maybe State)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (State -> CI Text) -> (CI Text -> f (CI Text)) -> State -> f State
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to State -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
)
]
}
newFunctionUpdated :: Core.Wait GetFunctionConfiguration
newFunctionUpdated :: Wait GetFunctionConfiguration
newFunctionUpdated =
Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
{ $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"FunctionUpdated",
$sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
60,
$sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
5,
$sel:_waitAcceptors:Wait :: [Acceptor GetFunctionConfiguration]
Core._waitAcceptors =
[ CI Text
-> Accept
-> Fold (AWSResponse GetFunctionConfiguration) (CI Text)
-> Acceptor GetFunctionConfiguration
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
CI Text
"Successful"
Accept
Core.AcceptSuccess
( (Maybe LastUpdateStatus -> f (Maybe LastUpdateStatus))
-> FunctionConfiguration -> f FunctionConfiguration
Lens' FunctionConfiguration (Maybe LastUpdateStatus)
functionConfiguration_lastUpdateStatus
((Maybe LastUpdateStatus -> f (Maybe LastUpdateStatus))
-> FunctionConfiguration -> f FunctionConfiguration)
-> ((CI Text -> f (CI Text))
-> Maybe LastUpdateStatus -> f (Maybe LastUpdateStatus))
-> (CI Text -> f (CI Text))
-> FunctionConfiguration
-> f FunctionConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (LastUpdateStatus -> f LastUpdateStatus)
-> Maybe LastUpdateStatus -> f (Maybe LastUpdateStatus)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
((LastUpdateStatus -> f LastUpdateStatus)
-> Maybe LastUpdateStatus -> f (Maybe LastUpdateStatus))
-> ((CI Text -> f (CI Text))
-> LastUpdateStatus -> f LastUpdateStatus)
-> (CI Text -> f (CI Text))
-> Maybe LastUpdateStatus
-> f (Maybe LastUpdateStatus)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (LastUpdateStatus -> CI Text)
-> (CI Text -> f (CI Text))
-> LastUpdateStatus
-> f LastUpdateStatus
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to LastUpdateStatus -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
),
CI Text
-> Accept
-> Fold (AWSResponse GetFunctionConfiguration) (CI Text)
-> Acceptor GetFunctionConfiguration
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
CI Text
"Failed"
Accept
Core.AcceptFailure
( (Maybe LastUpdateStatus -> f (Maybe LastUpdateStatus))
-> FunctionConfiguration -> f FunctionConfiguration
Lens' FunctionConfiguration (Maybe LastUpdateStatus)
functionConfiguration_lastUpdateStatus
((Maybe LastUpdateStatus -> f (Maybe LastUpdateStatus))
-> FunctionConfiguration -> f FunctionConfiguration)
-> ((CI Text -> f (CI Text))
-> Maybe LastUpdateStatus -> f (Maybe LastUpdateStatus))
-> (CI Text -> f (CI Text))
-> FunctionConfiguration
-> f FunctionConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (LastUpdateStatus -> f LastUpdateStatus)
-> Maybe LastUpdateStatus -> f (Maybe LastUpdateStatus)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
((LastUpdateStatus -> f LastUpdateStatus)
-> Maybe LastUpdateStatus -> f (Maybe LastUpdateStatus))
-> ((CI Text -> f (CI Text))
-> LastUpdateStatus -> f LastUpdateStatus)
-> (CI Text -> f (CI Text))
-> Maybe LastUpdateStatus
-> f (Maybe LastUpdateStatus)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (LastUpdateStatus -> CI Text)
-> (CI Text -> f (CI Text))
-> LastUpdateStatus
-> f LastUpdateStatus
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to LastUpdateStatus -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
),
CI Text
-> Accept
-> Fold (AWSResponse GetFunctionConfiguration) (CI Text)
-> Acceptor GetFunctionConfiguration
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
CI Text
"InProgress"
Accept
Core.AcceptRetry
( (Maybe LastUpdateStatus -> f (Maybe LastUpdateStatus))
-> FunctionConfiguration -> f FunctionConfiguration
Lens' FunctionConfiguration (Maybe LastUpdateStatus)
functionConfiguration_lastUpdateStatus
((Maybe LastUpdateStatus -> f (Maybe LastUpdateStatus))
-> FunctionConfiguration -> f FunctionConfiguration)
-> ((CI Text -> f (CI Text))
-> Maybe LastUpdateStatus -> f (Maybe LastUpdateStatus))
-> (CI Text -> f (CI Text))
-> FunctionConfiguration
-> f FunctionConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (LastUpdateStatus -> f LastUpdateStatus)
-> Maybe LastUpdateStatus -> f (Maybe LastUpdateStatus)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
((LastUpdateStatus -> f LastUpdateStatus)
-> Maybe LastUpdateStatus -> f (Maybe LastUpdateStatus))
-> ((CI Text -> f (CI Text))
-> LastUpdateStatus -> f LastUpdateStatus)
-> (CI Text -> f (CI Text))
-> Maybe LastUpdateStatus
-> f (Maybe LastUpdateStatus)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (LastUpdateStatus -> CI Text)
-> (CI Text -> f (CI Text))
-> LastUpdateStatus
-> f LastUpdateStatus
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to LastUpdateStatus -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
)
]
}