{-# 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.AutoScalingPlans.Types.Datapoint where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Datapoint = Datapoint'
{
Datapoint -> Maybe Double
value :: Prelude.Maybe Prelude.Double,
Datapoint -> Maybe POSIX
timestamp :: Prelude.Maybe Core.POSIX
}
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 POSIX -> Datapoint
Datapoint'
{ $sel:value:Datapoint' :: Maybe Double
value = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:timestamp:Datapoint' :: Maybe POSIX
timestamp = Maybe POSIX
forall a. Maybe a
Prelude.Nothing
}
datapoint_value :: Lens.Lens' Datapoint (Prelude.Maybe Prelude.Double)
datapoint_value :: (Maybe Double -> f (Maybe Double)) -> Datapoint -> f Datapoint
datapoint_value = (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
value :: Maybe Double
$sel:value:Datapoint' :: Datapoint -> Maybe Double
value} -> Maybe Double
value) (\s :: Datapoint
s@Datapoint' {} Maybe Double
a -> Datapoint
s {$sel:value:Datapoint' :: Maybe Double
value = Maybe Double
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 POSIX)
-> (Datapoint -> Maybe POSIX -> Datapoint)
-> Lens Datapoint Datapoint (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Datapoint' {Maybe POSIX
timestamp :: Maybe POSIX
$sel:timestamp:Datapoint' :: Datapoint -> Maybe POSIX
timestamp} -> Maybe POSIX
timestamp) (\s :: Datapoint
s@Datapoint' {} Maybe POSIX
a -> Datapoint
s {$sel:timestamp:Datapoint' :: Maybe POSIX
timestamp = Maybe POSIX
a} :: Datapoint) ((Maybe POSIX -> f (Maybe POSIX)) -> Datapoint -> f Datapoint)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> Datapoint
-> f Datapoint
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
instance Core.FromJSON Datapoint where
parseJSON :: Value -> Parser Datapoint
parseJSON =
String -> (Object -> Parser Datapoint) -> Value -> Parser Datapoint
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Datapoint"
( \Object
x ->
Maybe Double -> Maybe POSIX -> Datapoint
Datapoint'
(Maybe Double -> Maybe POSIX -> Datapoint)
-> Parser (Maybe Double) -> Parser (Maybe POSIX -> Datapoint)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Value")
Parser (Maybe POSIX -> Datapoint)
-> Parser (Maybe POSIX) -> Parser Datapoint
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Timestamp")
)
instance Prelude.Hashable Datapoint
instance Prelude.NFData Datapoint