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