{-# 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.GetBucketOwnershipControls
(
GetBucketOwnershipControls (..),
newGetBucketOwnershipControls,
getBucketOwnershipControls_expectedBucketOwner,
getBucketOwnershipControls_bucket,
GetBucketOwnershipControlsResponse (..),
newGetBucketOwnershipControlsResponse,
getBucketOwnershipControlsResponse_ownershipControls,
getBucketOwnershipControlsResponse_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 GetBucketOwnershipControls = GetBucketOwnershipControls'
{
GetBucketOwnershipControls -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
GetBucketOwnershipControls -> BucketName
bucket :: BucketName
}
deriving (GetBucketOwnershipControls -> GetBucketOwnershipControls -> Bool
(GetBucketOwnershipControls -> GetBucketOwnershipControls -> Bool)
-> (GetBucketOwnershipControls
-> GetBucketOwnershipControls -> Bool)
-> Eq GetBucketOwnershipControls
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBucketOwnershipControls -> GetBucketOwnershipControls -> Bool
$c/= :: GetBucketOwnershipControls -> GetBucketOwnershipControls -> Bool
== :: GetBucketOwnershipControls -> GetBucketOwnershipControls -> Bool
$c== :: GetBucketOwnershipControls -> GetBucketOwnershipControls -> Bool
Prelude.Eq, ReadPrec [GetBucketOwnershipControls]
ReadPrec GetBucketOwnershipControls
Int -> ReadS GetBucketOwnershipControls
ReadS [GetBucketOwnershipControls]
(Int -> ReadS GetBucketOwnershipControls)
-> ReadS [GetBucketOwnershipControls]
-> ReadPrec GetBucketOwnershipControls
-> ReadPrec [GetBucketOwnershipControls]
-> Read GetBucketOwnershipControls
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBucketOwnershipControls]
$creadListPrec :: ReadPrec [GetBucketOwnershipControls]
readPrec :: ReadPrec GetBucketOwnershipControls
$creadPrec :: ReadPrec GetBucketOwnershipControls
readList :: ReadS [GetBucketOwnershipControls]
$creadList :: ReadS [GetBucketOwnershipControls]
readsPrec :: Int -> ReadS GetBucketOwnershipControls
$creadsPrec :: Int -> ReadS GetBucketOwnershipControls
Prelude.Read, Int -> GetBucketOwnershipControls -> ShowS
[GetBucketOwnershipControls] -> ShowS
GetBucketOwnershipControls -> String
(Int -> GetBucketOwnershipControls -> ShowS)
-> (GetBucketOwnershipControls -> String)
-> ([GetBucketOwnershipControls] -> ShowS)
-> Show GetBucketOwnershipControls
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBucketOwnershipControls] -> ShowS
$cshowList :: [GetBucketOwnershipControls] -> ShowS
show :: GetBucketOwnershipControls -> String
$cshow :: GetBucketOwnershipControls -> String
showsPrec :: Int -> GetBucketOwnershipControls -> ShowS
$cshowsPrec :: Int -> GetBucketOwnershipControls -> ShowS
Prelude.Show, (forall x.
GetBucketOwnershipControls -> Rep GetBucketOwnershipControls x)
-> (forall x.
Rep GetBucketOwnershipControls x -> GetBucketOwnershipControls)
-> Generic GetBucketOwnershipControls
forall x.
Rep GetBucketOwnershipControls x -> GetBucketOwnershipControls
forall x.
GetBucketOwnershipControls -> Rep GetBucketOwnershipControls x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetBucketOwnershipControls x -> GetBucketOwnershipControls
$cfrom :: forall x.
GetBucketOwnershipControls -> Rep GetBucketOwnershipControls x
Prelude.Generic)
newGetBucketOwnershipControls ::
BucketName ->
GetBucketOwnershipControls
newGetBucketOwnershipControls :: BucketName -> GetBucketOwnershipControls
newGetBucketOwnershipControls BucketName
pBucket_ =
GetBucketOwnershipControls' :: Maybe Text -> BucketName -> GetBucketOwnershipControls
GetBucketOwnershipControls'
{ $sel:expectedBucketOwner:GetBucketOwnershipControls' :: Maybe Text
expectedBucketOwner =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:bucket:GetBucketOwnershipControls' :: BucketName
bucket = BucketName
pBucket_
}
getBucketOwnershipControls_expectedBucketOwner :: Lens.Lens' GetBucketOwnershipControls (Prelude.Maybe Prelude.Text)
getBucketOwnershipControls_expectedBucketOwner :: (Maybe Text -> f (Maybe Text))
-> GetBucketOwnershipControls -> f GetBucketOwnershipControls
getBucketOwnershipControls_expectedBucketOwner = (GetBucketOwnershipControls -> Maybe Text)
-> (GetBucketOwnershipControls
-> Maybe Text -> GetBucketOwnershipControls)
-> Lens
GetBucketOwnershipControls
GetBucketOwnershipControls
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketOwnershipControls' {Maybe Text
expectedBucketOwner :: Maybe Text
$sel:expectedBucketOwner:GetBucketOwnershipControls' :: GetBucketOwnershipControls -> Maybe Text
expectedBucketOwner} -> Maybe Text
expectedBucketOwner) (\s :: GetBucketOwnershipControls
s@GetBucketOwnershipControls' {} Maybe Text
a -> GetBucketOwnershipControls
s {$sel:expectedBucketOwner:GetBucketOwnershipControls' :: Maybe Text
expectedBucketOwner = Maybe Text
a} :: GetBucketOwnershipControls)
getBucketOwnershipControls_bucket :: Lens.Lens' GetBucketOwnershipControls BucketName
getBucketOwnershipControls_bucket :: (BucketName -> f BucketName)
-> GetBucketOwnershipControls -> f GetBucketOwnershipControls
getBucketOwnershipControls_bucket = (GetBucketOwnershipControls -> BucketName)
-> (GetBucketOwnershipControls
-> BucketName -> GetBucketOwnershipControls)
-> Lens
GetBucketOwnershipControls
GetBucketOwnershipControls
BucketName
BucketName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketOwnershipControls' {BucketName
bucket :: BucketName
$sel:bucket:GetBucketOwnershipControls' :: GetBucketOwnershipControls -> BucketName
bucket} -> BucketName
bucket) (\s :: GetBucketOwnershipControls
s@GetBucketOwnershipControls' {} BucketName
a -> GetBucketOwnershipControls
s {$sel:bucket:GetBucketOwnershipControls' :: BucketName
bucket = BucketName
a} :: GetBucketOwnershipControls)
instance Core.AWSRequest GetBucketOwnershipControls where
type
AWSResponse GetBucketOwnershipControls =
GetBucketOwnershipControlsResponse
request :: GetBucketOwnershipControls -> Request GetBucketOwnershipControls
request =
Request GetBucketOwnershipControls
-> Request GetBucketOwnershipControls
forall a. Request a -> Request a
Request.s3vhost
(Request GetBucketOwnershipControls
-> Request GetBucketOwnershipControls)
-> (GetBucketOwnershipControls
-> Request GetBucketOwnershipControls)
-> GetBucketOwnershipControls
-> Request GetBucketOwnershipControls
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service
-> GetBucketOwnershipControls -> Request GetBucketOwnershipControls
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetBucketOwnershipControls
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetBucketOwnershipControls)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetBucketOwnershipControls))
-> Logger
-> Service
-> Proxy GetBucketOwnershipControls
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetBucketOwnershipControls)))
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 OwnershipControls
-> Int -> GetBucketOwnershipControlsResponse
GetBucketOwnershipControlsResponse'
(Maybe OwnershipControls
-> Int -> GetBucketOwnershipControlsResponse)
-> Either String (Maybe OwnershipControls)
-> Either String (Int -> GetBucketOwnershipControlsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node] -> Either String (Maybe OwnershipControls)
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
Either String (Int -> GetBucketOwnershipControlsResponse)
-> Either String Int
-> Either String GetBucketOwnershipControlsResponse
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 GetBucketOwnershipControls
instance Prelude.NFData GetBucketOwnershipControls
instance Core.ToHeaders GetBucketOwnershipControls where
toHeaders :: GetBucketOwnershipControls -> ResponseHeaders
toHeaders GetBucketOwnershipControls' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:GetBucketOwnershipControls' :: GetBucketOwnershipControls -> BucketName
$sel:expectedBucketOwner:GetBucketOwnershipControls' :: GetBucketOwnershipControls -> 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 GetBucketOwnershipControls where
toPath :: GetBucketOwnershipControls -> ByteString
toPath GetBucketOwnershipControls' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:GetBucketOwnershipControls' :: GetBucketOwnershipControls -> BucketName
$sel:expectedBucketOwner:GetBucketOwnershipControls' :: GetBucketOwnershipControls -> 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 GetBucketOwnershipControls where
toQuery :: GetBucketOwnershipControls -> QueryString
toQuery =
QueryString -> GetBucketOwnershipControls -> QueryString
forall a b. a -> b -> a
Prelude.const
([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"ownershipControls"])
data GetBucketOwnershipControlsResponse = GetBucketOwnershipControlsResponse'
{
GetBucketOwnershipControlsResponse -> Maybe OwnershipControls
ownershipControls :: Prelude.Maybe OwnershipControls,
GetBucketOwnershipControlsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetBucketOwnershipControlsResponse
-> GetBucketOwnershipControlsResponse -> Bool
(GetBucketOwnershipControlsResponse
-> GetBucketOwnershipControlsResponse -> Bool)
-> (GetBucketOwnershipControlsResponse
-> GetBucketOwnershipControlsResponse -> Bool)
-> Eq GetBucketOwnershipControlsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBucketOwnershipControlsResponse
-> GetBucketOwnershipControlsResponse -> Bool
$c/= :: GetBucketOwnershipControlsResponse
-> GetBucketOwnershipControlsResponse -> Bool
== :: GetBucketOwnershipControlsResponse
-> GetBucketOwnershipControlsResponse -> Bool
$c== :: GetBucketOwnershipControlsResponse
-> GetBucketOwnershipControlsResponse -> Bool
Prelude.Eq, ReadPrec [GetBucketOwnershipControlsResponse]
ReadPrec GetBucketOwnershipControlsResponse
Int -> ReadS GetBucketOwnershipControlsResponse
ReadS [GetBucketOwnershipControlsResponse]
(Int -> ReadS GetBucketOwnershipControlsResponse)
-> ReadS [GetBucketOwnershipControlsResponse]
-> ReadPrec GetBucketOwnershipControlsResponse
-> ReadPrec [GetBucketOwnershipControlsResponse]
-> Read GetBucketOwnershipControlsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBucketOwnershipControlsResponse]
$creadListPrec :: ReadPrec [GetBucketOwnershipControlsResponse]
readPrec :: ReadPrec GetBucketOwnershipControlsResponse
$creadPrec :: ReadPrec GetBucketOwnershipControlsResponse
readList :: ReadS [GetBucketOwnershipControlsResponse]
$creadList :: ReadS [GetBucketOwnershipControlsResponse]
readsPrec :: Int -> ReadS GetBucketOwnershipControlsResponse
$creadsPrec :: Int -> ReadS GetBucketOwnershipControlsResponse
Prelude.Read, Int -> GetBucketOwnershipControlsResponse -> ShowS
[GetBucketOwnershipControlsResponse] -> ShowS
GetBucketOwnershipControlsResponse -> String
(Int -> GetBucketOwnershipControlsResponse -> ShowS)
-> (GetBucketOwnershipControlsResponse -> String)
-> ([GetBucketOwnershipControlsResponse] -> ShowS)
-> Show GetBucketOwnershipControlsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBucketOwnershipControlsResponse] -> ShowS
$cshowList :: [GetBucketOwnershipControlsResponse] -> ShowS
show :: GetBucketOwnershipControlsResponse -> String
$cshow :: GetBucketOwnershipControlsResponse -> String
showsPrec :: Int -> GetBucketOwnershipControlsResponse -> ShowS
$cshowsPrec :: Int -> GetBucketOwnershipControlsResponse -> ShowS
Prelude.Show, (forall x.
GetBucketOwnershipControlsResponse
-> Rep GetBucketOwnershipControlsResponse x)
-> (forall x.
Rep GetBucketOwnershipControlsResponse x
-> GetBucketOwnershipControlsResponse)
-> Generic GetBucketOwnershipControlsResponse
forall x.
Rep GetBucketOwnershipControlsResponse x
-> GetBucketOwnershipControlsResponse
forall x.
GetBucketOwnershipControlsResponse
-> Rep GetBucketOwnershipControlsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetBucketOwnershipControlsResponse x
-> GetBucketOwnershipControlsResponse
$cfrom :: forall x.
GetBucketOwnershipControlsResponse
-> Rep GetBucketOwnershipControlsResponse x
Prelude.Generic)
newGetBucketOwnershipControlsResponse ::
Prelude.Int ->
GetBucketOwnershipControlsResponse
newGetBucketOwnershipControlsResponse :: Int -> GetBucketOwnershipControlsResponse
newGetBucketOwnershipControlsResponse Int
pHttpStatus_ =
GetBucketOwnershipControlsResponse' :: Maybe OwnershipControls
-> Int -> GetBucketOwnershipControlsResponse
GetBucketOwnershipControlsResponse'
{ $sel:ownershipControls:GetBucketOwnershipControlsResponse' :: Maybe OwnershipControls
ownershipControls =
Maybe OwnershipControls
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetBucketOwnershipControlsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getBucketOwnershipControlsResponse_ownershipControls :: Lens.Lens' GetBucketOwnershipControlsResponse (Prelude.Maybe OwnershipControls)
getBucketOwnershipControlsResponse_ownershipControls :: (Maybe OwnershipControls -> f (Maybe OwnershipControls))
-> GetBucketOwnershipControlsResponse
-> f GetBucketOwnershipControlsResponse
getBucketOwnershipControlsResponse_ownershipControls = (GetBucketOwnershipControlsResponse -> Maybe OwnershipControls)
-> (GetBucketOwnershipControlsResponse
-> Maybe OwnershipControls -> GetBucketOwnershipControlsResponse)
-> Lens
GetBucketOwnershipControlsResponse
GetBucketOwnershipControlsResponse
(Maybe OwnershipControls)
(Maybe OwnershipControls)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketOwnershipControlsResponse' {Maybe OwnershipControls
ownershipControls :: Maybe OwnershipControls
$sel:ownershipControls:GetBucketOwnershipControlsResponse' :: GetBucketOwnershipControlsResponse -> Maybe OwnershipControls
ownershipControls} -> Maybe OwnershipControls
ownershipControls) (\s :: GetBucketOwnershipControlsResponse
s@GetBucketOwnershipControlsResponse' {} Maybe OwnershipControls
a -> GetBucketOwnershipControlsResponse
s {$sel:ownershipControls:GetBucketOwnershipControlsResponse' :: Maybe OwnershipControls
ownershipControls = Maybe OwnershipControls
a} :: GetBucketOwnershipControlsResponse)
getBucketOwnershipControlsResponse_httpStatus :: Lens.Lens' GetBucketOwnershipControlsResponse Prelude.Int
getBucketOwnershipControlsResponse_httpStatus :: (Int -> f Int)
-> GetBucketOwnershipControlsResponse
-> f GetBucketOwnershipControlsResponse
getBucketOwnershipControlsResponse_httpStatus = (GetBucketOwnershipControlsResponse -> Int)
-> (GetBucketOwnershipControlsResponse
-> Int -> GetBucketOwnershipControlsResponse)
-> Lens
GetBucketOwnershipControlsResponse
GetBucketOwnershipControlsResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketOwnershipControlsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetBucketOwnershipControlsResponse' :: GetBucketOwnershipControlsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetBucketOwnershipControlsResponse
s@GetBucketOwnershipControlsResponse' {} Int
a -> GetBucketOwnershipControlsResponse
s {$sel:httpStatus:GetBucketOwnershipControlsResponse' :: Int
httpStatus = Int
a} :: GetBucketOwnershipControlsResponse)
instance
Prelude.NFData
GetBucketOwnershipControlsResponse