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

import qualified Amazonka.Core as Core
import Amazonka.ELBV2.DescribeLoadBalancers
import Amazonka.ELBV2.DescribeTargetHealth
import Amazonka.ELBV2.Lens
import Amazonka.ELBV2.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Polls 'Amazonka.ELBV2.DescribeLoadBalancers' every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
newLoadBalancersDeleted :: Core.Wait DescribeLoadBalancers
newLoadBalancersDeleted :: Wait DescribeLoadBalancers
newLoadBalancersDeleted =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"LoadBalancersDeleted",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
40,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
15,
      $sel:_waitAcceptors:Wait :: [Acceptor DescribeLoadBalancers]
Core._waitAcceptors =
        [ CI Text
-> Accept
-> Fold (AWSResponse DescribeLoadBalancers) (CI Text)
-> Acceptor DescribeLoadBalancers
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"active"
            Accept
Core.AcceptRetry
            ( (DescribeLoadBalancersResponse -> [LoadBalancer])
-> Fold DescribeLoadBalancersResponse LoadBalancer
forall (f :: * -> *) s a. Foldable f => (s -> f a) -> Fold s a
Lens.folding
                ( Getting [LoadBalancer] DescribeLoadBalancersResponse [LoadBalancer]
-> DescribeLoadBalancersResponse -> [LoadBalancer]
forall r s. Getting [r] s [r] -> s -> [r]
Lens.concatOf
                    ( (Maybe [LoadBalancer]
 -> Const [LoadBalancer] (Maybe [LoadBalancer]))
-> DescribeLoadBalancersResponse
-> Const [LoadBalancer] DescribeLoadBalancersResponse
Lens' DescribeLoadBalancersResponse (Maybe [LoadBalancer])
describeLoadBalancersResponse_loadBalancers
                        ((Maybe [LoadBalancer]
  -> Const [LoadBalancer] (Maybe [LoadBalancer]))
 -> DescribeLoadBalancersResponse
 -> Const [LoadBalancer] DescribeLoadBalancersResponse)
-> (([LoadBalancer] -> Const [LoadBalancer] [LoadBalancer])
    -> Maybe [LoadBalancer]
    -> Const [LoadBalancer] (Maybe [LoadBalancer]))
-> Getting
     [LoadBalancer] DescribeLoadBalancersResponse [LoadBalancer]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([LoadBalancer] -> Const [LoadBalancer] [LoadBalancer])
-> Maybe [LoadBalancer]
-> Const [LoadBalancer] (Maybe [LoadBalancer])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                    )
                )
                ((LoadBalancer -> f LoadBalancer)
 -> DescribeLoadBalancersResponse
 -> f DescribeLoadBalancersResponse)
-> ((CI Text -> f (CI Text)) -> LoadBalancer -> f LoadBalancer)
-> (CI Text -> f (CI Text))
-> DescribeLoadBalancersResponse
-> f DescribeLoadBalancersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe LoadBalancerState -> f (Maybe LoadBalancerState))
-> LoadBalancer -> f LoadBalancer
Lens' LoadBalancer (Maybe LoadBalancerState)
loadBalancer_state
                ((Maybe LoadBalancerState -> f (Maybe LoadBalancerState))
 -> LoadBalancer -> f LoadBalancer)
-> ((CI Text -> f (CI Text))
    -> Maybe LoadBalancerState -> f (Maybe LoadBalancerState))
-> (CI Text -> f (CI Text))
-> LoadBalancer
-> f LoadBalancer
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (LoadBalancerState -> f LoadBalancerState)
-> Maybe LoadBalancerState -> f (Maybe LoadBalancerState)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((LoadBalancerState -> f LoadBalancerState)
 -> Maybe LoadBalancerState -> f (Maybe LoadBalancerState))
-> ((CI Text -> f (CI Text))
    -> LoadBalancerState -> f LoadBalancerState)
-> (CI Text -> f (CI Text))
-> Maybe LoadBalancerState
-> f (Maybe LoadBalancerState)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe LoadBalancerStateEnum -> f (Maybe LoadBalancerStateEnum))
-> LoadBalancerState -> f LoadBalancerState
Lens' LoadBalancerState (Maybe LoadBalancerStateEnum)
loadBalancerState_code
                ((Maybe LoadBalancerStateEnum -> f (Maybe LoadBalancerStateEnum))
 -> LoadBalancerState -> f LoadBalancerState)
