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