{-# 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.GameLift.Types.GameProperty where
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data GameProperty = GameProperty'
{
GameProperty -> Text
key :: Prelude.Text,
GameProperty -> Text
value :: Prelude.Text
}
deriving (GameProperty -> GameProperty -> Bool
(GameProperty -> GameProperty -> Bool)
-> (GameProperty -> GameProperty -> Bool) -> Eq GameProperty
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GameProperty -> GameProperty -> Bool
$c/= :: GameProperty -> GameProperty -> Bool
== :: GameProperty -> GameProperty -> Bool
$c== :: GameProperty -> GameProperty -> Bool
Prelude.Eq, ReadPrec [GameProperty]
ReadPrec GameProperty
Int -> ReadS GameProperty
ReadS [GameProperty]
(Int -> ReadS GameProperty)
-> ReadS [GameProperty]
-> ReadPrec GameProperty
-> ReadPrec [GameProperty]
-> Read GameProperty
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GameProperty]
$creadListPrec :: ReadPrec [GameProperty]
readPrec :: ReadPrec GameProperty
$creadPrec :: ReadPrec GameProperty
readList :: ReadS [GameProperty]
$creadList :: ReadS [GameProperty]
readsPrec :: Int -> ReadS GameProperty
$creadsPrec :: Int -> ReadS GameProperty
Prelude.Read, Int -> GameProperty -> ShowS
[GameProperty] -> ShowS
GameProperty -> String
(Int -> GameProperty -> ShowS)
-> (GameProperty -> String)
-> ([GameProperty] -> ShowS)
-> Show GameProperty
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GameProperty] -> ShowS
$cshowList :: [GameProperty] -> ShowS
show :: GameProperty -> String
$cshow :: GameProperty -> String
showsPrec :: Int -> GameProperty -> ShowS
$cshowsPrec :: Int -> GameProperty -> ShowS
Prelude.Show, (forall x. GameProperty -> Rep GameProperty x)
-> (forall x. Rep GameProperty x -> GameProperty)
-> Generic GameProperty
forall x. Rep GameProperty x -> GameProperty
forall x. GameProperty -> Rep GameProperty x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GameProperty x -> GameProperty
$cfrom :: forall x. GameProperty -> Rep GameProperty x
Prelude.Generic)
newGameProperty ::
Prelude.Text ->
Prelude.Text ->
GameProperty
newGameProperty :: Text -> Text -> GameProperty
newGameProperty Text
pKey_ Text
pValue_ =
GameProperty' :: Text -> Text -> GameProperty
GameProperty' {$sel:key:GameProperty' :: Text
key = Text
pKey_, $sel:value:GameProperty' :: Text
value = Text
pValue_}
gameProperty_key :: Lens.Lens' GameProperty Prelude.Text
gameProperty_key :: (Text -> f Text) -> GameProperty -> f GameProperty
gameProperty_key = (GameProperty -> Text)
-> (GameProperty -> Text -> GameProperty)
-> Lens GameProperty GameProperty Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GameProperty' {Text
key :: Text
$sel:key:GameProperty' :: GameProperty -> Text
key} -> Text
key) (\s :: GameProperty
s@GameProperty' {} Text
a -> GameProperty
s {$sel:key:GameProperty' :: Text
key = Text
a} :: GameProperty)
gameProperty_value :: Lens.Lens' GameProperty Prelude.Text
gameProperty_value :: (Text -> f Text) -> GameProperty -> f GameProperty
gameProperty_value = (GameProperty -> Text)
-> (GameProperty -> Text -> GameProperty)
-> Lens GameProperty GameProperty Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GameProperty' {Text
value :: Text
$sel:value:GameProperty' :: GameProperty -> Text
value} -> Text
value) (\s :: GameProperty
s@GameProperty' {} Text
a -> GameProperty
s {$sel:value:GameProperty' :: Text
value = Text
a} :: GameProperty)
instance Core.FromJSON GameProperty where
parseJSON :: Value -> Parser GameProperty
parseJSON =
String
-> (Object -> Parser GameProperty) -> Value -> Parser GameProperty
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
String
"GameProperty"
( \Object
x ->
Text -> Text -> GameProperty
GameProperty'
(Text -> Text -> GameProperty)
-> Parser Text -> Parser (Text -> GameProperty)
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
"Key") Parser (Text -> GameProperty) -> Parser Text -> Parser GameProperty
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 GameProperty
instance Prelude.NFData GameProperty
instance Core.ToJSON GameProperty where
toJSON :: GameProperty -> Value
toJSON GameProperty' {Text
value :: Text
key :: Text
$sel:value:GameProperty' :: GameProperty -> Text
$sel:key:GameProperty' :: GameProperty -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Key" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
key),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Value" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
value)
]
)