{-# 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.GetBucketRequestPayment
(
GetBucketRequestPayment (..),
newGetBucketRequestPayment,
getBucketRequestPayment_expectedBucketOwner,
getBucketRequestPayment_bucket,
GetBucketRequestPaymentResponse (..),
newGetBucketRequestPaymentResponse,
getBucketRequestPaymentResponse_payer,
getBucketRequestPaymentResponse_httpStatus,
)
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 GetBucketRequestPayment = GetBucketRequestPayment'
{
GetBucketRequestPayment -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
GetBucketRequestPayment -> BucketName
bucket :: BucketName
}
deriving (GetBucketRequestPayment -> GetBucketRequestPayment -> Bool
(GetBucketRequestPayment -> GetBucketRequestPayment -> Bool)
-> (GetBucketRequestPayment -> GetBucketRequestPayment -> Bool)
-> Eq GetBucketRequestPayment
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBucketRequestPayment -> GetBucketRequestPayment -> Bool
$c/= :: GetBucketRequestPayment -> GetBucketRequestPayment -> Bool
== :: GetBucketRequestPayment -> GetBucketRequestPayment -> Bool
$c== :: GetBucketRequestPayment -> GetBucketRequestPayment -> Bool
Prelude.Eq, ReadPrec [GetBucketRequestPayment]
ReadPrec GetBucketRequestPayment
Int -> ReadS GetBucketRequestPayment
ReadS [GetBucketRequestPayment]
(Int -> ReadS GetBucketRequestPayment)
-> ReadS [GetBucketRequestPayment]
-> ReadPrec GetBucketRequestPayment
-> ReadPrec [GetBucketRequestPayment]
-> Read GetBucketRequestPayment
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBucketRequestPayment]
$creadListPrec :: ReadPrec [GetBucketRequestPayment]
readPrec :: ReadPrec GetBucketRequestPayment
$creadPrec :: ReadPrec GetBucketRequestPayment
readList :: ReadS [GetBucketRequestPayment]
$creadList :: ReadS [GetBucketRequestPayment]
readsPrec :: Int -> ReadS GetBucketRequestPayment
$creadsPrec :: Int -> ReadS GetBucketRequestPayment
Prelude.Read, Int -> GetBucketRequestPayment -> ShowS
[GetBucketRequestPayment] -> ShowS
GetBucketRequestPayment -> String
(Int -> GetBucketRequestPayment -> ShowS)
-> (GetBucketRequestPayment -> String)
-> ([GetBucketRequestPayment] -> ShowS)
-> Show GetBucketRequestPayment
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBucketRequestPayment] -> ShowS
$cshowList :: [GetBucketRequestPayment] -> ShowS
show :: GetBucketRequestPayment -> String
$cshow :: GetBucketRequestPayment -> String
showsPrec :: Int -> GetBucketRequestPayment -> ShowS
$cshowsPrec :: Int -> GetBucketRequestPayment -> ShowS
Prelude.Show, (forall x.
GetBucketRequestPayment -> Rep GetBucketRequestPayment x)
-> (forall x.
Rep GetBucketRequestPayment x -> GetBucketRequestPayment)
-> Generic GetBucketRequestPayment
forall x. Rep GetBucketRequestPayment x -> GetBucketRequestPayment
forall x. GetBucketRequestPayment -> Rep GetBucketRequestPayment x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBucketRequestPayment x -> GetBucketRequestPayment
$cfrom :: forall x. GetBucketRequestPayment -> Rep GetBucketRequestPayment x
Prelude.Generic)
newGetBucketRequestPayment ::
BucketName ->
GetBucketRequestPayment
newGetBucketRequestPayment :: BucketName -> GetBucketRequestPayment
newGetBucketRequestPayment BucketName
pBucket_ =
GetBucketRequestPayment' :: Maybe Text -> BucketName -> GetBucketRequestPayment
GetBucketRequestPayment'
{ $sel:expectedBucketOwner:GetBucketRequestPayment' :: Maybe Text
expectedBucketOwner =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:bucket:GetBucketRequestPayment' :: BucketName
bucket = BucketName
pBucket_
}
getBucketRequestPayment_expectedBucketOwner :: Lens.Lens' GetBucketRequestPayment (Prelude.Maybe Prelude.Text)
getBucketRequestPayment_expectedBucketOwner :: (Maybe Text -> f (Maybe Text))
-> GetBucketRequestPayment -> f GetBucketRequestPayment
getBucketRequestPayment_expectedBucketOwner = (GetBucketRequestPayment -> Maybe Text)
-> (GetBucketRequestPayment
-> Maybe Text -> GetBucketRequestPayment)
-> Lens
GetBucketRequestPayment
GetBucketRequestPayment
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketRequestPayment' {Maybe Text
expectedBucketOwner :: Maybe Text
$sel:expectedBucketOwner:GetBucketRequestPayment' :: GetBucketRequestPayment -> Maybe Text
expectedBucketOwner} -> Maybe Text
expectedBucketOwner) (\s :: GetBucketRequestPayment
s@GetBucketRequestPayment' {} Maybe Text
a -> GetBucketRequestPayment
s {$sel:expectedBucketOwner:GetBucketRequestPayment' :: Maybe Text
expectedBucketOwner = Maybe Text
a} :: GetBucketRequestPayment)
getBucketRequestPayment_bucket :: Lens.Lens' GetBucketRequestPayment BucketName
getBucketRequestPayment_bucket :: (BucketName -> f BucketName)
-> GetBucketRequestPayment -> f GetBucketRequestPayment
getBucketRequestPayment_bucket = (GetBucketRequestPayment -> BucketName)
-> (GetBucketRequestPayment
-> BucketName -> GetBucketRequestPayment)
-> Lens
GetBucketRequestPayment
GetBucketRequestPayment
BucketName
BucketName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketRequestPayment' {BucketName
bucket :: BucketName
$sel:bucket:GetBucketRequestPayment' :: GetBucketRequestPayment -> BucketName
bucket} -> BucketName
bucket) (\s :: GetBucketRequestPayment
s@GetBucketRequestPayment' {} BucketName
a -> GetBucketRequestPayment
s {$sel:bucket:GetBucketRequestPayment' :: BucketName
bucket = BucketName
a} :: GetBucketRequestPayment)
instance Core.AWSRequest GetBucketRequestPayment where
type
AWSResponse GetBucketRequestPayment =
GetBucketRequestPaymentResponse
request :: GetBucketRequestPayment -> Request GetBucketRequestPayment
request =
Request GetBucketRequestPayment -> Request GetBucketRequestPayment
forall a. Request a -> Request a
Request.s3vhost
(Request GetBucketRequestPayment
-> Request GetBucketRequestPayment)
-> (GetBucketRequestPayment -> Request GetBucketRequestPayment)
-> GetBucketRequestPayment
-> Request GetBucketRequestPayment
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service
-> GetBucketRequestPayment -> Request GetBucketRequestPayment
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetBucketRequestPayment
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetBucketRequestPayment)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetBucketRequestPayment))
-> Logger
-> Service
-> Proxy GetBucketRequestPayment
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetBucketRequestPayment)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe Payer -> Int -> GetBucketRequestPaymentResponse
GetBucketRequestPaymentResponse'
(Maybe Payer -> Int -> GetBucketRequestPaymentResponse)
-> Either String (Maybe Payer)
-> Either String (Int -> GetBucketRequestPaymentResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Payer)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Payer")
Either String (Int -> GetBucketRequestPaymentResponse)
-> Either String Int
-> Either String GetBucketRequestPaymentResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetBucketRequestPayment
instance Prelude.NFData GetBucketRequestPayment
instance Core.ToHeaders GetBucketRequestPayment where
toHeaders :: GetBucketRequestPayment -> ResponseHeaders
toHeaders GetBucketRequestPayment' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:GetBucketRequestPayment' :: GetBucketRequestPayment -> BucketName
$sel:expectedBucketOwner:GetBucketRequestPayment' :: GetBucketRequestPayment -> Maybe Text
..} =
[ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"x-amz-expected-bucket-owner"
HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
expectedBucketOwner
]
instance Core.ToPath GetBucketRequestPayment where
toPath :: GetBucketRequestPayment -> ByteString
toPath GetBucketRequestPayment' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:GetBucketRequestPayment' :: GetBucketRequestPayment -> BucketName
$sel:expectedBucketOwner:GetBucketRequestPayment' :: GetBucketRequestPayment -> 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 GetBucketRequestPayment where
toQuery :: GetBucketRequestPayment -> QueryString
toQuery =
QueryString -> GetBucketRequestPayment -> QueryString
forall a b. a -> b -> a
Prelude.const ([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"requestPayment"])
data GetBucketRequestPaymentResponse = GetBucketRequestPaymentResponse'
{
GetBucketRequestPaymentResponse -> Maybe Payer
payer :: Prelude.Maybe Payer,
GetBucketRequestPaymentResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetBucketRequestPaymentResponse
-> GetBucketRequestPaymentResponse -> Bool
(GetBucketRequestPaymentResponse
-> GetBucketRequestPaymentResponse -> Bool)
-> (GetBucketRequestPaymentResponse
-> GetBucketRequestPaymentResponse -> Bool)
-> Eq GetBucketRequestPaymentResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBucketRequestPaymentResponse
-> GetBucketRequestPaymentResponse -> Bool
$c/= :: GetBucketRequestPaymentResponse
-> GetBucketRequestPaymentResponse -> Bool
== :: GetBucketRequestPaymentResponse
-> GetBucketRequestPaymentResponse -> Bool
$c== :: GetBucketRequestPaymentResponse
-> GetBucketRequestPaymentResponse -> Bool
Prelude.Eq, ReadPrec [GetBucketRequestPaymentResponse]
ReadPrec GetBucketRequestPaymentResponse
Int -> ReadS GetBucketRequestPaymentResponse
ReadS [GetBucketRequestPaymentResponse]
(Int -> ReadS GetBucketRequestPaymentResponse)
-> ReadS [GetBucketRequestPaymentResponse]
-> ReadPrec GetBucketRequestPaymentResponse
-> ReadPrec [GetBucketRequestPaymentResponse]
-> Read GetBucketRequestPaymentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBucketRequestPaymentResponse]
$creadListPrec :: ReadPrec [GetBucketRequestPaymentResponse]
readPrec :: ReadPrec GetBucketRequestPaymentResponse
$creadPrec :: ReadPrec GetBucketRequestPaymentResponse
readList :: ReadS [GetBucketRequestPaymentResponse]
$creadList :: ReadS [GetBucketRequestPaymentResponse]
readsPrec :: Int -> ReadS GetBucketRequestPaymentResponse
$creadsPrec :: Int -> ReadS GetBucketRequestPaymentResponse
Prelude.Read, Int -> GetBucketRequestPaymentResponse -> ShowS
[GetBucketRequestPaymentResponse] -> ShowS
GetBucketRequestPaymentResponse -> String
(Int -> GetBucketRequestPaymentResponse -> ShowS)
-> (GetBucketRequestPaymentResponse -> String)
-> ([GetBucketRequestPaymentResponse] -> ShowS)
-> Show GetBucketRequestPaymentResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBucketRequestPaymentResponse] -> ShowS
$cshowList :: [GetBucketRequestPaymentResponse] -> ShowS
show :: GetBucketRequestPaymentResponse -> String
$cshow :: GetBucketRequestPaymentResponse -> String
showsPrec :: Int -> GetBucketRequestPaymentResponse -> ShowS
$cshowsPrec :: Int -> GetBucketRequestPaymentResponse -> ShowS
Prelude.Show, (forall x.
GetBucketRequestPaymentResponse
-> Rep GetBucketRequestPaymentResponse x)
-> (forall x.
Rep GetBucketRequestPaymentResponse x
-> GetBucketRequestPaymentResponse)
-> Generic GetBucketRequestPaymentResponse
forall x.
Rep GetBucketRequestPaymentResponse x
-> GetBucketRequestPaymentResponse
forall x.
GetBucketRequestPaymentResponse
-> Rep GetBucketRequestPaymentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetBucketRequestPaymentResponse x
-> GetBucketRequestPaymentResponse
$cfrom :: forall x.
GetBucketRequestPaymentResponse
-> Rep GetBucketRequestPaymentResponse x
Prelude.Generic)
newGetBucketRequestPaymentResponse ::
Prelude.Int ->
GetBucketRequestPaymentResponse
newGetBucketRequestPaymentResponse :: Int -> GetBucketRequestPaymentResponse
newGetBucketRequestPaymentResponse Int
pHttpStatus_ =
GetBucketRequestPaymentResponse' :: Maybe Payer -> Int -> GetBucketRequestPaymentResponse
GetBucketRequestPaymentResponse'
{ $sel:payer:GetBucketRequestPaymentResponse' :: Maybe Payer
payer =
Maybe Payer
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetBucketRequestPaymentResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getBucketRequestPaymentResponse_payer :: Lens.Lens' GetBucketRequestPaymentResponse (Prelude.Maybe Payer)
getBucketRequestPaymentResponse_payer :: (Maybe Payer -> f (Maybe Payer))
-> GetBucketRequestPaymentResponse
-> f GetBucketRequestPaymentResponse
getBucketRequestPaymentResponse_payer = (GetBucketRequestPaymentResponse -> Maybe Payer)
-> (GetBucketRequestPaymentResponse
-> Maybe Payer -> GetBucketRequestPaymentResponse)
-> Lens
GetBucketRequestPaymentResponse
GetBucketRequestPaymentResponse
(Maybe Payer)
(Maybe Payer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketRequestPaymentResponse' {Maybe Payer
payer :: Maybe Payer
$sel:payer:GetBucketRequestPaymentResponse' :: GetBucketRequestPaymentResponse -> Maybe Payer
payer} -> Maybe Payer
payer) (\s :: GetBucketRequestPaymentResponse
s@GetBucketRequestPaymentResponse' {} Maybe Payer
a -> GetBucketRequestPaymentResponse
s {$sel:payer:GetBucketRequestPaymentResponse' :: Maybe Payer
payer = Maybe Payer
a} :: GetBucketRequestPaymentResponse)
getBucketRequestPaymentResponse_httpStatus :: Lens.Lens' GetBucketRequestPaymentResponse Prelude.Int
getBucketRequestPaymentResponse_httpStatus :: (Int -> f Int)
-> GetBucketRequestPaymentResponse
-> f GetBucketRequestPaymentResponse
getBucketRequestPaymentResponse_httpStatus = (GetBucketRequestPaymentResponse -> Int)
-> (GetBucketRequestPaymentResponse
-> Int -> GetBucketRequestPaymentResponse)
-> Lens
GetBucketRequestPaymentResponse
GetBucketRequestPaymentResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketRequestPaymentResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetBucketRequestPaymentResponse' :: GetBucketRequestPaymentResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetBucketRequestPaymentResponse
s@GetBucketRequestPaymentResponse' {} Int
a -> GetBucketRequestPaymentResponse
s {$sel:httpStatus:GetBucketRequestPaymentResponse' :: Int
httpStatus = Int
a} :: GetBucketRequestPaymentResponse)
instance
Prelude.NFData
GetBucketRequestPaymentResponse