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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Redshift.DescribeClusterSnapshots
import Amazonka.Redshift.DescribeClusters
import Amazonka.Redshift.Lens
import Amazonka.Redshift.Types

-- | Polls 'Amazonka.Redshift.DescribeClusters' every 60 seconds until a successful state is reached. An error is returned after 30 failed checks.
newClusterRestored :: Core.Wait DescribeClusters
newClusterRestored :: Wait DescribeClusters
newClusterRestored =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"ClusterRestored",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
30,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
60,
      $sel:_waitAcceptors:Wait :: [Acceptor DescribeClusters]
Core._waitAcceptors =
        [ CI Text
-> Accept
-> Fold (AWSResponse DescribeClusters) (CI Text)
-> Acceptor DescribeClusters
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"completed"
            Accept
Core.AcceptSuccess
            ( (DescribeClustersResponse -> [Cluster])
-> Fold DescribeClustersResponse Cluster
forall (f :: * -> *) s a. Foldable f => (s -> f a) -> Fold s a
Lens.folding
                ( Getting [Cluster] DescribeClustersResponse [Cluster]
-> DescribeClustersResponse -> [Cluster]
forall r s. Getting [r] s [r] -> s -> [r]
Lens.concatOf
                    ( (Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster]))
-> DescribeClustersResponse
-> Const [Cluster] DescribeClustersResponse
Lens' DescribeClustersResponse (Maybe [Cluster])
describeClustersResponse_clusters
                        ((Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster]))
 -> DescribeClustersResponse
 -> Const [Cluster] DescribeClustersResponse)
-> (([Cluster] -> Const [Cluster] [Cluster])
    -> Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster]))
-> Getting [Cluster] DescribeClustersResponse [Cluster]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Cluster] -> Const [Cluster] [Cluster])
-> Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                    )
                )
                ((Cluster -> f Cluster)
 -> DescribeClustersResponse -> f DescribeClustersResponse)
-> ((CI Text -> f (CI Text)) -> Cluster -> f Cluster)
-> (CI Text -> f (CI Text))
-> DescribeClustersResponse
-> f DescribeClustersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe RestoreStatus -> f (Maybe RestoreStatus))
-> Cluster -> f Cluster
Lens' Cluster (Maybe RestoreStatus)
cluster_restoreStatus
                ((Maybe RestoreStatus -> f (Maybe RestoreStatus))
 -> Cluster -> f Cluster)
-> ((CI Text -> f (CI Text))
    -> Maybe RestoreStatus -> f (Maybe RestoreStatus))
-> (CI Text -> f (CI Text))
-> Cluster
-> f Cluster
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (RestoreStatus -> f RestoreStatus)
-> Maybe RestoreStatus -> f (Maybe RestoreStatus)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((RestoreStatus -> f RestoreStatus)
 -> Maybe RestoreStatus -> f (Maybe RestoreStatus))
-> ((CI Text -> f (CI Text)) -> RestoreStatus -> f RestoreStatus)
-> (CI Text -> f (CI Text))
-> Maybe RestoreStatus
-> f (Maybe RestoreStatus)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe Text -> f (Maybe Text)) -> RestoreStatus -> f RestoreStatus
Lens' RestoreStatus (Maybe Text)
restoreStatus_status
                ((Maybe Text -> f (Maybe Text))
 -> RestoreStatus -> f RestoreStatus)
-> ((CI Text -> f (CI Text)) -> Maybe Text -> f (Maybe Text))
-> (CI Text -> f (CI Text))
-> RestoreStatus
-> f RestoreStatus
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Maybe Text -> f (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((Text -> f Text) -> Maybe Text -> f (Maybe Text))
-> ((CI Text -> f (CI Text)) -> Text -> f Text)
-> (CI Text -> f (CI Text))
-> Maybe Text
-> f (Maybe Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> CI Text) -> (CI Text -> f (CI Text)) -> Text -> f Text
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to Text -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          CI Text
-> Accept
-> Fold (AWSResponse DescribeClusters) (CI Text)
-> Acceptor DescribeClusters
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAny
            CI Text
"deleting"
            Accept
Core.AcceptFailure
            ( (DescribeClustersResponse -> [Cluster])
-> Fold DescribeClustersResponse Cluster
forall (f :: * -> *) s a. Foldable f => (s -> f a) -> Fold s a
Lens.folding
                ( Getting [Cluster] DescribeClustersResponse [Cluster]
-> DescribeClustersResponse -> [Cluster]
forall r s. Getting [r] s [r] -> s -> [r]
Lens.concatOf
                    ( (Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster]))
-> DescribeClustersResponse
-> Const [Cluster] DescribeClustersResponse
Lens' DescribeClustersResponse (Maybe [Cluster])
describeClustersResponse_clusters
                        ((Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster]))
 -> DescribeClustersResponse
 -> Const [Cluster] DescribeClustersResponse)
