{-# 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.IotTwinMaker.Types.DataValue where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IotTwinMaker.Types.RelationshipValue
import qualified Amazonka.Prelude as Prelude
data DataValue = DataValue'
{
DataValue -> Maybe Bool
booleanValue :: Prelude.Maybe Prelude.Bool,
DataValue -> Maybe Double
doubleValue :: Prelude.Maybe Prelude.Double,
DataValue -> Maybe Text
expression :: Prelude.Maybe Prelude.Text,
DataValue -> Maybe Int
integerValue :: Prelude.Maybe Prelude.Int,
DataValue -> Maybe [DataValue]
listValue :: Prelude.Maybe [DataValue],
DataValue -> Maybe Integer
longValue :: Prelude.Maybe Prelude.Integer,
DataValue -> Maybe (HashMap Text DataValue)
mapValue :: Prelude.Maybe (Prelude.HashMap Prelude.Text DataValue),
DataValue -> Maybe RelationshipValue
relationshipValue :: Prelude.Maybe RelationshipValue,
DataValue -> Maybe Text
stringValue :: Prelude.Maybe Prelude.Text
}
deriving (DataValue -> DataValue -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataValue -> DataValue -> Bool
$c/= :: DataValue -> DataValue -> Bool
== :: DataValue -> DataValue -> Bool
$c== :: DataValue -> DataValue -> Bool
Prelude.Eq, ReadPrec [DataValue]
ReadPrec DataValue
Int -> ReadS DataValue
ReadS [DataValue]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataValue]
$creadListPrec :: ReadPrec [DataValue]
readPrec :: ReadPrec DataValue
$creadPrec :: ReadPrec DataValue
readList :: ReadS [DataValue]
$creadList :: ReadS [DataValue]
readsPrec :: Int -> ReadS DataValue
$creadsPrec :: Int -> ReadS DataValue
Prelude.Read, Int -> DataValue -> ShowS
[DataValue] -> ShowS
DataValue -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataValue] -> ShowS
$cshowList :: [DataValue] -> ShowS
show :: DataValue -> String
$cshow :: DataValue -> String
showsPrec :: Int -> DataValue -> ShowS
$cshowsPrec :: Int -> DataValue -> ShowS
Prelude.Show, forall x. Rep DataValue x -> DataValue
forall x. DataValue -> Rep DataValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataValue x -> DataValue
$cfrom :: forall x. DataValue -> Rep DataValue x
Prelude.Generic)
newDataValue ::
DataValue
newDataValue :: DataValue
newDataValue =
DataValue'
{ $sel:booleanValue:DataValue' :: Maybe Bool
booleanValue = forall a. Maybe a
Prelude.Nothing,
$sel:doubleValue:DataValue' :: Maybe Double
doubleValue = forall a. Maybe a
Prelude.Nothing,
$sel:expression:DataValue' :: Maybe Text
expression = forall a. Maybe a
Prelude.Nothing,
$sel:integerValue:DataValue' :: Maybe Int
integerValue = forall a. Maybe a
Prelude.Nothing,
$sel:listValue:DataValue' :: Maybe [DataValue]
listValue = forall a. Maybe a
Prelude.Nothing,
$sel:longValue:DataValue' :: Maybe Integer
longValue = forall a. Maybe a
Prelude.Nothing,
$sel:mapValue:DataValue' :: Maybe (HashMap Text DataValue)
mapValue = forall a. Maybe a
Prelude.Nothing,
$sel:relationshipValue:DataValue' :: Maybe RelationshipValue
relationshipValue = forall a. Maybe a
Prelude.Nothing,
$sel:stringValue:DataValue' :: Maybe Text
stringValue = forall a. Maybe a
Prelude.Nothing
}
dataValue_booleanValue :: Lens.Lens' DataValue (Prelude.Maybe Prelude.Bool)
dataValue_booleanValue :: Lens' DataValue (Maybe Bool)
dataValue_booleanValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataValue' {Maybe Bool
booleanValue :: Maybe Bool
$sel:booleanValue:DataValue' :: DataValue -> Maybe Bool
booleanValue} -> Maybe Bool
booleanValue) (\s :: DataValue
s@DataValue' {} Maybe Bool
a -> DataValue
s {$sel:booleanValue:DataValue' :: Maybe Bool
booleanValue = Maybe Bool
a} :: DataValue)
dataValue_doubleValue :: Lens.Lens' DataValue (Prelude.Maybe Prelude.Double)
dataValue_doubleValue :: Lens' DataValue (Maybe Double)
dataValue_doubleValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataValue' {Maybe Double
doubleValue :: Maybe Double
$sel:doubleValue:DataValue' :: DataValue -> Maybe Double
doubleValue} -> Maybe Double
doubleValue) (\s :: DataValue
s@DataValue' {} Maybe Double
a -> DataValue
s {$sel:doubleValue:DataValue' :: Maybe Double
doubleValue = Maybe Double
a} :: DataValue)
dataValue_expression :: Lens.Lens' DataValue (Prelude.Maybe Prelude.Text)
dataValue_expression :: Lens' DataValue (Maybe Text)
dataValue_expression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataValue' {Maybe Text
expression :: Maybe Text
$sel:expression:DataValue' :: DataValue -> Maybe Text
expression} -> Maybe Text
expression) (\s :: DataValue
s@DataValue' {} Maybe Text
a -> DataValue
s {$sel:expression:DataValue' :: Maybe Text
expression = Maybe Text
a} :: DataValue)
dataValue_integerValue :: Lens.Lens' DataValue (Prelude.Maybe Prelude.Int)
dataValue_integerValue :: Lens' DataValue (Maybe Int)
dataValue_integerValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataValue' {Maybe Int
integerValue :: Maybe Int
$sel:integerValue:DataValue' :: DataValue -> Maybe Int
integerValue} -> Maybe Int
integerValue) (\s :: DataValue
s@DataValue' {} Maybe Int
a -> DataValue
s {$sel:integerValue:DataValue' :: Maybe Int
integerValue = Maybe Int
a} :: DataValue)
dataValue_listValue :: Lens.Lens' DataValue (Prelude.Maybe [DataValue])
dataValue_listValue :: Lens' DataValue (Maybe [DataValue])
dataValue_listValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataValue' {Maybe [DataValue]
listValue :: Maybe [DataValue]
$sel:listValue:DataValue' :: DataValue -> Maybe [DataValue]
listValue} -> Maybe [DataValue]
listValue) (\s :: DataValue
s@DataValue' {} Maybe [DataValue]
a -> DataValue
s {$sel:listValue:DataValue' :: Maybe [DataValue]
listValue = Maybe [DataValue]
a} :: DataValue) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
dataValue_longValue :: Lens.Lens' DataValue (Prelude.Maybe Prelude.Integer)
dataValue_longValue :: Lens' DataValue (Maybe Integer)
dataValue_longValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataValue' {Maybe Integer
longValue :: Maybe Integer
$sel:longValue:DataValue' :: DataValue -> Maybe Integer
longValue} -> Maybe Integer
longValue) (\s :: DataValue
s@DataValue' {} Maybe Integer
a -> DataValue
s {$sel:longValue:DataValue' :: Maybe Integer
longValue = Maybe Integer
a} :: DataValue)
dataValue_mapValue :: Lens.Lens' DataValue (Prelude.Maybe (Prelude.HashMap Prelude.Text DataValue))
dataValue_mapValue :: Lens' DataValue (Maybe (HashMap Text DataValue))
dataValue_mapValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataValue' {Maybe (HashMap Text DataValue)
mapValue :: Maybe (HashMap Text DataValue)
$sel:mapValue:DataValue' :: DataValue -> Maybe (HashMap Text DataValue)
mapValue} -> Maybe (HashMap Text DataValue)
mapValue) (\s :: DataValue
s@DataValue' {} Maybe (HashMap Text DataValue)
a -> DataValue
s {$sel:mapValue:DataValue' :: Maybe (HashMap Text DataValue)
mapValue = Maybe (HashMap Text DataValue)
a} :: DataValue) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
dataValue_relationshipValue :: Lens.Lens' DataValue (Prelude.Maybe RelationshipValue)
dataValue_relationshipValue :: Lens' DataValue (Maybe RelationshipValue)
dataValue_relationshipValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataValue' {Maybe RelationshipValue
relationshipValue :: Maybe RelationshipValue
$sel:relationshipValue:DataValue' :: DataValue -> Maybe RelationshipValue
relationshipValue} -> Maybe RelationshipValue
relationshipValue) (\s :: DataValue
s@DataValue' {} Maybe RelationshipValue
a -> DataValue
s {$sel:relationshipValue:DataValue' :: Maybe RelationshipValue
relationshipValue = Maybe RelationshipValue
a} :: DataValue)
dataValue_stringValue :: Lens.Lens' DataValue (Prelude.Maybe Prelude.Text)
dataValue_stringValue :: Lens' DataValue (Maybe Text)
dataValue_stringValue = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataValue' {Maybe Text
stringValue :: Maybe Text
$sel:stringValue:DataValue' :: DataValue -> Maybe Text
stringValue} -> Maybe Text
stringValue) (\s :: DataValue
s@DataValue' {} Maybe Text
a -> DataValue
s {$sel:stringValue:DataValue' :: Maybe Text
stringValue = Maybe Text
a} :: DataValue)
instance Data.FromJSON DataValue where
parseJSON :: Value -> Parser DataValue
parseJSON =
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
String
"DataValue"
( \Object
x ->
Maybe Bool
-> Maybe Double
-> Maybe Text
-> Maybe Int
-> Maybe [DataValue]
-> Maybe Integer
-> Maybe (HashMap Text DataValue)
-> Maybe RelationshipValue
-> Maybe Text
-> DataValue
DataValue'
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
"booleanValue")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"doubleValue")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"expression")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"integerValue")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"listValue" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"longValue")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"mapValue" forall a. Parser (Maybe a) -> a -> Parser a
Data..!= forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"relationshipValue")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"stringValue")
)
instance Prelude.Hashable DataValue where
hashWithSalt :: Int -> DataValue -> Int
hashWithSalt Int
_salt DataValue' {Maybe Bool
Maybe Double
Maybe Int
Maybe Integer
Maybe [DataValue]
Maybe Text
Maybe (HashMap Text DataValue)
Maybe RelationshipValue
stringValue :: Maybe Text
relationshipValue :: Maybe RelationshipValue
mapValue :: Maybe (HashMap Text DataValue)
longValue :: Maybe Integer
listValue :: Maybe [DataValue]
integerValue :: Maybe Int
expression :: Maybe Text
doubleValue :: Maybe Double
booleanValue :: Maybe Bool
$sel:stringValue:DataValue' :: DataValue -> Maybe Text
$sel:relationshipValue:DataValue' :: DataValue -> Maybe RelationshipValue
$sel:mapValue:DataValue' :: DataValue -> Maybe (HashMap Text DataValue)
$sel:longValue:DataValue' :: DataValue -> Maybe Integer
$sel:listValue:DataValue' :: DataValue -> Maybe [DataValue]
$sel:integerValue:DataValue' :: DataValue -> Maybe Int
$sel:expression:DataValue' :: DataValue -> Maybe Text
$sel:doubleValue:DataValue' :: DataValue -> Maybe Double
$sel:booleanValue:DataValue' :: DataValue -> Maybe Bool
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
booleanValue
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
doubleValue
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
expression
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
integerValue
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [DataValue]
listValue
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
longValue
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text DataValue)
mapValue
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe RelationshipValue
relationshipValue
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
stringValue
instance Prelude.NFData DataValue where
rnf :: DataValue -> ()
rnf DataValue' {Maybe Bool
Maybe Double
Maybe Int
Maybe Integer
Maybe [DataValue]
Maybe Text
Maybe (HashMap Text DataValue)
Maybe RelationshipValue
stringValue :: Maybe Text
relationshipValue :: Maybe RelationshipValue
mapValue :: Maybe (HashMap Text DataValue)
longValue :: Maybe Integer
listValue :: Maybe [DataValue]
integerValue :: Maybe Int
expression :: Maybe Text
doubleValue :: Maybe Double
booleanValue :: Maybe Bool
$sel:stringValue:DataValue' :: DataValue -> Maybe Text
$sel:relationshipValue:DataValue' :: DataValue -> Maybe RelationshipValue
$sel:mapValue:DataValue' :: DataValue -> Maybe (HashMap Text DataValue)
$sel:longValue:DataValue' :: DataValue -> Maybe Integer
$sel:listValue:DataValue' :: DataValue -> Maybe [DataValue]
$sel:integerValue:DataValue' :: DataValue -> Maybe Int
$sel:expression:DataValue' :: DataValue -> Maybe Text
$sel:doubleValue:DataValue' :: DataValue -> Maybe Double
$sel:booleanValue:DataValue' :: DataValue -> Maybe Bool
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
booleanValue
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
doubleValue
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
expression
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
integerValue
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [DataValue]
listValue
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
longValue
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text DataValue)
mapValue
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe RelationshipValue
relationshipValue
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
stringValue
instance Data.ToJSON DataValue where
toJSON :: DataValue -> Value
toJSON DataValue' {Maybe Bool
Maybe Double
Maybe Int
Maybe Integer
Maybe [DataValue]
Maybe Text
Maybe (HashMap Text DataValue)
Maybe RelationshipValue
stringValue :: Maybe Text
relationshipValue :: Maybe RelationshipValue
mapValue :: Maybe (HashMap Text DataValue)
longValue :: Maybe Integer
listValue :: Maybe [DataValue]
integerValue :: Maybe Int
expression :: Maybe Text
doubleValue :: Maybe Double
booleanValue :: Maybe Bool
$sel:stringValue:DataValue' :: DataValue -> Maybe Text
$sel:relationshipValue:DataValue' :: DataValue -> Maybe RelationshipValue
$sel:mapValue:DataValue' :: DataValue -> Maybe (HashMap Text DataValue)
$sel:longValue:DataValue' :: DataValue -> Maybe Integer
$sel:listValue:DataValue' :: DataValue -> Maybe [DataValue]
$sel:integerValue:DataValue' :: DataValue -> Maybe Int
$sel:expression:DataValue' :: DataValue -> Maybe Text
$sel:doubleValue:DataValue' :: DataValue -> Maybe Double
$sel:booleanValue:DataValue' :: DataValue -> Maybe Bool
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"booleanValue" 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 Bool
booleanValue,
(Key
"doubleValue" 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 Double
doubleValue,
(Key
"expression" 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
expression,
(Key
"integerValue" 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 Int
integerValue,
(Key
"listValue" 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 [DataValue]
listValue,
(Key
"longValue" 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 Integer
longValue,
(Key
"mapValue" 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 (HashMap Text DataValue)
mapValue,
(Key
"relationshipValue" 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 RelationshipValue
relationshipValue,
(Key
"stringValue" 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
stringValue
]
)