{-# 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.SSMIncidents.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.SSMIncidents.Waiters where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSMIncidents.GetReplicationSet
import Amazonka.SSMIncidents.Lens
import Amazonka.SSMIncidents.Types

-- | Polls 'Amazonka.SSMIncidents.GetReplicationSet' every 30 seconds until a successful state is reached. An error is returned after 5 failed checks.
newWaitForReplicationSetActive :: Core.Wait GetReplicationSet
newWaitForReplicationSetActive :: Wait GetReplicationSet
newWaitForReplicationSetActive =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName =
        ByteString
"WaitForReplicationSetActive",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
5,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
30,
      $sel:_waitAcceptors:Wait :: [Acceptor GetReplicationSet]
Core._waitAcceptors =
        [ CI Text
-> Accept
-> Fold (AWSResponse GetReplicationSet) (CI Text)
-> Acceptor GetReplicationSet
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"ACTIVE"
            Accept
Core.AcceptSuccess
            ( (ReplicationSet -> f ReplicationSet)
-> GetReplicationSetResponse -> f GetReplicationSetResponse
Lens' GetReplicationSetResponse ReplicationSet
getReplicationSetResponse_replicationSet
                ((ReplicationSet -> f ReplicationSet)
 -> GetReplicationSetResponse -> f GetReplicationSetResponse)
-> ((CI Text -> f (CI Text)) -> ReplicationSet -> f ReplicationSet)
-> (CI Text -> f (CI Text))
-> GetReplicationSetResponse
-> f GetReplicationSetResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ReplicationSetStatus -> f ReplicationSetStatus)
-> ReplicationSet -> f ReplicationSet
Lens' ReplicationSet ReplicationSetStatus
replicationSet_status
                ((ReplicationSetStatus -> f ReplicationSetStatus)
 -> ReplicationSet -> f ReplicationSet)
-> ((CI Text -> f (CI Text))
    -> ReplicationSetStatus -> f ReplicationSetStatus)
-> (CI Text -> f (CI Text))
-> ReplicationSet
-> f ReplicationSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ReplicationSetStatus -> CI Text)
-> (CI Text -> f (CI Text))
-> ReplicationSetStatus
-> f ReplicationSetStatus
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to ReplicationSetStatus -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          CI Text
-> Accept
-> Fold (AWSResponse GetReplicationSet) (CI Text)
-> Acceptor GetReplicationSet
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"CREATING"
            Accept
Core.AcceptRetry
            ( (ReplicationSet -> f ReplicationSet)
-> GetReplicationSetResponse -> f GetReplicationSetResponse
Lens' GetReplicationSetResponse ReplicationSet
getReplicationSetResponse_replicationSet
                ((ReplicationSet -> f ReplicationSet)
 -> GetReplicationSetResponse -> f GetReplicationSetResponse)
-> ((CI Text -> f (CI Text)) -> ReplicationSet -> f ReplicationSet)
-> (CI Text -> f (CI Text))
-> GetReplicationSetResponse
-> f GetReplicationSetResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ReplicationSetStatus -> f ReplicationSetStatus)
-> ReplicationSet -> f ReplicationSet
Lens' ReplicationSet ReplicationSetStatus
replicationSet_status
                ((ReplicationSetStatus -> f ReplicationSetStatus)
 -> ReplicationSet -> f ReplicationSet)
-> ((CI Text -> f (CI Text))
    -> ReplicationSetStatus -> f ReplicationSetStatus)
-> (CI Text -> f (CI Text))
-> ReplicationSet
-> f ReplicationSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ReplicationSetStatus -> CI Text)
-> (CI Text -> f (CI Text))
-> ReplicationSetStatus
-> f ReplicationSetStatus
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to ReplicationSetStatus -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          CI Text
-> Accept
-> Fold (AWSResponse GetReplicationSet) (CI Text)
-> Acceptor GetReplicationSet
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"UPDATING"
            Accept
Core.AcceptRetry
            ( (ReplicationSet -> f ReplicationSet)
-> GetReplicationSetResponse -> f GetReplicationSetResponse
Lens' GetReplicationSetResponse ReplicationSet
getReplicationSetResponse_replicationSet
                ((ReplicationSet -> f ReplicationSet)
 -> GetReplicationSetResponse -> f GetReplicationSetResponse)
-> ((CI Text -> f (CI Text)) -> ReplicationSet -> f ReplicationSet)
-> (CI Text -> f (CI Text))
-> GetReplicationSetResponse
-> f GetReplicationSetResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ReplicationSetStatus -> f ReplicationSetStatus)
-> ReplicationSet -> f ReplicationSet
Lens' ReplicationSet ReplicationSetStatus
replicationSet_status
                ((ReplicationSetStatus -> f ReplicationSetStatus)
 -> ReplicationSet -> f ReplicationSet)
-> ((CI Text -> f (CI Text))
    -> ReplicationSetStatus -> f ReplicationSetStatus)
-> (CI Text -> f (CI Text))
-> ReplicationSet
-> f ReplicationSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ReplicationSetStatus -> CI Text)
-> (CI Text -> f (CI Text))
-> ReplicationSetStatus
-> f ReplicationSetStatus
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to ReplicationSetStatus -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          CI Text
-> Accept
-> Fold (AWSResponse GetReplicationSet) (CI Text)
-> Acceptor GetReplicationSet
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"FAILED"
            Accept
