{-# 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.StartMatchmaking
(
StartMatchmaking (..),
newStartMatchmaking,
startMatchmaking_ticketId,
startMatchmaking_configurationName,
startMatchmaking_players,
StartMatchmakingResponse (..),
newStartMatchmakingResponse,
startMatchmakingResponse_matchmakingTicket,
startMatchmakingResponse_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 StartMatchmaking = StartMatchmaking'
{
StartMatchmaking -> Maybe Text
ticketId :: Prelude.Maybe Prelude.Text,
StartMatchmaking -> Text
configurationName :: Prelude.Text,
StartMatchmaking -> [Player]
players :: [Player]
}
deriving (StartMatchmaking -> StartMatchmaking -> Bool
(StartMatchmaking -> StartMatchmaking -> Bool)
-> (StartMatchmaking -> StartMatchmaking -> Bool)
-> Eq StartMatchmaking
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartMatchmaking -> StartMatchmaking -> Bool
$c/= :: StartMatchmaking -> StartMatchmaking -> Bool
== :: StartMatchmaking -> StartMatchmaking -> Bool
$c== :: StartMatchmaking -> StartMatchmaking -> Bool
Prelude.Eq, ReadPrec [StartMatchmaking]
ReadPrec StartMatchmaking
Int -> ReadS StartMatchmaking
ReadS [StartMatchmaking]
(Int -> ReadS StartMatchmaking)
-> ReadS [StartMatchmaking]
-> ReadPrec StartMatchmaking
-> ReadPrec [StartMatchmaking]
-> Read StartMatchmaking
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartMatchmaking]
$creadListPrec :: ReadPrec [StartMatchmaking]
readPrec :: ReadPrec StartMatchmaking
$creadPrec :: ReadPrec StartMatchmaking
readList :: ReadS [StartMatchmaking]
$creadList :: ReadS [StartMatchmaking]
readsPrec :: Int -> ReadS StartMatchmaking
$creadsPrec :: Int -> ReadS StartMatchmaking
Prelude.Read, Int -> StartMatchmaking -> ShowS
[StartMatchmaking] -> ShowS
StartMatchmaking -> String
(Int -> StartMatchmaking -> ShowS)
-> (StartMatchmaking -> String)
-> ([StartMatchmaking] -> ShowS)
-> Show StartMatchmaking
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartMatchmaking] -> ShowS
$cshowList :: [StartMatchmaking] -> ShowS
show :: StartMatchmaking -> String
$cshow :: StartMatchmaking -> String
showsPrec :: Int -> StartMatchmaking -> ShowS
$cshowsPrec :: Int -> StartMatchmaking -> ShowS
Prelude.Show, (forall x. StartMatchmaking -> Rep StartMatchmaking x)
-> (forall x. Rep StartMatchmaking x -> StartMatchmaking)
-> Generic StartMatchmaking
forall x. Rep StartMatchmaking x -> StartMatchmaking
forall x. StartMatchmaking -> Rep StartMatchmaking x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartMatchmaking x -> StartMatchmaking
$cfrom :: forall x. StartMatchmaking -> Rep StartMatchmaking x
Prelude.Generic)
newStartMatchmaking ::
Prelude.Text ->
StartMatchmaking
newStartMatchmaking :: Text -> StartMatchmaking
newStartMatchmaking Text
pConfigurationName_ =
StartMatchmaking' :: Maybe Text -> Text -> [Player] -> StartMatchmaking
StartMatchmaking'
{ $sel:ticketId:StartMatchmaking' :: Maybe Text
ticketId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:configurationName:StartMatchmaking' :: Text
configurationName = Text
pConfigurationName_,
$sel:players:StartMatchmaking' :: [Player]
players = [Player]
forall a. Monoid a => a
Prelude.mempty
}
startMatchmaking_ticketId :: Lens.Lens' StartMatchmaking (Prelude.Maybe Prelude.Text)
startMatchmaking_ticketId :: (Maybe Text -> f (Maybe Text))
-> StartMatchmaking -> f StartMatchmaking
startMatchmaking_ticketId = (StartMatchmaking -> Maybe Text)
-> (StartMatchmaking -> Maybe Text -> StartMatchmaking)
-> Lens StartMatchmaking StartMatchmaking (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMatchmaking' {Maybe Text
ticketId :: Maybe Text
$sel:ticketId:StartMatchmaking' :: StartMatchmaking -> Maybe Text
ticketId} -> Maybe Text
ticketId) (\s :: StartMatchmaking
s@StartMatchmaking' {} Maybe Text
a -> StartMatchmaking
s {$sel:ticketId:StartMatchmaking' :: Maybe Text
ticketId = Maybe Text
a} :: StartMatchmaking)
startMatchmaking_configurationName :: Lens.Lens' StartMatchmaking Prelude.Text
startMatchmaking_configurationName :: (Text -> f Text) -> StartMatchmaking -> f StartMatchmaking
startMatchmaking_configurationName = (StartMatchmaking -> Text)
-> (StartMatchmaking -> Text -> StartMatchmaking)
-> Lens StartMatchmaking StartMatchmaking Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMatchmaking' {Text
configurationName :: Text
$sel:configurationName:StartMatchmaking' :: StartMatchmaking -> Text
configurationName} -> Text
configurationName) (\s :: StartMatchmaking
s@StartMatchmaking' {} Text
a -> StartMatchmaking
s {$sel:configurationName:StartMatchmaking' :: Text
configurationName = Text
a} :: StartMatchmaking)
startMatchmaking_players :: Lens.Lens' StartMatchmaking [Player]
startMatchmaking_players :: ([Player] -> f [Player]) -> StartMatchmaking -> f StartMatchmaking
startMatchmaking_players = (StartMatchmaking -> [Player])
-> (StartMatchmaking -> [Player] -> StartMatchmaking)
-> Lens StartMatchmaking StartMatchmaking [Player] [Player]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMatchmaking' {[Player]
players :: [Player]
$sel:players:StartMatchmaking' :: StartMatchmaking -> [Player]
players} -> [Player]
players) (\s :: StartMatchmaking
s@StartMatchmaking' {} [Player]
a -> StartMatchmaking
s {$sel:players:StartMatchmaking' :: [Player]
players = [Player]
a} :: StartMatchmaking) (([Player] -> f [Player])
-> StartMatchmaking -> f StartMatchmaking)
-> (([Player] -> f [Player]) -> [Player] -> f [Player])
-> ([Player] -> f [Player])
-> StartMatchmaking
-> f StartMatchmaking
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Player] -> f [Player]) -> [Player] -> f [Player]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest StartMatchmaking where
type
AWSResponse StartMatchmaking =
StartMatchmakingResponse
request :: StartMatchmaking -> Request StartMatchmaking
request = Service -> StartMatchmaking -> Request StartMatchmaking
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartMatchmaking
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartMatchmaking)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartMatchmaking))
-> Logger
-> Service
-> Proxy StartMatchmaking
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StartMatchmaking)))
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 MatchmakingTicket -> Int -> StartMatchmakingResponse
StartMatchmakingResponse'
(Maybe MatchmakingTicket -> Int -> StartMatchmakingResponse)
-> Either String (Maybe MatchmakingTicket)
-> Either String (Int -> StartMatchmakingResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe MatchmakingTicket)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"MatchmakingTicket")
Either String (Int -> StartMatchmakingResponse)
-> Either String Int -> Either String StartMatchmakingResponse
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 StartMatchmaking
instance Prelude.NFData StartMatchmaking
instance Core.ToHeaders StartMatchmaking where
toHeaders :: StartMatchmaking -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartMatchmaking -> 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.StartMatchmaking" :: 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 StartMatchmaking where
toJSON :: StartMatchmaking -> Value
toJSON StartMatchmaking' {[Player]
Maybe Text
Text
players :: [Player]
configurationName :: Text
ticketId :: Maybe Text
$sel:players:StartMatchmaking' :: StartMatchmaking -> [Player]
$sel:configurationName:StartMatchmaking' :: StartMatchmaking -> Text
$sel:ticketId:StartMatchmaking' :: StartMatchmaking -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"TicketId" 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
ticketId,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"ConfigurationName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
configurationName),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Players" Text -> [Player] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Player]
players)
]
)
instance Core.ToPath StartMatchmaking where
toPath :: StartMatchmaking -> ByteString
toPath = ByteString -> StartMatchmaking -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StartMatchmaking where
toQuery :: StartMatchmaking -> QueryString
toQuery = QueryString -> StartMatchmaking -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartMatchmakingResponse = StartMatchmakingResponse'
{
StartMatchmakingResponse -> Maybe MatchmakingTicket
matchmakingTicket :: Prelude.Maybe MatchmakingTicket,
StartMatchmakingResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartMatchmakingResponse -> StartMatchmakingResponse -> Bool
(StartMatchmakingResponse -> StartMatchmakingResponse -> Bool)
-> (StartMatchmakingResponse -> StartMatchmakingResponse -> Bool)
-> Eq StartMatchmakingResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartMatchmakingResponse -> StartMatchmakingResponse -> Bool
$c/= :: StartMatchmakingResponse -> StartMatchmakingResponse -> Bool
== :: StartMatchmakingResponse -> StartMatchmakingResponse -> Bool
$c== :: StartMatchmakingResponse -> StartMatchmakingResponse -> Bool
Prelude.Eq, ReadPrec [StartMatchmakingResponse]
ReadPrec StartMatchmakingResponse
Int -> ReadS StartMatchmakingResponse
ReadS [StartMatchmakingResponse]
(Int -> ReadS StartMatchmakingResponse)
-> ReadS [StartMatchmakingResponse]
-> ReadPrec StartMatchmakingResponse
-> ReadPrec [StartMatchmakingResponse]
-> Read StartMatchmakingResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartMatchmakingResponse]
$creadListPrec :: ReadPrec [StartMatchmakingResponse]
readPrec :: ReadPrec StartMatchmakingResponse
$creadPrec :: ReadPrec StartMatchmakingResponse
readList :: ReadS [StartMatchmakingResponse]
$creadList :: ReadS [StartMatchmakingResponse]
readsPrec :: Int -> ReadS StartMatchmakingResponse
$creadsPrec :: Int -> ReadS StartMatchmakingResponse
Prelude.Read, Int -> StartMatchmakingResponse -> ShowS
[StartMatchmakingResponse] -> ShowS
StartMatchmakingResponse -> String
(Int -> StartMatchmakingResponse -> ShowS)
-> (StartMatchmakingResponse -> String)
-> ([StartMatchmakingResponse] -> ShowS)
-> Show StartMatchmakingResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartMatchmakingResponse] -> ShowS
$cshowList :: [StartMatchmakingResponse] -> ShowS
show :: StartMatchmakingResponse -> String
$cshow :: StartMatchmakingResponse -> String
showsPrec :: Int -> StartMatchmakingResponse -> ShowS
$cshowsPrec :: Int -> StartMatchmakingResponse -> ShowS
Prelude.Show, (forall x.
StartMatchmakingResponse -> Rep StartMatchmakingResponse x)
-> (forall x.
Rep StartMatchmakingResponse x -> StartMatchmakingResponse)
-> Generic StartMatchmakingResponse
forall x.
Rep StartMatchmakingResponse x -> StartMatchmakingResponse
forall x.
StartMatchmakingResponse -> Rep StartMatchmakingResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartMatchmakingResponse x -> StartMatchmakingResponse
$cfrom :: forall x.
StartMatchmakingResponse -> Rep StartMatchmakingResponse x
Prelude.Generic)
newStartMatchmakingResponse ::
Prelude.Int ->
StartMatchmakingResponse
newStartMatchmakingResponse :: Int -> StartMatchmakingResponse
newStartMatchmakingResponse Int
pHttpStatus_ =
StartMatchmakingResponse' :: Maybe MatchmakingTicket -> Int -> StartMatchmakingResponse
StartMatchmakingResponse'
{ $sel:matchmakingTicket:StartMatchmakingResponse' :: Maybe MatchmakingTicket
matchmakingTicket =
Maybe MatchmakingTicket
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartMatchmakingResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startMatchmakingResponse_matchmakingTicket :: Lens.Lens' StartMatchmakingResponse (Prelude.Maybe MatchmakingTicket)
startMatchmakingResponse_matchmakingTicket :: (Maybe MatchmakingTicket -> f (Maybe MatchmakingTicket))
-> StartMatchmakingResponse -> f StartMatchmakingResponse
startMatchmakingResponse_matchmakingTicket = (StartMatchmakingResponse -> Maybe MatchmakingTicket)
-> (StartMatchmakingResponse
-> Maybe MatchmakingTicket -> StartMatchmakingResponse)
-> Lens
StartMatchmakingResponse
StartMatchmakingResponse
(Maybe MatchmakingTicket)
(Maybe MatchmakingTicket)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMatchmakingResponse' {Maybe MatchmakingTicket
matchmakingTicket :: Maybe MatchmakingTicket
$sel:matchmakingTicket:StartMatchmakingResponse' :: StartMatchmakingResponse -> Maybe MatchmakingTicket
matchmakingTicket} -> Maybe MatchmakingTicket
matchmakingTicket) (\s :: StartMatchmakingResponse
s@StartMatchmakingResponse' {} Maybe MatchmakingTicket
a -> StartMatchmakingResponse
s {$sel:matchmakingTicket:StartMatchmakingResponse' :: Maybe MatchmakingTicket
matchmakingTicket = Maybe MatchmakingTicket
a} :: StartMatchmakingResponse)
startMatchmakingResponse_httpStatus :: Lens.Lens' StartMatchmakingResponse Prelude.Int
startMatchmakingResponse_httpStatus :: (Int -> f Int)
-> StartMatchmakingResponse -> f StartMatchmakingResponse
startMatchmakingResponse_httpStatus = (StartMatchmakingResponse -> Int)
-> (StartMatchmakingResponse -> Int -> StartMatchmakingResponse)
-> Lens StartMatchmakingResponse StartMatchmakingResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartMatchmakingResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartMatchmakingResponse' :: StartMatchmakingResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartMatchmakingResponse
s@StartMatchmakingResponse' {} Int
a -> StartMatchmakingResponse
s {$sel:httpStatus:StartMatchmakingResponse' :: Int
httpStatus = Int
a} :: StartMatchmakingResponse)
instance Prelude.NFData StartMatchmakingResponse