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