{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.S3.Types.MetricsConfiguration where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal
import Amazonka.S3.Types.MetricsFilter
data MetricsConfiguration = MetricsConfiguration'
{
MetricsConfiguration -> Maybe MetricsFilter
filter' :: Prelude.Maybe MetricsFilter,
MetricsConfiguration -> Text
id :: Prelude.Text
}
deriving (MetricsConfiguration -> MetricsConfiguration -> Bool
(MetricsConfiguration -> MetricsConfiguration -> Bool)
-> (MetricsConfiguration -> MetricsConfiguration -> Bool)
-> Eq MetricsConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MetricsConfiguration -> MetricsConfiguration -> Bool
$c/= :: MetricsConfiguration -> MetricsConfiguration -> Bool
== :: MetricsConfiguration -> MetricsConfiguration -> Bool
$c== :: MetricsConfiguration -> MetricsConfiguration -> Bool
Prelude.Eq, ReadPrec [MetricsConfiguration]
ReadPrec MetricsConfiguration
Int -> ReadS MetricsConfiguration
ReadS [MetricsConfiguration]
(Int -> ReadS MetricsConfiguration)
-> ReadS [MetricsConfiguration]
-> ReadPrec MetricsConfiguration
-> ReadPrec [MetricsConfiguration]
-> Read MetricsConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MetricsConfiguration]
$creadListPrec :: ReadPrec [MetricsConfiguration]
readPrec :: ReadPrec MetricsConfiguration
$creadPrec :: ReadPrec MetricsConfiguration
readList :: ReadS [MetricsConfiguration]
$creadList :: ReadS [MetricsConfiguration]
readsPrec :: Int -> ReadS MetricsConfiguration
$creadsPrec :: Int -> ReadS MetricsConfiguration
Prelude.Read, Int -> MetricsConfiguration -> ShowS
[MetricsConfiguration] -> ShowS
MetricsConfiguration -> String
(Int -> MetricsConfiguration -> ShowS)
-> (MetricsConfiguration -> String)
-> ([MetricsConfiguration] -> ShowS)
-> Show MetricsConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MetricsConfiguration] -> ShowS
$cshowList :: [MetricsConfiguration] -> ShowS
show :: MetricsConfiguration -> String
$cshow :: MetricsConfiguration -> String
showsPrec :: Int -> MetricsConfiguration -> ShowS
$cshowsPrec :: Int -> MetricsConfiguration -> ShowS
Prelude.Show, (forall x. MetricsConfiguration -> Rep MetricsConfiguration x)
-> (forall x. Rep MetricsConfiguration x -> MetricsConfiguration)
-> Generic MetricsConfiguration
forall x. Rep MetricsConfiguration x -> MetricsConfiguration
forall x. MetricsConfiguration -> Rep MetricsConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MetricsConfiguration x -> MetricsConfiguration
$cfrom :: forall x. MetricsConfiguration -> Rep MetricsConfiguration x
Prelude.Generic)
newMetricsConfiguration ::
Prelude.Text ->
MetricsConfiguration
newMetricsConfiguration :: Text -> MetricsConfiguration
newMetricsConfiguration Text
pId_ =
MetricsConfiguration' :: Maybe MetricsFilter -> Text -> MetricsConfiguration
MetricsConfiguration'
{ $sel:filter':MetricsConfiguration' :: Maybe MetricsFilter
filter' = Maybe MetricsFilter
forall a. Maybe a
Prelude.Nothing,
$sel:id:MetricsConfiguration' :: Text
id = Text
pId_
}
metricsConfiguration_filter :: Lens.Lens' MetricsConfiguration (Prelude.Maybe MetricsFilter)
metricsConfiguration_filter :: (Maybe MetricsFilter -> f (Maybe MetricsFilter))
-> MetricsConfiguration -> f MetricsConfiguration
metricsConfiguration_filter = (MetricsConfiguration -> Maybe MetricsFilter)
-> (MetricsConfiguration
-> Maybe MetricsFilter -> MetricsConfiguration)
-> Lens
MetricsConfiguration
MetricsConfiguration
(Maybe MetricsFilter)
(Maybe MetricsFilter)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricsConfiguration' {Maybe MetricsFilter
filter' :: Maybe MetricsFilter
$sel:filter':MetricsConfiguration' :: MetricsConfiguration -> Maybe MetricsFilter
filter'} -> Maybe MetricsFilter
filter') (\s :: MetricsConfiguration
s@MetricsConfiguration' {} Maybe MetricsFilter
a -> MetricsConfiguration
s {$sel:filter':MetricsConfiguration' :: Maybe MetricsFilter
filter' = Maybe MetricsFilter
a} :: MetricsConfiguration)
metricsConfiguration_id :: Lens.Lens' MetricsConfiguration Prelude.Text
metricsConfiguration_id :: (Text -> f Text) -> MetricsConfiguration -> f MetricsConfiguration
metricsConfiguration_id = (MetricsConfiguration -> Text)
-> (MetricsConfiguration -> Text -> MetricsConfiguration)
-> Lens MetricsConfiguration MetricsConfiguration Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricsConfiguration' {Text
id :: Text
$sel:id:MetricsConfiguration' :: MetricsConfiguration -> Text
id} -> Text
id) (\s :: MetricsConfiguration
s@MetricsConfiguration' {} Text
a -> MetricsConfiguration
s {$sel:id:MetricsConfiguration' :: Text
id = Text
a} :: MetricsConfiguration)
instance Core.FromXML MetricsConfiguration where
parseXML :: [Node] -> Either String MetricsConfiguration
parseXML [Node]
x =
Maybe MetricsFilter -> Text -> MetricsConfiguration
MetricsConfiguration'
(Maybe MetricsFilter -> Text -> MetricsConfiguration)
-> Either String (Maybe MetricsFilter)
-> Either String (Text -> MetricsConfiguration)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe MetricsFilter)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Filter") Either String (Text -> MetricsConfiguration)
-> Either String Text -> Either String MetricsConfiguration
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String Text
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Id")
instance Prelude.Hashable MetricsConfiguration
instance Prelude.NFData MetricsConfiguration
instance Core.ToXML MetricsConfiguration where
toXML :: MetricsConfiguration -> XML
toXML MetricsConfiguration' {Maybe MetricsFilter
Text
id :: Text
filter' :: Maybe MetricsFilter
$sel:id:MetricsConfiguration' :: MetricsConfiguration -> Text
$sel:filter':MetricsConfiguration' :: MetricsConfiguration -> Maybe MetricsFilter
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[Name
"Filter" Name -> Maybe MetricsFilter -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe MetricsFilter
filter', Name
"Id" Name -> Text -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Text
id]