{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MediaConnect.Waiters
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MediaConnect.Waiters where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MediaConnect.DescribeFlow
import Amazonka.MediaConnect.Lens
import Amazonka.MediaConnect.Types
import qualified Amazonka.Prelude as Prelude

-- | Polls 'Amazonka.MediaConnect.DescribeFlow' every 3 seconds until a successful state is reached. An error is returned after 40 failed checks.
newFlowStandby :: Core.Wait DescribeFlow
newFlowStandby :: Wait DescribeFlow
newFlowStandby =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"FlowStandby",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
40,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
3,
      $sel:_waitAcceptors:Wait :: [Acceptor DescribeFlow]
Core._waitAcceptors =
        [ CI Text
-> Accept
-> Fold (AWSResponse DescribeFlow) (CI Text)
-> Acceptor DescribeFlow
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"STANDBY"
            Accept
Core.AcceptSuccess
            ( (Maybe Flow -> f (Maybe Flow))
-> DescribeFlowResponse -> f DescribeFlowResponse
Lens' DescribeFlowResponse (Maybe Flow)
describeFlowResponse_flow ((Maybe Flow -> f (Maybe Flow))
 -> DescribeFlowResponse -> f DescribeFlowResponse)
-> ((CI Text -> f (CI Text)) -> Maybe Flow -> f (Maybe Flow))
-> (CI Text -> f (CI Text))
-> DescribeFlowResponse
-> f DescribeFlowResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Flow -> f Flow) -> Maybe Flow -> f (Maybe Flow)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((Flow -> f Flow) -> Maybe Flow -> f (Maybe Flow))
-> ((CI Text -> f (CI Text)) -> Flow -> f Flow)
-> (CI Text -> f (CI Text))
-> Maybe Flow
-> f (Maybe Flow)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Status -> f Status) -> Flow -> f Flow
Lens' Flow Status
flow_status
                ((Status -> f Status) -> Flow -> f Flow)
-> ((CI Text -> f (CI Text)) -> Status -> f Status)
-> (CI Text -> f (CI Text))
-> Flow
-> f Flow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Status -> CI Text)
-> (CI Text -> f (CI Text)) -> Status -> f Status
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to Status -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          CI Text
-> Accept
-> Fold (AWSResponse DescribeFlow) (CI Text)
-> Acceptor DescribeFlow
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"STOPPING"
            Accept
Core.AcceptRetry
            ( (Maybe Flow -> f (Maybe Flow))
-> DescribeFlowResponse -> f DescribeFlowResponse
Lens' DescribeFlowResponse (Maybe Flow)
describeFlowResponse_flow ((Maybe Flow -> f (Maybe Flow))
 -> DescribeFlowResponse -> f DescribeFlowResponse)
-> ((CI Text -> f (CI Text)) -> Maybe Flow -> f (Maybe Flow))
-> (CI Text -> f (CI Text))
-> DescribeFlowResponse
-> f DescribeFlowResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Flow -> f Flow) -> Maybe Flow -> f (Maybe Flow)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((Flow -> f Flow) -> Maybe Flow -> f (Maybe Flow))
-> ((CI Text -> f (CI Text)) -> Flow -> f Flow)
-> (CI Text -> f (CI Text))
-> Maybe Flow
-> f (Maybe Flow)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Status -> f Status) -> Flow -> f Flow
Lens' Flow Status
flow_status
                ((Status -> f Status) -> Flow -> f Flow)
-> ((CI Text -> f (CI Text)) -> Status -> f Status)
-> (CI Text -> f (CI Text))
-> Flow
-> f Flow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Status -> CI Text)
-> (CI Text -> f (CI Text)) -> Status -> f Status
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to Status -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          Int -> Accept -> Acceptor DescribeFlow
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
500 Accept
Core.AcceptRetry,
          Int -> Accept -> Acceptor DescribeFlow
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
503 Accept
Core.AcceptRetry,
          CI Text
