{-# 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.VariableValue where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
data VariableValue = VariableValue'
{
VariableValue -> Maybe Text
hierarchyId :: Prelude.Maybe Prelude.Text,
VariableValue -> Text
propertyId :: Prelude.Text
}
deriving (VariableValue -> VariableValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VariableValue -> VariableValue -> Bool
$c/= :: VariableValue -> VariableValue -> Bool
== :: VariableValue -> VariableValue -> Bool
$c== :: VariableValue -> VariableValue -> Bool
Prelude.Eq, ReadPrec [VariableValue]
ReadPrec VariableValue
Int -> ReadS VariableValue
ReadS [VariableValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VariableValue]
$creadListPrec :: ReadPrec [VariableValue]
readPrec :: ReadPrec VariableValue
$creadPrec :: ReadPrec VariableValue
readList :: ReadS [VariableValue]
$creadList :: ReadS [VariableValue]
readsPrec :: Int -> ReadS VariableValue
$creadsPrec :: Int -> ReadS VariableValue
Prelude.Read, Int -> VariableValue -> ShowS
[VariableValue] -> ShowS
VariableValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VariableValue] -> ShowS
$cshowList :: [VariableValue] -> ShowS
show :: VariableValue -> String
$cshow :: VariableValue -> String
showsPrec :: Int -> VariableValue -> ShowS
$cshowsPrec :: Int -> VariableValue -> ShowS
Prelude.Show, forall x. Rep VariableValue x -> VariableValue
forall x. VariableValue -> Rep VariableValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VariableValue x -> VariableValue
$cfrom :: forall x. VariableValue -> Rep VariableValue x
Prelude.Generic)
newVariableValue ::
Prelude.Text ->
VariableValue
newVariableValue :: Text -> VariableValue
newVariableValue Text
pPropertyId_ =
VariableValue'
{ $sel:hierarchyId:VariableValue' :: Maybe Text
hierarchyId = forall a. Maybe a
Prelude.Nothing,
$sel:propertyId:VariableValue' :: Text
propertyId = Text
pPropertyId_
}
variableValue_hierarchyId :: Lens.Lens' VariableValue (Prelude.Maybe Prelude.Text)
variableValue_hierarchyId :: Lens' VariableValue (Maybe Text)
variableValue_hierarchyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VariableValue' {Maybe Text
hierarchyId :: Maybe Text
$sel:hierarchyId:VariableValue' :: VariableValue -> Maybe Text
hierarchyId} -> Maybe Text
hierarchyId) (\s :: VariableValue
s@VariableValue' {} Maybe Text
a -> VariableValue
s {$sel:hierarchyId:VariableValue' :: Maybe Text
hierarchyId = Maybe Text
a} :: VariableValue)
variableValue_propertyId :: Lens.Lens' VariableValue Prelude.Text
variableValue_propertyId :: Lens' VariableValue Text
variableValue_propertyId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VariableValue' {Text
propertyId :: Text
$sel:propertyId:VariableValue' :: VariableValue -> Text
propertyId} -> Text
propertyId) (\s :: VariableValue
s@VariableValue' {} Text
a -> VariableValue
s {$sel:propertyId:VariableValue' :: Text
propertyId = Text
a} :: VariableValue)
instance Data.FromJSON VariableValue where
parseJSON :: Value -> Parser VariableValue
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"VariableValue"
( \Object
x ->
Maybe Text -> Text -> VariableValue
VariableValue'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"hierarchyId")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"propertyId")
)
instance Prelude.Hashable VariableValue where
hashWithSalt :: Int -> VariableValue -> Int
hashWithSalt Int
_salt VariableValue' {Maybe Text
Text
propertyId :: Text
hierarchyId :: Maybe Text
$sel:propertyId:VariableValue' :: VariableValue -> Text
$sel:hierarchyId:VariableValue' :: VariableValue -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hierarchyId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
propertyId
instance Prelude.NFData VariableValue where
rnf :: VariableValue -> ()
rnf VariableValue' {Maybe Text
Text
propertyId :: Text
hierarchyId :: Maybe Text
$sel:propertyId:VariableValue' :: VariableValue -> Text
$sel:hierarchyId:VariableValue' :: VariableValue -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hierarchyId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
propertyId
instance Data.ToJSON VariableValue where
toJSON :: VariableValue -> Value
toJSON VariableValue' {Maybe Text
Text
propertyId :: Text
hierarchyId :: Maybe Text
$sel:propertyId:VariableValue' :: VariableValue -> Text
$sel:hierarchyId:VariableValue' :: VariableValue -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"hierarchyId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
hierarchyId,
forall a. a -> Maybe a
Prelude.Just (Key
"propertyId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
propertyId)
]
)