{-# 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.Metrics 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.MetricsStatus
import Amazonka.S3.Types.ReplicationTimeValue
data Metrics = Metrics'
{
Metrics -> Maybe ReplicationTimeValue
eventThreshold :: Prelude.Maybe ReplicationTimeValue,
Metrics -> MetricsStatus
status :: MetricsStatus
}
deriving (Metrics -> Metrics -> Bool
(Metrics -> Metrics -> Bool)
-> (Metrics -> Metrics -> Bool) -> Eq Metrics
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Metrics -> Metrics -> Bool
$c/= :: Metrics -> Metrics -> Bool
== :: Metrics -> Metrics -> Bool
$c== :: Metrics -> Metrics -> Bool
Prelude.Eq, ReadPrec [Metrics]
ReadPrec Metrics
Int -> ReadS Metrics
ReadS [Metrics]
(Int -> ReadS Metrics)
-> ReadS [Metrics]
-> ReadPrec Metrics
-> ReadPrec [Metrics]
-> Read Metrics
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Metrics]
$creadListPrec :: ReadPrec [Metrics]
readPrec :: ReadPrec Metrics
$creadPrec :: ReadPrec Metrics
readList :: ReadS [Metrics]
$creadList :: ReadS [Metrics]
readsPrec :: Int -> ReadS Metrics
$creadsPrec :: Int -> ReadS Metrics
Prelude.Read, Int -> Metrics -> ShowS
[Metrics] -> ShowS
Metrics -> String
(Int -> Metrics -> ShowS)
-> (Metrics -> String) -> ([Metrics] -> ShowS) -> Show Metrics
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Metrics] -> ShowS
$cshowList :: [Metrics] -> ShowS
show :: Metrics -> String
$cshow :: Metrics -> String
showsPrec :: Int -> Metrics -> ShowS
$cshowsPrec :: Int -> Metrics -> ShowS
Prelude.Show, (forall x. Metrics -> Rep Metrics x)
-> (forall x. Rep Metrics x -> Metrics) -> Generic Metrics
forall x. Rep Metrics x -> Metrics
forall x. Metrics -> Rep Metrics x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Metrics x -> Metrics
$cfrom :: forall x. Metrics -> Rep Metrics x
Prelude.Generic)
newMetrics ::
MetricsStatus ->
Metrics
newMetrics :: MetricsStatus -> Metrics
newMetrics MetricsStatus
pStatus_ =
Metrics' :: Maybe ReplicationTimeValue -> MetricsStatus -> Metrics
Metrics'
{ $sel:eventThreshold:Metrics' :: Maybe ReplicationTimeValue
eventThreshold = Maybe ReplicationTimeValue
forall a. Maybe a
Prelude.Nothing,
$sel:status:Metrics' :: MetricsStatus
status = MetricsStatus
pStatus_
}
metrics_eventThreshold :: Lens.Lens' Metrics (Prelude.Maybe ReplicationTimeValue)
metrics_eventThreshold :: (Maybe ReplicationTimeValue -> f (Maybe ReplicationTimeValue))
-> Metrics -> f Metrics
metrics_eventThreshold = (Metrics -> Maybe ReplicationTimeValue)
-> (Metrics -> Maybe ReplicationTimeValue -> Metrics)
-> Lens
Metrics
Metrics
(Maybe ReplicationTimeValue)
(Maybe ReplicationTimeValue)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Metrics' {Maybe ReplicationTimeValue
eventThreshold :: Maybe ReplicationTimeValue
$sel:eventThreshold:Metrics' :: Metrics -> Maybe ReplicationTimeValue
eventThreshold} -> Maybe ReplicationTimeValue
eventThreshold) (\s :: Metrics
s@Metrics' {} Maybe ReplicationTimeValue
a -> Metrics
s {$sel:eventThreshold:Metrics' :: Maybe ReplicationTimeValue
eventThreshold = Maybe ReplicationTimeValue
a} :: Metrics)
metrics_status :: Lens.Lens' Metrics MetricsStatus
metrics_status :: (MetricsStatus -> f MetricsStatus) -> Metrics -> f Metrics
metrics_status = (Metrics -> MetricsStatus)
-> (Metrics -> MetricsStatus -> Metrics)
-> Lens Metrics Metrics MetricsStatus MetricsStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Metrics' {MetricsStatus
status :: MetricsStatus
$sel:status:Metrics' :: Metrics -> MetricsStatus
status} -> MetricsStatus
status) (\s :: Metrics
s@Metrics' {} MetricsStatus
a -> Metrics
s {$sel:status:Metrics' :: MetricsStatus
status = MetricsStatus
a} :: Metrics)
instance Core.FromXML Metrics where
parseXML :: [Node] -> Either String Metrics
parseXML [Node]
x =
Maybe ReplicationTimeValue -> MetricsStatus -> Metrics
Metrics'
(Maybe ReplicationTimeValue -> MetricsStatus -> Metrics)
-> Either String (Maybe ReplicationTimeValue)
-> Either String (MetricsStatus -> Metrics)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ReplicationTimeValue)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"EventThreshold")
Either String (MetricsStatus -> Metrics)
-> Either String MetricsStatus -> Either String Metrics
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String MetricsStatus
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"Status")
instance Prelude.Hashable Metrics
instance Prelude.NFData Metrics
instance Core.ToXML Metrics where
toXML :: Metrics -> XML
toXML Metrics' {Maybe ReplicationTimeValue
MetricsStatus
status :: MetricsStatus
eventThreshold :: Maybe ReplicationTimeValue
$sel:status:Metrics' :: Metrics -> MetricsStatus
$sel:eventThreshold:Metrics' :: Metrics -> Maybe ReplicationTimeValue
..} =
[XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ Name
"EventThreshold" Name -> Maybe ReplicationTimeValue -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= Maybe ReplicationTimeValue
eventThreshold,
Name
"Status" Name -> MetricsStatus -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= MetricsStatus
status
]