{-# 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.IoTEventsData.Types.Variable where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data Variable = Variable'
{
Variable -> Text
name :: Prelude.Text,
Variable -> Text
value :: 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 ->
Prelude.Text ->
Variable
newVariable :: Text -> Text -> Variable
newVariable Text
pName_ Text
pValue_ =
Variable' :: Text -> Text -> Variable
Variable' {$sel:name:Variable' :: Text
name = Text
pName_, $sel:value:Variable' :: Text
value = Text
pValue_}
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)
variable_value :: Lens.Lens' Variable Prelude.Text
variable_value :: (Text -> f Text) -> Variable -> f Variable
variable_value = (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
value :: Text
$sel:value:Variable' :: Variable -> Text
value} -> Text
value) (\s :: Variable
s@Variable' {} Text
a -> Variable
s {$sel:value:Variable' :: Text
value = 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 ->
Text -> Text -> Variable
Variable'
(Text -> Text -> Variable)
-> Parser Text -> Parser (Text -> Variable)
forall (f :: * -> *) a b. Functor 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") 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
"value")
)
instance Prelude.Hashable Variable
instance Prelude.NFData Variable