-> ((CI Text -> f (CI Text))
    -> Maybe LoadBalancerStateEnum -> f (Maybe LoadBalancerStateEnum))
-> (CI Text -> f (CI Text))
-> LoadBalancerState
-> f LoadBalancerState
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (LoadBalancerStateEnum -> f LoadBalancerStateEnum)
-> Maybe LoadBalancerStateEnum -> f (Maybe LoadBalancerStateEnum)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((LoadBalancerStateEnum -> f LoadBalancerStateEnum)
 -> Maybe LoadBalancerStateEnum -> f (Maybe LoadBalancerStateEnum))
-> ((CI Text -> f (CI Text))
    -> LoadBalancerStateEnum -> f LoadBalancerStateEnum)
-> (CI Text -> f (CI Text))
-> Maybe LoadBalancerStateEnum
-> f (Maybe LoadBalancerStateEnum)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (LoadBalancerStateEnum -> CI Text)
-> (CI Text -> f (CI Text))
-> LoadBalancerStateEnum
-> f LoadBalancerStateEnum
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to LoadBalancerStateEnum -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          ErrorCode -> Accept -> Acceptor DescribeLoadBalancers
forall a. ErrorCode -> Accept -> Acceptor a
Core.matchError
            ErrorCode
"LoadBalancerNotFound"
            Accept
Core.AcceptSuccess
        ]
    }

-- | Polls 'Amazonka.ELBV2.DescribeTargetHealth' every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
newTargetDeregistered :: Core.Wait DescribeTargetHealth
newTargetDeregistered :: Wait DescribeTargetHealth
newTargetDeregistered =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"TargetDeregistered",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
40,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
15,
      $sel:_waitAcceptors:Wait :: [Acceptor DescribeTargetHealth]
