{-# 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.Datapoint where
import Amazonka.CloudWatch.Types.StandardUnit
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Datapoint = Datapoint'
{
Datapoint -> Maybe Double
sampleCount :: Prelude.Maybe Prelude.Double,
Datapoint -> Maybe Double
maximum :: Prelude.Maybe Prelude.Double,
Datapoint -> Maybe Double
average :: Prelude.Maybe Prelude.Double,
Datapoint -> Maybe Double
minimum :: Prelude.Maybe Prelude.Double,
Datapoint -> Maybe (HashMap Text Double)
extendedStatistics :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Double),
Datapoint -> Maybe Double
sum :: Prelude.Maybe Prelude.Double,
Datapoint -> Maybe StandardUnit
unit :: Prelude.Maybe StandardUnit,
Datapoint -> Maybe ISO8601
timestamp :: Prelude.Maybe Core.ISO8601
}
deriving (Datapoint -> Datapoint -> Bool
(Datapoint -> Datapoint -> Bool)
-> (Datapoint -> Datapoint -> Bool) -> Eq Datapoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Datapoint -> Datapoint -> Bool
$c/= :: Datapoint -> Datapoint -> Bool
== :: Datapoint -> Datapoint -> Bool
$c== :: Datapoint -> Datapoint -> Bool
Prelude.Eq, ReadPrec [Datapoint]
ReadPrec Datapoint
Int -> ReadS Datapoint
ReadS [Datapoint]
(Int -> ReadS Datapoint)
-> ReadS [Datapoint]
-> ReadPrec Datapoint
-> ReadPrec [Datapoint]
-> Read Datapoint
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Datapoint]
$creadListPrec :: ReadPrec [Datapoint]
readPrec :: ReadPrec Datapoint
$creadPrec :: ReadPrec Datapoint
readList :: ReadS [Datapoint]
$creadList :: ReadS [Datapoint]
readsPrec :: Int -> ReadS Datapoint
$creadsPrec :: Int -> ReadS Datapoint
Prelude.Read, Int -> Datapoint -> ShowS
[Datapoint] -> ShowS
Datapoint -> String
(Int -> Datapoint -> ShowS)
-> (Datapoint -> String)
-> ([Datapoint] -> ShowS)
-> Show Datapoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Datapoint] -> ShowS
$cshowList :: [Datapoint] -> ShowS
show :: Datapoint -> String
$cshow :: Datapoint -> String
showsPrec :: Int -> Datapoint -> ShowS
$cshowsPrec :: Int -> Datapoint -> ShowS
Prelude.Show, (forall x. Datapoint -> Rep Datapoint x)
-> (forall x. Rep Datapoint x -> Datapoint) -> Generic Datapoint
forall x. Rep Datapoint x -> Datapoint
forall x. Datapoint -> Rep Datapoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Datapoint x -> Datapoint
$cfrom :: forall x. Datapoint -> Rep Datapoint x
Prelude.Generic)
newDatapoint ::
Datapoint
newDatapoint :: Datapoint
newDatapoint =
Datapoint' :: Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe (HashMap Text Double)
-> Maybe Double
-> Maybe StandardUnit
-> Maybe ISO8601
-> Datapoint
Datapoint'
{ $sel:sampleCount:Datapoint' :: Maybe Double
sampleCount = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:maximum:Datapoint' :: Maybe Double
maximum = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:average:Datapoint' :: Maybe Double
average = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:minimum:Datapoint' :: Maybe Double
minimum = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:extendedStatistics:Datapoint' :: Maybe (HashMap Text Double)
extendedStatistics = Maybe (HashMap Text Double)
forall a. Maybe a
Prelude.Nothing,
$sel:sum:Datapoint' :: Maybe Double
sum = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:unit:Datapoint' :: Maybe StandardUnit
unit = Maybe StandardUnit
forall a. Maybe a
Prelude.Nothing,
$sel:timestamp:Datapoint' :: Maybe ISO8601
timestamp = Maybe ISO8601
forall a. Maybe a
Prelude.Nothing
}
datapoint_sampleCount :: Lens.Lens' Datapoint (Prelude.Maybe Prelude.Double)
datapoint_sampleCount :: (Maybe Double -> f (Maybe Double)) -> Datapoint -> f Datapoint
datapoint_sampleCount = (Datapoint -> Maybe Double)
-> (Datapoint -> Maybe Double -> Datapoint)
-> Lens Datapoint Datapoint (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Datapoint' {Maybe Double
sampleCount :: Maybe Double
$sel:sampleCount:Datapoint' :: Datapoint -> Maybe Double
sampleCount} -> Maybe Double
sampleCount) (\s :: Datapoint
s@Datapoint' {} Maybe Double
a -> Datapoint
s {$sel:sampleCount:Datapoint' :: Maybe Double
sampleCount = Maybe Double
a} :: Datapoint)
datapoint_maximum :: Lens.Lens' Datapoint (Prelude.Maybe Prelude.Double)
datapoint_maximum :: (Maybe Double -> f (Maybe Double)) -> Datapoint -> f Datapoint
datapoint_maximum = (Datapoint -> Maybe Double)
-> (Datapoint -> Maybe Double -> Datapoint)
-> Lens Datapoint Datapoint (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Datapoint' {Maybe Double
maximum :: Maybe Double
$sel:maximum:Datapoint' :: Datapoint -> Maybe Double
maximum} -> Maybe Double
maximum) (\s :: Datapoint
s@Datapoint' {} Maybe Double
a -> Datapoint
s {$sel:maximum:Datapoint' :: Maybe Double
maximum = Maybe Double
a} :: Datapoint)
datapoint_average :: Lens.Lens' Datapoint (Prelude.Maybe Prelude.Double)
datapoint_average :: (Maybe Double -> f (Maybe Double)) -> Datapoint -> f Datapoint
datapoint_average = (Datapoint -> Maybe Double)
-> (Datapoint -> Maybe Double -> Datapoint)
-> Lens Datapoint Datapoint (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Datapoint' {Maybe Double
average :: Maybe Double
$sel:average:Datapoint' :: Datapoint -> Maybe Double
average} -> Maybe Double
average) (\s :: Datapoint
s@Datapoint' {} Maybe Double
a -> Datapoint
s {$sel:average:Datapoint' :: Maybe Double
average = Maybe Double
a} :: Datapoint)
datapoint_minimum :: Lens.Lens' Datapoint (Prelude.Maybe Prelude.Double)
datapoint_minimum :: (Maybe Double -> f (Maybe Double)) -> Datapoint -> f Datapoint
datapoint_minimum = (Datapoint -> Maybe Double)
-> (Datapoint -> Maybe Double -> Datapoint)
-> Lens Datapoint Datapoint (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Datapoint' {Maybe Double
minimum :: Maybe Double
$sel:minimum:Datapoint' :: Datapoint -> Maybe Double
minimum} -> Maybe Double
minimum) (\s :: Datapoint
s@Datapoint' {} Maybe Double
a -> Datapoint
s {$sel:minimum:Datapoint' :: Maybe Double
minimum = Maybe Double
a} :: Datapoint)
datapoint_extendedStatistics :: Lens.Lens' Datapoint (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Double))
datapoint_extendedStatistics :: (Maybe (HashMap Text Double) -> f (Maybe (HashMap Text Double)))
-> Datapoint -> f Datapoint
datapoint_extendedStatistics = (Datapoint -> Maybe (HashMap Text Double))
-> (Datapoint -> Maybe (HashMap Text Double) -> Datapoint)
-> Lens
Datapoint
Datapoint
(Maybe (HashMap Text Double))
(Maybe (HashMap Text Double))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Datapoint' {Maybe (HashMap Text Double)
extendedStatistics :: Maybe (HashMap Text Double)
$sel:extendedStatistics:Datapoint' :: Datapoint -> Maybe (HashMap Text Double)
extendedStatistics} -> Maybe (HashMap Text Double)
extendedStatistics) (\s :: Datapoint
s@Datapoint' {} Maybe (HashMap Text Double)
a -> Datapoint
s {$sel:extendedStatistics:Datapoint' :: Maybe (HashMap Text Double)
extendedStatistics = Maybe (HashMap Text Double)
a} :: Datapoint) ((Maybe (HashMap Text Double) -> f (Maybe (HashMap Text Double)))
-> Datapoint -> f Datapoint)
-> ((Maybe (HashMap Text Double)
-> f (Maybe (HashMap Text Double)))
-> Maybe (HashMap Text Double) -> f (Maybe (HashMap Text Double)))
-> (Maybe (HashMap Text Double) -> f (Maybe (HashMap Text Double)))
-> Datapoint
-> f Datapoint
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(HashMap Text Double)
(HashMap Text Double)
(HashMap Text Double)
(HashMap Text Double)
-> Iso
(Maybe (HashMap Text Double))
(Maybe (HashMap Text Double))
(Maybe (HashMap Text Double))
(Maybe (HashMap Text 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
(HashMap Text Double)
(HashMap Text Double)
(HashMap Text Double)
(HashMap Text Double)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
datapoint_sum :: Lens.Lens' Datapoint (Prelude.Maybe Prelude.Double)
datapoint_sum :: (Maybe Double -> f (Maybe Double)) -> Datapoint -> f Datapoint
datapoint_sum = (Datapoint -> Maybe Double)
-> (Datapoint -> Maybe Double -> Datapoint)
-> Lens Datapoint Datapoint (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Datapoint' {Maybe Double
sum :: Maybe Double
$sel:sum:Datapoint' :: Datapoint -> Maybe Double
sum} -> Maybe Double
sum) (\s :: Datapoint
s@Datapoint' {} Maybe Double
a -> Datapoint
s {$sel:sum:Datapoint' :: Maybe Double
sum = Maybe Double
a} :: Datapoint)
datapoint_unit :: Lens.Lens' Datapoint (Prelude.Maybe StandardUnit)
datapoint_unit :: (Maybe StandardUnit -> f (Maybe StandardUnit))
-> Datapoint -> f Datapoint
datapoint_unit = (Datapoint -> Maybe StandardUnit)
-> (Datapoint -> Maybe StandardUnit -> Datapoint)
-> Lens
Datapoint Datapoint (Maybe StandardUnit) (Maybe StandardUnit)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Datapoint' {Maybe StandardUnit
unit :: Maybe StandardUnit
$sel:unit:Datapoint' :: Datapoint -> Maybe StandardUnit
unit} -> Maybe StandardUnit
unit) (\s :: Datapoint
s@Datapoint' {} Maybe StandardUnit
a -> Datapoint
s {$sel:unit:Datapoint' :: Maybe StandardUnit
unit = Maybe StandardUnit
a} :: Datapoint)
datapoint_timestamp :: Lens.Lens' Datapoint (Prelude.Maybe Prelude.UTCTime)
datapoint_timestamp :: (Maybe UTCTime -> f (Maybe UTCTime)) -> Datapoint -> f Datapoint
datapoint_timestamp = (Datapoint -> Maybe ISO8601)
-> (Datapoint -> Maybe ISO8601 -> Datapoint)
-> Lens Datapoint Datapoint (Maybe ISO8601) (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Datapoint' {Maybe ISO8601
timestamp :: Maybe ISO8601
$sel:timestamp:Datapoint' :: Datapoint -> Maybe ISO8601
timestamp} -> Maybe ISO8601
timestamp) (\s :: Datapoint
s@Datapoint' {} Maybe ISO8601
a -> Datapoint
s {$sel:timestamp:Datapoint' :: Maybe ISO8601
timestamp = Maybe ISO8601
a} :: Datapoint) ((Maybe ISO8601 -> f (Maybe ISO8601)) -> Datapoint -> f Datapoint)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Datapoint
-> f Datapoint
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 (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Core.FromXML Datapoint where
parseXML :: [Node] -> Either String Datapoint
parseXML [Node]
x =
Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe (HashMap Text Double)
-> Maybe Double
-> Maybe StandardUnit
-> Maybe ISO8601
-> Datapoint
Datapoint'
(Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe (HashMap Text Double)
-> Maybe Double
-> Maybe StandardUnit
-> Maybe ISO8601
-> Datapoint)
-> Either String (Maybe Double)
-> Either
String
(Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe (HashMap Text Double)
-> Maybe Double
-> Maybe StandardUnit
-> Maybe ISO8601
-> Datapoint)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Double)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SampleCount")
Either
String
(Maybe Double
-> Maybe Double
-> Maybe Double
-> Maybe (HashMap Text Double)
-> Maybe Double
-> Maybe StandardUnit
-> Maybe ISO8601
-> Datapoint)
-> Either String (Maybe Double)
-> Either
String
(Maybe Double
-> Maybe Double
-> Maybe (HashMap Text Double)
-> Maybe Double
-> Maybe StandardUnit
-> Maybe ISO8601
-> Datapoint)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Double)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Maximum")
Either
String
(Maybe Double
-> Maybe Double
-> Maybe (HashMap Text Double)
-> Maybe Double
-> Maybe StandardUnit
-> Maybe ISO8601
-> Datapoint)
-> Either String (Maybe Double)
-> Either
String
(Maybe Double
-> Maybe (HashMap Text Double)
-> Maybe Double
-> Maybe StandardUnit
-> Maybe ISO8601
-> Datapoint)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Double)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Average")
Either
String
(Maybe Double
-> Maybe (HashMap Text Double)
-> Maybe Double
-> Maybe StandardUnit
-> Maybe ISO8601
-> Datapoint)
-> Either String (Maybe Double)
-> Either
String
(Maybe (HashMap Text Double)
-> Maybe Double
-> Maybe StandardUnit
-> Maybe ISO8601
-> Datapoint)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Double)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Minimum")
Either
String
(Maybe (HashMap Text Double)
-> Maybe Double
-> Maybe StandardUnit
-> Maybe ISO8601
-> Datapoint)
-> Either String (Maybe (HashMap Text Double))
-> Either
String
(Maybe Double -> Maybe StandardUnit -> Maybe ISO8601 -> Datapoint)
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
"ExtendedStatistics"
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 (HashMap Text Double)))
-> Either String (Maybe (HashMap Text Double))
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= ([Node] -> Either String (HashMap Text Double))
-> [Node] -> Either String (Maybe (HashMap Text Double))
forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (Text
-> Text -> Text -> [Node] -> Either String (HashMap Text Double)
forall k v.
(Eq k, Hashable k, FromText k, FromXML v) =>
Text -> Text -> Text -> [Node] -> Either String (HashMap k v)
Core.parseXMLMap Text
"entry" Text
"key" Text
"value")
)
Either
String
(Maybe Double -> Maybe StandardUnit -> Maybe ISO8601 -> Datapoint)
-> Either String (Maybe Double)
-> Either String (Maybe StandardUnit -> Maybe ISO8601 -> Datapoint)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Double)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Sum")
Either String (Maybe StandardUnit -> Maybe ISO8601 -> Datapoint)
-> Either String (Maybe StandardUnit)
-> Either String (Maybe ISO8601 -> Datapoint)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe StandardUnit)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Unit")
Either String (Maybe ISO8601 -> Datapoint)
-> Either String (Maybe ISO8601) -> Either String Datapoint
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Timestamp")
instance Prelude.Hashable Datapoint
instance Prelude.NFData Datapoint