{-# 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.GetBucketMetricsConfiguration
(
GetBucketMetricsConfiguration (..),
newGetBucketMetricsConfiguration,
getBucketMetricsConfiguration_expectedBucketOwner,
getBucketMetricsConfiguration_bucket,
getBucketMetricsConfiguration_id,
GetBucketMetricsConfigurationResponse (..),
newGetBucketMetricsConfigurationResponse,
getBucketMetricsConfigurationResponse_metricsConfiguration,
getBucketMetricsConfigurationResponse_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 GetBucketMetricsConfiguration = GetBucketMetricsConfiguration'
{
GetBucketMetricsConfiguration -> Maybe Text
expectedBucketOwner :: Prelude.Maybe Prelude.Text,
GetBucketMetricsConfiguration -> BucketName
bucket :: BucketName,
GetBucketMetricsConfiguration -> Text
id :: Prelude.Text
}
deriving (GetBucketMetricsConfiguration
-> GetBucketMetricsConfiguration -> Bool
(GetBucketMetricsConfiguration
-> GetBucketMetricsConfiguration -> Bool)
-> (GetBucketMetricsConfiguration
-> GetBucketMetricsConfiguration -> Bool)
-> Eq GetBucketMetricsConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBucketMetricsConfiguration
-> GetBucketMetricsConfiguration -> Bool
$c/= :: GetBucketMetricsConfiguration
-> GetBucketMetricsConfiguration -> Bool
== :: GetBucketMetricsConfiguration
-> GetBucketMetricsConfiguration -> Bool
$c== :: GetBucketMetricsConfiguration
-> GetBucketMetricsConfiguration -> Bool
Prelude.Eq, ReadPrec [GetBucketMetricsConfiguration]
ReadPrec GetBucketMetricsConfiguration
Int -> ReadS GetBucketMetricsConfiguration
ReadS [GetBucketMetricsConfiguration]
(Int -> ReadS GetBucketMetricsConfiguration)
-> ReadS [GetBucketMetricsConfiguration]
-> ReadPrec GetBucketMetricsConfiguration
-> ReadPrec [GetBucketMetricsConfiguration]
-> Read GetBucketMetricsConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBucketMetricsConfiguration]
$creadListPrec :: ReadPrec [GetBucketMetricsConfiguration]
readPrec :: ReadPrec GetBucketMetricsConfiguration
$creadPrec :: ReadPrec GetBucketMetricsConfiguration
readList :: ReadS [GetBucketMetricsConfiguration]
$creadList :: ReadS [GetBucketMetricsConfiguration]
readsPrec :: Int -> ReadS GetBucketMetricsConfiguration
$creadsPrec :: Int -> ReadS GetBucketMetricsConfiguration
Prelude.Read, Int -> GetBucketMetricsConfiguration -> ShowS
[GetBucketMetricsConfiguration] -> ShowS
GetBucketMetricsConfiguration -> String
(Int -> GetBucketMetricsConfiguration -> ShowS)
-> (GetBucketMetricsConfiguration -> String)
-> ([GetBucketMetricsConfiguration] -> ShowS)
-> Show GetBucketMetricsConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBucketMetricsConfiguration] -> ShowS
$cshowList :: [GetBucketMetricsConfiguration] -> ShowS
show :: GetBucketMetricsConfiguration -> String
$cshow :: GetBucketMetricsConfiguration -> String
showsPrec :: Int -> GetBucketMetricsConfiguration -> ShowS
$cshowsPrec :: Int -> GetBucketMetricsConfiguration -> ShowS
Prelude.Show, (forall x.
GetBucketMetricsConfiguration
-> Rep GetBucketMetricsConfiguration x)
-> (forall x.
Rep GetBucketMetricsConfiguration x
-> GetBucketMetricsConfiguration)
-> Generic GetBucketMetricsConfiguration
forall x.
Rep GetBucketMetricsConfiguration x
-> GetBucketMetricsConfiguration
forall x.
GetBucketMetricsConfiguration
-> Rep GetBucketMetricsConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetBucketMetricsConfiguration x
-> GetBucketMetricsConfiguration
$cfrom :: forall x.
GetBucketMetricsConfiguration
-> Rep GetBucketMetricsConfiguration x
Prelude.Generic)
newGetBucketMetricsConfiguration ::
BucketName ->
Prelude.Text ->
GetBucketMetricsConfiguration
newGetBucketMetricsConfiguration :: BucketName -> Text -> GetBucketMetricsConfiguration
newGetBucketMetricsConfiguration BucketName
pBucket_ Text
pId_ =
GetBucketMetricsConfiguration' :: Maybe Text -> BucketName -> Text -> GetBucketMetricsConfiguration
GetBucketMetricsConfiguration'
{ $sel:expectedBucketOwner:GetBucketMetricsConfiguration' :: Maybe Text
expectedBucketOwner =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:bucket:GetBucketMetricsConfiguration' :: BucketName
bucket = BucketName
pBucket_,
$sel:id:GetBucketMetricsConfiguration' :: Text
id = Text
pId_
}
getBucketMetricsConfiguration_expectedBucketOwner :: Lens.Lens' GetBucketMetricsConfiguration (Prelude.Maybe Prelude.Text)
getBucketMetricsConfiguration_expectedBucketOwner :: (Maybe Text -> f (Maybe Text))
-> GetBucketMetricsConfiguration -> f GetBucketMetricsConfiguration
getBucketMetricsConfiguration_expectedBucketOwner = (GetBucketMetricsConfiguration -> Maybe Text)
-> (GetBucketMetricsConfiguration
-> Maybe Text -> GetBucketMetricsConfiguration)
-> Lens
GetBucketMetricsConfiguration
GetBucketMetricsConfiguration
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketMetricsConfiguration' {Maybe Text
expectedBucketOwner :: Maybe Text
$sel:expectedBucketOwner:GetBucketMetricsConfiguration' :: GetBucketMetricsConfiguration -> Maybe Text
expectedBucketOwner} -> Maybe Text
expectedBucketOwner) (\s :: GetBucketMetricsConfiguration
s@GetBucketMetricsConfiguration' {} Maybe Text
a -> GetBucketMetricsConfiguration
s {$sel:expectedBucketOwner:GetBucketMetricsConfiguration' :: Maybe Text
expectedBucketOwner = Maybe Text
a} :: GetBucketMetricsConfiguration)
getBucketMetricsConfiguration_bucket :: Lens.Lens' GetBucketMetricsConfiguration BucketName
getBucketMetricsConfiguration_bucket :: (BucketName -> f BucketName)
-> GetBucketMetricsConfiguration -> f GetBucketMetricsConfiguration
getBucketMetricsConfiguration_bucket = (GetBucketMetricsConfiguration -> BucketName)
-> (GetBucketMetricsConfiguration
-> BucketName -> GetBucketMetricsConfiguration)
-> Lens
GetBucketMetricsConfiguration
GetBucketMetricsConfiguration
BucketName
BucketName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketMetricsConfiguration' {BucketName
bucket :: BucketName
$sel:bucket:GetBucketMetricsConfiguration' :: GetBucketMetricsConfiguration -> BucketName
bucket} -> BucketName
bucket) (\s :: GetBucketMetricsConfiguration
s@GetBucketMetricsConfiguration' {} BucketName
a -> GetBucketMetricsConfiguration
s {$sel:bucket:GetBucketMetricsConfiguration' :: BucketName
bucket = BucketName
a} :: GetBucketMetricsConfiguration)
getBucketMetricsConfiguration_id :: Lens.Lens' GetBucketMetricsConfiguration Prelude.Text
getBucketMetricsConfiguration_id :: (Text -> f Text)
-> GetBucketMetricsConfiguration -> f GetBucketMetricsConfiguration
getBucketMetricsConfiguration_id = (GetBucketMetricsConfiguration -> Text)
-> (GetBucketMetricsConfiguration
-> Text -> GetBucketMetricsConfiguration)
-> Lens
GetBucketMetricsConfiguration
GetBucketMetricsConfiguration
Text
Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketMetricsConfiguration' {Text
id :: Text
$sel:id:GetBucketMetricsConfiguration' :: GetBucketMetricsConfiguration -> Text
id} -> Text
id) (\s :: GetBucketMetricsConfiguration
s@GetBucketMetricsConfiguration' {} Text
a -> GetBucketMetricsConfiguration
s {$sel:id:GetBucketMetricsConfiguration' :: Text
id = Text
a} :: GetBucketMetricsConfiguration)
instance
Core.AWSRequest
GetBucketMetricsConfiguration
where
type
AWSResponse GetBucketMetricsConfiguration =
GetBucketMetricsConfigurationResponse
request :: GetBucketMetricsConfiguration
-> Request GetBucketMetricsConfiguration
request =
Request GetBucketMetricsConfiguration
-> Request GetBucketMetricsConfiguration
forall a. Request a -> Request a
Request.s3vhost
(Request GetBucketMetricsConfiguration
-> Request GetBucketMetricsConfiguration)
-> (GetBucketMetricsConfiguration
-> Request GetBucketMetricsConfiguration)
-> GetBucketMetricsConfiguration
-> Request GetBucketMetricsConfiguration
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Service
-> GetBucketMetricsConfiguration
-> Request GetBucketMetricsConfiguration
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetBucketMetricsConfiguration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetBucketMetricsConfiguration)))
response =
(Int
-> ResponseHeaders
-> [Node]
-> Either String (AWSResponse GetBucketMetricsConfiguration))
-> Logger
-> Service
-> Proxy GetBucketMetricsConfiguration
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetBucketMetricsConfiguration)))
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 MetricsConfiguration
-> Int -> GetBucketMetricsConfigurationResponse
GetBucketMetricsConfigurationResponse'
(Maybe MetricsConfiguration
-> Int -> GetBucketMetricsConfigurationResponse)
-> Either String (Maybe MetricsConfiguration)
-> Either String (Int -> GetBucketMetricsConfigurationResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node] -> Either String (Maybe MetricsConfiguration)
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)
Either String (Int -> GetBucketMetricsConfigurationResponse)
-> Either String Int
-> Either String GetBucketMetricsConfigurationResponse
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
GetBucketMetricsConfiguration
instance Prelude.NFData GetBucketMetricsConfiguration
instance Core.ToHeaders GetBucketMetricsConfiguration where
toHeaders :: GetBucketMetricsConfiguration -> ResponseHeaders
toHeaders GetBucketMetricsConfiguration' {Maybe Text
Text
BucketName
id :: Text
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:id:GetBucketMetricsConfiguration' :: GetBucketMetricsConfiguration -> Text
$sel:bucket:GetBucketMetricsConfiguration' :: GetBucketMetricsConfiguration -> BucketName
$sel:expectedBucketOwner:GetBucketMetricsConfiguration' :: GetBucketMetricsConfiguration -> 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 GetBucketMetricsConfiguration where
toPath :: GetBucketMetricsConfiguration -> ByteString
toPath GetBucketMetricsConfiguration' {Maybe Text
Text
BucketName
id :: Text
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:id:GetBucketMetricsConfiguration' :: GetBucketMetricsConfiguration -> Text
$sel:bucket:GetBucketMetricsConfiguration' :: GetBucketMetricsConfiguration -> BucketName
$sel:expectedBucketOwner:GetBucketMetricsConfiguration' :: GetBucketMetricsConfiguration -> 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 GetBucketMetricsConfiguration where
toQuery :: GetBucketMetricsConfiguration -> QueryString
toQuery GetBucketMetricsConfiguration' {Maybe Text
Text
BucketName
id :: Text
bucket :: BucketName
expectedBucketOwner :: Maybe Text
$sel:id:GetBucketMetricsConfiguration' :: GetBucketMetricsConfiguration -> Text
$sel:bucket:GetBucketMetricsConfiguration' :: GetBucketMetricsConfiguration -> BucketName
$sel:expectedBucketOwner:GetBucketMetricsConfiguration' :: GetBucketMetricsConfiguration -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"id" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
id, QueryString
"metrics"]
data GetBucketMetricsConfigurationResponse = GetBucketMetricsConfigurationResponse'
{
GetBucketMetricsConfigurationResponse -> Maybe MetricsConfiguration
metricsConfiguration :: Prelude.Maybe MetricsConfiguration,
GetBucketMetricsConfigurationResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetBucketMetricsConfigurationResponse
-> GetBucketMetricsConfigurationResponse -> Bool
(GetBucketMetricsConfigurationResponse
-> GetBucketMetricsConfigurationResponse -> Bool)
-> (GetBucketMetricsConfigurationResponse
-> GetBucketMetricsConfigurationResponse -> Bool)
-> Eq GetBucketMetricsConfigurationResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetBucketMetricsConfigurationResponse
-> GetBucketMetricsConfigurationResponse -> Bool
$c/= :: GetBucketMetricsConfigurationResponse
-> GetBucketMetricsConfigurationResponse -> Bool
== :: GetBucketMetricsConfigurationResponse
-> GetBucketMetricsConfigurationResponse -> Bool
$c== :: GetBucketMetricsConfigurationResponse
-> GetBucketMetricsConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [GetBucketMetricsConfigurationResponse]
ReadPrec GetBucketMetricsConfigurationResponse
Int -> ReadS GetBucketMetricsConfigurationResponse
ReadS [GetBucketMetricsConfigurationResponse]
(Int -> ReadS GetBucketMetricsConfigurationResponse)
-> ReadS [GetBucketMetricsConfigurationResponse]
-> ReadPrec GetBucketMetricsConfigurationResponse
-> ReadPrec [GetBucketMetricsConfigurationResponse]
-> Read GetBucketMetricsConfigurationResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetBucketMetricsConfigurationResponse]
$creadListPrec :: ReadPrec [GetBucketMetricsConfigurationResponse]
readPrec :: ReadPrec GetBucketMetricsConfigurationResponse
$creadPrec :: ReadPrec GetBucketMetricsConfigurationResponse
readList :: ReadS [GetBucketMetricsConfigurationResponse]
$creadList :: ReadS [GetBucketMetricsConfigurationResponse]
readsPrec :: Int -> ReadS GetBucketMetricsConfigurationResponse
$creadsPrec :: Int -> ReadS GetBucketMetricsConfigurationResponse
Prelude.Read, Int -> GetBucketMetricsConfigurationResponse -> ShowS
[GetBucketMetricsConfigurationResponse] -> ShowS
GetBucketMetricsConfigurationResponse -> String
(Int -> GetBucketMetricsConfigurationResponse -> ShowS)
-> (GetBucketMetricsConfigurationResponse -> String)
-> ([GetBucketMetricsConfigurationResponse] -> ShowS)
-> Show GetBucketMetricsConfigurationResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetBucketMetricsConfigurationResponse] -> ShowS
$cshowList :: [GetBucketMetricsConfigurationResponse] -> ShowS
show :: GetBucketMetricsConfigurationResponse -> String
$cshow :: GetBucketMetricsConfigurationResponse -> String
showsPrec :: Int -> GetBucketMetricsConfigurationResponse -> ShowS
$cshowsPrec :: Int -> GetBucketMetricsConfigurationResponse -> ShowS
Prelude.Show, (forall x.
GetBucketMetricsConfigurationResponse
-> Rep GetBucketMetricsConfigurationResponse x)
-> (forall x.
Rep GetBucketMetricsConfigurationResponse x
-> GetBucketMetricsConfigurationResponse)
-> Generic GetBucketMetricsConfigurationResponse
forall x.
Rep GetBucketMetricsConfigurationResponse x
-> GetBucketMetricsConfigurationResponse
forall x.
GetBucketMetricsConfigurationResponse
-> Rep GetBucketMetricsConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetBucketMetricsConfigurationResponse x
-> GetBucketMetricsConfigurationResponse
$cfrom :: forall x.
GetBucketMetricsConfigurationResponse
-> Rep GetBucketMetricsConfigurationResponse x
Prelude.Generic)
newGetBucketMetricsConfigurationResponse ::
Prelude.Int ->
GetBucketMetricsConfigurationResponse
newGetBucketMetricsConfigurationResponse :: Int -> GetBucketMetricsConfigurationResponse
newGetBucketMetricsConfigurationResponse Int
pHttpStatus_ =
GetBucketMetricsConfigurationResponse' :: Maybe MetricsConfiguration
-> Int -> GetBucketMetricsConfigurationResponse
GetBucketMetricsConfigurationResponse'
{ $sel:metricsConfiguration:GetBucketMetricsConfigurationResponse' :: Maybe MetricsConfiguration
metricsConfiguration =
Maybe MetricsConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetBucketMetricsConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getBucketMetricsConfigurationResponse_metricsConfiguration :: Lens.Lens' GetBucketMetricsConfigurationResponse (Prelude.Maybe MetricsConfiguration)
getBucketMetricsConfigurationResponse_metricsConfiguration :: (Maybe MetricsConfiguration -> f (Maybe MetricsConfiguration))
-> GetBucketMetricsConfigurationResponse
-> f GetBucketMetricsConfigurationResponse
getBucketMetricsConfigurationResponse_metricsConfiguration = (GetBucketMetricsConfigurationResponse
-> Maybe MetricsConfiguration)
-> (GetBucketMetricsConfigurationResponse
-> Maybe MetricsConfiguration
-> GetBucketMetricsConfigurationResponse)
-> Lens
GetBucketMetricsConfigurationResponse
GetBucketMetricsConfigurationResponse
(Maybe MetricsConfiguration)
(Maybe MetricsConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketMetricsConfigurationResponse' {Maybe MetricsConfiguration
metricsConfiguration :: Maybe MetricsConfiguration
$sel:metricsConfiguration:GetBucketMetricsConfigurationResponse' :: GetBucketMetricsConfigurationResponse -> Maybe MetricsConfiguration
metricsConfiguration} -> Maybe MetricsConfiguration
metricsConfiguration) (\s :: GetBucketMetricsConfigurationResponse
s@GetBucketMetricsConfigurationResponse' {} Maybe MetricsConfiguration
a -> GetBucketMetricsConfigurationResponse
s {$sel:metricsConfiguration:GetBucketMetricsConfigurationResponse' :: Maybe MetricsConfiguration
metricsConfiguration = Maybe MetricsConfiguration
a} :: GetBucketMetricsConfigurationResponse)
getBucketMetricsConfigurationResponse_httpStatus :: Lens.Lens' GetBucketMetricsConfigurationResponse Prelude.Int
getBucketMetricsConfigurationResponse_httpStatus :: (Int -> f Int)
-> GetBucketMetricsConfigurationResponse
-> f GetBucketMetricsConfigurationResponse
getBucketMetricsConfigurationResponse_httpStatus = (GetBucketMetricsConfigurationResponse -> Int)
-> (GetBucketMetricsConfigurationResponse
-> Int -> GetBucketMetricsConfigurationResponse)
-> Lens
GetBucketMetricsConfigurationResponse
GetBucketMetricsConfigurationResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetBucketMetricsConfigurationResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetBucketMetricsConfigurationResponse' :: GetBucketMetricsConfigurationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetBucketMetricsConfigurationResponse
s@GetBucketMetricsConfigurationResponse' {} Int
a -> GetBucketMetricsConfigurationResponse
s {$sel:httpStatus:GetBucketMetricsConfigurationResponse' :: Int
httpStatus = Int
a} :: GetBucketMetricsConfigurationResponse)
instance
Prelude.NFData
GetBucketMetricsConfigurationResponse