-> (([Cluster] -> Const [Cluster] [Cluster])
    -> Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster]))
-> Getting [Cluster] DescribeClustersResponse [Cluster]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Cluster] -> Const [Cluster] [Cluster])
-> Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                    )
                )
                ((Cluster -> f Cluster)
 -> DescribeClustersResponse -> f DescribeClustersResponse)
-> ((CI Text -> f (CI Text)) -> Cluster -> f Cluster)
-> (CI Text -> f (CI Text))
-> DescribeClustersResponse
-> f DescribeClustersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe Text -> f (Maybe Text)) -> Cluster -> f Cluster
Lens' Cluster (Maybe Text)
cluster_clusterStatus
                ((Maybe Text -> f (Maybe Text)) -> Cluster -> f Cluster)
-> ((CI Text -> f (CI Text)) -> Maybe Text -> f (Maybe Text))
-> (CI Text -> f (CI Text))
-> Cluster
-> f Cluster
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Maybe Text -> f (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((Text -> f Text) -> Maybe Text -> f (Maybe Text))
-> ((CI Text -> f (CI Text)) -> Text -> f Text)
-> (CI Text -> f (CI Text))
-> Maybe Text
-> f (Maybe Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> CI Text) -> (CI Text -> f (CI Text)) -> Text -> f Text
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to Text -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            )
        ]
    }

-- | Polls 'Amazonka.Redshift.DescribeClusters' every 60 seconds until a successful state is reached. An error is returned after 30 failed checks.
newClusterDeleted :: Core.Wait DescribeClusters
newClusterDeleted :: Wait DescribeClusters
newClusterDeleted =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"ClusterDeleted",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
30,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
60,
      $sel:_waitAcceptors:Wait :: [Acceptor DescribeClusters]
Core._waitAcceptors =
        [ ErrorCode -> Accept -> Acceptor DescribeClusters
forall a. ErrorCode -> Accept -> Acceptor a
Core.matchError
            ErrorCode
"ClusterNotFound"
            Accept
Core.AcceptSuccess,
          CI Text
-> Accept
-> Fold (AWSResponse DescribeClusters) (CI Text)
-> Acceptor DescribeClusters
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAny
            CI Text
"creating"
            Accept
Core.AcceptFailure
            ( (DescribeClustersResponse -> [Cluster])
-> Fold DescribeClustersResponse Cluster
forall (f :: * -> *) s a. Foldable f => (s -> f a) -> Fold s a
Lens.folding
                ( Getting [Cluster] DescribeClustersResponse [Cluster]
-> DescribeClustersResponse -> [Cluster]
forall r s. Getting [r] s [r] -> s -> [r]
Lens.concatOf
                    ( (Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster]))
-> DescribeClustersResponse
-> Const [Cluster] DescribeClustersResponse
Lens' DescribeClustersResponse (Maybe [Cluster])
describeClustersResponse_clusters
                        ((Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster]))
 -> DescribeClustersResponse
 -> Const [Cluster] DescribeClustersResponse)
-> (([Cluster] -> Const [Cluster] [Cluster])
    -> Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster]))
-> Getting [Cluster] DescribeClustersResponse [Cluster]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Cluster] -> Const [Cluster] [Cluster])
-> Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                    )
                )
                ((Cluster -> f Cluster)
 -> DescribeClustersResponse -> f DescribeClustersResponse)
-> ((CI Text -> f (CI Text)) -> Cluster -> f Cluster)
-> (CI Text -> f (CI Text))
-> DescribeClustersResponse
-> f DescribeClustersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe Text -> f (Maybe Text)) -> Cluster -> f Cluster
Lens' Cluster (Maybe Text)
cluster_clusterStatus
                ((Maybe Text -> f (Maybe Text)) -> Cluster -> f Cluster)
