{-# 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.RegisterGameServer
(
RegisterGameServer (..),
newRegisterGameServer,
registerGameServer_gameServerData,
registerGameServer_connectionInfo,
registerGameServer_gameServerGroupName,
registerGameServer_gameServerId,
registerGameServer_instanceId,
RegisterGameServerResponse (..),
newRegisterGameServerResponse,
registerGameServerResponse_gameServer,
registerGameServerResponse_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 RegisterGameServer = RegisterGameServer'
{
RegisterGameServer -> Maybe Text
gameServerData :: Prelude.Maybe Prelude.Text,
RegisterGameServer -> Maybe Text
connectionInfo :: Prelude.Maybe Prelude.Text,
RegisterGameServer -> Text
gameServerGroupName :: Prelude.Text,
RegisterGameServer -> Text
gameServerId :: Prelude.Text,
RegisterGameServer -> Text
instanceId :: Prelude.Text
}
deriving (RegisterGameServer -> RegisterGameServer -> Bool
(RegisterGameServer -> RegisterGameServer -> Bool)
-> (RegisterGameServer -> RegisterGameServer -> Bool)
-> Eq RegisterGameServer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterGameServer -> RegisterGameServer -> Bool
$c/= :: RegisterGameServer -> RegisterGameServer -> Bool
== :: RegisterGameServer -> RegisterGameServer -> Bool
$c== :: RegisterGameServer -> RegisterGameServer -> Bool
Prelude.Eq, ReadPrec [RegisterGameServer]
ReadPrec RegisterGameServer
Int -> ReadS RegisterGameServer
ReadS [RegisterGameServer]
(Int -> ReadS RegisterGameServer)
-> ReadS [RegisterGameServer]
-> ReadPrec RegisterGameServer
-> ReadPrec [RegisterGameServer]
-> Read RegisterGameServer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterGameServer]
$creadListPrec :: ReadPrec [RegisterGameServer]
readPrec :: ReadPrec RegisterGameServer
$creadPrec :: ReadPrec RegisterGameServer
readList :: ReadS [RegisterGameServer]
$creadList :: ReadS [RegisterGameServer]
readsPrec :: Int -> ReadS RegisterGameServer
$creadsPrec :: Int -> ReadS RegisterGameServer
Prelude.Read, Int -> RegisterGameServer -> ShowS
[RegisterGameServer] -> ShowS
RegisterGameServer -> String
(Int -> RegisterGameServer -> ShowS)
-> (RegisterGameServer -> String)
-> ([RegisterGameServer] -> ShowS)
-> Show RegisterGameServer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterGameServer] -> ShowS
$cshowList :: [RegisterGameServer] -> ShowS
show :: RegisterGameServer -> String
$cshow :: RegisterGameServer -> String
showsPrec :: Int -> RegisterGameServer -> ShowS
$cshowsPrec :: Int -> RegisterGameServer -> ShowS
Prelude.Show, (forall x. RegisterGameServer -> Rep RegisterGameServer x)
-> (forall x. Rep RegisterGameServer x -> RegisterGameServer)
-> Generic RegisterGameServer
forall x. Rep RegisterGameServer x -> RegisterGameServer
forall x. RegisterGameServer -> Rep RegisterGameServer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterGameServer x -> RegisterGameServer
$cfrom :: forall x. RegisterGameServer -> Rep RegisterGameServer x
Prelude.Generic)
newRegisterGameServer ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
RegisterGameServer
newRegisterGameServer :: Text -> Text -> Text -> RegisterGameServer
newRegisterGameServer
Text
pGameServerGroupName_
Text
pGameServerId_
Text
pInstanceId_ =
RegisterGameServer' :: Maybe Text
-> Maybe Text -> Text -> Text -> Text -> RegisterGameServer
RegisterGameServer'
{ $sel:gameServerData:RegisterGameServer' :: Maybe Text
gameServerData =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:connectionInfo:RegisterGameServer' :: Maybe Text
connectionInfo = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:gameServerGroupName:RegisterGameServer' :: Text
gameServerGroupName = Text
pGameServerGroupName_,
$sel:gameServerId:RegisterGameServer' :: Text
gameServerId = Text
pGameServerId_,
$sel:instanceId:RegisterGameServer' :: Text
instanceId = Text
pInstanceId_
}
registerGameServer_gameServerData :: Lens.Lens' RegisterGameServer (Prelude.Maybe Prelude.Text)
registerGameServer_gameServerData :: (Maybe Text -> f (Maybe Text))
-> RegisterGameServer -> f RegisterGameServer
registerGameServer_gameServerData = (RegisterGameServer -> Maybe Text)
-> (RegisterGameServer -> Maybe Text -> RegisterGameServer)
-> Lens
RegisterGameServer RegisterGameServer (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterGameServer' {Maybe Text
gameServerData :: Maybe Text
$sel:gameServerData:RegisterGameServer' :: RegisterGameServer -> Maybe Text
gameServerData} -> Maybe Text
gameServerData) (\s :: RegisterGameServer
s@RegisterGameServer' {} Maybe Text
a -> RegisterGameServer
s {$sel:gameServerData:RegisterGameServer' :: Maybe Text
gameServerData = Maybe Text
a} :: RegisterGameServer)
registerGameServer_connectionInfo :: Lens.Lens' RegisterGameServer (Prelude.Maybe Prelude.Text)
registerGameServer_connectionInfo :: (Maybe Text -> f (Maybe Text))
-> RegisterGameServer -> f RegisterGameServer
registerGameServer_connectionInfo = (RegisterGameServer -> Maybe Text)
-> (RegisterGameServer -> Maybe Text -> RegisterGameServer)
-> Lens
RegisterGameServer RegisterGameServer (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterGameServer' {Maybe Text
connectionInfo :: Maybe Text
$sel:connectionInfo:RegisterGameServer' :: RegisterGameServer -> Maybe Text
connectionInfo} -> Maybe Text
connectionInfo) (\s :: RegisterGameServer
s@RegisterGameServer' {} Maybe Text
a -> RegisterGameServer
s {$sel:connectionInfo:RegisterGameServer' :: Maybe Text
connectionInfo = Maybe Text
a} :: RegisterGameServer)
registerGameServer_gameServerGroupName :: Lens.Lens' RegisterGameServer Prelude.Text
registerGameServer_gameServerGroupName :: (Text -> f Text) -> RegisterGameServer -> f RegisterGameServer
registerGameServer_gameServerGroupName = (RegisterGameServer -> Text)
-> (RegisterGameServer -> Text -> RegisterGameServer)
-> Lens RegisterGameServer RegisterGameServer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterGameServer' {Text
gameServerGroupName :: Text
$sel:gameServerGroupName:RegisterGameServer' :: RegisterGameServer -> Text
gameServerGroupName} -> Text
gameServerGroupName) (\s :: RegisterGameServer
s@RegisterGameServer' {} Text
a -> RegisterGameServer
s {$sel:gameServerGroupName:RegisterGameServer' :: Text
gameServerGroupName = Text
a} :: RegisterGameServer)
registerGameServer_gameServerId :: Lens.Lens' RegisterGameServer Prelude.Text
registerGameServer_gameServerId :: (Text -> f Text) -> RegisterGameServer -> f RegisterGameServer
registerGameServer_gameServerId = (RegisterGameServer -> Text)
-> (RegisterGameServer -> Text -> RegisterGameServer)
-> Lens RegisterGameServer RegisterGameServer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterGameServer' {Text
gameServerId :: Text
$sel:gameServerId:RegisterGameServer' :: RegisterGameServer -> Text
gameServerId} -> Text
gameServerId) (\s :: RegisterGameServer
s@RegisterGameServer' {} Text
a -> RegisterGameServer
s {$sel:gameServerId:RegisterGameServer' :: Text
gameServerId = Text
a} :: RegisterGameServer)
registerGameServer_instanceId :: Lens.Lens' RegisterGameServer Prelude.Text
registerGameServer_instanceId :: (Text -> f Text) -> RegisterGameServer -> f RegisterGameServer
registerGameServer_instanceId = (RegisterGameServer -> Text)
-> (RegisterGameServer -> Text -> RegisterGameServer)
-> Lens RegisterGameServer RegisterGameServer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterGameServer' {Text
instanceId :: Text
$sel:instanceId:RegisterGameServer' :: RegisterGameServer -> Text
instanceId} -> Text
instanceId) (\s :: RegisterGameServer
s@RegisterGameServer' {} Text
a -> RegisterGameServer
s {$sel:instanceId:RegisterGameServer' :: Text
instanceId = Text
a} :: RegisterGameServer)
instance Core.AWSRequest RegisterGameServer where
type
AWSResponse RegisterGameServer =
RegisterGameServerResponse
request :: RegisterGameServer -> Request RegisterGameServer
request = Service -> RegisterGameServer -> Request RegisterGameServer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RegisterGameServer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterGameServer)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RegisterGameServer))
-> Logger
-> Service
-> Proxy RegisterGameServer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RegisterGameServer)))
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 -> RegisterGameServerResponse
RegisterGameServerResponse'
(Maybe GameServer -> Int -> RegisterGameServerResponse)
-> Either String (Maybe GameServer)
-> Either String (Int -> RegisterGameServerResponse)
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 -> RegisterGameServerResponse)
-> Either String Int -> Either String RegisterGameServerResponse
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 RegisterGameServer
instance Prelude.NFData RegisterGameServer
instance Core.ToHeaders RegisterGameServer where
toHeaders :: RegisterGameServer -> ResponseHeaders
toHeaders =
ResponseHeaders -> RegisterGameServer -> 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.RegisterGameServer" ::
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 RegisterGameServer where
toJSON :: RegisterGameServer -> Value
toJSON RegisterGameServer' {Maybe Text
Text
instanceId :: Text
gameServerId :: Text
gameServerGroupName :: Text
connectionInfo :: Maybe Text
gameServerData :: Maybe Text
$sel:instanceId:RegisterGameServer' :: RegisterGameServer -> Text
$sel:gameServerId:RegisterGameServer' :: RegisterGameServer -> Text
$sel:gameServerGroupName:RegisterGameServer' :: RegisterGameServer -> Text
$sel:connectionInfo:RegisterGameServer' :: RegisterGameServer -> Maybe Text
$sel:gameServerData:RegisterGameServer' :: RegisterGameServer -> 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
"ConnectionInfo" 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
connectionInfo,
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),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GameServerId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
gameServerId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InstanceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceId)
]
)
instance Core.ToPath RegisterGameServer where
toPath :: RegisterGameServer -> ByteString
toPath = ByteString -> RegisterGameServer -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RegisterGameServer where
toQuery :: RegisterGameServer -> QueryString
toQuery = QueryString -> RegisterGameServer -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RegisterGameServerResponse = RegisterGameServerResponse'
{
RegisterGameServerResponse -> Maybe GameServer
gameServer :: Prelude.Maybe GameServer,
RegisterGameServerResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RegisterGameServerResponse -> RegisterGameServerResponse -> Bool
(RegisterGameServerResponse -> RegisterGameServerResponse -> Bool)
-> (RegisterGameServerResponse
-> RegisterGameServerResponse -> Bool)
-> Eq RegisterGameServerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterGameServerResponse -> RegisterGameServerResponse -> Bool
$c/= :: RegisterGameServerResponse -> RegisterGameServerResponse -> Bool
== :: RegisterGameServerResponse -> RegisterGameServerResponse -> Bool
$c== :: RegisterGameServerResponse -> RegisterGameServerResponse -> Bool
Prelude.Eq, ReadPrec [RegisterGameServerResponse]
ReadPrec RegisterGameServerResponse
Int -> ReadS RegisterGameServerResponse
ReadS [RegisterGameServerResponse]
(Int -> ReadS RegisterGameServerResponse)
-> ReadS [RegisterGameServerResponse]
-> ReadPrec RegisterGameServerResponse
-> ReadPrec [RegisterGameServerResponse]
-> Read RegisterGameServerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterGameServerResponse]
$creadListPrec :: ReadPrec [RegisterGameServerResponse]
readPrec :: ReadPrec RegisterGameServerResponse
$creadPrec :: ReadPrec RegisterGameServerResponse
readList :: ReadS [RegisterGameServerResponse]
$creadList :: ReadS [RegisterGameServerResponse]
readsPrec :: Int -> ReadS RegisterGameServerResponse
$creadsPrec :: Int -> ReadS RegisterGameServerResponse
Prelude.Read, Int -> RegisterGameServerResponse -> ShowS
[RegisterGameServerResponse] -> ShowS
RegisterGameServerResponse -> String
(Int -> RegisterGameServerResponse -> ShowS)
-> (RegisterGameServerResponse -> String)
-> ([RegisterGameServerResponse] -> ShowS)
-> Show RegisterGameServerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterGameServerResponse] -> ShowS
$cshowList :: [RegisterGameServerResponse] -> ShowS
show :: RegisterGameServerResponse -> String
$cshow :: RegisterGameServerResponse -> String
showsPrec :: Int -> RegisterGameServerResponse -> ShowS
$cshowsPrec :: Int -> RegisterGameServerResponse -> ShowS
Prelude.Show, (forall x.
RegisterGameServerResponse -> Rep RegisterGameServerResponse x)
-> (forall x.
Rep RegisterGameServerResponse x -> RegisterGameServerResponse)
-> Generic RegisterGameServerResponse
forall x.
Rep RegisterGameServerResponse x -> RegisterGameServerResponse
forall x.
RegisterGameServerResponse -> Rep RegisterGameServerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterGameServerResponse x -> RegisterGameServerResponse
$cfrom :: forall x.
RegisterGameServerResponse -> Rep RegisterGameServerResponse x
Prelude.Generic)
newRegisterGameServerResponse ::
Prelude.Int ->
RegisterGameServerResponse
newRegisterGameServerResponse :: Int -> RegisterGameServerResponse
newRegisterGameServerResponse Int
pHttpStatus_ =
RegisterGameServerResponse' :: Maybe GameServer -> Int -> RegisterGameServerResponse
RegisterGameServerResponse'
{ $sel:gameServer:RegisterGameServerResponse' :: Maybe GameServer
gameServer =
Maybe GameServer
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RegisterGameServerResponse' :: Int
httpStatus = Int
pHttpStatus_
}
registerGameServerResponse_gameServer :: Lens.Lens' RegisterGameServerResponse (Prelude.Maybe GameServer)
registerGameServerResponse_gameServer :: (Maybe GameServer -> f (Maybe GameServer))
-> RegisterGameServerResponse -> f RegisterGameServerResponse
registerGameServerResponse_gameServer = (RegisterGameServerResponse -> Maybe GameServer)
-> (RegisterGameServerResponse
-> Maybe GameServer -> RegisterGameServerResponse)
-> Lens
RegisterGameServerResponse
RegisterGameServerResponse
(Maybe GameServer)
(Maybe GameServer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterGameServerResponse' {Maybe GameServer
gameServer :: Maybe GameServer
$sel:gameServer:RegisterGameServerResponse' :: RegisterGameServerResponse -> Maybe GameServer
gameServer} -> Maybe GameServer
gameServer) (\s :: RegisterGameServerResponse
s@RegisterGameServerResponse' {} Maybe GameServer
a -> RegisterGameServerResponse
s {$sel:gameServer:RegisterGameServerResponse' :: Maybe GameServer
gameServer = Maybe GameServer
a} :: RegisterGameServerResponse)
registerGameServerResponse_httpStatus :: Lens.Lens' RegisterGameServerResponse Prelude.Int
registerGameServerResponse_httpStatus :: (Int -> f Int)
-> RegisterGameServerResponse -> f RegisterGameServerResponse
registerGameServerResponse_httpStatus = (RegisterGameServerResponse -> Int)
-> (RegisterGameServerResponse
-> Int -> RegisterGameServerResponse)
-> Lens
RegisterGameServerResponse RegisterGameServerResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterGameServerResponse' {Int
httpStatus :: Int
$sel:httpStatus:RegisterGameServerResponse' :: RegisterGameServerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RegisterGameServerResponse
s@RegisterGameServerResponse' {} Int
a -> RegisterGameServerResponse
s {$sel:httpStatus:RegisterGameServerResponse' :: Int
httpStatus = Int
a} :: RegisterGameServerResponse)
instance Prelude.NFData RegisterGameServerResponse