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