Core._waitAcceptors =
        [ ErrorCode -> Accept -> Acceptor DescribeTargetHealth
forall a. ErrorCode -> Accept -> Acceptor a
Core.matchError ErrorCode
"InvalidTarget" Accept
Core.AcceptSuccess,
          CI Text
-> Accept
-> Fold (AWSResponse DescribeTargetHealth) (CI Text)
-> Acceptor DescribeTargetHealth
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"unused"
            Accept
Core.AcceptSuccess
            ( (DescribeTargetHealthResponse -> [TargetHealthDescription])
-> Fold DescribeTargetHealthResponse TargetHealthDescription
forall (f :: * -> *) s a. Foldable f => (s -> f a) -> Fold s a
Lens.folding
                ( Getting
  [TargetHealthDescription]
  DescribeTargetHealthResponse
  [TargetHealthDescription]
-> DescribeTargetHealthResponse -> [TargetHealthDescription]
forall r s. Getting [r] s [r] -> s -> [r]
Lens.concatOf
                    ( (Maybe [TargetHealthDescription]
 -> Const
      [TargetHealthDescription] (Maybe [TargetHealthDescription]))
-> DescribeTargetHealthResponse
-> Const [TargetHealthDescription] DescribeTargetHealthResponse
Lens'
  DescribeTargetHealthResponse (Maybe [TargetHealthDescription])
describeTargetHealthResponse_targetHealthDescriptions
                        ((Maybe [TargetHealthDescription]
  -> Const
       [TargetHealthDescription] (Maybe [TargetHealthDescription]))
 -> DescribeTargetHealthResponse
 -> Const [TargetHealthDescription] DescribeTargetHealthResponse)
-> (([TargetHealthDescription]
     -> Const [TargetHealthDescription] [TargetHealthDescription])
    -> Maybe [TargetHealthDescription]
    -> Const
         [TargetHealthDescription] (Maybe [TargetHealthDescription]))
-> Getting
     [TargetHealthDescription]
     DescribeTargetHealthResponse
     [TargetHealthDescription]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([TargetHealthDescription]
 -> Const [TargetHealthDescription] [TargetHealthDescription])
-> Maybe [TargetHealthDescription]
-> Const
     [TargetHealthDescription] (Maybe [TargetHealthDescription])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                    )
                )
                ((TargetHealthDescription -> f TargetHealthDescription)
 -> DescribeTargetHealthResponse -> f DescribeTargetHealthResponse)
-> ((CI Text -> f (CI Text))
    -> TargetHealthDescription -> f TargetHealthDescription)
-> (CI Text -> f (CI Text))
-> DescribeTargetHealthResponse
-> f DescribeTargetHealthResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe TargetHealth -> f (Maybe TargetHealth))
-> TargetHealthDescription -> f TargetHealthDescription
Lens' TargetHealthDescription (Maybe TargetHealth)
targetHealthDescription_targetHealth
                ((Maybe TargetHealth -> f (Maybe TargetHealth))
 -> TargetHealthDescription -> f TargetHealthDescription)
-> ((CI Text -> f (CI Text))
    -> Maybe TargetHealth -> f (Maybe TargetHealth))
-> (CI Text -> f (CI Text))
-> TargetHealthDescription
-> f TargetHealthDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (TargetHealth -> f TargetHealth)
-> Maybe TargetHealth -> f (Maybe TargetHealth)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((TargetHealth -> f TargetHealth)
 -> Maybe TargetHealth -> f (Maybe TargetHealth))
-> ((CI Text -> f (CI Text)) -> TargetHealth -> f TargetHealth)
-> (CI Text -> f (CI Text))
-> Maybe TargetHealth
-> f (Maybe TargetHealth)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe TargetHealthStateEnum -> f (Maybe TargetHealthStateEnum))
-> TargetHealth -> f TargetHealth
Lens' TargetHealth (Maybe TargetHealthStateEnum)
targetHealth_state
                ((Maybe TargetHealthStateEnum -> f (Maybe TargetHealthStateEnum))
 -> TargetHealth -> f TargetHealth)
-> ((CI Text -> f (CI Text))
    -> Maybe TargetHealthStateEnum -> f (Maybe TargetHealthStateEnum))
-> (CI Text -> f (CI Text))
-> TargetHealth
-> f TargetHealth
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (TargetHealthStateEnum -> f TargetHealthStateEnum)
-> Maybe TargetHealthStateEnum -> f (Maybe TargetHealthStateEnum)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((TargetHealthStateEnum -> f TargetHealthStateEnum)
 -> Maybe TargetHealthStateEnum -> f (Maybe TargetHealthStateEnum))
-> ((CI Text -> f (CI Text))
    -> TargetHealthStateEnum -> f TargetHealthStateEnum)
-> (CI Text -> f (CI Text))
-> Maybe TargetHealthStateEnum
-> f (Maybe TargetHealthStateEnum)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (TargetHealthStateEnum -> CI Text)
-> (CI Text -> f (CI Text))
-> TargetHealthStateEnum
-> f TargetHealthStateEnum
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to TargetHealthStateEnum -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            )
        ]
    }

-- | Polls 'Amazonka.ELBV2.DescribeLoadBalancers' every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
newLoadBalancerAvailable :: Core.Wait DescribeLoadBalancers
newLoadBalancerAvailable :: Wait DescribeLoadBalancers
newLoadBalancerAvailable =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"LoadBalancerAvailable",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
40,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
15,
      $sel:_waitAcceptors:Wait :: [Acceptor DescribeLoadBalancers]
Core._waitAcceptors =
        [ CI Text
-> Accept
-> Fold (AWSResponse DescribeLoadBalancers) (CI Text)
-> Acceptor DescribeLoadBalancers
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"active"
            Accept
Core.AcceptSuccess
            ( (DescribeLoadBalancersResponse -> [LoadBalancer])
-> Fold DescribeLoadBalancersResponse LoadBalancer
forall (f :: * -> *) s a. Foldable f => (s -> f a) -> Fold s a
Lens.folding
                ( Getting [LoadBalancer] DescribeLoadBalancersResponse [LoadBalancer]
-> DescribeLoadBalancersResponse -> [LoadBalancer]
forall r s. Getting [r] s [r] -> s -> [r]
Lens.concatOf
                    ( (Maybe [LoadBalancer]
 -> Const [LoadBalancer] (Maybe [LoadBalancer]))
-> DescribeLoadBalancersResponse
-> Const [LoadBalancer] DescribeLoadBalancersResponse
Lens' DescribeLoadBalancersResponse (Maybe [LoadBalancer])
describeLoadBalancersResponse_loadBalancers
                        ((Maybe [LoadBalancer]
  -> Const [LoadBalancer] (Maybe [LoadBalancer]))
 -> DescribeLoadBalancersResponse
 -> Const [LoadBalancer] DescribeLoadBalancersResponse)
-> (([LoadBalancer] -> Const [LoadBalancer] [LoadBalancer])
    -> Maybe [LoadBalancer]
    -> Const [LoadBalancer] (Maybe [LoadBalancer]))
-> Getting
     [LoadBalancer] DescribeLoadBalancersResponse [LoadBalancer]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([LoadBalancer] -> Const [LoadBalancer] [LoadBalancer])
-> Maybe [LoadBalancer]
-> Const [LoadBalancer] (Maybe [LoadBalancer])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                    )
                )
                ((LoadBalancer -> f LoadBalancer)
 -> DescribeLoadBalancersResponse
 -> f DescribeLoadBalancersResponse)
-> ((CI Text -> f (CI Text)) -> LoadBalancer -> f LoadBalancer)
-> (CI Text -> f (CI Text))
-> DescribeLoadBalancersResponse
-> f DescribeLoadBalancersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe LoadBalancerState -> f (Maybe LoadBalancerState))
-> LoadBalancer -> f LoadBalancer
Lens' LoadBalancer (Maybe LoadBalancerState)
loadBalancer_state
                ((Maybe LoadBalancerState -> f (Maybe LoadBalancerState))
 -> LoadBalancer -> f LoadBalancer)
-> ((CI Text -> f (CI Text))
    -> Maybe LoadBalancerState -> f (Maybe LoadBalancerState))
-> (CI Text -> f (CI Text))
-> LoadBalancer
-> f LoadBalancer
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (LoadBalancerState -> f LoadBalancerState)
-> Maybe LoadBalancerState -> f (Maybe LoadBalancerState)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((LoadBalancerState -> f LoadBalancerState)
 -> Maybe LoadBalancerState -> f (Maybe LoadBalancerState))
-> ((CI Text -> f (CI Text))
    -> LoadBalancerState -> f LoadBalancerState)
-> (CI Text -> f (CI Text))
-> Maybe LoadBalancerState
-> f (Maybe LoadBalancerState)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe LoadBalancerStateEnum -> f (Maybe LoadBalancerStateEnum))
-> LoadBalancerState -> f LoadBalancerState
Lens' LoadBalancerState (Maybe LoadBalancerStateEnum)
loadBalancerState_code
                ((Maybe LoadBalancerStateEnum -> f (Maybe LoadBalancerStateEnum))
 -> LoadBalancerState -> f LoadBalancerState)
-> ((CI Text -> f (CI Text))
    -> Maybe LoadBalancerStateEnum -> f (Maybe LoadBalancerStateEnum))
-> (CI Text -> f (CI Text))
-> LoadBalancerState
-> f LoadBalancerState
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (LoadBalancerStateEnum -> f LoadBalancerStateEnum)
-> Maybe LoadBalancerStateEnum -> f (Maybe LoadBalancerStateEnum)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((LoadBalancerStateEnum -> f LoadBalancerStateEnum)
 -> Maybe LoadBalancerStateEnum -> f (Maybe LoadBalancerStateEnum))
