{-# 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.ElasticInference.Types.KeyValuePair where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data KeyValuePair = KeyValuePair'
{
KeyValuePair -> Maybe Int
value :: Prelude.Maybe Prelude.Int,
KeyValuePair -> Maybe Text
key :: Prelude.Maybe Prelude.Text
}
deriving (KeyValuePair -> KeyValuePair -> Bool
(KeyValuePair -> KeyValuePair -> Bool)
-> (KeyValuePair -> KeyValuePair -> Bool) -> Eq KeyValuePair
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: KeyValuePair -> KeyValuePair -> Bool
$c/= :: KeyValuePair -> KeyValuePair -> Bool
== :: KeyValuePair -> KeyValuePair -> Bool
$c== :: KeyValuePair -> KeyValuePair -> Bool
Prelude.Eq, ReadPrec [KeyValuePair]
ReadPrec KeyValuePair
Int -> ReadS KeyValuePair
ReadS [KeyValuePair]
(Int -> ReadS KeyValuePair)
-> ReadS [KeyValuePair]
-> ReadPrec KeyValuePair
-> ReadPrec [KeyValuePair]
-> Read KeyValuePair
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [KeyValuePair]
$creadListPrec :: ReadPrec [KeyValuePair]
readPrec :: ReadPrec KeyValuePair
$creadPrec :: ReadPrec KeyValuePair
readList :: ReadS [KeyValuePair]
$creadList :: ReadS [KeyValuePair]
readsPrec :: Int -> ReadS KeyValuePair
$creadsPrec :: Int -> ReadS KeyValuePair
Prelude.Read, Int -> KeyValuePair -> ShowS
[KeyValuePair] -> ShowS
KeyValuePair -> String
(Int -> KeyValuePair -> ShowS)
-> (KeyValuePair -> String)
-> ([KeyValuePair] -> ShowS)
-> Show KeyValuePair
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [KeyValuePair] -> ShowS
$cshowList :: [KeyValuePair] -> ShowS
show :: KeyValuePair -> String
$cshow :: KeyValuePair -> String
showsPrec :: Int -> KeyValuePair -> ShowS
$cshowsPrec :: Int -> KeyValuePair -> ShowS
Prelude.Show, (forall x. KeyValuePair -> Rep KeyValuePair x)
-> (forall x. Rep KeyValuePair x -> KeyValuePair)
-> Generic KeyValuePair
forall x. Rep KeyValuePair x -> KeyValuePair
forall x. KeyValuePair -> Rep KeyValuePair x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep KeyValuePair x -> KeyValuePair
$cfrom :: forall x. KeyValuePair -> Rep KeyValuePair x
Prelude.Generic)
newKeyValuePair ::
KeyValuePair
newKeyValuePair :: KeyValuePair
newKeyValuePair =
KeyValuePair' :: Maybe Int -> Maybe Text -> KeyValuePair
KeyValuePair'
{ $sel:value:KeyValuePair' :: Maybe Int
value = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:key:KeyValuePair' :: Maybe Text
key = Maybe Text
forall a. Maybe a
Prelude.Nothing
}
keyValuePair_value :: Lens.Lens' KeyValuePair (Prelude.Maybe Prelude.Int)
keyValuePair_value :: (Maybe Int -> f (Maybe Int)) -> KeyValuePair -> f KeyValuePair
keyValuePair_value = (KeyValuePair -> Maybe Int)
-> (KeyValuePair -> Maybe Int -> KeyValuePair)
-> Lens KeyValuePair KeyValuePair (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyValuePair' {Maybe Int
value :: Maybe Int
$sel:value:KeyValuePair' :: KeyValuePair -> Maybe Int
value} -> Maybe Int
value) (\s :: KeyValuePair
s@KeyValuePair' {} Maybe Int
a -> KeyValuePair
s {$sel:value:KeyValuePair' :: Maybe Int
value = Maybe Int
a} :: KeyValuePair)
keyValuePair_key :: Lens.Lens' KeyValuePair (Prelude.Maybe Prelude.Text)
keyValuePair_key :: (Maybe Text -> f (Maybe Text)) -> KeyValuePair -> f KeyValuePair
keyValuePair_key = (KeyValuePair -> Maybe Text)
-> (KeyValuePair -> Maybe Text -> KeyValuePair)
-> Lens KeyValuePair KeyValuePair (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\KeyValuePair' {Maybe Text
key :: Maybe Text
$sel:key:KeyValuePair' :: KeyValuePair -> Maybe Text
key} -> Maybe Text
key) (\s :: KeyValuePair
s@KeyValuePair' {} Maybe Text
a -> KeyValuePair
s {$sel:key:KeyValuePair' :: Maybe Text
key = Maybe Text
a} :: KeyValuePair)
instance Core.FromJSON KeyValuePair where
parseJSON :: Value -> Parser KeyValuePair
parseJSON =
String
-> (Object -> Parser KeyValuePair) -> Value -> Parser KeyValuePair
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"KeyValuePair"
( \Object
x ->
Maybe Int -> Maybe Text -> KeyValuePair
KeyValuePair'
(Maybe Int -> Maybe Text -> KeyValuePair)
-> Parser (Maybe Int) -> Parser (Maybe Text -> KeyValuePair)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Int)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"value") Parser (Maybe Text -> KeyValuePair)
-> Parser (Maybe Text) -> Parser KeyValuePair
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 KeyValuePair
instance Prelude.NFData KeyValuePair