{-# 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.IoTAnalytics.Types.Variable where
import qualified Amazonka.Core as Core
import Amazonka.IoTAnalytics.Types.DatasetContentVersionValue
import Amazonka.IoTAnalytics.Types.OutputFileUriValue
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Variable = Variable'
{
Variable -> Maybe OutputFileUriValue
outputFileUriValue :: Prelude.Maybe OutputFileUriValue,
Variable -> Maybe Double
doubleValue :: Prelude.Maybe Prelude.Double,
Variable -> Maybe Text
stringValue :: Prelude.Maybe Prelude.Text,
Variable -> Maybe DatasetContentVersionValue
datasetContentVersionValue :: Prelude.Maybe DatasetContentVersionValue,
Variable -> Text
name :: Prelude.Text
}
deriving (Variable -> Variable -> Bool
(Variable -> Variable -> Bool)
-> (Variable -> Variable -> Bool) -> Eq Variable
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Variable -> Variable -> Bool
$c/= :: Variable -> Variable -> Bool
== :: Variable -> Variable -> Bool
$c== :: Variable -> Variable -> Bool
Prelude.Eq, ReadPrec [Variable]
ReadPrec Variable
Int -> ReadS Variable
ReadS [Variable]
(Int -> ReadS Variable)
-> ReadS [Variable]
-> ReadPrec Variable
-> ReadPrec [Variable]
-> Read Variable
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Variable]
$creadListPrec :: ReadPrec [Variable]
readPrec :: ReadPrec Variable
$creadPrec :: ReadPrec Variable
readList :: ReadS [Variable]
$creadList :: ReadS [Variable]
readsPrec :: Int -> ReadS Variable
$creadsPrec :: Int -> ReadS Variable
Prelude.Read, Int -> Variable -> ShowS
[Variable] -> ShowS
Variable -> String
(Int -> Variable -> ShowS)
-> (Variable -> String) -> ([Variable] -> ShowS) -> Show Variable
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Variable] -> ShowS
$cshowList :: [Variable] -> ShowS
show :: Variable -> String
$cshow :: Variable -> String
showsPrec :: Int -> Variable -> ShowS
$cshowsPrec :: Int -> Variable -> ShowS
Prelude.Show, (forall x. Variable -> Rep Variable x)
-> (forall x. Rep Variable x -> Variable) -> Generic Variable
forall x. Rep Variable x -> Variable
forall x. Variable -> Rep Variable x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Variable x -> Variable
$cfrom :: forall x. Variable -> Rep Variable x
Prelude.Generic)
newVariable ::
Prelude.Text ->
Variable
newVariable :: Text -> Variable
newVariable Text
pName_ =
Variable' :: Maybe OutputFileUriValue
-> Maybe Double
-> Maybe Text
-> Maybe DatasetContentVersionValue
-> Text
-> Variable
Variable'
{ $sel:outputFileUriValue:Variable' :: Maybe OutputFileUriValue
outputFileUriValue = Maybe OutputFileUriValue
forall a. Maybe a
Prelude.Nothing,
$sel:doubleValue:Variable' :: Maybe Double
doubleValue = Maybe Double
forall a. Maybe a
Prelude.Nothing,
$sel:stringValue:Variable' :: Maybe Text
stringValue = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:datasetContentVersionValue:Variable' :: Maybe DatasetContentVersionValue
datasetContentVersionValue = Maybe DatasetContentVersionValue
forall a. Maybe a
Prelude.Nothing,
$sel:name:Variable' :: Text
name = Text
pName_
}
variable_outputFileUriValue :: Lens.Lens' Variable (Prelude.Maybe OutputFileUriValue)
variable_outputFileUriValue :: (Maybe OutputFileUriValue -> f (Maybe OutputFileUriValue))
-> Variable -> f Variable
variable_outputFileUriValue = (Variable -> Maybe OutputFileUriValue)
-> (Variable -> Maybe OutputFileUriValue -> Variable)
-> Lens
Variable
Variable
(Maybe OutputFileUriValue)
(Maybe OutputFileUriValue)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Variable' {Maybe OutputFileUriValue
outputFileUriValue :: Maybe OutputFileUriValue
$sel:outputFileUriValue:Variable' :: Variable -> Maybe OutputFileUriValue
outputFileUriValue} -> Maybe OutputFileUriValue
outputFileUriValue) (\s :: Variable
s@Variable' {} Maybe OutputFileUriValue
a -> Variable
s {$sel:outputFileUriValue:Variable' :: Maybe OutputFileUriValue
outputFileUriValue = Maybe OutputFileUriValue
a} :: Variable)
variable_doubleValue :: Lens.Lens' Variable (Prelude.Maybe Prelude.Double)
variable_doubleValue :: (Maybe Double -> f (Maybe Double)) -> Variable -> f Variable
variable_doubleValue = (Variable -> Maybe Double)
-> (Variable -> Maybe Double -> Variable)
-> Lens Variable Variable (Maybe Double) (Maybe Double)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Variable' {Maybe Double
doubleValue :: Maybe Double
$sel:doubleValue:Variable' :: Variable -> Maybe Double
doubleValue} -> Maybe Double
doubleValue) (\s :: Variable
s@Variable' {} Maybe Double
a -> Variable
s {$sel:doubleValue:Variable' :: Maybe Double
doubleValue = Maybe Double
a} :: Variable)
variable_stringValue :: Lens.Lens' Variable (Prelude.Maybe Prelude.Text)
variable_stringValue :: (Maybe Text -> f (Maybe Text)) -> Variable -> f Variable
variable_stringValue = (Variable -> Maybe Text)
-> (Variable -> Maybe Text -> Variable)
-> Lens Variable Variable (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Variable' {Maybe Text
stringValue :: Maybe Text
$sel:stringValue:Variable' :: Variable -> Maybe Text
stringValue} -> Maybe Text
stringValue) (\s :: Variable
s@Variable' {} Maybe Text
a -> Variable
s {$sel:stringValue:Variable' :: Maybe Text
stringValue = Maybe Text
a} :: Variable)
variable_datasetContentVersionValue :: Lens.Lens' Variable (Prelude.Maybe DatasetContentVersionValue)
variable_datasetContentVersionValue :: (Maybe DatasetContentVersionValue
-> f (Maybe DatasetContentVersionValue))
-> Variable -> f Variable
variable_datasetContentVersionValue = (Variable -> Maybe DatasetContentVersionValue)
-> (Variable -> Maybe DatasetContentVersionValue -> Variable)
-> Lens
Variable
Variable
(Maybe DatasetContentVersionValue)
(Maybe DatasetContentVersionValue)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Variable' {Maybe DatasetContentVersionValue
datasetContentVersionValue :: Maybe DatasetContentVersionValue
$sel:datasetContentVersionValue:Variable' :: Variable -> Maybe DatasetContentVersionValue
datasetContentVersionValue} -> Maybe DatasetContentVersionValue
datasetContentVersionValue) (\s :: Variable
s@Variable' {} Maybe DatasetContentVersionValue
a -> Variable
s {$sel:datasetContentVersionValue:Variable' :: Maybe DatasetContentVersionValue
datasetContentVersionValue = Maybe DatasetContentVersionValue
a} :: Variable)
variable_name :: Lens.Lens' Variable Prelude.Text
variable_name :: (Text -> f Text) -> Variable -> f Variable
variable_name = (Variable -> Text)
-> (Variable -> Text -> Variable)
-> Lens Variable Variable Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Variable' {Text
name :: Text
$sel:name:Variable' :: Variable -> Text
name} -> Text
name) (\s :: Variable
s@Variable' {} Text
a -> Variable
s {$sel:name:Variable' :: Text
name = Text
a} :: Variable)
instance Core.FromJSON Variable where
parseJSON :: Value -> Parser Variable
parseJSON =
String -> (Object -> Parser Variable) -> Value -> Parser Variable
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"Variable"
( \Object
x ->
Maybe OutputFileUriValue
-> Maybe Double
-> Maybe Text
-> Maybe DatasetContentVersionValue
-> Text
-> Variable
Variable'
(Maybe OutputFileUriValue
-> Maybe Double
-> Maybe Text
-> Maybe DatasetContentVersionValue
-> Text
-> Variable)
-> Parser (Maybe OutputFileUriValue)
-> Parser
(Maybe Double
-> Maybe Text
-> Maybe DatasetContentVersionValue
-> Text
-> Variable)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe OutputFileUriValue)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"outputFileUriValue")
Parser
(Maybe Double
-> Maybe Text
-> Maybe DatasetContentVersionValue
-> Text
-> Variable)
-> Parser (Maybe Double)
-> Parser
(Maybe Text
-> Maybe DatasetContentVersionValue -> Text -> Variable)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Double)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"doubleValue")
Parser
(Maybe Text
-> Maybe DatasetContentVersionValue -> Text -> Variable)
-> Parser (Maybe Text)
-> Parser (Maybe DatasetContentVersionValue -> Text -> Variable)
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 DatasetContentVersionValue -> Text -> Variable)
-> Parser (Maybe DatasetContentVersionValue)
-> Parser (Text -> Variable)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DatasetContentVersionValue)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"datasetContentVersionValue")
Parser (Text -> Variable) -> Parser Text -> Parser Variable
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"name")
)
instance Prelude.Hashable Variable
instance Prelude.NFData Variable
instance Core.ToJSON Variable where
toJSON :: Variable -> Value
toJSON Variable' {Maybe Double
Maybe Text
Maybe DatasetContentVersionValue
Maybe OutputFileUriValue
Text
name :: Text
datasetContentVersionValue :: Maybe DatasetContentVersionValue
stringValue :: Maybe Text
doubleValue :: Maybe Double
outputFileUriValue :: Maybe OutputFileUriValue
$sel:name:Variable' :: Variable -> Text
$sel:datasetContentVersionValue:Variable' :: Variable -> Maybe DatasetContentVersionValue
$sel:stringValue:Variable' :: Variable -> Maybe Text
$sel:doubleValue:Variable' :: Variable -> Maybe Double
$sel:outputFileUriValue:Variable' :: Variable -> Maybe OutputFileUriValue
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"outputFileUriValue" Text -> OutputFileUriValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(OutputFileUriValue -> Pair)
-> Maybe OutputFileUriValue -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe OutputFileUriValue
outputFileUriValue,
(Text
"doubleValue" Text -> Double -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Double -> Pair) -> Maybe Double -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
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
"datasetContentVersionValue" Text -> DatasetContentVersionValue -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(DatasetContentVersionValue -> Pair)
-> Maybe DatasetContentVersionValue -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DatasetContentVersionValue
datasetContentVersionValue,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
]
)