-> ((CI Text -> f (CI Text)) -> Maybe Text -> f (Maybe Text))
-> (CI Text -> f (CI Text))
-> Cluster
-> f Cluster
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Maybe Text -> f (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((Text -> f Text) -> Maybe Text -> f (Maybe Text))
-> ((CI Text -> f (CI Text)) -> Text -> f Text)
-> (CI Text -> f (CI Text))
-> Maybe Text
-> f (Maybe Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> CI Text) -> (CI Text -> f (CI Text)) -> Text -> f Text
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to Text -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          CI Text
-> Accept
-> Fold (AWSResponse DescribeClusters) (CI Text)
-> Acceptor DescribeClusters
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAny
            CI Text
"modifying"
            Accept
Core.AcceptFailure
            ( (DescribeClustersResponse -> [Cluster])
-> Fold DescribeClustersResponse Cluster
forall (f :: * -> *) s a. Foldable f => (s -> f a) -> Fold s a
Lens.folding
                ( Getting [Cluster] DescribeClustersResponse [Cluster]
-> DescribeClustersResponse -> [Cluster]
forall r s. Getting [r] s [r] -> s -> [r]
Lens.concatOf
                    ( (Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster]))
-> DescribeClustersResponse
-> Const [Cluster] DescribeClustersResponse
Lens' DescribeClustersResponse (Maybe [Cluster])
describeClustersResponse_clusters
                        ((Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster]))
 -> DescribeClustersResponse
 -> Const [Cluster] DescribeClustersResponse)
-> (([Cluster] -> Const [Cluster] [Cluster])
    -> Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster]))
-> Getting [Cluster] DescribeClustersResponse [Cluster]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Cluster] -> Const [Cluster] [Cluster])
-> Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                    )
                )
                ((Cluster -> f Cluster)
 -> DescribeClustersResponse -> f DescribeClustersResponse)
-> ((CI Text -> f (CI Text)) -> Cluster -> f Cluster)
-> (CI Text -> f (CI Text))
-> DescribeClustersResponse
-> f DescribeClustersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe Text -> f (Maybe Text)) -> Cluster -> f Cluster
Lens' Cluster (Maybe Text)
cluster_clusterStatus
                ((Maybe Text -> f (Maybe Text)) -> Cluster -> f Cluster)
-> ((CI Text -> f (CI Text)) -> Maybe Text -> f (Maybe Text))
-> (CI Text -> f (CI Text))
-> Cluster
-> f Cluster
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Maybe Text -> f (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((Text -> f Text) -> Maybe Text -> f (Maybe Text))
-> ((CI Text -> f (CI Text)) -> Text -> f Text)
-> (CI Text -> f (CI Text))
-> Maybe Text
-> f (Maybe Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> CI Text) -> (CI Text -> f (CI Text)) -> Text -> f Text
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to Text -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            )
        ]
    }

-- | Polls 'Amazonka.Redshift.DescribeClusterSnapshots' every 15 seconds until a successful state is reached. An error is returned after 20 failed checks.
newSnapshotAvailable :: Core.Wait DescribeClusterSnapshots
newSnapshotAvailable :: Wait DescribeClusterSnapshots
newSnapshotAvailable =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"SnapshotAvailable",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
20,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
15,
      $sel:_waitAcceptors:Wait :: [Acceptor DescribeClusterSnapshots]
Core._waitAcceptors =
        [ CI Text
-> Accept
-> Fold (AWSResponse DescribeClusterSnapshots) (CI Text)
-> Acceptor DescribeClusterSnapshots
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"available"
            Accept
Core.AcceptSuccess
            ( (DescribeClusterSnapshotsResponse -> [Snapshot])
-> Fold DescribeClusterSnapshotsResponse Snapshot
forall (f :: * -> *) s a. Foldable f => (s -> f a) -> Fold s a
Lens.folding
                ( Getting [Snapshot] DescribeClusterSnapshotsResponse [Snapshot]
-> DescribeClusterSnapshotsResponse -> [Snapshot]
forall r s. Getting [r] s [r] -> s -> [r]
Lens.concatOf
                    ( (Maybe [Snapshot] -> Const [Snapshot] (Maybe [Snapshot]))
-> DescribeClusterSnapshotsResponse
-> Const [Snapshot] DescribeClusterSnapshotsResponse
Lens' DescribeClusterSnapshotsResponse (Maybe [Snapshot])
describeClusterSnapshotsResponse_snapshots
                        ((Maybe [Snapshot] -> Const [Snapshot] (Maybe [Snapshot]))
 -> DescribeClusterSnapshotsResponse
 -> Const [Snapshot] DescribeClusterSnapshotsResponse)
-> (([Snapshot] -> Const [Snapshot] [Snapshot])
    -> Maybe [Snapshot] -> Const [Snapshot] (Maybe [Snapshot]))
-> Getting [Snapshot] DescribeClusterSnapshotsResponse [Snapshot]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Snapshot] -> Const [Snapshot] [Snapshot])
-> Maybe [Snapshot] -> Const [Snapshot] (Maybe [Snapshot])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                    )
                )
                ((Snapshot -> f Snapshot)
 -> DescribeClusterSnapshotsResponse
 -> f DescribeClusterSnapshotsResponse)
