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