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

import qualified Amazonka.Core as Core
import Amazonka.IAM.GetInstanceProfile
import Amazonka.IAM.GetPolicy
import Amazonka.IAM.GetRole
import Amazonka.IAM.GetUser
import Amazonka.IAM.Lens
import Amazonka.IAM.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Polls 'Amazonka.IAM.GetInstanceProfile' every 1 seconds until a successful state is reached. An error is returned after 40 failed checks.
newInstanceProfileExists :: Core.Wait GetInstanceProfile
newInstanceProfileExists :: Wait GetInstanceProfile
newInstanceProfileExists =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"InstanceProfileExists",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
40,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
1,
      $sel:_waitAcceptors:Wait :: [Acceptor GetInstanceProfile]
Core._waitAcceptors =
        [ Int -> Accept -> Acceptor GetInstanceProfile
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
200 Accept
Core.AcceptSuccess,
          Int -> Accept -> Acceptor GetInstanceProfile
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
404 Accept
Core.AcceptRetry
        ]
    }

-- | Polls 'Amazonka.IAM.GetUser' every 1 seconds until a successful state is reached. An error is returned after 20 failed checks.
newUserExists :: Core.Wait GetUser
newUserExists :: Wait GetUser
newUserExists =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"UserExists",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
20,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
1,
      $sel:_waitAcceptors:Wait :: [Acceptor GetUser]
Core._waitAcceptors =
        [ Int -> Accept -> Acceptor GetUser
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
200 Accept
Core.AcceptSuccess,
          ErrorCode -> Accept -> Acceptor GetUser
forall a. ErrorCode -> Accept -> Acceptor a
Core.matchError ErrorCode
"NoSuchEntity" Accept
Core.AcceptRetry
        ]
    }

-- | Polls 'Amazonka.IAM.GetRole' every 1 seconds until a successful state is reached. An error is returned after 20 failed checks.
newRoleExists :: Core.Wait GetRole
newRoleExists :: Wait GetRole
newRoleExists =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"RoleExists",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
20,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
1,
      $sel:_waitAcceptors:Wait :: [Acceptor GetRole]
Core._waitAcceptors =
        [ Int -> Accept -> Acceptor GetRole
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
200 Accept
Core.AcceptSuccess,
          ErrorCode -> Accept -> Acceptor GetRole
forall a. ErrorCode -> Accept -> Acceptor a
Core.matchError ErrorCode
"NoSuchEntity" Accept
Core.AcceptRetry
        ]
    }

-- | Polls 'Amazonka.IAM.GetPolicy' every 1 seconds until a successful state is reached. An error is returned after 20 failed checks.
newPolicyExists :: Core.Wait GetPolicy
newPolicyExists :: Wait GetPolicy
newPolicyExists =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"PolicyExists",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
20,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
1,
      $sel:_waitAcceptors:Wait :: [Acceptor GetPolicy]
Core._waitAcceptors =
        [ Int -> Accept -> Acceptor GetPolicy
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
200 Accept
Core.AcceptSuccess,
          ErrorCode -> Accept -> Acceptor GetPolicy
forall a. ErrorCode -> Accept -> Acceptor a
Core.matchError ErrorCode
"NoSuchEntity" Accept
Core.AcceptRetry
        ]
    }