{-# 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.EMR.Types.KeyValue where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data KeyValue = KeyValue'
{
KeyValue -> Maybe Text
value :: Prelude.Maybe Prelude.Text,
KeyValue -> Maybe Text
key :: Prelude.Maybe Prelude.Text
}
deriving (KeyValue -> KeyValue -> Bool
(KeyValue -> KeyValue -> Bool)
-> (KeyValue -> KeyValue -> Bool) -> Eq KeyValue
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KeyValue -> KeyValue -> Bool
$c/= :: KeyValue -> KeyValue -> Bool
== :: KeyValue -> KeyValue -> Bool
$c== :: KeyValue -> KeyValue -> Bool
Prelude.Eq, ReadPrec [KeyValue]
ReadPrec KeyValue
Int -> ReadS KeyValue
ReadS [KeyValue]
(Int -> ReadS KeyValue)
-> ReadS [KeyValue]
-> ReadPrec KeyValue
-> ReadPrec [KeyValue]
-> Read KeyValue
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KeyValue]
$creadListPrec :: ReadPrec [KeyValue]
readPrec :: ReadPrec KeyValue
$creadPrec :: ReadPrec KeyValue
readList :: ReadS [KeyValue]
$creadList :: ReadS [KeyValue]
readsPrec :: Int -> ReadS KeyValue
$creadsPrec :: Int -> ReadS KeyValue
Prelude.Read, Int -> KeyValue -> ShowS
[KeyValue] -> ShowS
KeyValue -> String
(Int -> KeyValue -> ShowS)
-> (KeyValue -> String) -> ([KeyValue] -> ShowS) -> Show KeyValue
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KeyValue] -> ShowS
$cshowList :: [KeyValue] -> ShowS
show :: KeyValue -> String
$cshow :: KeyValue -> String
showsPrec :: Int -> KeyValue -> ShowS
$cshowsPrec :: Int -> KeyValue -> ShowS
Prelude.Show, (forall x. KeyValue -> Rep KeyValue x)
-> (forall x. Rep KeyValue x -> KeyValue) -> Generic KeyValue
forall x. Rep KeyValue x -> KeyValue
forall x. KeyValue -> Rep KeyValue x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KeyValue x -> KeyValue
$cfrom :: forall x. KeyValue -> Rep KeyValue x
Prelude.Generic)
newKeyValue ::
KeyValue
newKeyValue :: KeyValue
newKeyValue =
KeyValue' :: Maybe Text -> Maybe Text -> KeyValue
KeyValue'
{ $sel:value:KeyValue' :: Maybe Text
value = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:key:KeyValue' :: Maybe Text
key = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
keyValue_value :: Lens.Lens' KeyValue (Prelude.Maybe Prelude.Text)
keyValue_value :: (Maybe Text -> f (Maybe Text)) -> KeyValue -> f KeyValue
keyValue_value = (KeyValue -> Maybe Text)
-> (KeyValue -> Maybe Text -> KeyValue)
-> Lens KeyValue KeyValue (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyValue' {Maybe Text
value :: Maybe Text
$sel:value:KeyValue' :: KeyValue -> Maybe Text
value} -> Maybe Text
value) (\s :: KeyValue
s@KeyValue' {} Maybe Text
a -> KeyValue
s {$sel:value:KeyValue' :: Maybe Text
value = Maybe Text
a} :: KeyValue)
keyValue_key :: Lens.Lens' KeyValue (Prelude.Maybe Prelude.Text)
keyValue_key :: (Maybe Text -> f (Maybe Text)) -> KeyValue -> f KeyValue
keyValue_key = (KeyValue -> Maybe Text)
-> (KeyValue -> Maybe Text -> KeyValue)
-> Lens KeyValue KeyValue (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyValue' {Maybe Text
key :: Maybe Text
$sel:key:KeyValue' :: KeyValue -> Maybe Text
key} -> Maybe Text
key) (\s :: KeyValue
s@KeyValue' {} Maybe Text
a -> KeyValue
s {$sel:key:KeyValue' :: Maybe Text
key = Maybe Text
a} :: KeyValue)
instance Prelude.Hashable KeyValue
instance Prelude.NFData KeyValue
instance Core.ToJSON KeyValue where
toJSON :: KeyValue -> Value
toJSON KeyValue' {Maybe Text
key :: Maybe Text
value :: Maybe Text
$sel:key:KeyValue' :: KeyValue -> Maybe Text
$sel:value:KeyValue' :: KeyValue -> 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
]
)