{-# 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.CloudWatch.Types.MetricDataResult where
import Amazonka.CloudWatch.Types.MessageData
import Amazonka.CloudWatch.Types.StatusCode
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data MetricDataResult = MetricDataResult'
{
MetricDataResult -> Maybe [Double]
values :: Prelude.Maybe [Prelude.Double],
MetricDataResult -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
MetricDataResult -> Maybe [ISO8601]
timestamps :: Prelude.Maybe [Core.ISO8601],
MetricDataResult -> Maybe [MessageData]
messages :: Prelude.Maybe [MessageData],
MetricDataResult -> Maybe Text
label :: Prelude.Maybe Prelude.Text,
MetricDataResult -> Maybe StatusCode
statusCode :: Prelude.Maybe StatusCode
}
deriving (MetricDataResult -> MetricDataResult -> Bool
(MetricDataResult -> MetricDataResult -> Bool)
-> (MetricDataResult -> MetricDataResult -> Bool)
-> Eq MetricDataResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: MetricDataResult -> MetricDataResult -> Bool
$c/= :: MetricDataResult -> MetricDataResult -> Bool
== :: MetricDataResult -> MetricDataResult -> Bool
$c== :: MetricDataResult -> MetricDataResult -> Bool
Prelude.Eq, ReadPrec [MetricDataResult]
ReadPrec MetricDataResult
Int -> ReadS MetricDataResult
ReadS [MetricDataResult]
(Int -> ReadS MetricDataResult)
-> ReadS [MetricDataResult]
-> ReadPrec MetricDataResult
-> ReadPrec [MetricDataResult]
-> Read MetricDataResult
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [MetricDataResult]
$creadListPrec :: ReadPrec [MetricDataResult]
readPrec :: ReadPrec MetricDataResult
$creadPrec :: ReadPrec MetricDataResult
readList :: ReadS [MetricDataResult]
$creadList :: ReadS [MetricDataResult]
readsPrec :: Int -> ReadS MetricDataResult
$creadsPrec :: Int -> ReadS MetricDataResult
Prelude.Read, Int -> MetricDataResult -> ShowS
[MetricDataResult] -> ShowS
MetricDataResult -> String
(Int -> MetricDataResult -> ShowS)
-> (MetricDataResult -> String)
-> ([MetricDataResult] -> ShowS)
-> Show MetricDataResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [MetricDataResult] -> ShowS
$cshowList :: [MetricDataResult] -> ShowS
show :: MetricDataResult -> String
$cshow :: MetricDataResult -> String
showsPrec :: Int -> MetricDataResult -> ShowS
$cshowsPrec :: Int -> MetricDataResult -> ShowS
Prelude.Show, (forall x. MetricDataResult -> Rep MetricDataResult x)
-> (forall x. Rep MetricDataResult x -> MetricDataResult)
-> Generic MetricDataResult
forall x. Rep MetricDataResult x -> MetricDataResult
forall x. MetricDataResult -> Rep MetricDataResult x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep MetricDataResult x -> MetricDataResult
$cfrom :: forall x. MetricDataResult -> Rep MetricDataResult x
Prelude.Generic)
newMetricDataResult ::
MetricDataResult
newMetricDataResult :: MetricDataResult
newMetricDataResult =
MetricDataResult' :: Maybe [Double]
-> Maybe Text
-> Maybe [ISO8601]
-> Maybe [MessageData]
-> Maybe Text
-> Maybe StatusCode
-> MetricDataResult
MetricDataResult'
{ $sel:values:MetricDataResult' :: Maybe [Double]
values = Maybe [Double]
forall a. Maybe a
Prelude.Nothing,
$sel:id:MetricDataResult' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:timestamps:MetricDataResult' :: Maybe [ISO8601]
timestamps = Maybe [ISO8601]
forall a. Maybe a
Prelude.Nothing,
$sel:messages:MetricDataResult' :: Maybe [MessageData]
messages = Maybe [MessageData]
forall a. Maybe a
Prelude.Nothing,
$sel:label:MetricDataResult' :: Maybe Text
label = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:statusCode:MetricDataResult' :: Maybe StatusCode
statusCode = Maybe StatusCode
forall a. Maybe a
Prelude.Nothing
}
metricDataResult_values :: Lens.Lens' MetricDataResult (Prelude.Maybe [Prelude.Double])
metricDataResult_values :: (Maybe [Double] -> f (Maybe [Double]))
-> MetricDataResult -> f MetricDataResult
metricDataResult_values = (MetricDataResult -> Maybe [Double])
-> (MetricDataResult -> Maybe [Double] -> MetricDataResult)
-> Lens
MetricDataResult MetricDataResult (Maybe [Double]) (Maybe [Double])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricDataResult' {Maybe [Double]
values :: Maybe [Double]
$sel:values:MetricDataResult' :: MetricDataResult -> Maybe [Double]
values} -> Maybe [Double]
values) (\s :: MetricDataResult
s@MetricDataResult' {} Maybe [Double]
a -> MetricDataResult
s {$sel:values:MetricDataResult' :: Maybe [Double]
values = Maybe [Double]
a} :: MetricDataResult) ((Maybe [Double] -> f (Maybe [Double]))
-> MetricDataResult -> f MetricDataResult)
-> ((Maybe [Double] -> f (Maybe [Double]))
-> Maybe [Double] -> f (Maybe [Double]))
-> (Maybe [Double] -> f (Maybe [Double]))
-> MetricDataResult
-> f MetricDataResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Double] [Double] [Double] [Double]
-> Iso
(Maybe [Double]) (Maybe [Double]) (Maybe [Double]) (Maybe [Double])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Double] [Double] [Double] [Double]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
metricDataResult_id :: Lens.Lens' MetricDataResult (Prelude.Maybe Prelude.Text)
metricDataResult_id :: (Maybe Text -> f (Maybe Text))
-> MetricDataResult -> f MetricDataResult
metricDataResult_id = (MetricDataResult -> Maybe Text)
-> (MetricDataResult -> Maybe Text -> MetricDataResult)
-> Lens MetricDataResult MetricDataResult (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricDataResult' {Maybe Text
id :: Maybe Text
$sel:id:MetricDataResult' :: MetricDataResult -> Maybe Text
id} -> Maybe Text
id) (\s :: MetricDataResult
s@MetricDataResult' {} Maybe Text
a -> MetricDataResult
s {$sel:id:MetricDataResult' :: Maybe Text
id = Maybe Text
a} :: MetricDataResult)
metricDataResult_timestamps :: Lens.Lens' MetricDataResult (Prelude.Maybe [Prelude.UTCTime])
metricDataResult_timestamps :: (Maybe [UTCTime] -> f (Maybe [UTCTime]))
-> MetricDataResult -> f MetricDataResult
metricDataResult_timestamps = (MetricDataResult -> Maybe [ISO8601])
-> (MetricDataResult -> Maybe [ISO8601] -> MetricDataResult)
-> Lens
MetricDataResult
MetricDataResult
(Maybe [ISO8601])
(Maybe [ISO8601])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricDataResult' {Maybe [ISO8601]
timestamps :: Maybe [ISO8601]
$sel:timestamps:MetricDataResult' :: MetricDataResult -> Maybe [ISO8601]
timestamps} -> Maybe [ISO8601]
timestamps) (\s :: MetricDataResult
s@MetricDataResult' {} Maybe [ISO8601]
a -> MetricDataResult
s {$sel:timestamps:MetricDataResult' :: Maybe [ISO8601]
timestamps = Maybe [ISO8601]
a} :: MetricDataResult) ((Maybe [ISO8601] -> f (Maybe [ISO8601]))
-> MetricDataResult -> f MetricDataResult)
-> ((Maybe [UTCTime] -> f (Maybe [UTCTime]))
-> Maybe [ISO8601] -> f (Maybe [ISO8601]))
-> (Maybe [UTCTime] -> f (Maybe [UTCTime]))
-> MetricDataResult
-> f MetricDataResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [ISO8601] [ISO8601] [UTCTime] [UTCTime]
-> Iso
(Maybe [ISO8601])
(Maybe [ISO8601])
(Maybe [UTCTime])
(Maybe [UTCTime])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [ISO8601] [ISO8601] [UTCTime] [UTCTime]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
metricDataResult_messages :: Lens.Lens' MetricDataResult (Prelude.Maybe [MessageData])
metricDataResult_messages :: (Maybe [MessageData] -> f (Maybe [MessageData]))
-> MetricDataResult -> f MetricDataResult
metricDataResult_messages = (MetricDataResult -> Maybe [MessageData])
-> (MetricDataResult -> Maybe [MessageData] -> MetricDataResult)
-> Lens
MetricDataResult
MetricDataResult
(Maybe [MessageData])
(Maybe [MessageData])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricDataResult' {Maybe [MessageData]
messages :: Maybe [MessageData]
$sel:messages:MetricDataResult' :: MetricDataResult -> Maybe [MessageData]
messages} -> Maybe [MessageData]
messages) (\s :: MetricDataResult
s@MetricDataResult' {} Maybe [MessageData]
a -> MetricDataResult
s {$sel:messages:MetricDataResult' :: Maybe [MessageData]
messages = Maybe [MessageData]
a} :: MetricDataResult) ((Maybe [MessageData] -> f (Maybe [MessageData]))
-> MetricDataResult -> f MetricDataResult)
-> ((Maybe [MessageData] -> f (Maybe [MessageData]))
-> Maybe [MessageData] -> f (Maybe [MessageData]))
-> (Maybe [MessageData] -> f (Maybe [MessageData]))
-> MetricDataResult
-> f MetricDataResult
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [MessageData] [MessageData] [MessageData] [MessageData]
-> Iso
(Maybe [MessageData])
(Maybe [MessageData])
(Maybe [MessageData])
(Maybe [MessageData])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [MessageData] [MessageData] [MessageData] [MessageData]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
metricDataResult_label :: Lens.Lens' MetricDataResult (Prelude.Maybe Prelude.Text)
metricDataResult_label :: (Maybe Text -> f (Maybe Text))
-> MetricDataResult -> f MetricDataResult
metricDataResult_label = (MetricDataResult -> Maybe Text)
-> (MetricDataResult -> Maybe Text -> MetricDataResult)
-> Lens MetricDataResult MetricDataResult (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricDataResult' {Maybe Text
label :: Maybe Text
$sel:label:MetricDataResult' :: MetricDataResult -> Maybe Text
label} -> Maybe Text
label) (\s :: MetricDataResult
s@MetricDataResult' {} Maybe Text
a -> MetricDataResult
s {$sel:label:MetricDataResult' :: Maybe Text
label = Maybe Text
a} :: MetricDataResult)
metricDataResult_statusCode :: Lens.Lens' MetricDataResult (Prelude.Maybe StatusCode)
metricDataResult_statusCode :: (Maybe StatusCode -> f (Maybe StatusCode))
-> MetricDataResult -> f MetricDataResult
metricDataResult_statusCode = (MetricDataResult -> Maybe StatusCode)
-> (MetricDataResult -> Maybe StatusCode -> MetricDataResult)
-> Lens
MetricDataResult
MetricDataResult
(Maybe StatusCode)
(Maybe StatusCode)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\MetricDataResult' {Maybe StatusCode
statusCode :: Maybe StatusCode
$sel:statusCode:MetricDataResult' :: MetricDataResult -> Maybe StatusCode
statusCode} -> Maybe StatusCode
statusCode) (\s :: MetricDataResult
s@MetricDataResult' {} Maybe StatusCode
a -> MetricDataResult
s {$sel:statusCode:MetricDataResult' :: Maybe StatusCode
statusCode = Maybe StatusCode
a} :: MetricDataResult)
instance Core.FromXML MetricDataResult where
parseXML :: [Node] -> Either String MetricDataResult
parseXML [Node]
x =
Maybe [Double]
-> Maybe Text
-> Maybe [ISO8601]
-> Maybe [MessageData]
-> Maybe Text
-> Maybe StatusCode
-> MetricDataResult
MetricDataResult'
(Maybe [Double]
-> Maybe Text
-> Maybe [ISO8601]
-> Maybe [MessageData]
-> Maybe Text
-> Maybe StatusCode
-> MetricDataResult)
-> Either String (Maybe [Double])
-> Either
String
(Maybe Text
-> Maybe [ISO8601]
-> Maybe [MessageData]
-> Maybe Text
-> Maybe StatusCode
-> MetricDataResult)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Values" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [Double]))
-> Either String (Maybe [Double])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [Double])
-> [Node] -> Either String (Maybe [Double])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [Double]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either
String
(Maybe Text
-> Maybe [ISO8601]
-> Maybe [MessageData]
-> Maybe Text
-> Maybe StatusCode
-> MetricDataResult)
-> Either String (Maybe Text)
-> Either
String
(Maybe [ISO8601]
-> Maybe [MessageData]
-> Maybe Text
-> Maybe StatusCode
-> MetricDataResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Id")
Either
String
(Maybe [ISO8601]
-> Maybe [MessageData]
-> Maybe Text
-> Maybe StatusCode
-> MetricDataResult)
-> Either String (Maybe [ISO8601])
-> Either
String
(Maybe [MessageData]
-> Maybe Text -> Maybe StatusCode -> MetricDataResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Timestamps" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [ISO8601]))
-> Either String (Maybe [ISO8601])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [ISO8601])
-> [Node] -> Either String (Maybe [ISO8601])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [ISO8601]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either
String
(Maybe [MessageData]
-> Maybe Text -> Maybe StatusCode -> MetricDataResult)
-> Either String (Maybe [MessageData])
-> Either
String (Maybe Text -> Maybe StatusCode -> MetricDataResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ( [Node]
x [Node] -> Text -> Either String (Maybe [Node])
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Messages" Either String (Maybe [Node]) -> [Node] -> Either String [Node]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [Node]
forall a. Monoid a => a
Prelude.mempty
Either String [Node]
-> ([Node] -> Either String (Maybe [MessageData]))
-> Either String (Maybe [MessageData])
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String [MessageData])
-> [Node] -> Either String (Maybe [MessageData])
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text -> [Node] -> Either String [MessageData]
forall a. FromXML a => Text -> [Node] -> Either String [a]
Core.parseXMLList Text
"member")
)
Either String (Maybe Text -> Maybe StatusCode -> MetricDataResult)
-> Either String (Maybe Text)
-> Either String (Maybe StatusCode -> MetricDataResult)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Label")
Either String (Maybe StatusCode -> MetricDataResult)
-> Either String (Maybe StatusCode)
-> Either String MetricDataResult
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe StatusCode)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"StatusCode")
instance Prelude.Hashable MetricDataResult
instance Prelude.NFData MetricDataResult