{-# LANGUAGE DisambiguateRecordFields #-}
{-# 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.Route53RecoveryControlConfig.Waiters
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Route53RecoveryControlConfig.Waiters where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53RecoveryControlConfig.DescribeCluster
import Amazonka.Route53RecoveryControlConfig.DescribeControlPanel
import Amazonka.Route53RecoveryControlConfig.DescribeRoutingControl
import Amazonka.Route53RecoveryControlConfig.Lens
import Amazonka.Route53RecoveryControlConfig.Types

-- | Polls 'Amazonka.Route53RecoveryControlConfig.DescribeCluster' every 5 seconds until a successful state is reached. An error is returned after 26 failed checks.
newClusterCreated :: Core.Wait DescribeCluster
newClusterCreated :: Wait DescribeCluster
newClusterCreated =
  Core.Wait
    { $sel:name:Wait :: ByteString
Core.name = ByteString
"ClusterCreated",
      $sel:attempts:Wait :: Int
Core.attempts = Int
26,
      $sel:delay:Wait :: Seconds
Core.delay = Seconds
5,
      $sel:acceptors:Wait :: [Acceptor DescribeCluster]
Core.acceptors =
        [ forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"DEPLOYED"
            Accept
Core.AcceptSuccess
            ( Lens' DescribeClusterResponse (Maybe Cluster)
describeClusterResponse_cluster
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Lens' Cluster (Maybe Status)
cluster_status
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to forall a. ToText a => a -> CI Text
Data.toTextCI
            ),
          forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"PENDING"
            Accept
Core.AcceptRetry
            ( Lens' DescribeClusterResponse (Maybe Cluster)
describeClusterResponse_cluster
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Lens' Cluster (Maybe Status)
cluster_status
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to forall a. ToText a => a -> CI Text
Data.toTextCI
            ),
          forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
500 Accept
Core.AcceptRetry
        ]
    }

-- | Polls 'Amazonka.Route53RecoveryControlConfig.DescribeCluster' every 5 seconds until a successful state is reached. An error is returned after 26 failed checks.
newClusterDeleted :: Core.Wait DescribeCluster
newClusterDeleted :: Wait DescribeCluster
newClusterDeleted =
  Core.Wait
    { $sel:name:Wait :: ByteString
Core.name = ByteString
"ClusterDeleted",
      $sel:attempts:Wait :: Int
Core.attempts = Int
26,
      $sel:delay:Wait :: Seconds
Core.delay = Seconds
5,
      $sel:acceptors:Wait :: [Acceptor DescribeCluster]
Core.acceptors =
        [ forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
404 Accept
Core.AcceptSuccess,
          forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"PENDING_DELETION"
            Accept
Core.AcceptRetry
            ( Lens' DescribeClusterResponse (Maybe Cluster)
describeClusterResponse_cluster
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Lens' Cluster (Maybe Status)
cluster_status
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to forall a. ToText a => a -> CI Text
Data.toTextCI
            ),
          forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
500 Accept
Core.AcceptRetry
        ]
    }

-- | Polls 'Amazonka.Route53RecoveryControlConfig.DescribeControlPanel' every 5 seconds until a successful state is reached. An error is returned after 26 failed checks.
newControlPanelCreated :: Core.Wait DescribeControlPanel
newControlPanelCreated :: Wait DescribeControlPanel
newControlPanelCreated =
  Core.Wait
    { $sel:name:Wait :: ByteString
Core.name = ByteString
"ControlPanelCreated",
      $sel:attempts:Wait :: Int
Core.attempts = Int
26,
      $sel:delay:Wait :: Seconds
Core.delay = Seconds
5,
      $sel:acceptors:Wait :: [Acceptor DescribeControlPanel]
Core.acceptors =
        [ forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"DEPLOYED"
            Accept
Core.AcceptSuccess
            ( Lens' DescribeControlPanelResponse (Maybe ControlPanel)
describeControlPanelResponse_controlPanel
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Lens' ControlPanel (Maybe Status)
controlPanel_status
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to forall a. ToText a => a -> CI Text
Data.toTextCI
            ),
          forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"PENDING"
            Accept
Core.AcceptRetry
            ( Lens' DescribeControlPanelResponse (Maybe ControlPanel)
describeControlPanelResponse_controlPanel
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Lens' ControlPanel (Maybe Status)
controlPanel_status
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to forall a. ToText a => a -> CI Text
Data.toTextCI
            ),
          forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
500 Accept
Core.AcceptRetry
        ]
    }

-- | Polls 'Amazonka.Route53RecoveryControlConfig.DescribeControlPanel' every 5 seconds until a successful state is reached. An error is returned after 26 failed checks.
newControlPanelDeleted :: Core.Wait DescribeControlPanel
newControlPanelDeleted :: Wait DescribeControlPanel
newControlPanelDeleted =
  Core.Wait
    { $sel:name:Wait :: ByteString
Core.name = ByteString
"ControlPanelDeleted",
      $sel:attempts:Wait :: Int
Core.attempts = Int
26,
      $sel:delay:Wait :: Seconds
Core.delay = Seconds
5,
      $sel:acceptors:Wait :: [Acceptor DescribeControlPanel]
Core.acceptors =
        [ forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
404 Accept
Core.AcceptSuccess,
          forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"PENDING_DELETION"
            Accept
Core.AcceptRetry
            ( Lens' DescribeControlPanelResponse (Maybe ControlPanel)
describeControlPanelResponse_controlPanel
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Lens' ControlPanel (Maybe Status)
controlPanel_status
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to forall a. ToText a => a -> CI Text
Data.toTextCI
            ),
          forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
500 Accept
Core.AcceptRetry
        ]
    }

-- | Polls 'Amazonka.Route53RecoveryControlConfig.DescribeRoutingControl' every 5 seconds until a successful state is reached. An error is returned after 26 failed checks.
newRoutingControlCreated :: Core.Wait DescribeRoutingControl
newRoutingControlCreated :: Wait DescribeRoutingControl
newRoutingControlCreated =
  Core.Wait
    { $sel:name:Wait :: ByteString
Core.name = ByteString
"RoutingControlCreated",
      $sel:attempts:Wait :: Int
Core.attempts = Int
26,
      $sel:delay:Wait :: Seconds
Core.delay = Seconds
5,
      $sel:acceptors:Wait :: [Acceptor DescribeRoutingControl]
Core.acceptors =
        [ forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"DEPLOYED"
            Accept
Core.AcceptSuccess
            ( Lens' DescribeRoutingControlResponse (Maybe RoutingControl)
describeRoutingControlResponse_routingControl
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Lens' RoutingControl (Maybe Status)
routingControl_status
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to forall a. ToText a => a -> CI Text
Data.toTextCI
            ),
          forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"PENDING"
            Accept
Core.AcceptRetry
            ( Lens' DescribeRoutingControlResponse (Maybe RoutingControl)
describeRoutingControlResponse_routingControl
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Lens' RoutingControl (Maybe Status)
routingControl_status
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to forall a. ToText a => a -> CI Text
Data.toTextCI
            ),
          forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
500 Accept
Core.AcceptRetry
        ]
    }

-- | Polls 'Amazonka.Route53RecoveryControlConfig.DescribeRoutingControl' every 5 seconds until a successful state is reached. An error is returned after 26 failed checks.
newRoutingControlDeleted :: Core.Wait DescribeRoutingControl
newRoutingControlDeleted :: Wait DescribeRoutingControl
newRoutingControlDeleted =
  Core.Wait
    { $sel:name:Wait :: ByteString
Core.name = ByteString
"RoutingControlDeleted",
      $sel:attempts:Wait :: Int
Core.attempts = Int
26,
      $sel:delay:Wait :: Seconds
Core.delay = Seconds
5,
      $sel:acceptors:Wait :: [Acceptor DescribeRoutingControl]
Core.acceptors =
        [ forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
404 Accept
Core.AcceptSuccess,
          forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"PENDING_DELETION"
            Accept
Core.AcceptRetry
            ( Lens' DescribeRoutingControlResponse (Maybe RoutingControl)
describeRoutingControlResponse_routingControl
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Lens' RoutingControl (Maybe Status)
routingControl_status
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to forall a. ToText a => a -> CI Text
Data.toTextCI
            ),
          forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
500 Accept
Core.AcceptRetry
        ]
    }