-> ((CI Text -> f (CI Text)) -> Snapshot -> f Snapshot)
-> (CI Text -> f (CI Text))
-> DescribeClusterSnapshotsResponse
-> f DescribeClusterSnapshotsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe Text -> f (Maybe Text)) -> Snapshot -> f Snapshot
Lens' Snapshot (Maybe Text)
snapshot_status
                ((Maybe Text -> f (Maybe Text)) -> Snapshot -> f Snapshot)
-> ((CI Text -> f (CI Text)) -> Maybe Text -> f (Maybe Text))
-> (CI Text -> f (CI Text))
-> Snapshot
-> f Snapshot
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Maybe Text -> f (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((Text -> f Text) -> Maybe Text -> f (Maybe Text))
-> ((CI Text -> f (CI Text)) -> Text -> f Text)
-> (CI Text -> f (CI Text))
-> Maybe Text
-> f (Maybe Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> CI Text) -> (CI Text -> f (CI Text)) -> Text -> f Text
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to Text -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          CI Text
-> Accept
-> Fold (AWSResponse DescribeClusterSnapshots) (CI Text)
-> Acceptor DescribeClusterSnapshots
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAny
            CI Text
"failed"
            Accept
Core.AcceptFailure
            ( (DescribeClusterSnapshotsResponse -> [Snapshot])
-> Fold DescribeClusterSnapshotsResponse Snapshot
forall (f :: * -> *) s a. Foldable f => (s -> f a) -> Fold s a
Lens.folding
                ( Getting [Snapshot] DescribeClusterSnapshotsResponse [Snapshot]
-> DescribeClusterSnapshotsResponse -> [Snapshot]
forall r s. Getting [r] s [r] -> s -> [r]
Lens.concatOf
                    ( (Maybe [Snapshot] -> Const [Snapshot] (Maybe [Snapshot]))
-> DescribeClusterSnapshotsResponse
-> Const [Snapshot] DescribeClusterSnapshotsResponse
Lens' DescribeClusterSnapshotsResponse (Maybe [Snapshot])
describeClusterSnapshotsResponse_snapshots
                        ((Maybe [Snapshot] -> Const [Snapshot] (Maybe [Snapshot]))
 -> DescribeClusterSnapshotsResponse
 -> Const [Snapshot] DescribeClusterSnapshotsResponse)
-> (([Snapshot] -> Const [Snapshot] [Snapshot])
    -> Maybe [Snapshot] -> Const [Snapshot] (Maybe [Snapshot]))
-> Getting [Snapshot] DescribeClusterSnapshotsResponse [Snapshot]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Snapshot] -> Const [Snapshot] [Snapshot])
-> Maybe [Snapshot] -> Const [Snapshot] (Maybe [Snapshot])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                    )
                )
                ((Snapshot -> f Snapshot)
 -> DescribeClusterSnapshotsResponse
 -> f DescribeClusterSnapshotsResponse)
-> ((CI Text -> f (CI Text)) -> Snapshot -> f Snapshot)
-> (CI Text -> f (CI Text))
-> DescribeClusterSnapshotsResponse
-> f DescribeClusterSnapshotsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe Text -> f (Maybe Text)) -> Snapshot -> f Snapshot
Lens' Snapshot (Maybe Text)
snapshot_status
                ((Maybe Text -> f (Maybe Text)) -> Snapshot -> f Snapshot)
-> ((CI Text -> f (CI Text)) -> Maybe Text -> f (Maybe Text))
-> (CI Text -> f (CI Text))
-> Snapshot
-> f Snapshot
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Maybe Text -> f (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((Text -> f Text) -> Maybe Text -> f (Maybe Text))
-> ((CI Text -> f (CI Text)) -> Text -> f Text)
-> (CI Text -> f (CI Text))
-> Maybe Text
-> f (Maybe Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> CI Text) -> (CI Text -> f (CI Text)) -> Text -> f Text
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to Text -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          CI Text
-> Accept
-> Fold (AWSResponse DescribeClusterSnapshots) (CI Text)
-> Acceptor DescribeClusterSnapshots
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAny
            CI Text
"deleted"
            Accept
Core.AcceptFailure
            ( (DescribeClusterSnapshotsResponse -> [Snapshot])
-> Fold DescribeClusterSnapshotsResponse Snapshot
forall (f :: * -> *) s a. Foldable f => (s -> f a) -> Fold s a
Lens.folding
                ( Getting [Snapshot] DescribeClusterSnapshotsResponse [Snapshot]
-> DescribeClusterSnapshotsResponse -> [Snapshot]
forall r s. Getting [r] s [r] -> s -> [r]
Lens.concatOf
                    ( (Maybe [Snapshot] -> Const [Snapshot] (Maybe [Snapshot]))
-> DescribeClusterSnapshotsResponse
-> Const [Snapshot] DescribeClusterSnapshotsResponse
Lens' DescribeClusterSnapshotsResponse (Maybe [Snapshot])
describeClusterSnapshotsResponse_snapshots
                        ((Maybe [Snapshot] -> Const [Snapshot] (Maybe [Snapshot]))
 -> DescribeClusterSnapshotsResponse
 -> Const [Snapshot] DescribeClusterSnapshotsResponse)
-> (([Snapshot] -> Const [Snapshot] [Snapshot])
    -> Maybe [Snapshot] -> Const [Snapshot] (Maybe [Snapshot]))
-> Getting [Snapshot] DescribeClusterSnapshotsResponse [Snapshot]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Snapshot] -> Const [Snapshot] [Snapshot])
-> Maybe [Snapshot] -> Const [Snapshot] (Maybe [Snapshot])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                    )
                )
                ((Snapshot -> f Snapshot)
 -> DescribeClusterSnapshotsResponse
 -> f DescribeClusterSnapshotsResponse)
-> ((CI Text -> f (CI Text)) -> Snapshot -> f Snapshot)
-> (CI Text -> f (CI Text))
-> DescribeClusterSnapshotsResponse
-> f DescribeClusterSnapshotsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe Text -> f (Maybe Text)) -> Snapshot -> f Snapshot
Lens' Snapshot (Maybe Text)
snapshot_status
                ((Maybe Text -> f (Maybe Text)) -> Snapshot -> f Snapshot)
-> ((CI Text -> f (CI Text)) -> Maybe Text -> f (Maybe Text))
-> (CI Text -> f (CI Text))
-> Snapshot
-> f Snapshot
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Maybe Text -> f (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((Text -> f Text) -> Maybe Text -> f (Maybe Text))
-> ((CI Text -> f (CI Text)) -> Text -> f Text)
-> (CI Text -> f (CI Text))
-> Maybe Text
-> f (Maybe Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> CI Text) -> (CI Text -> f (CI Text)) -> Text -> f Text
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to Text -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            )
        ]
    }

-- | Polls 'Amazonka.Redshift.DescribeClusters' every 60 seconds until a successful state is reached. An error is returned after 30 failed checks.
newClusterAvailable :: Core.Wait DescribeClusters
newClusterAvailable :: Wait DescribeClusters
newClusterAvailable =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"ClusterAvailable",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
30,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
60,
      $sel:_waitAcceptors:Wait :: [Acceptor DescribeClusters]
Core._waitAcceptors =
        [ CI Text
-> Accept
-> Fold (AWSResponse DescribeClusters) (CI Text)
-> Acceptor DescribeClusters
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"available"
            Accept
Core.AcceptSuccess
            ( (DescribeClustersResponse -> [Cluster])
-> Fold DescribeClustersResponse Cluster
forall (f :: * -> *) s a. Foldable f => (s -> f a) -> Fold s a
Lens.folding
                ( Getting [Cluster] DescribeClustersResponse [Cluster]
-> DescribeClustersResponse -> [Cluster]
forall r s. Getting [r] s [r] -> s -> [r]
Lens.concatOf
                    ( (Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster]))
-> DescribeClustersResponse
-> Const [Cluster] DescribeClustersResponse
Lens' DescribeClustersResponse (Maybe [Cluster])
describeClustersResponse_clusters
                        ((Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster]))
 -> DescribeClustersResponse
 -> Const [Cluster] DescribeClustersResponse)