Core.AcceptFailure
            ( (ReplicationSet -> f ReplicationSet)
-> GetReplicationSetResponse -> f GetReplicationSetResponse
Lens' GetReplicationSetResponse ReplicationSet
getReplicationSetResponse_replicationSet
                ((ReplicationSet -> f ReplicationSet)
 -> GetReplicationSetResponse -> f GetReplicationSetResponse)
-> ((CI Text -> f (CI Text)) -> ReplicationSet -> f ReplicationSet)
-> (CI Text -> f (CI Text))
-> GetReplicationSetResponse
-> f GetReplicationSetResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ReplicationSetStatus -> f ReplicationSetStatus)
-> ReplicationSet -> f ReplicationSet
Lens' ReplicationSet ReplicationSetStatus
replicationSet_status
                ((ReplicationSetStatus -> f ReplicationSetStatus)
 -> ReplicationSet -> f ReplicationSet)
-> ((CI Text -> f (CI Text))
    -> ReplicationSetStatus -> f ReplicationSetStatus)
-> (CI Text -> f (CI Text))
-> ReplicationSet
-> f ReplicationSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ReplicationSetStatus -> CI Text)
-> (CI Text -> f (CI Text))
-> ReplicationSetStatus
-> f ReplicationSetStatus
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to ReplicationSetStatus -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            )
        ]
    }

-- | Polls 'Amazonka.SSMIncidents.GetReplicationSet' every 30 seconds until a successful state is reached. An error is returned after 5 failed checks.
newWaitForReplicationSetDeleted :: Core.Wait GetReplicationSet
newWaitForReplicationSetDeleted :: Wait GetReplicationSet
newWaitForReplicationSetDeleted =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName =
        ByteString
"WaitForReplicationSetDeleted",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
5,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
30,
      $sel:_waitAcceptors:Wait :: [Acceptor GetReplicationSet]
Core._waitAcceptors =
        [ ErrorCode -> Accept -> Acceptor GetReplicationSet
forall a. ErrorCode -> Accept -> Acceptor a
Core.matchError
            ErrorCode
"ResourceNotFoundException"
            Accept
Core.AcceptSuccess,
          CI Text
-> Accept
-> Fold (AWSResponse GetReplicationSet) (CI Text)
-> Acceptor GetReplicationSet
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"DELETING"
            Accept
Core.AcceptRetry
            ( (ReplicationSet -> f ReplicationSet)
-> GetReplicationSetResponse -> f GetReplicationSetResponse
Lens' GetReplicationSetResponse ReplicationSet
getReplicationSetResponse_replicationSet
                ((ReplicationSet -> f ReplicationSet)
 -> GetReplicationSetResponse -> f GetReplicationSetResponse)
-> ((CI Text -> f (CI Text)) -> ReplicationSet -> f ReplicationSet)
-> (CI Text -> f (CI Text))
-> GetReplicationSetResponse
-> f GetReplicationSetResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ReplicationSetStatus -> f ReplicationSetStatus)
-> ReplicationSet -> f ReplicationSet
Lens' ReplicationSet ReplicationSetStatus
replicationSet_status
                ((ReplicationSetStatus -> f ReplicationSetStatus)
 -> ReplicationSet -> f ReplicationSet)
-> ((CI Text -> f (CI Text))
    -> ReplicationSetStatus -> f ReplicationSetStatus)
-> (CI Text -> f (CI Text))
-> ReplicationSet
-> f ReplicationSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ReplicationSetStatus -> CI Text)
-> (CI Text -> f (CI Text))
-> ReplicationSetStatus
-> f ReplicationSetStatus
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to ReplicationSetStatus -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          CI Text
-> Accept
-> Fold (AWSResponse GetReplicationSet) (CI Text)
-> Acceptor GetReplicationSet
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"FAILED"
            Accept
Core.AcceptFailure
            ( (ReplicationSet -> f ReplicationSet)
-> GetReplicationSetResponse -> f GetReplicationSetResponse
Lens' GetReplicationSetResponse ReplicationSet
getReplicationSetResponse_replicationSet
                ((ReplicationSet -> f ReplicationSet)
 -> GetReplicationSetResponse -> f GetReplicationSetResponse)
-> ((CI Text -> f (CI Text)) -> ReplicationSet -> f ReplicationSet)
-> (CI Text -> f (CI Text))
-> GetReplicationSetResponse
-> f GetReplicationSetResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ReplicationSetStatus -> f ReplicationSetStatus)
-> ReplicationSet -> f ReplicationSet
Lens' ReplicationSet ReplicationSetStatus
replicationSet_status
                ((ReplicationSetStatus -> f ReplicationSetStatus)
 -> ReplicationSet -> f ReplicationSet)
-> ((CI Text -> f (CI Text))
    -> ReplicationSetStatus -> f ReplicationSetStatus)
-> (CI Text -> f (CI Text))
-> ReplicationSet
-> f ReplicationSet
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ReplicationSetStatus -> CI Text)
-> (CI Text -> f (CI Text))
-> ReplicationSetStatus
-> f ReplicationSetStatus
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to ReplicationSetStatus -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            )
        ]
    }