{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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.
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'
{ $sel:expectedBucketOwner:GetBucketOwnershipControls' :: Maybe Text
expectedBucketOwner =
forall a. Maybe a
Prelude.Nothing,
$sel:bucket:GetBucketOwnershipControls' :: BucketName
bucket = BucketName
pBucket_
}
getBucketOwnershipControls_expectedBucketOwner :: Lens.Lens' GetBucketOwnershipControls (Prelude.Maybe Prelude.Text)
getBucketOwnershipControls_expectedBucketOwner :: Lens' GetBucketOwnershipControls (Maybe Text)
getBucketOwnershipControls_expectedBucketOwner = 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 :: Lens' GetBucketOwnershipControls BucketName
getBucketOwnershipControls_bucket = 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 :: (Service -> Service)
-> GetBucketOwnershipControls -> Request GetBucketOwnershipControls
request Service -> Service
overrides =
forall a. Request a -> Request a
Request.s3vhost
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetBucketOwnershipControls
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetBucketOwnershipControls)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
( \Int
s ResponseHeaders
h [Node]
x ->
Maybe OwnershipControls
-> Int -> GetBucketOwnershipControlsResponse
GetBucketOwnershipControlsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall a. FromXML a => [Node] -> Either String a
Data.parseXML [Node]
x)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetBucketOwnershipControls where
hashWithSalt :: Int -> GetBucketOwnershipControls -> Int
hashWithSalt Int
_salt GetBucketOwnershipControls' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:GetBucketOwnershipControls' :: GetBucketOwnershipControls -> BucketName
$sel:expectedBucketOwner:GetBucketOwnershipControls' :: GetBucketOwnershipControls -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
expectedBucketOwner
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` BucketName
bucket
instance Prelude.NFData GetBucketOwnershipControls where
rnf :: GetBucketOwnershipControls -> ()
rnf GetBucketOwnershipControls' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:GetBucketOwnershipControls' :: GetBucketOwnershipControls -> BucketName
$sel:expectedBucketOwner:GetBucketOwnershipControls' :: GetBucketOwnershipControls -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
expectedBucketOwner
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf BucketName
bucket
instance Data.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
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"x-amz-expected-bucket-owner"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe Text
expectedBucketOwner
]
instance Data.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
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/", forall a. ToByteString a => a -> ByteString
Data.toBS BucketName
bucket]
instance Data.ToQuery GetBucketOwnershipControls where
toQuery :: GetBucketOwnershipControls -> QueryString
toQuery =
forall a b. a -> b -> a
Prelude.const
(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
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]
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
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.
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'
{ $sel:ownershipControls:GetBucketOwnershipControlsResponse' :: Maybe OwnershipControls
ownershipControls =
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetBucketOwnershipControlsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getBucketOwnershipControlsResponse_ownershipControls :: Lens.Lens' GetBucketOwnershipControlsResponse (Prelude.Maybe OwnershipControls)
getBucketOwnershipControlsResponse_ownershipControls :: Lens' GetBucketOwnershipControlsResponse (Maybe OwnershipControls)
getBucketOwnershipControlsResponse_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 :: Lens' GetBucketOwnershipControlsResponse Int
getBucketOwnershipControlsResponse_httpStatus = 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
where
rnf :: GetBucketOwnershipControlsResponse -> ()
rnf GetBucketOwnershipControlsResponse' {Int
Maybe OwnershipControls
httpStatus :: Int
ownershipControls :: Maybe OwnershipControls
$sel:httpStatus:GetBucketOwnershipControlsResponse' :: GetBucketOwnershipControlsResponse -> Int
$sel:ownershipControls:GetBucketOwnershipControlsResponse' :: GetBucketOwnershipControlsResponse -> Maybe OwnershipControls
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe OwnershipControls
ownershipControls
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus