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