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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53.GetChange
import Amazonka.Route53.Lens
import Amazonka.Route53.Types

-- | Polls 'Amazonka.Route53.GetChange' every 30 seconds until a successful state is reached. An error is returned after 60 failed checks.
newResourceRecordSetsChanged :: Core.Wait GetChange
newResourceRecordSetsChanged :: Wait GetChange
newResourceRecordSetsChanged =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName =
        ByteString
"ResourceRecordSetsChanged",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
60,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
30,
      $sel:_waitAcceptors:Wait :: [Acceptor GetChange]
Core._waitAcceptors =
        [ CI Text
-> Accept
-> Fold (AWSResponse GetChange) (CI Text)
-> Acceptor GetChange
forall b a.
Eq b =>
b -> Accept -> Fold (AWSResponse a) b -> Acceptor a
Core.matchAll
            CI Text
"INSYNC"
            Accept
Core.AcceptSuccess
            ( (ChangeInfo -> f ChangeInfo)
-> GetChangeResponse -> f GetChangeResponse
Lens' GetChangeResponse ChangeInfo
getChangeResponse_changeInfo
                ((ChangeInfo -> f ChangeInfo)
 -> GetChangeResponse -> f GetChangeResponse)
-> ((CI Text -> f (CI Text)) -> ChangeInfo -> f ChangeInfo)
-> (CI Text -> f (CI Text))
-> GetChangeResponse
-> f GetChangeResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ChangeStatus -> f ChangeStatus) -> ChangeInfo -> f ChangeInfo
Lens' ChangeInfo ChangeStatus
changeInfo_status
                ((ChangeStatus -> f ChangeStatus) -> ChangeInfo -> f ChangeInfo)
-> ((CI Text -> f (CI Text)) -> ChangeStatus -> f ChangeStatus)
-> (CI Text -> f (CI Text))
-> ChangeInfo
-> f ChangeInfo
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (ChangeStatus -> CI Text)
-> (CI Text -> f (CI Text)) -> ChangeStatus -> f ChangeStatus
forall (p :: * -> * -> *) (f :: * -> *) s a.
(Profunctor p, Contravariant f) =>
(s -> a) -> Optic' p f s a
Lens.to ChangeStatus -> CI Text
forall a. ToText a => a -> CI Text
Core.toTextCI
            )
        ]
    }