{-# 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.GameLift.ClaimGameServer
(
ClaimGameServer (..),
newClaimGameServer,
claimGameServer_gameServerData,
claimGameServer_gameServerId,
claimGameServer_gameServerGroupName,
ClaimGameServerResponse (..),
newClaimGameServerResponse,
claimGameServerResponse_gameServer,
claimGameServerResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.GameLift.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ClaimGameServer = ClaimGameServer'
{
ClaimGameServer -> Maybe Text
gameServerData :: Prelude.Maybe Prelude.Text,
ClaimGameServer -> Maybe Text
gameServerId :: Prelude.Maybe Prelude.Text,
ClaimGameServer -> Text
gameServerGroupName :: Prelude.Text
}
deriving (ClaimGameServer -> ClaimGameServer -> Bool
(ClaimGameServer -> ClaimGameServer -> Bool)
-> (ClaimGameServer -> ClaimGameServer -> Bool)
-> Eq ClaimGameServer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClaimGameServer -> ClaimGameServer -> Bool
$c/= :: ClaimGameServer -> ClaimGameServer -> Bool
== :: ClaimGameServer -> ClaimGameServer -> Bool
$c== :: ClaimGameServer -> ClaimGameServer -> Bool
Prelude.Eq, ReadPrec [ClaimGameServer]
ReadPrec ClaimGameServer
Int -> ReadS ClaimGameServer
ReadS [ClaimGameServer]
(Int -> ReadS ClaimGameServer)
-> ReadS [ClaimGameServer]
-> ReadPrec ClaimGameServer
-> ReadPrec [ClaimGameServer]
-> Read ClaimGameServer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClaimGameServer]
$creadListPrec :: ReadPrec [ClaimGameServer]
readPrec :: ReadPrec ClaimGameServer
$creadPrec :: ReadPrec ClaimGameServer
readList :: ReadS [ClaimGameServer]
$creadList :: ReadS [ClaimGameServer]
readsPrec :: Int -> ReadS ClaimGameServer
$creadsPrec :: Int -> ReadS ClaimGameServer
Prelude.Read, Int -> ClaimGameServer -> ShowS
[ClaimGameServer] -> ShowS
ClaimGameServer -> String
(Int -> ClaimGameServer -> ShowS)
-> (ClaimGameServer -> String)
-> ([ClaimGameServer] -> ShowS)
-> Show ClaimGameServer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClaimGameServer] -> ShowS
$cshowList :: [ClaimGameServer] -> ShowS
show :: ClaimGameServer -> String
$cshow :: ClaimGameServer -> String
showsPrec :: Int -> ClaimGameServer -> ShowS
$cshowsPrec :: Int -> ClaimGameServer -> ShowS
Prelude.Show, (forall x. ClaimGameServer -> Rep ClaimGameServer x)
-> (forall x. Rep ClaimGameServer x -> ClaimGameServer)
-> Generic ClaimGameServer
forall x. Rep ClaimGameServer x -> ClaimGameServer
forall x. ClaimGameServer -> Rep ClaimGameServer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClaimGameServer x -> ClaimGameServer
$cfrom :: forall x. ClaimGameServer -> Rep ClaimGameServer x
Prelude.Generic)
newClaimGameServer ::
Prelude.Text ->
ClaimGameServer
newClaimGameServer :: Text -> ClaimGameServer
newClaimGameServer Text
pGameServerGroupName_ =
ClaimGameServer' :: Maybe Text -> Maybe Text -> Text -> ClaimGameServer
ClaimGameServer'
{ $sel:gameServerData:ClaimGameServer' :: Maybe Text
gameServerData = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:gameServerId:ClaimGameServer' :: Maybe Text
gameServerId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:gameServerGroupName:ClaimGameServer' :: Text
gameServerGroupName = Text
pGameServerGroupName_
}
claimGameServer_gameServerData :: Lens.Lens' ClaimGameServer (Prelude.Maybe Prelude.Text)
claimGameServer_gameServerData :: (Maybe Text -> f (Maybe Text))
-> ClaimGameServer -> f ClaimGameServer
claimGameServer_gameServerData = (ClaimGameServer -> Maybe Text)
-> (ClaimGameServer -> Maybe Text -> ClaimGameServer)
-> Lens ClaimGameServer ClaimGameServer (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClaimGameServer' {Maybe Text
gameServerData :: Maybe Text
$sel:gameServerData:ClaimGameServer' :: ClaimGameServer -> Maybe Text
gameServerData} -> Maybe Text
gameServerData) (\s :: ClaimGameServer
s@ClaimGameServer' {} Maybe Text
a -> ClaimGameServer
s {$sel:gameServerData:ClaimGameServer' :: Maybe Text
gameServerData = Maybe Text
a} :: ClaimGameServer)
claimGameServer_gameServerId :: Lens.Lens' ClaimGameServer (Prelude.Maybe Prelude.Text)
claimGameServer_gameServerId :: (Maybe Text -> f (Maybe Text))
-> ClaimGameServer -> f ClaimGameServer
claimGameServer_gameServerId = (ClaimGameServer -> Maybe Text)
-> (ClaimGameServer -> Maybe Text -> ClaimGameServer)
-> Lens ClaimGameServer ClaimGameServer (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClaimGameServer' {Maybe Text
gameServerId :: Maybe Text
$sel:gameServerId:ClaimGameServer' :: ClaimGameServer -> Maybe Text
gameServerId} -> Maybe Text
gameServerId) (\s :: ClaimGameServer
s@ClaimGameServer' {} Maybe Text
a -> ClaimGameServer
s {$sel:gameServerId:ClaimGameServer' :: Maybe Text
gameServerId = Maybe Text
a} :: ClaimGameServer)
claimGameServer_gameServerGroupName :: Lens.Lens' ClaimGameServer Prelude.Text
claimGameServer_gameServerGroupName :: (Text -> f Text) -> ClaimGameServer -> f ClaimGameServer
claimGameServer_gameServerGroupName = (ClaimGameServer -> Text)
-> (ClaimGameServer -> Text -> ClaimGameServer)
-> Lens ClaimGameServer ClaimGameServer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClaimGameServer' {Text
gameServerGroupName :: Text
$sel:gameServerGroupName:ClaimGameServer' :: ClaimGameServer -> Text
gameServerGroupName} -> Text
gameServerGroupName) (\s :: ClaimGameServer
s@ClaimGameServer' {} Text
a -> ClaimGameServer
s {$sel:gameServerGroupName:ClaimGameServer' :: Text
gameServerGroupName = Text
a} :: ClaimGameServer)
instance Core.AWSRequest ClaimGameServer where
type
AWSResponse ClaimGameServer =
ClaimGameServerResponse
request :: ClaimGameServer -> Request ClaimGameServer
request = Service -> ClaimGameServer -> Request ClaimGameServer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ClaimGameServer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ClaimGameServer)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ClaimGameServer))
-> Logger
-> Service
-> Proxy ClaimGameServer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ClaimGameServer)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe GameServer -> Int -> ClaimGameServerResponse
ClaimGameServerResponse'
(Maybe GameServer -> Int -> ClaimGameServerResponse)
-> Either String (Maybe GameServer)
-> Either String (Int -> ClaimGameServerResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe GameServer)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"GameServer")
Either String (Int -> ClaimGameServerResponse)
-> Either String Int -> Either String ClaimGameServerResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ClaimGameServer
instance Prelude.NFData ClaimGameServer
instance Core.ToHeaders ClaimGameServer where
toHeaders :: ClaimGameServer -> ResponseHeaders
toHeaders =
ResponseHeaders -> ClaimGameServer -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"GameLift.ClaimGameServer" :: Prelude.ByteString),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON ClaimGameServer where
toJSON :: ClaimGameServer -> Value
toJSON ClaimGameServer' {Maybe Text
Text
gameServerGroupName :: Text
gameServerId :: Maybe Text
gameServerData :: Maybe Text
$sel:gameServerGroupName:ClaimGameServer' :: ClaimGameServer -> Text
$sel:gameServerId:ClaimGameServer' :: ClaimGameServer -> Maybe Text
$sel:gameServerData:ClaimGameServer' :: ClaimGameServer -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"GameServerData" 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
gameServerData,
(Text
"GameServerId" 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
gameServerId,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"GameServerGroupName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
gameServerGroupName)
]
)
instance Core.ToPath ClaimGameServer where
toPath :: ClaimGameServer -> ByteString
toPath = ByteString -> ClaimGameServer -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ClaimGameServer where
toQuery :: ClaimGameServer -> QueryString
toQuery = QueryString -> ClaimGameServer -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data ClaimGameServerResponse = ClaimGameServerResponse'
{
ClaimGameServerResponse -> Maybe GameServer
gameServer :: Prelude.Maybe GameServer,
ClaimGameServerResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ClaimGameServerResponse -> ClaimGameServerResponse -> Bool
(ClaimGameServerResponse -> ClaimGameServerResponse -> Bool)
-> (ClaimGameServerResponse -> ClaimGameServerResponse -> Bool)
-> Eq ClaimGameServerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClaimGameServerResponse -> ClaimGameServerResponse -> Bool
$c/= :: ClaimGameServerResponse -> ClaimGameServerResponse -> Bool
== :: ClaimGameServerResponse -> ClaimGameServerResponse -> Bool
$c== :: ClaimGameServerResponse -> ClaimGameServerResponse -> Bool
Prelude.Eq, ReadPrec [ClaimGameServerResponse]
ReadPrec ClaimGameServerResponse
Int -> ReadS ClaimGameServerResponse
ReadS [ClaimGameServerResponse]
(Int -> ReadS ClaimGameServerResponse)
-> ReadS [ClaimGameServerResponse]
-> ReadPrec ClaimGameServerResponse
-> ReadPrec [ClaimGameServerResponse]
-> Read ClaimGameServerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ClaimGameServerResponse]
$creadListPrec :: ReadPrec [ClaimGameServerResponse]
readPrec :: ReadPrec ClaimGameServerResponse
$creadPrec :: ReadPrec ClaimGameServerResponse
readList :: ReadS [ClaimGameServerResponse]
$creadList :: ReadS [ClaimGameServerResponse]
readsPrec :: Int -> ReadS ClaimGameServerResponse
$creadsPrec :: Int -> ReadS ClaimGameServerResponse
Prelude.Read, Int -> ClaimGameServerResponse -> ShowS
[ClaimGameServerResponse] -> ShowS
ClaimGameServerResponse -> String
(Int -> ClaimGameServerResponse -> ShowS)
-> (ClaimGameServerResponse -> String)
-> ([ClaimGameServerResponse] -> ShowS)
-> Show ClaimGameServerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ClaimGameServerResponse] -> ShowS
$cshowList :: [ClaimGameServerResponse] -> ShowS
show :: ClaimGameServerResponse -> String
$cshow :: ClaimGameServerResponse -> String
showsPrec :: Int -> ClaimGameServerResponse -> ShowS
$cshowsPrec :: Int -> ClaimGameServerResponse -> ShowS
Prelude.Show, (forall x.
ClaimGameServerResponse -> Rep ClaimGameServerResponse x)
-> (forall x.
Rep ClaimGameServerResponse x -> ClaimGameServerResponse)
-> Generic ClaimGameServerResponse
forall x. Rep ClaimGameServerResponse x -> ClaimGameServerResponse
forall x. ClaimGameServerResponse -> Rep ClaimGameServerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ClaimGameServerResponse x -> ClaimGameServerResponse
$cfrom :: forall x. ClaimGameServerResponse -> Rep ClaimGameServerResponse x
Prelude.Generic)
newClaimGameServerResponse ::
Prelude.Int ->
ClaimGameServerResponse
newClaimGameServerResponse :: Int -> ClaimGameServerResponse
newClaimGameServerResponse Int
pHttpStatus_ =
ClaimGameServerResponse' :: Maybe GameServer -> Int -> ClaimGameServerResponse
ClaimGameServerResponse'
{ $sel:gameServer:ClaimGameServerResponse' :: Maybe GameServer
gameServer =
Maybe GameServer
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ClaimGameServerResponse' :: Int
httpStatus = Int
pHttpStatus_
}
claimGameServerResponse_gameServer :: Lens.Lens' ClaimGameServerResponse (Prelude.Maybe GameServer)
claimGameServerResponse_gameServer :: (Maybe GameServer -> f (Maybe GameServer))
-> ClaimGameServerResponse -> f ClaimGameServerResponse
claimGameServerResponse_gameServer = (ClaimGameServerResponse -> Maybe GameServer)
-> (ClaimGameServerResponse
-> Maybe GameServer -> ClaimGameServerResponse)
-> Lens
ClaimGameServerResponse
ClaimGameServerResponse
(Maybe GameServer)
(Maybe GameServer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClaimGameServerResponse' {Maybe GameServer
gameServer :: Maybe GameServer
$sel:gameServer:ClaimGameServerResponse' :: ClaimGameServerResponse -> Maybe GameServer
gameServer} -> Maybe GameServer
gameServer) (\s :: ClaimGameServerResponse
s@ClaimGameServerResponse' {} Maybe GameServer
a -> ClaimGameServerResponse
s {$sel:gameServer:ClaimGameServerResponse' :: Maybe GameServer
gameServer = Maybe GameServer
a} :: ClaimGameServerResponse)
claimGameServerResponse_httpStatus :: Lens.Lens' ClaimGameServerResponse Prelude.Int
claimGameServerResponse_httpStatus :: (Int -> f Int)
-> ClaimGameServerResponse -> f ClaimGameServerResponse
claimGameServerResponse_httpStatus = (ClaimGameServerResponse -> Int)
-> (ClaimGameServerResponse -> Int -> ClaimGameServerResponse)
-> Lens ClaimGameServerResponse ClaimGameServerResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ClaimGameServerResponse' {Int
httpStatus :: Int
$sel:httpStatus:ClaimGameServerResponse' :: ClaimGameServerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ClaimGameServerResponse
s@ClaimGameServerResponse' {} Int
a -> ClaimGameServerResponse
s {$sel:httpStatus:ClaimGameServerResponse' :: Int
httpStatus = Int
a} :: ClaimGameServerResponse)
instance Prelude.NFData ClaimGameServerResponse