-> Accept
-> Fold (AWSResponse DescribeFlow) (CI Text)
-> Acceptor DescribeFlow
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"ERROR"
            Accept
Core.AcceptFailure
            ( (Maybe Flow -> f (Maybe Flow))
-> DescribeFlowResponse -> f DescribeFlowResponse
Lens' DescribeFlowResponse (Maybe Flow)
describeFlowResponse_flow ((Maybe Flow -> f (Maybe Flow))
 -> DescribeFlowResponse -> f DescribeFlowResponse)
-> ((CI Text -> f (CI Text)) -> Maybe Flow -> f (Maybe Flow))
-> (CI Text -> f (CI Text))
-> DescribeFlowResponse
-> f DescribeFlowResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Flow -> f Flow) -> Maybe Flow -> f (Maybe Flow)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((Flow -> f Flow) -> Maybe Flow -> f (Maybe Flow))
-> ((CI Text -> f (CI Text)) -> Flow -> f Flow)
-> (CI Text -> f (CI Text))
-> Maybe Flow
-> f (Maybe Flow)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Status -> f Status) -> Flow -> f Flow
Lens' Flow Status
flow_status
                ((Status -> f Status) -> Flow -> f Flow)
-> ((CI Text -> f (CI Text)) -> Status -> f Status)
-> (CI Text -> f (CI Text))
-> Flow
-> f Flow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Status -> CI Text)
-> (CI Text -> f (CI Text)) -> Status -> f Status
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to Status -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            )
        ]
    }

-- | Polls 'Amazonka.MediaConnect.DescribeFlow' every 3 seconds until a successful state is reached. An error is returned after 40 failed checks.
newFlowActive :: Core.Wait DescribeFlow
newFlowActive :: Wait DescribeFlow
newFlowActive =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"FlowActive",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
40,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
3,
      $sel:_waitAcceptors:Wait :: [Acceptor DescribeFlow]
Core._waitAcceptors =
        [ CI Text
-> Accept
-> Fold (AWSResponse DescribeFlow) (CI Text)
-> Acceptor DescribeFlow
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"ACTIVE"
            Accept
Core.AcceptSuccess
            ( (Maybe Flow -> f (Maybe Flow))
-> DescribeFlowResponse -> f DescribeFlowResponse
Lens' DescribeFlowResponse (Maybe Flow)
describeFlowResponse_flow ((Maybe Flow -> f (Maybe Flow))
 -> DescribeFlowResponse -> f DescribeFlowResponse)
-> ((CI Text -> f (CI Text)) -> Maybe Flow -> f (Maybe Flow))
-> (CI Text -> f (CI Text))
-> DescribeFlowResponse
-> f DescribeFlowResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Flow -> f Flow) -> Maybe Flow -> f (Maybe Flow)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((Flow -> f Flow) -> Maybe Flow -> f (Maybe Flow))
-> ((CI Text -> f (CI Text)) -> Flow -> f Flow)
-> (CI Text -> f (CI Text))
-> Maybe Flow
-> f (Maybe Flow)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Status -> f Status) -> Flow -> f Flow
Lens' Flow Status
flow_status
                ((Status -> f Status) -> Flow -> f Flow)
-> ((CI Text -> f (CI Text)) -> Status -> f Status)
-> (CI Text -> f (CI Text))
-> Flow
-> f Flow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Status -> CI Text)
-> (CI Text -> f (CI Text)) -> Status -> f Status
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to Status -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          CI Text
-> Accept
-> Fold (AWSResponse DescribeFlow) (CI Text)
-> Acceptor DescribeFlow
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"STARTING"
            Accept
Core.AcceptRetry
            ( (Maybe Flow -> f (Maybe Flow))
-> DescribeFlowResponse -> f DescribeFlowResponse
Lens' DescribeFlowResponse (Maybe Flow)
describeFlowResponse_flow ((Maybe Flow -> f (Maybe Flow))
 -> DescribeFlowResponse -> f DescribeFlowResponse)
-> ((CI Text -> f (CI Text)) -> Maybe Flow -> f (Maybe Flow))
-> (CI Text -> f (CI Text))
-> DescribeFlowResponse
-> f DescribeFlowResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Flow -> f Flow) -> Maybe Flow -> f (Maybe Flow)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((Flow -> f Flow) -> Maybe Flow -> f (Maybe Flow))
-> ((CI Text -> f (CI Text)) -> Flow -> f Flow)
-> (CI Text -> f (CI Text))
-> Maybe Flow
-> f (Maybe Flow)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Status -> f Status) -> Flow -> f Flow
Lens' Flow Status
flow_status
                ((Status -> f Status) -> Flow -> f Flow)
-> ((CI Text -> f (CI Text)) -> Status -> f Status)
-> (CI Text -> f (CI Text))
-> Flow
-> f Flow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Status -> CI Text)
-> (CI Text -> f (CI Text)) -> Status -> f Status
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to Status -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          CI Text
-> Accept
-> Fold (AWSResponse DescribeFlow) (CI Text)
-> Acceptor DescribeFlow
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"UPDATING"
            Accept
Core.AcceptRetry
            ( (Maybe Flow -> f (Maybe Flow))
-> DescribeFlowResponse -> f DescribeFlowResponse
Lens' DescribeFlowResponse (Maybe Flow)
describeFlowResponse_flow ((Maybe Flow -> f (Maybe Flow))
 -> DescribeFlowResponse -> f DescribeFlowResponse)
-> ((CI Text -> f (CI Text)) -> Maybe Flow -> f (Maybe Flow))
-> (CI Text -> f (CI Text))
-> DescribeFlowResponse
-> f DescribeFlowResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Flow -> f Flow) -> Maybe Flow -> f (Maybe Flow)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((Flow -> f Flow) -> Maybe Flow -> f (Maybe Flow))
-> ((CI Text -> f (CI Text)) -> Flow -> f Flow)
-> (CI Text -> f (CI Text))
-> Maybe Flow
-> f (Maybe Flow)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Status -> f Status) -> Flow -> f Flow
Lens' Flow Status
flow_status
                ((Status -> f Status) -> Flow -> f Flow)
-> ((CI Text -> f (CI Text)) -> Status -> f Status)
-> (CI Text -> f (CI Text))
-> Flow
-> f Flow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Status -> CI Text)
-> (CI Text -> f (CI Text)) -> Status -> f Status
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to Status -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          Int -> Accept -> Acceptor DescribeFlow
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
500 Accept
Core.AcceptRetry,
          Int -> Accept -> Acceptor DescribeFlow
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
503 Accept
Core.AcceptRetry,
          CI Text
-> Accept
-> Fold (AWSResponse DescribeFlow) (CI Text)
-> Acceptor DescribeFlow
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"ERROR"
            Accept
Core.AcceptFailure
            ( (Maybe Flow -> f (Maybe Flow))
-> DescribeFlowResponse -> f DescribeFlowResponse
Lens' DescribeFlowResponse (Maybe Flow)
describeFlowResponse_flow ((Maybe Flow -> f (Maybe Flow))
 -> DescribeFlowResponse -> f DescribeFlowResponse)
-> ((CI Text -> f (CI Text)) -> Maybe Flow -> f (Maybe Flow))
-> (CI Text -> f (CI Text))
-> DescribeFlowResponse
-> f DescribeFlowResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Flow -> f Flow) -> Maybe Flow -> f (Maybe Flow)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((Flow -> f Flow) -> Maybe Flow -> f (Maybe Flow))
-> ((CI Text -> f (CI Text)) -> Flow -> f Flow)
-> (CI Text -> f (CI Text))
-> Maybe Flow
-> f (Maybe Flow)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Status -> f Status) -> Flow -> f Flow
Lens' Flow Status
flow_status
                ((Status -> f Status) -> Flow -> f Flow)
-> ((CI Text -> f (CI Text)) -> Status -> f Status)
-> (CI Text -> f (CI Text))
-> Flow
-> f Flow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Status -> CI Text)
-> (CI Text -> f (CI Text)) -> Status -> f Status
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to Status -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            )
        ]
    }

-- | Polls 'Amazonka.MediaConnect.DescribeFlow' every 3 seconds until a successful state is reached. An error is returned after 40 failed checks.
newFlowDeleted :: Core.Wait DescribeFlow
newFlowDeleted :: Wait DescribeFlow
newFlowDeleted =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"FlowDeleted",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
40,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
3,
      $sel:_waitAcceptors:Wait :: [Acceptor DescribeFlow]
Core._waitAcceptors =
        [ Int -> Accept -> Acceptor DescribeFlow
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
404 Accept
Core.AcceptSuccess,
          CI Text
-> Accept
-> Fold (AWSResponse DescribeFlow) (CI Text)
-> Acceptor DescribeFlow
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"DELETING"
            Accept
Core.AcceptRetry
            ( (Maybe Flow -> f (Maybe Flow))
-> DescribeFlowResponse -> f DescribeFlowResponse
Lens' DescribeFlowResponse (Maybe Flow)
describeFlowResponse_flow ((Maybe Flow -> f (Maybe Flow))
 -> DescribeFlowResponse -> f DescribeFlowResponse)
-> ((CI Text -> f (CI Text)) -> Maybe Flow -> f (Maybe Flow))
-> (CI Text -> f (CI Text))
-> DescribeFlowResponse
-> f DescribeFlowResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Flow -> f Flow) -> Maybe Flow -> f (Maybe Flow)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((Flow -> f Flow) -> Maybe Flow -> f (Maybe Flow))
-> ((CI Text -> f (CI Text)) -> Flow -> f Flow)
-> (CI Text -> f (CI Text))
-> Maybe Flow
-> f (Maybe Flow)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Status -> f Status) -> Flow -> f Flow
Lens' Flow Status
flow_status
                ((Status -> f Status) -> Flow -> f Flow)
-> ((CI Text -> f (CI Text)) -> Status -> f Status)
-> (CI Text -> f (CI Text))
-> Flow
-> f Flow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Status -> CI Text)
-> (CI Text -> f (CI Text)) -> Status -> f Status
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to Status -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          Int -> Accept -> Acceptor DescribeFlow
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
500 Accept
Core.AcceptRetry,
          Int -> Accept -> Acceptor DescribeFlow
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
503 Accept
Core.AcceptRetry,
          CI Text
-> Accept
-> Fold (AWSResponse DescribeFlow) (CI Text)
-> Acceptor DescribeFlow
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"ERROR"
            Accept
Core.AcceptFailure
            ( (Maybe Flow -> f (Maybe Flow))
-> DescribeFlowResponse -> f DescribeFlowResponse
Lens' DescribeFlowResponse (Maybe Flow)
describeFlowResponse_flow ((Maybe Flow -> f (Maybe Flow))
 -> DescribeFlowResponse -> f DescribeFlowResponse)
-> ((CI Text -> f (CI Text)) -> Maybe Flow -> f (Maybe Flow))
-> (CI Text -> f (CI Text))
-> DescribeFlowResponse
-> f DescribeFlowResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Flow -> f Flow) -> Maybe Flow -> f (Maybe Flow)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((Flow -> f Flow) -> Maybe Flow -> f (Maybe Flow))
-> ((CI Text -> f (CI Text)) -> Flow -> f Flow)
-> (CI Text -> f (CI Text))
-> Maybe Flow
-> f (Maybe Flow)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Status -> f Status) -> Flow -> f Flow
Lens' Flow Status
flow_status
                ((Status -> f Status) -> Flow -> f Flow)
-> ((CI Text -> f (CI Text)) -> Status -> f Status)
-> (CI Text -> f (CI Text))
-> Flow
-> f Flow
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Status -> CI Text)
-> (CI Text -> f (CI Text)) -> Status -> f Status
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to Status -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            )
        ]
    }