{-# LANGUAGE DisambiguateRecordFields #-}
{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.S3.Waiters where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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.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 =
  Core.Wait
    { $sel:name:Wait :: ByteString
Core.name = ByteString
"BucketExists",
      $sel:attempts:Wait :: Int
Core.attempts = Int
20,
      $sel:delay:Wait :: Seconds
Core.delay = Seconds
5,
      $sel:acceptors:Wait :: [Acceptor HeadBucket]
Core.acceptors =
        [ forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
200 Accept
Core.AcceptSuccess,
          forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
301 Accept
Core.AcceptSuccess,
          forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
403 Accept
Core.AcceptSuccess,
          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 =
  Core.Wait
    { $sel:name:Wait :: ByteString
Core.name = ByteString
"BucketNotExists",
      $sel:attempts:Wait :: Int
Core.attempts = Int
20,
      $sel:delay:Wait :: Seconds
Core.delay = Seconds
5,
      $sel:acceptors:Wait :: [Acceptor HeadBucket]
Core.acceptors =
        [forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
404 Accept
Core.AcceptSuccess]
    }

-- | 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 =
  Core.Wait
    { $sel:name:Wait :: ByteString
Core.name = ByteString
"ObjectExists",
      $sel:attempts:Wait :: Int
Core.attempts = Int
20,
      $sel:delay:Wait :: Seconds
Core.delay = Seconds
5,
      $sel:acceptors:Wait :: [Acceptor HeadObject]
Core.acceptors =
        [ forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
200 Accept
Core.AcceptSuccess,
          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.
newObjectNotExists :: Core.Wait HeadObject
newObjectNotExists :: Wait HeadObject
newObjectNotExists =
  Core.Wait
    { $sel:name:Wait :: ByteString
Core.name = ByteString
"ObjectNotExists",
      $sel:attempts:Wait :: Int
Core.attempts = Int
20,
      $sel:delay:Wait :: Seconds
Core.delay = Seconds
5,
      $sel:acceptors:Wait :: [Acceptor HeadObject]
Core.acceptors =
        [forall a. Int -> Accept -> Acceptor a
Core.matchStatus Int
404 Accept
Core.AcceptSuccess]
    }