-> ((CI Text -> f (CI Text))
    -> LoadBalancerStateEnum -> f LoadBalancerStateEnum)
-> (CI Text -> f (CI Text))
-> Maybe LoadBalancerStateEnum
-> f (Maybe LoadBalancerStateEnum)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (LoadBalancerStateEnum -> CI Text)
-> (CI Text -> f (CI Text))
-> LoadBalancerStateEnum
-> f LoadBalancerStateEnum
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to LoadBalancerStateEnum -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          CI Text
-> Accept
-> Fold (AWSResponse DescribeLoadBalancers) (CI Text)
-> Acceptor DescribeLoadBalancers
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAny
            CI Text
"provisioning"
            Accept
Core.AcceptRetry
            ( (DescribeLoadBalancersResponse -> [LoadBalancer])
-> Fold DescribeLoadBalancersResponse LoadBalancer
forall (f :: * -> *) s a. Foldable f => (s -> f a) -> Fold s a
Lens.folding
                ( Getting [LoadBalancer] DescribeLoadBalancersResponse [LoadBalancer]
-> DescribeLoadBalancersResponse -> [LoadBalancer]
forall r s. Getting [r] s [r] -> s -> [r]
Lens.concatOf
                    ( (Maybe [LoadBalancer]
 -> Const [LoadBalancer] (Maybe [LoadBalancer]))
-> DescribeLoadBalancersResponse
-> Const [LoadBalancer] DescribeLoadBalancersResponse
Lens' DescribeLoadBalancersResponse (Maybe [LoadBalancer])
describeLoadBalancersResponse_loadBalancers
                        ((Maybe [LoadBalancer]
  -> Const [LoadBalancer] (Maybe [LoadBalancer]))
 -> DescribeLoadBalancersResponse
 -> Const [LoadBalancer] DescribeLoadBalancersResponse)
-> (([LoadBalancer] -> Const [LoadBalancer] [LoadBalancer])
    -> Maybe [LoadBalancer]
    -> Const [LoadBalancer] (Maybe [LoadBalancer]))
-> Getting
     [LoadBalancer] DescribeLoadBalancersResponse [LoadBalancer]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([LoadBalancer] -> Const [LoadBalancer] [LoadBalancer])
-> Maybe [LoadBalancer]
-> Const [LoadBalancer] (Maybe [LoadBalancer])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                    )
                )
                ((LoadBalancer -> f LoadBalancer)
 -> DescribeLoadBalancersResponse
 -> f DescribeLoadBalancersResponse)
-> ((CI Text -> f (CI Text)) -> LoadBalancer -> f LoadBalancer)
-> (CI Text -> f (CI Text))
-> DescribeLoadBalancersResponse
-> f DescribeLoadBalancersResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe LoadBalancerState -> f (Maybe LoadBalancerState))
-> LoadBalancer -> f LoadBalancer
Lens' LoadBalancer (Maybe LoadBalancerState)
loadBalancer_state
                ((Maybe LoadBalancerState -> f (Maybe LoadBalancerState))
 -> LoadBalancer -> f LoadBalancer)
-> ((CI Text -> f (CI Text))
    -> Maybe LoadBalancerState -> f (Maybe LoadBalancerState))
-> (CI Text -> f (CI Text))
-> LoadBalancer
-> f LoadBalancer
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (LoadBalancerState -> f LoadBalancerState)
-> Maybe LoadBalancerState -> f (Maybe LoadBalancerState)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((LoadBalancerState -> f LoadBalancerState)
 -> Maybe LoadBalancerState -> f (Maybe LoadBalancerState))
-> ((CI Text -> f (CI Text))
    -> LoadBalancerState -> f LoadBalancerState)
-> (CI Text -> f (CI Text))
-> Maybe LoadBalancerState
-> f (Maybe LoadBalancerState)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe LoadBalancerStateEnum -> f (Maybe LoadBalancerStateEnum))
-> LoadBalancerState -> f LoadBalancerState
Lens' LoadBalancerState (Maybe LoadBalancerStateEnum)
loadBalancerState_code
                ((Maybe LoadBalancerStateEnum -> f (Maybe LoadBalancerStateEnum))
 -> LoadBalancerState -> f LoadBalancerState)
