{-# 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.IoTSiteWise.Types.AggregatedValue where
import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.Types.Aggregates
import Amazonka.IoTSiteWise.Types.Quality
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data AggregatedValue = AggregatedValue'
{
AggregatedValue -> Maybe Quality
quality :: Prelude.Maybe Quality,
AggregatedValue -> POSIX
timestamp :: Core.POSIX,
AggregatedValue -> Aggregates
value :: Aggregates
}
deriving (AggregatedValue -> AggregatedValue -> Bool
(AggregatedValue -> AggregatedValue -> Bool)
-> (AggregatedValue -> AggregatedValue -> Bool)
-> Eq AggregatedValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AggregatedValue -> AggregatedValue -> Bool
$c/= :: AggregatedValue -> AggregatedValue -> Bool
== :: AggregatedValue -> AggregatedValue -> Bool
$c== :: AggregatedValue -> AggregatedValue -> Bool
Prelude.Eq, ReadPrec [AggregatedValue]
ReadPrec AggregatedValue
Int -> ReadS AggregatedValue
ReadS [AggregatedValue]
(Int -> ReadS AggregatedValue)
-> ReadS [AggregatedValue]
-> ReadPrec AggregatedValue
-> ReadPrec [AggregatedValue]
-> Read AggregatedValue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AggregatedValue]
$creadListPrec :: ReadPrec [AggregatedValue]
readPrec :: ReadPrec AggregatedValue
$creadPrec :: ReadPrec AggregatedValue
readList :: ReadS [AggregatedValue]
$creadList :: ReadS [AggregatedValue]
readsPrec :: Int -> ReadS AggregatedValue
$creadsPrec :: Int -> ReadS AggregatedValue
Prelude.Read, Int -> AggregatedValue -> ShowS
[AggregatedValue] -> ShowS
AggregatedValue -> String
(Int -> AggregatedValue -> ShowS)
-> (AggregatedValue -> String)
-> ([AggregatedValue] -> ShowS)
-> Show AggregatedValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AggregatedValue] -> ShowS
$cshowList :: [AggregatedValue] -> ShowS
show :: AggregatedValue -> String
$cshow :: AggregatedValue -> String
showsPrec :: Int -> AggregatedValue -> ShowS
$cshowsPrec :: Int -> AggregatedValue -> ShowS
Prelude.Show, (forall x. AggregatedValue -> Rep AggregatedValue x)
-> (forall x. Rep AggregatedValue x -> AggregatedValue)
-> Generic AggregatedValue
forall x. Rep AggregatedValue x -> AggregatedValue
forall x. AggregatedValue -> Rep AggregatedValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AggregatedValue x -> AggregatedValue
$cfrom :: forall x. AggregatedValue -> Rep AggregatedValue x
Prelude.Generic)
newAggregatedValue ::
Prelude.UTCTime ->
Aggregates ->
AggregatedValue
newAggregatedValue :: UTCTime -> Aggregates -> AggregatedValue
newAggregatedValue UTCTime
pTimestamp_ Aggregates
pValue_ =
AggregatedValue' :: Maybe Quality -> POSIX -> Aggregates -> AggregatedValue
AggregatedValue'
{ $sel:quality:AggregatedValue' :: Maybe Quality
quality = Maybe Quality
forall a. Maybe a
Prelude.Nothing,
$sel:timestamp:AggregatedValue' :: POSIX
timestamp = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
-> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pTimestamp_,
$sel:value:AggregatedValue' :: Aggregates
value = Aggregates
pValue_
}
aggregatedValue_quality :: Lens.Lens' AggregatedValue (Prelude.Maybe Quality)
aggregatedValue_quality :: (Maybe Quality -> f (Maybe Quality))
-> AggregatedValue -> f AggregatedValue
aggregatedValue_quality = (AggregatedValue -> Maybe Quality)
-> (AggregatedValue -> Maybe Quality -> AggregatedValue)
-> Lens
AggregatedValue AggregatedValue (Maybe Quality) (Maybe Quality)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedValue' {Maybe Quality
quality :: Maybe Quality
$sel:quality:AggregatedValue' :: AggregatedValue -> Maybe Quality
quality} -> Maybe Quality
quality) (\s :: AggregatedValue
s@AggregatedValue' {} Maybe Quality
a -> AggregatedValue
s {$sel:quality:AggregatedValue' :: Maybe Quality
quality = Maybe Quality
a} :: AggregatedValue)
aggregatedValue_timestamp :: Lens.Lens' AggregatedValue Prelude.UTCTime
aggregatedValue_timestamp :: (UTCTime -> f UTCTime) -> AggregatedValue -> f AggregatedValue
aggregatedValue_timestamp = (AggregatedValue -> POSIX)
-> (AggregatedValue -> POSIX -> AggregatedValue)
-> Lens AggregatedValue AggregatedValue POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedValue' {POSIX
timestamp :: POSIX
$sel:timestamp:AggregatedValue' :: AggregatedValue -> POSIX
timestamp} -> POSIX
timestamp) (\s :: AggregatedValue
s@AggregatedValue' {} POSIX
a -> AggregatedValue
s {$sel:timestamp:AggregatedValue' :: POSIX
timestamp = POSIX
a} :: AggregatedValue) ((POSIX -> f POSIX) -> AggregatedValue -> f AggregatedValue)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> AggregatedValue
-> f AggregatedValue
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
aggregatedValue_value :: Lens.Lens' AggregatedValue Aggregates
aggregatedValue_value :: (Aggregates -> f Aggregates)
-> AggregatedValue -> f AggregatedValue
aggregatedValue_value = (AggregatedValue -> Aggregates)
-> (AggregatedValue -> Aggregates -> AggregatedValue)
-> Lens AggregatedValue AggregatedValue Aggregates Aggregates
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AggregatedValue' {Aggregates
value :: Aggregates
$sel:value:AggregatedValue' :: AggregatedValue -> Aggregates
value} -> Aggregates
value) (\s :: AggregatedValue
s@AggregatedValue' {} Aggregates
a -> AggregatedValue
s {$sel:value:AggregatedValue' :: Aggregates
value = Aggregates
a} :: AggregatedValue)
instance Core.FromJSON AggregatedValue where
parseJSON :: Value -> Parser AggregatedValue
parseJSON =
String
-> (Object -> Parser AggregatedValue)
-> Value
-> Parser AggregatedValue
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"AggregatedValue"
( \Object
x ->
Maybe Quality -> POSIX -> Aggregates -> AggregatedValue
AggregatedValue'
(Maybe Quality -> POSIX -> Aggregates -> AggregatedValue)
-> Parser (Maybe Quality)
-> Parser (POSIX -> Aggregates -> AggregatedValue)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Quality)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"quality")
Parser (POSIX -> Aggregates -> AggregatedValue)
-> Parser POSIX -> Parser (Aggregates -> AggregatedValue)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser POSIX
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"timestamp")
Parser (Aggregates -> AggregatedValue)
-> Parser Aggregates -> Parser AggregatedValue
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Aggregates
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"value")
)
instance Prelude.Hashable AggregatedValue
instance Prelude.NFData AggregatedValue