{-# 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.GetBucketVersioning
(
GetBucketVersioning (..),
newGetBucketVersioning,
getBucketVersioning_expectedBucketOwner,
getBucketVersioning_bucket,
GetBucketVersioningResponse (..),
newGetBucketVersioningResponse,
getBucketVersioningResponse_status,
getBucketVersioningResponse_mfaDelete,
getBucketVersioningResponse_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 GetBucketVersioning = GetBucketVersioning'
{
GetBucketVersioning -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
GetBucketVersioning -> BucketName
bucket :: BucketName
}
deriving (GetBucketVersioning -> GetBucketVersioning -> Bool
(GetBucketVersioning -> GetBucketVersioning -> Bool)
-> (GetBucketVersioning -> GetBucketVersioning -> Bool)
-> Eq GetBucketVersioning
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBucketVersioning -> GetBucketVersioning -> Bool
$c/= :: GetBucketVersioning -> GetBucketVersioning -> Bool
== :: GetBucketVersioning -> GetBucketVersioning -> Bool
$c== :: GetBucketVersioning -> GetBucketVersioning -> Bool
Prelude.Eq, ReadPrec [GetBucketVersioning]
ReadPrec GetBucketVersioning
Int -> ReadS GetBucketVersioning
ReadS [GetBucketVersioning]
(Int -> ReadS GetBucketVersioning)
-> ReadS [GetBucketVersioning]
-> ReadPrec GetBucketVersioning
-> ReadPrec [GetBucketVersioning]
-> Read GetBucketVersioning
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBucketVersioning]
$creadListPrec :: ReadPrec [GetBucketVersioning]
readPrec :: ReadPrec GetBucketVersioning
$creadPrec :: ReadPrec GetBucketVersioning
readList :: ReadS [GetBucketVersioning]
$creadList :: ReadS [GetBucketVersioning]
readsPrec :: Int -> ReadS GetBucketVersioning
$creadsPrec :: Int -> ReadS GetBucketVersioning
Prelude.Read, Int -> GetBucketVersioning -> ShowS
[GetBucketVersioning] -> ShowS
GetBucketVersioning -> String
(Int -> GetBucketVersioning -> ShowS)
-> (GetBucketVersioning -> String)
-> ([GetBucketVersioning] -> ShowS)
-> Show GetBucketVersioning
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBucketVersioning] -> ShowS
$cshowList :: [GetBucketVersioning] -> ShowS
show :: GetBucketVersioning -> String
$cshow :: GetBucketVersioning -> String
showsPrec :: Int -> GetBucketVersioning -> ShowS
$cshowsPrec :: Int -> GetBucketVersioning -> ShowS
Prelude.Show, (forall x. GetBucketVersioning -> Rep GetBucketVersioning x)
-> (forall x. Rep GetBucketVersioning x -> GetBucketVersioning)
-> Generic GetBucketVersioning
forall x. Rep GetBucketVersioning x -> GetBucketVersioning
forall x. GetBucketVersioning -> Rep GetBucketVersioning x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetBucketVersioning x -> GetBucketVersioning
$cfrom :: forall x. GetBucketVersioning -> Rep GetBucketVersioning x
Prelude.Generic)
newGetBucketVersioning ::
BucketName ->
GetBucketVersioning
newGetBucketVersioning :: BucketName -> GetBucketVersioning
newGetBucketVersioning BucketName
pBucket_ =
GetBucketVersioning' :: Maybe Text -> BucketName -> GetBucketVersioning
GetBucketVersioning'
{ $sel:expectedBucketOwner:GetBucketVersioning' :: Maybe Text
expectedBucketOwner =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:bucket:GetBucketVersioning' :: BucketName
bucket = BucketName
pBucket_
}
getBucketVersioning_expectedBucketOwner :: Lens.Lens' GetBucketVersioning (Prelude.Maybe Prelude.Text)
getBucketVersioning_expectedBucketOwner :: (Maybe Text -> f (Maybe Text))
-> GetBucketVersioning -> f GetBucketVersioning
getBucketVersioning_expectedBucketOwner = (GetBucketVersioning -> Maybe Text)
-> (GetBucketVersioning -> Maybe Text -> GetBucketVersioning)
-> Lens
GetBucketVersioning GetBucketVersioning (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketVersioning' {Maybe Text
expectedBucketOwner :: Maybe Text
$sel:expectedBucketOwner:GetBucketVersioning' :: GetBucketVersioning -> Maybe Text
expectedBucketOwner} -> Maybe Text
expectedBucketOwner) (\s :: GetBucketVersioning
s@GetBucketVersioning' {} Maybe Text
a -> GetBucketVersioning
s {$sel:expectedBucketOwner:GetBucketVersioning' :: Maybe Text
expectedBucketOwner = Maybe Text
a} :: GetBucketVersioning)
getBucketVersioning_bucket :: Lens.Lens' GetBucketVersioning BucketName
getBucketVersioning_bucket :: (BucketName -> f BucketName)
-> GetBucketVersioning -> f GetBucketVersioning
getBucketVersioning_bucket = (GetBucketVersioning -> BucketName)
-> (GetBucketVersioning -> BucketName -> GetBucketVersioning)
-> Lens
GetBucketVersioning GetBucketVersioning BucketName BucketName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketVersioning' {BucketName
bucket :: BucketName
$sel:bucket:GetBucketVersioning' :: GetBucketVersioning -> BucketName
bucket} -> BucketName
bucket) (\s :: GetBucketVersioning
s@GetBucketVersioning' {} BucketName
a -> GetBucketVersioning
s {$sel:bucket:GetBucketVersioning' :: BucketName
bucket = BucketName
a} :: GetBucketVersioning)
instance Core.AWSRequest GetBucketVersioning where
type
AWSResponse GetBucketVersioning =
GetBucketVersioningResponse
request :: GetBucketVersioning -> Request GetBucketVersioning
request =
Request GetBucketVersioning -> Request GetBucketVersioning
forall a. Request a -> Request a
Request.s3vhost
(Request GetBucketVersioning -> Request GetBucketVersioning)
-> (GetBucketVersioning -> Request GetBucketVersioning)
-> GetBucketVersioning
-> Request GetBucketVersioning
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service -> GetBucketVersioning -> Request GetBucketVersioning
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetBucketVersioning
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetBucketVersioning)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetBucketVersioning))
-> Logger
-> Service
-> Proxy GetBucketVersioning
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetBucketVersioning)))
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 BucketVersioningStatus
-> Maybe MFADeleteStatus -> Int -> GetBucketVersioningResponse
GetBucketVersioningResponse'
(Maybe BucketVersioningStatus
-> Maybe MFADeleteStatus -> Int -> GetBucketVersioningResponse)
-> Either String (Maybe BucketVersioningStatus)
-> Either
String
(Maybe MFADeleteStatus -> Int -> GetBucketVersioningResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe BucketVersioningStatus)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Status")
Either
String
(Maybe MFADeleteStatus -> Int -> GetBucketVersioningResponse)
-> Either String (Maybe MFADeleteStatus)
-> Either String (Int -> GetBucketVersioningResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe MFADeleteStatus)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"MfaDelete")
Either String (Int -> GetBucketVersioningResponse)
-> Either String Int -> Either String GetBucketVersioningResponse
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 GetBucketVersioning
instance Prelude.NFData GetBucketVersioning
instance Core.ToHeaders GetBucketVersioning where
toHeaders :: GetBucketVersioning -> ResponseHeaders
toHeaders GetBucketVersioning' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:GetBucketVersioning' :: GetBucketVersioning -> BucketName
$sel:expectedBucketOwner:GetBucketVersioning' :: GetBucketVersioning -> 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 GetBucketVersioning where
toPath :: GetBucketVersioning -> ByteString
toPath GetBucketVersioning' {Maybe Text
BucketName
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:bucket:GetBucketVersioning' :: GetBucketVersioning -> BucketName
$sel:expectedBucketOwner:GetBucketVersioning' :: GetBucketVersioning -> 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 GetBucketVersioning where
toQuery :: GetBucketVersioning -> QueryString
toQuery =
QueryString -> GetBucketVersioning -> QueryString
forall a b. a -> b -> a
Prelude.const ([QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [QueryString
"versioning"])
data GetBucketVersioningResponse = GetBucketVersioningResponse'
{
GetBucketVersioningResponse -> Maybe BucketVersioningStatus
status :: Prelude.Maybe BucketVersioningStatus,
GetBucketVersioningResponse -> Maybe MFADeleteStatus
mfaDelete :: Prelude.Maybe MFADeleteStatus,
GetBucketVersioningResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetBucketVersioningResponse -> GetBucketVersioningResponse -> Bool
(GetBucketVersioningResponse
-> GetBucketVersioningResponse -> Bool)
-> (GetBucketVersioningResponse
-> GetBucketVersioningResponse -> Bool)
-> Eq GetBucketVersioningResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBucketVersioningResponse -> GetBucketVersioningResponse -> Bool
$c/= :: GetBucketVersioningResponse -> GetBucketVersioningResponse -> Bool
== :: GetBucketVersioningResponse -> GetBucketVersioningResponse -> Bool
$c== :: GetBucketVersioningResponse -> GetBucketVersioningResponse -> Bool
Prelude.Eq, ReadPrec [GetBucketVersioningResponse]
ReadPrec GetBucketVersioningResponse
Int -> ReadS GetBucketVersioningResponse
ReadS [GetBucketVersioningResponse]
(Int -> ReadS GetBucketVersioningResponse)
-> ReadS [GetBucketVersioningResponse]
-> ReadPrec GetBucketVersioningResponse
-> ReadPrec [GetBucketVersioningResponse]
-> Read GetBucketVersioningResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBucketVersioningResponse]
$creadListPrec :: ReadPrec [GetBucketVersioningResponse]
readPrec :: ReadPrec GetBucketVersioningResponse
$creadPrec :: ReadPrec GetBucketVersioningResponse
readList :: ReadS [GetBucketVersioningResponse]
$creadList :: ReadS [GetBucketVersioningResponse]
readsPrec :: Int -> ReadS GetBucketVersioningResponse
$creadsPrec :: Int -> ReadS GetBucketVersioningResponse
Prelude.Read, Int -> GetBucketVersioningResponse -> ShowS
[GetBucketVersioningResponse] -> ShowS
GetBucketVersioningResponse -> String
(Int -> GetBucketVersioningResponse -> ShowS)
-> (GetBucketVersioningResponse -> String)
-> ([GetBucketVersioningResponse] -> ShowS)
-> Show GetBucketVersioningResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBucketVersioningResponse] -> ShowS
$cshowList :: [GetBucketVersioningResponse] -> ShowS
show :: GetBucketVersioningResponse -> String
$cshow :: GetBucketVersioningResponse -> String
showsPrec :: Int -> GetBucketVersioningResponse -> ShowS
$cshowsPrec :: Int -> GetBucketVersioningResponse -> ShowS
Prelude.Show, (forall x.
GetBucketVersioningResponse -> Rep GetBucketVersioningResponse x)
-> (forall x.
Rep GetBucketVersioningResponse x -> GetBucketVersioningResponse)
-> Generic GetBucketVersioningResponse
forall x.
Rep GetBucketVersioningResponse x -> GetBucketVersioningResponse
forall x.
GetBucketVersioningResponse -> Rep GetBucketVersioningResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetBucketVersioningResponse x -> GetBucketVersioningResponse
$cfrom :: forall x.
GetBucketVersioningResponse -> Rep GetBucketVersioningResponse x
Prelude.Generic)
newGetBucketVersioningResponse ::
Prelude.Int ->
GetBucketVersioningResponse
newGetBucketVersioningResponse :: Int -> GetBucketVersioningResponse
newGetBucketVersioningResponse Int
pHttpStatus_ =
GetBucketVersioningResponse' :: Maybe BucketVersioningStatus
-> Maybe MFADeleteStatus -> Int -> GetBucketVersioningResponse
GetBucketVersioningResponse'
{ $sel:status:GetBucketVersioningResponse' :: Maybe BucketVersioningStatus
status =
Maybe BucketVersioningStatus
forall a. Maybe a
Prelude.Nothing,
$sel:mfaDelete:GetBucketVersioningResponse' :: Maybe MFADeleteStatus
mfaDelete = Maybe MFADeleteStatus
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetBucketVersioningResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getBucketVersioningResponse_status :: Lens.Lens' GetBucketVersioningResponse (Prelude.Maybe BucketVersioningStatus)
getBucketVersioningResponse_status :: (Maybe BucketVersioningStatus -> f (Maybe BucketVersioningStatus))
-> GetBucketVersioningResponse -> f GetBucketVersioningResponse
getBucketVersioningResponse_status = (GetBucketVersioningResponse -> Maybe BucketVersioningStatus)
-> (GetBucketVersioningResponse
-> Maybe BucketVersioningStatus -> GetBucketVersioningResponse)
-> Lens
GetBucketVersioningResponse
GetBucketVersioningResponse
(Maybe BucketVersioningStatus)
(Maybe BucketVersioningStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketVersioningResponse' {Maybe BucketVersioningStatus
status :: Maybe BucketVersioningStatus
$sel:status:GetBucketVersioningResponse' :: GetBucketVersioningResponse -> Maybe BucketVersioningStatus
status} -> Maybe BucketVersioningStatus
status) (\s :: GetBucketVersioningResponse
s@GetBucketVersioningResponse' {} Maybe BucketVersioningStatus
a -> GetBucketVersioningResponse
s {$sel:status:GetBucketVersioningResponse' :: Maybe BucketVersioningStatus
status = Maybe BucketVersioningStatus
a} :: GetBucketVersioningResponse)
getBucketVersioningResponse_mfaDelete :: Lens.Lens' GetBucketVersioningResponse (Prelude.Maybe MFADeleteStatus)
getBucketVersioningResponse_mfaDelete :: (Maybe MFADeleteStatus -> f (Maybe MFADeleteStatus))
-> GetBucketVersioningResponse -> f GetBucketVersioningResponse
getBucketVersioningResponse_mfaDelete = (GetBucketVersioningResponse -> Maybe MFADeleteStatus)
-> (GetBucketVersioningResponse
-> Maybe MFADeleteStatus -> GetBucketVersioningResponse)
-> Lens
GetBucketVersioningResponse
GetBucketVersioningResponse
(Maybe MFADeleteStatus)
(Maybe MFADeleteStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketVersioningResponse' {Maybe MFADeleteStatus
mfaDelete :: Maybe MFADeleteStatus
$sel:mfaDelete:GetBucketVersioningResponse' :: GetBucketVersioningResponse -> Maybe MFADeleteStatus
mfaDelete} -> Maybe MFADeleteStatus
mfaDelete) (\s :: GetBucketVersioningResponse
s@GetBucketVersioningResponse' {} Maybe MFADeleteStatus
a -> GetBucketVersioningResponse
s {$sel:mfaDelete:GetBucketVersioningResponse' :: Maybe MFADeleteStatus
mfaDelete = Maybe MFADeleteStatus
a} :: GetBucketVersioningResponse)
getBucketVersioningResponse_httpStatus :: Lens.Lens' GetBucketVersioningResponse Prelude.Int
getBucketVersioningResponse_httpStatus :: (Int -> f Int)
-> GetBucketVersioningResponse -> f GetBucketVersioningResponse
getBucketVersioningResponse_httpStatus = (GetBucketVersioningResponse -> Int)
-> (GetBucketVersioningResponse
-> Int -> GetBucketVersioningResponse)
-> Lens
GetBucketVersioningResponse GetBucketVersioningResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketVersioningResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetBucketVersioningResponse' :: GetBucketVersioningResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetBucketVersioningResponse
s@GetBucketVersioningResponse' {} Int
a -> GetBucketVersioningResponse
s {$sel:httpStatus:GetBucketVersioningResponse' :: Int
httpStatus = Int
a} :: GetBucketVersioningResponse)
instance Prelude.NFData GetBucketVersioningResponse