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