-> ((CI Text -> f (CI Text))
    -> Maybe LoadBalancerStateEnum -> f (Maybe LoadBalancerStateEnum))
-> (CI Text -> f (CI Text))
-> LoadBalancerState
-> f LoadBalancerState
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (LoadBalancerStateEnum -> f LoadBalancerStateEnum)
-> Maybe LoadBalancerStateEnum -> f (Maybe LoadBalancerStateEnum)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((LoadBalancerStateEnum -> f LoadBalancerStateEnum)
 -> Maybe LoadBalancerStateEnum -> f (Maybe LoadBalancerStateEnum))
-> ((CI Text -> f (CI Text))
    -> LoadBalancerStateEnum -> f LoadBalancerStateEnum)
-> (CI Text -> f (CI Text))
-> Maybe LoadBalancerStateEnum
-> f (Maybe LoadBalancerStateEnum)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (LoadBalancerStateEnum -> CI Text)
-> (CI Text -> f (CI Text))
-> LoadBalancerStateEnum
-> f LoadBalancerStateEnum
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to LoadBalancerStateEnum -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          ErrorCode -> Accept -> Acceptor DescribeLoadBalancers
forall a. ErrorCode -> Accept -> Acceptor a
Core.matchError
            ErrorCode
"LoadBalancerNotFound"
            Accept
Core.AcceptRetry
        ]
    }

-- | Polls 'Amazonka.ELBV2.DescribeTargetHealth' every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
newTargetInService :: Core.Wait DescribeTargetHealth
newTargetInService :: Wait DescribeTargetHealth
newTargetInService =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"TargetInService",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
40,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
15,
      $sel:_waitAcceptors:Wait :: [Acceptor DescribeTargetHealth]
Core._waitAcceptors =
        [ CI Text
-> Accept
-> Fold (AWSResponse DescribeTargetHealth) (CI Text)
-> Acceptor DescribeTargetHealth
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"healthy"
            Accept
Core.AcceptSuccess
            ( (DescribeTargetHealthResponse -> [TargetHealthDescription])
-> Fold DescribeTargetHealthResponse TargetHealthDescription
forall (f :: * -> *) s a. Foldable f => (s -> f a) -> Fold s a
Lens.folding
                ( Getting
  [TargetHealthDescription]
  DescribeTargetHealthResponse
  [TargetHealthDescription]
-> DescribeTargetHealthResponse -> [TargetHealthDescription]
forall r s. Getting [r] s [r] -> s -> [r]
Lens.concatOf
                    ( (Maybe [TargetHealthDescription]
 -> Const
      [TargetHealthDescription] (Maybe [TargetHealthDescription]))
-> DescribeTargetHealthResponse
-> Const [TargetHealthDescription] DescribeTargetHealthResponse
Lens'
  DescribeTargetHealthResponse (Maybe [TargetHealthDescription])
describeTargetHealthResponse_targetHealthDescriptions
                        ((Maybe [TargetHealthDescription]
  -> Const
       [TargetHealthDescription] (Maybe [TargetHealthDescription]))
 -> DescribeTargetHealthResponse
 -> Const [TargetHealthDescription] DescribeTargetHealthResponse)
-> (([TargetHealthDescription]
     -> Const [TargetHealthDescription] [TargetHealthDescription])
    -> Maybe [TargetHealthDescription]
    -> Const
         [TargetHealthDescription] (Maybe [TargetHealthDescription]))
-> Getting
     [TargetHealthDescription]
     DescribeTargetHealthResponse
     [TargetHealthDescription]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([TargetHealthDescription]
 -> Const [TargetHealthDescription] [TargetHealthDescription])
-> Maybe [TargetHealthDescription]
-> Const
     [TargetHealthDescription] (Maybe [TargetHealthDescription])
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                    )
                )
                ((TargetHealthDescription -> f TargetHealthDescription)
 -> DescribeTargetHealthResponse -> f DescribeTargetHealthResponse)
-> ((CI Text -> f (CI Text))
    -> TargetHealthDescription -> f TargetHealthDescription)
-> (CI Text -> f (CI Text))
-> DescribeTargetHealthResponse
-> f DescribeTargetHealthResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe TargetHealth -> f (Maybe TargetHealth))
-> TargetHealthDescription -> f TargetHealthDescription
Lens' TargetHealthDescription (Maybe TargetHealth)
targetHealthDescription_targetHealth
                ((Maybe TargetHealth -> f (Maybe TargetHealth))
 -> TargetHealthDescription -> f TargetHealthDescription)
-> ((CI Text -> f (CI Text))
    -> Maybe TargetHealth -> f (Maybe TargetHealth))
-> (CI Text -> f (CI Text))
-> TargetHealthDescription
-> f TargetHealthDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (TargetHealth -> f TargetHealth)
-> Maybe TargetHealth -> f (Maybe TargetHealth)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((TargetHealth -> f TargetHealth)
 -> Maybe TargetHealth -> f (Maybe TargetHealth))
-> ((CI Text -> f (CI Text)) -> TargetHealth -> f TargetHealth)
-> (CI Text -> f (CI Text))
-> Maybe TargetHealth
-> f (Maybe TargetHealth)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Maybe TargetHealthStateEnum -> f (Maybe TargetHealthStateEnum))
-> TargetHealth -> f TargetHealth
Lens' TargetHealth (Maybe TargetHealthStateEnum)
targetHealth_state
                ((Maybe TargetHealthStateEnum -> f (Maybe TargetHealthStateEnum))
 -> TargetHealth -> f TargetHealth)
