{-# 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.DescribeGameServer
(
DescribeGameServer (..),
newDescribeGameServer,
describeGameServer_gameServerGroupName,
describeGameServer_gameServerId,
DescribeGameServerResponse (..),
newDescribeGameServerResponse,
describeGameServerResponse_gameServer,
describeGameServerResponse_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 DescribeGameServer = DescribeGameServer'
{
DescribeGameServer -> Text
gameServerGroupName :: Prelude.Text,
DescribeGameServer -> Text
gameServerId :: Prelude.Text
}
deriving (DescribeGameServer -> DescribeGameServer -> Bool
(DescribeGameServer -> DescribeGameServer -> Bool)
-> (DescribeGameServer -> DescribeGameServer -> Bool)
-> Eq DescribeGameServer
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeGameServer -> DescribeGameServer -> Bool
$c/= :: DescribeGameServer -> DescribeGameServer -> Bool
== :: DescribeGameServer -> DescribeGameServer -> Bool
$c== :: DescribeGameServer -> DescribeGameServer -> Bool
Prelude.Eq, ReadPrec [DescribeGameServer]
ReadPrec DescribeGameServer
Int -> ReadS DescribeGameServer
ReadS [DescribeGameServer]
(Int -> ReadS DescribeGameServer)
-> ReadS [DescribeGameServer]
-> ReadPrec DescribeGameServer
-> ReadPrec [DescribeGameServer]
-> Read DescribeGameServer
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeGameServer]
$creadListPrec :: ReadPrec [DescribeGameServer]
readPrec :: ReadPrec DescribeGameServer
$creadPrec :: ReadPrec DescribeGameServer
readList :: ReadS [DescribeGameServer]
$creadList :: ReadS [DescribeGameServer]
readsPrec :: Int -> ReadS DescribeGameServer
$creadsPrec :: Int -> ReadS DescribeGameServer
Prelude.Read, Int -> DescribeGameServer -> ShowS
[DescribeGameServer] -> ShowS
DescribeGameServer -> String
(Int -> DescribeGameServer -> ShowS)
-> (DescribeGameServer -> String)
-> ([DescribeGameServer] -> ShowS)
-> Show DescribeGameServer
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeGameServer] -> ShowS
$cshowList :: [DescribeGameServer] -> ShowS
show :: DescribeGameServer -> String
$cshow :: DescribeGameServer -> String
showsPrec :: Int -> DescribeGameServer -> ShowS
$cshowsPrec :: Int -> DescribeGameServer -> ShowS
Prelude.Show, (forall x. DescribeGameServer -> Rep DescribeGameServer x)
-> (forall x. Rep DescribeGameServer x -> DescribeGameServer)
-> Generic DescribeGameServer
forall x. Rep DescribeGameServer x -> DescribeGameServer
forall x. DescribeGameServer -> Rep DescribeGameServer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DescribeGameServer x -> DescribeGameServer
$cfrom :: forall x. DescribeGameServer -> Rep DescribeGameServer x
Prelude.Generic)
newDescribeGameServer ::
Prelude.Text ->
Prelude.Text ->
DescribeGameServer
newDescribeGameServer :: Text -> Text -> DescribeGameServer
newDescribeGameServer
Text
pGameServerGroupName_
Text
pGameServerId_ =
DescribeGameServer' :: Text -> Text -> DescribeGameServer
DescribeGameServer'
{ $sel:gameServerGroupName:DescribeGameServer' :: Text
gameServerGroupName =
Text
pGameServerGroupName_,
$sel:gameServerId:DescribeGameServer' :: Text
gameServerId = Text
pGameServerId_
}
describeGameServer_gameServerGroupName :: Lens.Lens' DescribeGameServer Prelude.Text
describeGameServer_gameServerGroupName :: (Text -> f Text) -> DescribeGameServer -> f DescribeGameServer
describeGameServer_gameServerGroupName = (DescribeGameServer -> Text)
-> (DescribeGameServer -> Text -> DescribeGameServer)
-> Lens DescribeGameServer DescribeGameServer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGameServer' {Text
gameServerGroupName :: Text
$sel:gameServerGroupName:DescribeGameServer' :: DescribeGameServer -> Text
gameServerGroupName} -> Text
gameServerGroupName) (\s :: DescribeGameServer
s@DescribeGameServer' {} Text
a -> DescribeGameServer
s {$sel:gameServerGroupName:DescribeGameServer' :: Text
gameServerGroupName = Text
a} :: DescribeGameServer)
describeGameServer_gameServerId :: Lens.Lens' DescribeGameServer Prelude.Text
describeGameServer_gameServerId :: (Text -> f Text) -> DescribeGameServer -> f DescribeGameServer
describeGameServer_gameServerId = (DescribeGameServer -> Text)
-> (DescribeGameServer -> Text -> DescribeGameServer)
-> Lens DescribeGameServer DescribeGameServer Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGameServer' {Text
gameServerId :: Text
$sel:gameServerId:DescribeGameServer' :: DescribeGameServer -> Text
gameServerId} -> Text
gameServerId) (\s :: DescribeGameServer
s@DescribeGameServer' {} Text
a -> DescribeGameServer
s {$sel:gameServerId:DescribeGameServer' :: Text
gameServerId = Text
a} :: DescribeGameServer)
instance Core.AWSRequest DescribeGameServer where
type
AWSResponse DescribeGameServer =
DescribeGameServerResponse
request :: DescribeGameServer -> Request DescribeGameServer
request = Service -> DescribeGameServer -> Request DescribeGameServer
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeGameServer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeGameServer)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeGameServer))
-> Logger
-> Service
-> Proxy DescribeGameServer
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeGameServer)))
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 -> DescribeGameServerResponse
DescribeGameServerResponse'
(Maybe GameServer -> Int -> DescribeGameServerResponse)
-> Either String (Maybe GameServer)
-> Either String (Int -> DescribeGameServerResponse)
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 -> DescribeGameServerResponse)
-> Either String Int -> Either String DescribeGameServerResponse
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 DescribeGameServer
instance Prelude.NFData DescribeGameServer
instance Core.ToHeaders DescribeGameServer where
toHeaders :: DescribeGameServer -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeGameServer -> 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.DescribeGameServer" ::
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 DescribeGameServer where
toJSON :: DescribeGameServer -> Value
toJSON DescribeGameServer' {Text
gameServerId :: Text
gameServerGroupName :: Text
$sel:gameServerId:DescribeGameServer' :: DescribeGameServer -> Text
$sel:gameServerGroupName:DescribeGameServer' :: DescribeGameServer -> 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
"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)
]
)
instance Core.ToPath DescribeGameServer where
toPath :: DescribeGameServer -> ByteString
toPath = ByteString -> DescribeGameServer -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DescribeGameServer where
toQuery :: DescribeGameServer -> QueryString
toQuery = QueryString -> DescribeGameServer -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeGameServerResponse = DescribeGameServerResponse'
{
DescribeGameServerResponse -> Maybe GameServer
gameServer :: Prelude.Maybe GameServer,
DescribeGameServerResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeGameServerResponse -> DescribeGameServerResponse -> Bool
(DescribeGameServerResponse -> DescribeGameServerResponse -> Bool)
-> (DescribeGameServerResponse
-> DescribeGameServerResponse -> Bool)
-> Eq DescribeGameServerResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeGameServerResponse -> DescribeGameServerResponse -> Bool
$c/= :: DescribeGameServerResponse -> DescribeGameServerResponse -> Bool
== :: DescribeGameServerResponse -> DescribeGameServerResponse -> Bool
$c== :: DescribeGameServerResponse -> DescribeGameServerResponse -> Bool
Prelude.Eq, ReadPrec [DescribeGameServerResponse]
ReadPrec DescribeGameServerResponse
Int -> ReadS DescribeGameServerResponse
ReadS [DescribeGameServerResponse]
(Int -> ReadS DescribeGameServerResponse)
-> ReadS [DescribeGameServerResponse]
-> ReadPrec DescribeGameServerResponse
-> ReadPrec [DescribeGameServerResponse]
-> Read DescribeGameServerResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeGameServerResponse]
$creadListPrec :: ReadPrec [DescribeGameServerResponse]
readPrec :: ReadPrec DescribeGameServerResponse
$creadPrec :: ReadPrec DescribeGameServerResponse
readList :: ReadS [DescribeGameServerResponse]
$creadList :: ReadS [DescribeGameServerResponse]
readsPrec :: Int -> ReadS DescribeGameServerResponse
$creadsPrec :: Int -> ReadS DescribeGameServerResponse
Prelude.Read, Int -> DescribeGameServerResponse -> ShowS
[DescribeGameServerResponse] -> ShowS
DescribeGameServerResponse -> String
(Int -> DescribeGameServerResponse -> ShowS)
-> (DescribeGameServerResponse -> String)
-> ([DescribeGameServerResponse] -> ShowS)
-> Show DescribeGameServerResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeGameServerResponse] -> ShowS
$cshowList :: [DescribeGameServerResponse] -> ShowS
show :: DescribeGameServerResponse -> String
$cshow :: DescribeGameServerResponse -> String
showsPrec :: Int -> DescribeGameServerResponse -> ShowS
$cshowsPrec :: Int -> DescribeGameServerResponse -> ShowS
Prelude.Show, (forall x.
DescribeGameServerResponse -> Rep DescribeGameServerResponse x)
-> (forall x.
Rep DescribeGameServerResponse x -> DescribeGameServerResponse)
-> Generic DescribeGameServerResponse
forall x.
Rep DescribeGameServerResponse x -> DescribeGameServerResponse
forall x.
DescribeGameServerResponse -> Rep DescribeGameServerResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeGameServerResponse x -> DescribeGameServerResponse
$cfrom :: forall x.
DescribeGameServerResponse -> Rep DescribeGameServerResponse x
Prelude.Generic)
newDescribeGameServerResponse ::
Prelude.Int ->
DescribeGameServerResponse
newDescribeGameServerResponse :: Int -> DescribeGameServerResponse
newDescribeGameServerResponse Int
pHttpStatus_ =
DescribeGameServerResponse' :: Maybe GameServer -> Int -> DescribeGameServerResponse
DescribeGameServerResponse'
{ $sel:gameServer:DescribeGameServerResponse' :: Maybe GameServer
gameServer =
Maybe GameServer
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeGameServerResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeGameServerResponse_gameServer :: Lens.Lens' DescribeGameServerResponse (Prelude.Maybe GameServer)
describeGameServerResponse_gameServer :: (Maybe GameServer -> f (Maybe GameServer))
-> DescribeGameServerResponse -> f DescribeGameServerResponse
describeGameServerResponse_gameServer = (DescribeGameServerResponse -> Maybe GameServer)
-> (DescribeGameServerResponse
-> Maybe GameServer -> DescribeGameServerResponse)
-> Lens
DescribeGameServerResponse
DescribeGameServerResponse
(Maybe GameServer)
(Maybe GameServer)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGameServerResponse' {Maybe GameServer
gameServer :: Maybe GameServer
$sel:gameServer:DescribeGameServerResponse' :: DescribeGameServerResponse -> Maybe GameServer
gameServer} -> Maybe GameServer
gameServer) (\s :: DescribeGameServerResponse
s@DescribeGameServerResponse' {} Maybe GameServer
a -> DescribeGameServerResponse
s {$sel:gameServer:DescribeGameServerResponse' :: Maybe GameServer
gameServer = Maybe GameServer
a} :: DescribeGameServerResponse)
describeGameServerResponse_httpStatus :: Lens.Lens' DescribeGameServerResponse Prelude.Int
describeGameServerResponse_httpStatus :: (Int -> f Int)
-> DescribeGameServerResponse -> f DescribeGameServerResponse
describeGameServerResponse_httpStatus = (DescribeGameServerResponse -> Int)
-> (DescribeGameServerResponse
-> Int -> DescribeGameServerResponse)
-> Lens
DescribeGameServerResponse DescribeGameServerResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeGameServerResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeGameServerResponse' :: DescribeGameServerResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeGameServerResponse
s@DescribeGameServerResponse' {} Int
a -> DescribeGameServerResponse
s {$sel:httpStatus:DescribeGameServerResponse' :: Int
httpStatus = Int
a} :: DescribeGameServerResponse)
instance Prelude.NFData DescribeGameServerResponse