{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.S3.HeadBucket
(
HeadBucket (..),
newHeadBucket,
headBucket_expectedBucketOwner,
headBucket_bucket,
HeadBucketResponse (..),
newHeadBucketResponse,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.S3.Types
data HeadBucket = HeadBucket'
{
HeadBucket -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
HeadBucket -> BucketName
bucket :: BucketName
}
deriving (HeadBucket -> HeadBucket -> Bool
(HeadBucket -> HeadBucket -> Bool)
-> (HeadBucket -> HeadBucket -> Bool) -> Eq HeadBucket
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HeadBucket -> HeadBucket -> Bool
$c/= :: HeadBucket -> HeadBucket -> Bool
== :: HeadBucket -> HeadBucket -> Bool
$c== :: HeadBucket -> HeadBucket -> Bool
Prelude.Eq, ReadPrec [HeadBucket]
ReadPrec HeadBucket
Int -> ReadS HeadBucket
ReadS [HeadBucket]
(Int -> ReadS HeadBucket)
-> ReadS [HeadBucket]
-> ReadPrec HeadBucket
-> ReadPrec [HeadBucket]
-> Read HeadBucket
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HeadBucket]
$creadListPrec :: ReadPrec [HeadBucket]
readPrec :: ReadPrec HeadBucket
$creadPrec :: ReadPrec HeadBucket
readList :: ReadS [HeadBucket]
$creadList :: ReadS [HeadBucket]
readsPrec :: Int -> ReadS HeadBucket
$creadsPrec :: Int -> ReadS HeadBucket
Prelude.Read, Int -> HeadBucket -> ShowS
[HeadBucket] -> ShowS
HeadBucket -> String
(Int -> HeadBucket -> ShowS)
-> (HeadBucket -> String)
-> ([HeadBucket] -> ShowS)
-> Show HeadBucket
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HeadBucket] -> ShowS
$cshowList :: [HeadBucket] -> ShowS
show :: HeadBucket -> String
$cshow :: HeadBucket -> String
showsPrec :: Int -> HeadBucket -> ShowS
$cshowsPrec :: Int -> HeadBucket -> ShowS
Prelude.Show, (forall x. HeadBucket -> Rep HeadBucket x)
-> (forall x. Rep HeadBucket x -> HeadBucket) -> Generic HeadBucket
forall x. Rep HeadBucket x -> HeadBucket
forall x. HeadBucket -> Rep HeadBucket x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HeadBucket x -> HeadBucket
$cfrom :: forall x. HeadBucket -> Rep HeadBucket x
Prelude.Generic)
newHeadBucket ::
BucketName ->
HeadBucket
newHeadBucket :: BucketName -> HeadBucket
newHeadBucket BucketName
pBucket_ =
HeadBucket' :: Maybe Text -> BucketName -> HeadBucket
HeadBucket'
{ $sel:expectedBucketOwner:HeadBucket' :: Maybe Text
expectedBucketOwner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:bucket:HeadBucket' :: BucketName
bucket = BucketName
pBucket_
}
headBucket_expectedBucketOwner :: Lens.Lens' HeadBucket (Prelude.Maybe Prelude.Text)
headBucket_expectedBucketOwner :: (Maybe Text -> f (Maybe Text)) -> HeadBucket -> f HeadBucket
headBucket_expectedBucketOwner = (HeadBucket -> Maybe Text)
-> (HeadBucket -> Maybe Text -> HeadBucket)
-> Lens HeadBucket HeadBucket (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HeadBucket' {Maybe Text
expectedBucketOwner :: Maybe Text
$sel:expectedBucketOwner:HeadBucket' :: HeadBucket -> Maybe Text
expectedBucketOwner} -> Maybe Text
expectedBucketOwner) (\s :: HeadBucket
s@HeadBucket' {} Maybe Text
a -> HeadBucket
s {$sel:expectedBucketOwner:HeadBucket' :: Maybe Text
expectedBucketOwner = Maybe Text
a} :: HeadBucket)
headBucket_bucket :: Lens.Lens' HeadBucket BucketName
headBucket_bucket :: (BucketName -> f BucketName) -> HeadBucket -> f HeadBucket
headBucket_bucket = (HeadBucket -> BucketName)
-> (HeadBucket -> BucketName -> HeadBucket)
-> Lens HeadBucket HeadBucket BucketName BucketName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\HeadBucket' {BucketName
bucket :: BucketName
$sel:bucket:HeadBucket' :: HeadBucket -> BucketName
bucket} -> BucketName
bucket) (\s :: HeadBucket
s@HeadBucket' {} BucketName
a -> HeadBucket
s {$sel:bucket:HeadBucket' :: BucketName
bucket = BucketName
a} :: HeadBucket)
instance Core.AWSRequest HeadBucket where
type AWSResponse HeadBucket = HeadBucketResponse
request :: HeadBucket -> Request HeadBucket
request =
Request HeadBucket -> Request HeadBucket
forall a. Request a -> Request a
Request.s3vhost
(Request HeadBucket -> Request HeadBucket)
-> (HeadBucket -> Request HeadBucket)
-> HeadBucket
-> Request HeadBucket
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service -> HeadBucket -> Request HeadBucket
forall a. ToRequest a => Service -> a -> Request a
Request.head' Service
defaultService
response :: Logger
-> Service
-> Proxy HeadBucket
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse HeadBucket)))
response = AWSResponse HeadBucket
-> Logger
-> Service
-> Proxy HeadBucket
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse HeadBucket)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse HeadBucket
HeadBucketResponse
HeadBucketResponse'
instance Prelude.Hashable HeadBucket
instance Prelude.NFData HeadBucket
instance Core.ToHeaders HeadBucket where
toHeaders :: HeadBucket -> [Header]
toHeaders HeadBucket' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:HeadBucket' :: HeadBucket -> BucketName
$sel:expectedBucketOwner:HeadBucket' :: HeadBucket -> Maybe Text
..} =
[[Header]] -> [Header]
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"x-amz-expected-bucket-owner"
HeaderName -> Maybe Text -> [Header]
forall a. ToHeader a => HeaderName -> a -> [Header]
Core.=# Maybe Text
expectedBucketOwner
]
instance Core.ToPath HeadBucket where
toPath :: HeadBucket -> ByteString
toPath HeadBucket' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:HeadBucket' :: HeadBucket -> BucketName
$sel:expectedBucketOwner:HeadBucket' :: HeadBucket -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/", BucketName -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS BucketName
bucket]
instance Core.ToQuery HeadBucket where
toQuery :: HeadBucket -> QueryString
toQuery = QueryString -> HeadBucket -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data HeadBucketResponse = HeadBucketResponse'
{
}
deriving (HeadBucketResponse -> HeadBucketResponse -> Bool
(HeadBucketResponse -> HeadBucketResponse -> Bool)
-> (HeadBucketResponse -> HeadBucketResponse -> Bool)
-> Eq HeadBucketResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: HeadBucketResponse -> HeadBucketResponse -> Bool
$c/= :: HeadBucketResponse -> HeadBucketResponse -> Bool
== :: HeadBucketResponse -> HeadBucketResponse -> Bool
$c== :: HeadBucketResponse -> HeadBucketResponse -> Bool
Prelude.Eq, ReadPrec [HeadBucketResponse]
ReadPrec HeadBucketResponse
Int -> ReadS HeadBucketResponse
ReadS [HeadBucketResponse]
(Int -> ReadS HeadBucketResponse)
-> ReadS [HeadBucketResponse]
-> ReadPrec HeadBucketResponse
-> ReadPrec [HeadBucketResponse]
-> Read HeadBucketResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [HeadBucketResponse]
$creadListPrec :: ReadPrec [HeadBucketResponse]
readPrec :: ReadPrec HeadBucketResponse
$creadPrec :: ReadPrec HeadBucketResponse
readList :: ReadS [HeadBucketResponse]
$creadList :: ReadS [HeadBucketResponse]
readsPrec :: Int -> ReadS HeadBucketResponse
$creadsPrec :: Int -> ReadS HeadBucketResponse
Prelude.Read, Int -> HeadBucketResponse -> ShowS
[HeadBucketResponse] -> ShowS
HeadBucketResponse -> String
(Int -> HeadBucketResponse -> ShowS)
-> (HeadBucketResponse -> String)
-> ([HeadBucketResponse] -> ShowS)
-> Show HeadBucketResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [HeadBucketResponse] -> ShowS
$cshowList :: [HeadBucketResponse] -> ShowS
show :: HeadBucketResponse -> String
$cshow :: HeadBucketResponse -> String
showsPrec :: Int -> HeadBucketResponse -> ShowS
$cshowsPrec :: Int -> HeadBucketResponse -> ShowS
Prelude.Show, (forall x. HeadBucketResponse -> Rep HeadBucketResponse x)
-> (forall x. Rep HeadBucketResponse x -> HeadBucketResponse)
-> Generic HeadBucketResponse
forall x. Rep HeadBucketResponse x -> HeadBucketResponse
forall x. HeadBucketResponse -> Rep HeadBucketResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep HeadBucketResponse x -> HeadBucketResponse
$cfrom :: forall x. HeadBucketResponse -> Rep HeadBucketResponse x
Prelude.Generic)
newHeadBucketResponse ::
HeadBucketResponse
newHeadBucketResponse :: HeadBucketResponse
newHeadBucketResponse = HeadBucketResponse
HeadBucketResponse'
instance Prelude.NFData HeadBucketResponse