{-# 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.Measurement where
import qualified Amazonka.Core as Core
import Amazonka.IoTSiteWise.Types.MeasurementProcessingConfig
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Measurement = Measurement'
{
Measurement -> Maybe MeasurementProcessingConfig
processingConfig :: Prelude.Maybe MeasurementProcessingConfig
}
deriving (Measurement -> Measurement -> Bool
(Measurement -> Measurement -> Bool)
-> (Measurement -> Measurement -> Bool) -> Eq Measurement
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Measurement -> Measurement -> Bool
$c/= :: Measurement -> Measurement -> Bool
== :: Measurement -> Measurement -> Bool
$c== :: Measurement -> Measurement -> Bool
Prelude.Eq, ReadPrec [Measurement]
ReadPrec Measurement
Int -> ReadS Measurement
ReadS [Measurement]
(Int -> ReadS Measurement)
-> ReadS [Measurement]
-> ReadPrec Measurement
-> ReadPrec [Measurement]
-> Read Measurement
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Measurement]
$creadListPrec :: ReadPrec [Measurement]
readPrec :: ReadPrec Measurement
$creadPrec :: ReadPrec Measurement
readList :: ReadS [Measurement]
$creadList :: ReadS [Measurement]
readsPrec :: Int -> ReadS Measurement
$creadsPrec :: Int -> ReadS Measurement
Prelude.Read, Int -> Measurement -> ShowS
[Measurement] -> ShowS
Measurement -> String
(Int -> Measurement -> ShowS)
-> (Measurement -> String)
-> ([Measurement] -> ShowS)
-> Show Measurement
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Measurement] -> ShowS
$cshowList :: [Measurement] -> ShowS
show :: Measurement -> String
$cshow :: Measurement -> String
showsPrec :: Int -> Measurement -> ShowS
$cshowsPrec :: Int -> Measurement -> ShowS
Prelude.Show, (forall x. Measurement -> Rep Measurement x)
-> (forall x. Rep Measurement x -> Measurement)
-> Generic Measurement
forall x. Rep Measurement x -> Measurement
forall x. Measurement -> Rep Measurement x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Measurement x -> Measurement
$cfrom :: forall x. Measurement -> Rep Measurement x
Prelude.Generic)
newMeasurement ::
Measurement
newMeasurement :: Measurement
newMeasurement =
Measurement' :: Maybe MeasurementProcessingConfig -> Measurement
Measurement' {$sel:processingConfig:Measurement' :: Maybe MeasurementProcessingConfig
processingConfig = Maybe MeasurementProcessingConfig
forall a. Maybe a
Prelude.Nothing}
measurement_processingConfig :: Lens.Lens' Measurement (Prelude.Maybe MeasurementProcessingConfig)
measurement_processingConfig :: (Maybe MeasurementProcessingConfig
-> f (Maybe MeasurementProcessingConfig))
-> Measurement -> f Measurement
measurement_processingConfig = (Measurement -> Maybe MeasurementProcessingConfig)
-> (Measurement
-> Maybe MeasurementProcessingConfig -> Measurement)
-> Lens
Measurement
Measurement
(Maybe MeasurementProcessingConfig)
(Maybe MeasurementProcessingConfig)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Measurement' {Maybe MeasurementProcessingConfig
processingConfig :: Maybe MeasurementProcessingConfig
$sel:processingConfig:Measurement' :: Measurement -> Maybe MeasurementProcessingConfig
processingConfig} -> Maybe MeasurementProcessingConfig
processingConfig) (\s :: Measurement
s@Measurement' {} Maybe MeasurementProcessingConfig
a -> Measurement
s {$sel:processingConfig:Measurement' :: Maybe MeasurementProcessingConfig
processingConfig = Maybe MeasurementProcessingConfig
a} :: Measurement)
instance Core.FromJSON Measurement where
parseJSON :: Value -> Parser Measurement
parseJSON =
String
-> (Object -> Parser Measurement) -> Value -> Parser Measurement
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Measurement"
( \Object
x ->
Maybe MeasurementProcessingConfig -> Measurement
Measurement'
(Maybe MeasurementProcessingConfig -> Measurement)
-> Parser (Maybe MeasurementProcessingConfig) -> Parser Measurement
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe MeasurementProcessingConfig)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"processingConfig")
)
instance Prelude.Hashable Measurement
instance Prelude.NFData Measurement
instance Core.ToJSON Measurement where
toJSON :: Measurement -> Value
toJSON Measurement' {Maybe MeasurementProcessingConfig
processingConfig :: Maybe MeasurementProcessingConfig
$sel:processingConfig:Measurement' :: Measurement -> Maybe MeasurementProcessingConfig
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"processingConfig" Text -> MeasurementProcessingConfig -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(MeasurementProcessingConfig -> Pair)
-> Maybe MeasurementProcessingConfig -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe MeasurementProcessingConfig
processingConfig
]
)