{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}
module Amazonka.GamesParks.CreateGame
(
CreateGame (..),
newCreateGame,
createGame_clientToken,
createGame_description,
createGame_tags,
createGame_gameName,
CreateGameResponse (..),
newCreateGameResponse,
createGameResponse_game,
createGameResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GamesParks.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data CreateGame = CreateGame'
{
CreateGame -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
CreateGame -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateGame -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreateGame -> Text
gameName :: Prelude.Text
}
deriving (CreateGame -> CreateGame -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateGame -> CreateGame -> Bool
$c/= :: CreateGame -> CreateGame -> Bool
== :: CreateGame -> CreateGame -> Bool
$c== :: CreateGame -> CreateGame -> Bool
Prelude.Eq, ReadPrec [CreateGame]
ReadPrec CreateGame
Int -> ReadS CreateGame
ReadS [CreateGame]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateGame]
$creadListPrec :: ReadPrec [CreateGame]
readPrec :: ReadPrec CreateGame
$creadPrec :: ReadPrec CreateGame
readList :: ReadS [CreateGame]
$creadList :: ReadS [CreateGame]
readsPrec :: Int -> ReadS CreateGame
$creadsPrec :: Int -> ReadS CreateGame
Prelude.Read, Int -> CreateGame -> ShowS
[CreateGame] -> ShowS
CreateGame -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateGame] -> ShowS
$cshowList :: [CreateGame] -> ShowS
show :: CreateGame -> String
$cshow :: CreateGame -> String
showsPrec :: Int -> CreateGame -> ShowS
$cshowsPrec :: Int -> CreateGame -> ShowS
Prelude.Show, forall x. Rep CreateGame x -> CreateGame
forall x. CreateGame -> Rep CreateGame x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateGame x -> CreateGame
$cfrom :: forall x. CreateGame -> Rep CreateGame x
Prelude.Generic)
newCreateGame ::
Prelude.Text ->
CreateGame
newCreateGame :: Text -> CreateGame
newCreateGame Text
pGameName_ =
CreateGame'
{ $sel:clientToken:CreateGame' :: Maybe Text
clientToken = forall a. Maybe a
Prelude.Nothing,
$sel:description:CreateGame' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateGame' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
$sel:gameName:CreateGame' :: Text
gameName = Text
pGameName_
}
createGame_clientToken :: Lens.Lens' CreateGame (Prelude.Maybe Prelude.Text)
createGame_clientToken :: Lens' CreateGame (Maybe Text)
createGame_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGame' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateGame' :: CreateGame -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateGame
s@CreateGame' {} Maybe Text
a -> CreateGame
s {$sel:clientToken:CreateGame' :: Maybe Text
clientToken = Maybe Text
a} :: CreateGame)
createGame_description :: Lens.Lens' CreateGame (Prelude.Maybe Prelude.Text)
createGame_description :: Lens' CreateGame (Maybe Text)
createGame_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGame' {Maybe Text
description :: Maybe Text
$sel:description:CreateGame' :: CreateGame -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateGame
s@CreateGame' {} Maybe Text
a -> CreateGame
s {$sel:description:CreateGame' :: Maybe Text
description = Maybe Text
a} :: CreateGame)
createGame_tags :: Lens.Lens' CreateGame (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createGame_tags :: Lens' CreateGame (Maybe (HashMap Text Text))
createGame_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGame' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateGame' :: CreateGame -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateGame
s@CreateGame' {} Maybe (HashMap Text Text)
a -> CreateGame
s {$sel:tags:CreateGame' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateGame) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
createGame_gameName :: Lens.Lens' CreateGame Prelude.Text
createGame_gameName :: Lens' CreateGame Text
createGame_gameName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGame' {Text
gameName :: Text
$sel:gameName:CreateGame' :: CreateGame -> Text
gameName} -> Text
gameName) (\s :: CreateGame
s@CreateGame' {} Text
a -> CreateGame
s {$sel:gameName:CreateGame' :: Text
gameName = Text
a} :: CreateGame)
instance Core.AWSRequest CreateGame where
type AWSResponse CreateGame = CreateGameResponse
request :: (Service -> Service) -> CreateGame -> Request CreateGame
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateGame
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateGame)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe GameDetails -> Int -> CreateGameResponse
CreateGameResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Game")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable CreateGame where
hashWithSalt :: Int -> CreateGame -> Int
hashWithSalt Int
_salt CreateGame' {Maybe Text
Maybe (HashMap Text Text)
Text
gameName :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
clientToken :: Maybe Text
$sel:gameName:CreateGame' :: CreateGame -> Text
$sel:tags:CreateGame' :: CreateGame -> Maybe (HashMap Text Text)
$sel:description:CreateGame' :: CreateGame -> Maybe Text
$sel:clientToken:CreateGame' :: CreateGame -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
gameName
instance Prelude.NFData CreateGame where
rnf :: CreateGame -> ()
rnf CreateGame' {Maybe Text
Maybe (HashMap Text Text)
Text
gameName :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
clientToken :: Maybe Text
$sel:gameName:CreateGame' :: CreateGame -> Text
$sel:tags:CreateGame' :: CreateGame -> Maybe (HashMap Text Text)
$sel:description:CreateGame' :: CreateGame -> Maybe Text
$sel:clientToken:CreateGame' :: CreateGame -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
gameName
instance Data.ToHeaders CreateGame where
toHeaders :: CreateGame -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON CreateGame where
toJSON :: CreateGame -> Value
toJSON CreateGame' {Maybe Text
Maybe (HashMap Text Text)
Text
gameName :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
clientToken :: Maybe Text
$sel:gameName:CreateGame' :: CreateGame -> Text
$sel:tags:CreateGame' :: CreateGame -> Maybe (HashMap Text Text)
$sel:description:CreateGame' :: CreateGame -> Maybe Text
$sel:clientToken:CreateGame' :: CreateGame -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"ClientToken" 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
clientToken,
(Key
"Description" 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
description,
(Key
"Tags" 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 (HashMap Text Text)
tags,
forall a. a -> Maybe a
Prelude.Just (Key
"GameName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
gameName)
]
)
instance Data.ToPath CreateGame where
toPath :: CreateGame -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/game"
instance Data.ToQuery CreateGame where
toQuery :: CreateGame -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateGameResponse = CreateGameResponse'
{
CreateGameResponse -> Maybe GameDetails
game :: Prelude.Maybe GameDetails,
CreateGameResponse -> Int
httpStatus :: Prelude.Int
}
deriving (CreateGameResponse -> CreateGameResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateGameResponse -> CreateGameResponse -> Bool
$c/= :: CreateGameResponse -> CreateGameResponse -> Bool
== :: CreateGameResponse -> CreateGameResponse -> Bool
$c== :: CreateGameResponse -> CreateGameResponse -> Bool
Prelude.Eq, ReadPrec [CreateGameResponse]
ReadPrec CreateGameResponse
Int -> ReadS CreateGameResponse
ReadS [CreateGameResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateGameResponse]
$creadListPrec :: ReadPrec [CreateGameResponse]
readPrec :: ReadPrec CreateGameResponse
$creadPrec :: ReadPrec CreateGameResponse
readList :: ReadS [CreateGameResponse]
$creadList :: ReadS [CreateGameResponse]
readsPrec :: Int -> ReadS CreateGameResponse
$creadsPrec :: Int -> ReadS CreateGameResponse
Prelude.Read, Int -> CreateGameResponse -> ShowS
[CreateGameResponse] -> ShowS
CreateGameResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateGameResponse] -> ShowS
$cshowList :: [CreateGameResponse] -> ShowS
show :: CreateGameResponse -> String
$cshow :: CreateGameResponse -> String
showsPrec :: Int -> CreateGameResponse -> ShowS
$cshowsPrec :: Int -> CreateGameResponse -> ShowS
Prelude.Show, forall x. Rep CreateGameResponse x -> CreateGameResponse
forall x. CreateGameResponse -> Rep CreateGameResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateGameResponse x -> CreateGameResponse
$cfrom :: forall x. CreateGameResponse -> Rep CreateGameResponse x
Prelude.Generic)
newCreateGameResponse ::
Prelude.Int ->
CreateGameResponse
newCreateGameResponse :: Int -> CreateGameResponse
newCreateGameResponse Int
pHttpStatus_ =
CreateGameResponse'
{ $sel:game:CreateGameResponse' :: Maybe GameDetails
game = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:CreateGameResponse' :: Int
httpStatus = Int
pHttpStatus_
}
createGameResponse_game :: Lens.Lens' CreateGameResponse (Prelude.Maybe GameDetails)
createGameResponse_game :: Lens' CreateGameResponse (Maybe GameDetails)
createGameResponse_game = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGameResponse' {Maybe GameDetails
game :: Maybe GameDetails
$sel:game:CreateGameResponse' :: CreateGameResponse -> Maybe GameDetails
game} -> Maybe GameDetails
game) (\s :: CreateGameResponse
s@CreateGameResponse' {} Maybe GameDetails
a -> CreateGameResponse
s {$sel:game:CreateGameResponse' :: Maybe GameDetails
game = Maybe GameDetails
a} :: CreateGameResponse)
createGameResponse_httpStatus :: Lens.Lens' CreateGameResponse Prelude.Int
createGameResponse_httpStatus :: Lens' CreateGameResponse Int
createGameResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateGameResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateGameResponse' :: CreateGameResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateGameResponse
s@CreateGameResponse' {} Int
a -> CreateGameResponse
s {$sel:httpStatus:CreateGameResponse' :: Int
httpStatus = Int
a} :: CreateGameResponse)
instance Prelude.NFData CreateGameResponse where
rnf :: CreateGameResponse -> ()
rnf CreateGameResponse' {Int
Maybe GameDetails
httpStatus :: Int
game :: Maybe GameDetails
$sel:httpStatus:CreateGameResponse' :: CreateGameResponse -> Int
$sel:game:CreateGameResponse' :: CreateGameResponse -> Maybe GameDetails
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe GameDetails
game
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus