{-# 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.AcceptMatch
(
AcceptMatch (..),
newAcceptMatch,
acceptMatch_ticketId,
acceptMatch_playerIds,
acceptMatch_acceptanceType,
AcceptMatchResponse (..),
newAcceptMatchResponse,
acceptMatchResponse_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 AcceptMatch = AcceptMatch'
{
AcceptMatch -> Text
ticketId :: Prelude.Text,
AcceptMatch -> [Text]
playerIds :: [Prelude.Text],
AcceptMatch -> AcceptanceType
acceptanceType :: AcceptanceType
}
deriving (AcceptMatch -> AcceptMatch -> Bool
(AcceptMatch -> AcceptMatch -> Bool)
-> (AcceptMatch -> AcceptMatch -> Bool) -> Eq AcceptMatch
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptMatch -> AcceptMatch -> Bool
$c/= :: AcceptMatch -> AcceptMatch -> Bool
== :: AcceptMatch -> AcceptMatch -> Bool
$c== :: AcceptMatch -> AcceptMatch -> Bool
Prelude.Eq, ReadPrec [AcceptMatch]
ReadPrec AcceptMatch
Int -> ReadS AcceptMatch
ReadS [AcceptMatch]
(Int -> ReadS AcceptMatch)
-> ReadS [AcceptMatch]
-> ReadPrec AcceptMatch
-> ReadPrec [AcceptMatch]
-> Read AcceptMatch
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptMatch]
$creadListPrec :: ReadPrec [AcceptMatch]
readPrec :: ReadPrec AcceptMatch
$creadPrec :: ReadPrec AcceptMatch
readList :: ReadS [AcceptMatch]
$creadList :: ReadS [AcceptMatch]
readsPrec :: Int -> ReadS AcceptMatch
$creadsPrec :: Int -> ReadS AcceptMatch
Prelude.Read, Int -> AcceptMatch -> ShowS
[AcceptMatch] -> ShowS
AcceptMatch -> String
(Int -> AcceptMatch -> ShowS)
-> (AcceptMatch -> String)
-> ([AcceptMatch] -> ShowS)
-> Show AcceptMatch
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptMatch] -> ShowS
$cshowList :: [AcceptMatch] -> ShowS
show :: AcceptMatch -> String
$cshow :: AcceptMatch -> String
showsPrec :: Int -> AcceptMatch -> ShowS
$cshowsPrec :: Int -> AcceptMatch -> ShowS
Prelude.Show, (forall x. AcceptMatch -> Rep AcceptMatch x)
-> (forall x. Rep AcceptMatch x -> AcceptMatch)
-> Generic AcceptMatch
forall x. Rep AcceptMatch x -> AcceptMatch
forall x. AcceptMatch -> Rep AcceptMatch x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AcceptMatch x -> AcceptMatch
$cfrom :: forall x. AcceptMatch -> Rep AcceptMatch x
Prelude.Generic)
newAcceptMatch ::
Prelude.Text ->
AcceptanceType ->
AcceptMatch
newAcceptMatch :: Text -> AcceptanceType -> AcceptMatch
newAcceptMatch Text
pTicketId_ AcceptanceType
pAcceptanceType_ =
AcceptMatch' :: Text -> [Text] -> AcceptanceType -> AcceptMatch
AcceptMatch'
{ $sel:ticketId:AcceptMatch' :: Text
ticketId = Text
pTicketId_,
$sel:playerIds:AcceptMatch' :: [Text]
playerIds = [Text]
forall a. Monoid a => a
Prelude.mempty,
$sel:acceptanceType:AcceptMatch' :: AcceptanceType
acceptanceType = AcceptanceType
pAcceptanceType_
}
acceptMatch_ticketId :: Lens.Lens' AcceptMatch Prelude.Text
acceptMatch_ticketId :: (Text -> f Text) -> AcceptMatch -> f AcceptMatch
acceptMatch_ticketId = (AcceptMatch -> Text)
-> (AcceptMatch -> Text -> AcceptMatch)
-> Lens AcceptMatch AcceptMatch Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptMatch' {Text
ticketId :: Text
$sel:ticketId:AcceptMatch' :: AcceptMatch -> Text
ticketId} -> Text
ticketId) (\s :: AcceptMatch
s@AcceptMatch' {} Text
a -> AcceptMatch
s {$sel:ticketId:AcceptMatch' :: Text
ticketId = Text
a} :: AcceptMatch)
acceptMatch_playerIds :: Lens.Lens' AcceptMatch [Prelude.Text]
acceptMatch_playerIds :: ([Text] -> f [Text]) -> AcceptMatch -> f AcceptMatch
acceptMatch_playerIds = (AcceptMatch -> [Text])
-> (AcceptMatch -> [Text] -> AcceptMatch)
-> Lens AcceptMatch AcceptMatch [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptMatch' {[Text]
playerIds :: [Text]
$sel:playerIds:AcceptMatch' :: AcceptMatch -> [Text]
playerIds} -> [Text]
playerIds) (\s :: AcceptMatch
s@AcceptMatch' {} [Text]
a -> AcceptMatch
s {$sel:playerIds:AcceptMatch' :: [Text]
playerIds = [Text]
a} :: AcceptMatch) (([Text] -> f [Text]) -> AcceptMatch -> f AcceptMatch)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> AcceptMatch
-> f AcceptMatch
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
acceptMatch_acceptanceType :: Lens.Lens' AcceptMatch AcceptanceType
acceptMatch_acceptanceType :: (AcceptanceType -> f AcceptanceType)
-> AcceptMatch -> f AcceptMatch
acceptMatch_acceptanceType = (AcceptMatch -> AcceptanceType)
-> (AcceptMatch -> AcceptanceType -> AcceptMatch)
-> Lens AcceptMatch AcceptMatch AcceptanceType AcceptanceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptMatch' {AcceptanceType
acceptanceType :: AcceptanceType
$sel:acceptanceType:AcceptMatch' :: AcceptMatch -> AcceptanceType
acceptanceType} -> AcceptanceType
acceptanceType) (\s :: AcceptMatch
s@AcceptMatch' {} AcceptanceType
a -> AcceptMatch
s {$sel:acceptanceType:AcceptMatch' :: AcceptanceType
acceptanceType = AcceptanceType
a} :: AcceptMatch)
instance Core.AWSRequest AcceptMatch where
type AWSResponse AcceptMatch = AcceptMatchResponse
request :: AcceptMatch -> Request AcceptMatch
request = Service -> AcceptMatch -> Request AcceptMatch
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AcceptMatch
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AcceptMatch)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse AcceptMatch))
-> Logger
-> Service
-> Proxy AcceptMatch
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse AcceptMatch)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> AcceptMatchResponse
AcceptMatchResponse'
(Int -> AcceptMatchResponse)
-> Either String Int -> Either String AcceptMatchResponse
forall (f :: * -> *) a b. Functor 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 AcceptMatch
instance Prelude.NFData AcceptMatch
instance Core.ToHeaders AcceptMatch where
toHeaders :: AcceptMatch -> ResponseHeaders
toHeaders =
ResponseHeaders -> AcceptMatch -> 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.AcceptMatch" :: 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 AcceptMatch where
toJSON :: AcceptMatch -> Value
toJSON AcceptMatch' {[Text]
Text
AcceptanceType
acceptanceType :: AcceptanceType
playerIds :: [Text]
ticketId :: Text
$sel:acceptanceType:AcceptMatch' :: AcceptMatch -> AcceptanceType
$sel:playerIds:AcceptMatch' :: AcceptMatch -> [Text]
$sel:ticketId:AcceptMatch' :: AcceptMatch -> 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
"TicketId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
ticketId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PlayerIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
playerIds),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"AcceptanceType" Text -> AcceptanceType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AcceptanceType
acceptanceType)
]
)
instance Core.ToPath AcceptMatch where
toPath :: AcceptMatch -> ByteString
toPath = ByteString -> AcceptMatch -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AcceptMatch where
toQuery :: AcceptMatch -> QueryString
toQuery = QueryString -> AcceptMatch -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AcceptMatchResponse = AcceptMatchResponse'
{
AcceptMatchResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AcceptMatchResponse -> AcceptMatchResponse -> Bool
(AcceptMatchResponse -> AcceptMatchResponse -> Bool)
-> (AcceptMatchResponse -> AcceptMatchResponse -> Bool)
-> Eq AcceptMatchResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceptMatchResponse -> AcceptMatchResponse -> Bool
$c/= :: AcceptMatchResponse -> AcceptMatchResponse -> Bool
== :: AcceptMatchResponse -> AcceptMatchResponse -> Bool
$c== :: AcceptMatchResponse -> AcceptMatchResponse -> Bool
Prelude.Eq, ReadPrec [AcceptMatchResponse]
ReadPrec AcceptMatchResponse
Int -> ReadS AcceptMatchResponse
ReadS [AcceptMatchResponse]
(Int -> ReadS AcceptMatchResponse)
-> ReadS [AcceptMatchResponse]
-> ReadPrec AcceptMatchResponse
-> ReadPrec [AcceptMatchResponse]
-> Read AcceptMatchResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceptMatchResponse]
$creadListPrec :: ReadPrec [AcceptMatchResponse]
readPrec :: ReadPrec AcceptMatchResponse
$creadPrec :: ReadPrec AcceptMatchResponse
readList :: ReadS [AcceptMatchResponse]
$creadList :: ReadS [AcceptMatchResponse]
readsPrec :: Int -> ReadS AcceptMatchResponse
$creadsPrec :: Int -> ReadS AcceptMatchResponse
Prelude.Read, Int -> AcceptMatchResponse -> ShowS
[AcceptMatchResponse] -> ShowS
AcceptMatchResponse -> String
(Int -> AcceptMatchResponse -> ShowS)
-> (AcceptMatchResponse -> String)
-> ([AcceptMatchResponse] -> ShowS)
-> Show AcceptMatchResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceptMatchResponse] -> ShowS
$cshowList :: [AcceptMatchResponse] -> ShowS
show :: AcceptMatchResponse -> String
$cshow :: AcceptMatchResponse -> String
showsPrec :: Int -> AcceptMatchResponse -> ShowS
$cshowsPrec :: Int -> AcceptMatchResponse -> ShowS
Prelude.Show, (forall x. AcceptMatchResponse -> Rep AcceptMatchResponse x)
-> (forall x. Rep AcceptMatchResponse x -> AcceptMatchResponse)
-> Generic AcceptMatchResponse
forall x. Rep AcceptMatchResponse x -> AcceptMatchResponse
forall x. AcceptMatchResponse -> Rep AcceptMatchResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AcceptMatchResponse x -> AcceptMatchResponse
$cfrom :: forall x. AcceptMatchResponse -> Rep AcceptMatchResponse x
Prelude.Generic)
newAcceptMatchResponse ::
Prelude.Int ->
AcceptMatchResponse
newAcceptMatchResponse :: Int -> AcceptMatchResponse
newAcceptMatchResponse Int
pHttpStatus_ =
AcceptMatchResponse' :: Int -> AcceptMatchResponse
AcceptMatchResponse' {$sel:httpStatus:AcceptMatchResponse' :: Int
httpStatus = Int
pHttpStatus_}
acceptMatchResponse_httpStatus :: Lens.Lens' AcceptMatchResponse Prelude.Int
acceptMatchResponse_httpStatus :: (Int -> f Int) -> AcceptMatchResponse -> f AcceptMatchResponse
acceptMatchResponse_httpStatus = (AcceptMatchResponse -> Int)
-> (AcceptMatchResponse -> Int -> AcceptMatchResponse)
-> Lens AcceptMatchResponse AcceptMatchResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceptMatchResponse' {Int
httpStatus :: Int
$sel:httpStatus:AcceptMatchResponse' :: AcceptMatchResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AcceptMatchResponse
s@AcceptMatchResponse' {} Int
a -> AcceptMatchResponse
s {$sel:httpStatus:AcceptMatchResponse' :: Int
httpStatus = Int
a} :: AcceptMatchResponse)
instance Prelude.NFData AcceptMatchResponse