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