{-# 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.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data ScriptParameterKeyValue = ScriptParameterKeyValue'
{
ScriptParameterKeyValue -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
ScriptParameterKeyValue -> Maybe Text
key :: Prelude.Maybe Prelude.Text
}
deriving (ScriptParameterKeyValue -> ScriptParameterKeyValue -> Bool
(ScriptParameterKeyValue -> ScriptParameterKeyValue -> Bool)
-> (ScriptParameterKeyValue -> ScriptParameterKeyValue -> Bool)
-> Eq ScriptParameterKeyValue
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]
(Int -> ReadS ScriptParameterKeyValue)
-> ReadS [ScriptParameterKeyValue]
-> ReadPrec ScriptParameterKeyValue
-> ReadPrec [ScriptParameterKeyValue]
-> Read 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
(Int -> ScriptParameterKeyValue -> ShowS)
-> (ScriptParameterKeyValue -> String)
-> ([ScriptParameterKeyValue] -> ShowS)
-> Show ScriptParameterKeyValue
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.
ScriptParameterKeyValue -> Rep ScriptParameterKeyValue x)
-> (forall x.
Rep ScriptParameterKeyValue x -> ScriptParameterKeyValue)
-> Generic ScriptParameterKeyValue
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' :: Maybe Text -> Maybe Text -> ScriptParameterKeyValue
ScriptParameterKeyValue'
{ $sel:value:ScriptParameterKeyValue' :: Maybe Text
value = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:key:ScriptParameterKeyValue' :: Maybe Text
key = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
scriptParameterKeyValue_value :: Lens.Lens' ScriptParameterKeyValue (Prelude.Maybe Prelude.Text)
scriptParameterKeyValue_value :: (Maybe Text -> f (Maybe Text))
-> ScriptParameterKeyValue -> f ScriptParameterKeyValue
scriptParameterKeyValue_value = (ScriptParameterKeyValue -> Maybe Text)
-> (ScriptParameterKeyValue
-> Maybe Text -> ScriptParameterKeyValue)
-> Lens
ScriptParameterKeyValue
ScriptParameterKeyValue
(Maybe Text)
(Maybe Text)
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)
scriptParameterKeyValue_key :: Lens.Lens' ScriptParameterKeyValue (Prelude.Maybe Prelude.Text)
scriptParameterKeyValue_key :: (Maybe Text -> f (Maybe Text))
-> ScriptParameterKeyValue -> f ScriptParameterKeyValue
scriptParameterKeyValue_key = (ScriptParameterKeyValue -> Maybe Text)
-> (ScriptParameterKeyValue
-> Maybe Text -> ScriptParameterKeyValue)
-> Lens
ScriptParameterKeyValue
ScriptParameterKeyValue
(Maybe Text)
(Maybe Text)
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)
instance Core.FromJSON ScriptParameterKeyValue where
parseJSON :: Value -> Parser ScriptParameterKeyValue
parseJSON =
String
-> (Object -> Parser ScriptParameterKeyValue)
-> Value
-> Parser ScriptParameterKeyValue
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"ScriptParameterKeyValue"
( \Object
x ->
Maybe Text -> Maybe Text -> ScriptParameterKeyValue
ScriptParameterKeyValue'
(Maybe Text -> Maybe Text -> ScriptParameterKeyValue)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> ScriptParameterKeyValue)
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
"value") Parser (Maybe Text -> ScriptParameterKeyValue)
-> Parser (Maybe Text) -> Parser ScriptParameterKeyValue
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
"key")
)
instance Prelude.Hashable ScriptParameterKeyValue
instance Prelude.NFData ScriptParameterKeyValue
instance Core.ToJSON ScriptParameterKeyValue where
toJSON :: ScriptParameterKeyValue -> Value
toJSON ScriptParameterKeyValue' {Maybe Text
key :: Maybe Text
value :: Maybe Text
$sel:key:ScriptParameterKeyValue' :: ScriptParameterKeyValue -> Maybe Text
$sel:value:ScriptParameterKeyValue' :: ScriptParameterKeyValue -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"value" 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
value,
(Text
"key" 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
key
]
)