-> (([Cluster] -> Const [Cluster] [Cluster])
    -> Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster]))
-> Getting [Cluster] DescribeClustersResponse [Cluster]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Cluster] -> Const [Cluster] [Cluster])
-> Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                    )
                )
                ((Cluster -> f Cluster)
 -> DescribeClustersResponse -> f DescribeClustersResponse)
-> ((CI Text -> f (CI Text)) -> Cluster -> f Cluster)
-> (CI Text -> f (CI Text))
-> DescribeClustersResponse
-> f DescribeClustersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe Text -> f (Maybe Text)) -> Cluster -> f Cluster
Lens' Cluster (Maybe Text)
cluster_clusterStatus
                ((Maybe Text -> f (Maybe Text)) -> Cluster -> f Cluster)
-> ((CI Text -> f (CI Text)) -> Maybe Text -> f (Maybe Text))
-> (CI Text -> f (CI Text))
-> Cluster
-> f Cluster
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Maybe Text -> f (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((Text -> f Text) -> Maybe Text -> f (Maybe Text))
-> ((CI Text -> f (CI Text)) -> Text -> f Text)
-> (CI Text -> f (CI Text))
-> Maybe Text
-> f (Maybe Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> CI Text) -> (CI Text -> f (CI Text)) -> Text -> f Text
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to Text -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          CI Text
-> Accept
-> Fold (AWSResponse DescribeClusters) (CI Text)
-> Acceptor DescribeClusters
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAny
            CI Text
"deleting"
            Accept
Core.AcceptFailure
            ( (DescribeClustersResponse -> [Cluster])
-> Fold DescribeClustersResponse Cluster
forall (f :: * -> *) s a. Foldable f => (s -> f a) -> Fold s a
Lens.folding
                ( Getting [Cluster] DescribeClustersResponse [Cluster]
-> DescribeClustersResponse -> [Cluster]
forall r s. Getting [r] s [r] -> s -> [r]
Lens.concatOf
                    ( (Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster]))
-> DescribeClustersResponse
-> Const [Cluster] DescribeClustersResponse
Lens' DescribeClustersResponse (Maybe [Cluster])
describeClustersResponse_clusters
                        ((Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster]))
 -> DescribeClustersResponse
 -> Const [Cluster] DescribeClustersResponse)
-> (([Cluster] -> Const [Cluster] [Cluster])
    -> Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster]))
-> Getting [Cluster] DescribeClustersResponse [Cluster]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Cluster] -> Const [Cluster] [Cluster])
-> Maybe [Cluster] -> Const [Cluster] (Maybe [Cluster])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                    )
                )
                ((Cluster -> f Cluster)
 -> DescribeClustersResponse -> f DescribeClustersResponse)
-> ((CI Text -> f (CI Text)) -> Cluster -> f Cluster)
-> (CI Text -> f (CI Text))
-> DescribeClustersResponse
-> f DescribeClustersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe Text -> f (Maybe Text)) -> Cluster -> f Cluster
Lens' Cluster (Maybe Text)
cluster_clusterStatus
                ((Maybe Text -> f (Maybe Text)) -> Cluster -> f Cluster)
-> ((CI Text -> f (CI Text)) -> Maybe Text -> f (Maybe Text))
-> (CI Text -> f (CI Text))
-> Cluster
-> f Cluster
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Maybe Text -> f (Maybe Text)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((Text -> f Text) -> Maybe Text -> f (Maybe Text))
-> ((CI Text -> f (CI Text)) -> Text -> f Text)
-> (CI Text -> f (CI Text))
-> Maybe Text
-> f (Maybe Text)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> CI Text) -> (CI Text -> f (CI Text)) -> Text -> f Text
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to Text -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          ErrorCode -> Accept -> Acceptor DescribeClusters
forall a. ErrorCode -> Accept -> Acceptor a
Core.matchError ErrorCode
"ClusterNotFound" Accept
Core.AcceptRetry
        ]
    }