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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.HeadBucket
import Amazonka.S3.HeadObject
import Amazonka.S3.Lens
import Amazonka.S3.Types

-- | Polls 'Amazonka.S3.HeadObject' every 5 seconds until a successful state is reached. An error is returned after 20 failed checks.
newObjectNotExists :: Core.Wait HeadObject
newObjectNotExists :: Wait HeadObject
newObjectNotExists =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"ObjectNotExists",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
20,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
5,
      $sel:_waitAcceptors:Wait :: [Acceptor HeadObject]
Core._waitAcceptors =
        [Int -> Accept -> Acceptor HeadObject
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
404 Accept
Core.AcceptSuccess]
    }

-- | Polls 'Amazonka.S3.HeadBucket' every 5 seconds until a successful state is reached. An error is returned after 20 failed checks.
newBucketExists :: Core.Wait HeadBucket
newBucketExists :: Wait HeadBucket
newBucketExists =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"BucketExists",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
20,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
5,
      $sel:_waitAcceptors:Wait :: [Acceptor HeadBucket]
Core._waitAcceptors =
        [ Int -> Accept -> Acceptor HeadBucket
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
200 Accept
Core.AcceptSuccess,
          Int -> Accept -> Acceptor HeadBucket
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
301 Accept
Core.AcceptSuccess,
          Int -> Accept -> Acceptor HeadBucket
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
403 Accept
Core.AcceptSuccess,
          Int -> Accept -> Acceptor HeadBucket
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
404 Accept
Core.AcceptRetry
        ]
    }

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

-- | Polls 'Amazonka.S3.HeadBucket' every 5 seconds until a successful state is reached. An error is returned after 20 failed checks.
newBucketNotExists :: Core.Wait HeadBucket
newBucketNotExists :: Wait HeadBucket
newBucketNotExists =
  Wait :: forall a. ByteString -> Int -> Seconds -> [Acceptor a] -> Wait a
Core.Wait
    { $sel:_waitName:Wait :: ByteString
Core._waitName = ByteString
"BucketNotExists",
      $sel:_waitAttempts:Wait :: Int
Core._waitAttempts = Int
20,
      $sel:_waitDelay:Wait :: Seconds
Core._waitDelay = Seconds
5,
      $sel:_waitAcceptors:Wait :: [Acceptor HeadBucket]
Core._waitAcceptors =
        [Int -> Accept -> Acceptor HeadBucket
forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
404 Accept
Core.AcceptSuccess]
    }