-> ((CI Text -> f (CI Text))
    -> Maybe TargetHealthStateEnum -> f (Maybe TargetHealthStateEnum))
-> (CI Text -> f (CI Text))
-> TargetHealth
-> f TargetHealth
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (TargetHealthStateEnum -> f TargetHealthStateEnum)
-> Maybe TargetHealthStateEnum -> f (Maybe TargetHealthStateEnum)
forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
                ((TargetHealthStateEnum -> f TargetHealthStateEnum)
 -> Maybe TargetHealthStateEnum -> f (Maybe TargetHealthStateEnum))
-> ((CI Text -> f (CI Text))
    -> TargetHealthStateEnum -> f TargetHealthStateEnum)
-> (CI Text -> f (CI Text))
-> Maybe TargetHealthStateEnum
-> f (Maybe TargetHealthStateEnum)
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (TargetHealthStateEnum -> CI Text)
-> (CI Text -> f (CI Text))
-> TargetHealthStateEnum
-> f TargetHealthStateEnum
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to TargetHealthStateEnum -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            ),
          ErrorCode -> Accept -> Acceptor DescribeTargetHealth
forall a. ErrorCode -> Accept -> Acceptor a
Core.matchError ErrorCode
"InvalidInstance" Accept
Core.AcceptRetry
        ]
    }

-- | Polls 'Amazonka.ELBV2.DescribeLoadBalancers' every 15 seconds until a successful state is reached. An error is returned after 40 failed checks.
newLoadBalancerExists :: Core.Wait DescribeLoadBalancers
newLoadBalancerExists :: Wait DescribeLoadBalancers
newLoadBalancerExists =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"LoadBalancerExists",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
40,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
15,
      $sel:_waitAcceptors:Wait :: [Acceptor DescribeLoadBalancers]
Core._waitAcceptors =
        [ Int -> Accept -> Acceptor DescribeLoadBalancers
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
200 Accept
Core.AcceptSuccess,
          ErrorCode -> Accept -> Acceptor DescribeLoadBalancers
forall a. ErrorCode -> Accept -> Acceptor a
Core.matchError
            ErrorCode
"LoadBalancerNotFound"
            Accept
Core.AcceptRetry
        ]
    }