module Network.AWS.GameLift.CreatePlayerSessions
(
createPlayerSessions
, CreatePlayerSessions
, cpsGameSessionId
, cpsPlayerIds
, createPlayerSessionsResponse
, CreatePlayerSessionsResponse
, crsPlayerSessions
, crsResponseStatus
) where
import Network.AWS.GameLift.Types
import Network.AWS.GameLift.Types.Product
import Network.AWS.Lens
import Network.AWS.Prelude
import Network.AWS.Request
import Network.AWS.Response
data CreatePlayerSessions = CreatePlayerSessions'
{ _cpsGameSessionId :: !Text
, _cpsPlayerIds :: !(List1 Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createPlayerSessions
:: Text
-> NonEmpty Text
-> CreatePlayerSessions
createPlayerSessions pGameSessionId_ pPlayerIds_ =
CreatePlayerSessions'
{ _cpsGameSessionId = pGameSessionId_
, _cpsPlayerIds = _List1 # pPlayerIds_
}
cpsGameSessionId :: Lens' CreatePlayerSessions Text
cpsGameSessionId = lens _cpsGameSessionId (\ s a -> s{_cpsGameSessionId = a});
cpsPlayerIds :: Lens' CreatePlayerSessions (NonEmpty Text)
cpsPlayerIds = lens _cpsPlayerIds (\ s a -> s{_cpsPlayerIds = a}) . _List1;
instance AWSRequest CreatePlayerSessions where
type Rs CreatePlayerSessions =
CreatePlayerSessionsResponse
request = postJSON gameLift
response
= receiveJSON
(\ s h x ->
CreatePlayerSessionsResponse' <$>
(x .?> "PlayerSessions" .!@ mempty) <*>
(pure (fromEnum s)))
instance Hashable CreatePlayerSessions
instance NFData CreatePlayerSessions
instance ToHeaders CreatePlayerSessions where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("GameLift.CreatePlayerSessions" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON CreatePlayerSessions where
toJSON CreatePlayerSessions'{..}
= object
(catMaybes
[Just ("GameSessionId" .= _cpsGameSessionId),
Just ("PlayerIds" .= _cpsPlayerIds)])
instance ToPath CreatePlayerSessions where
toPath = const "/"
instance ToQuery CreatePlayerSessions where
toQuery = const mempty
data CreatePlayerSessionsResponse = CreatePlayerSessionsResponse'
{ _crsPlayerSessions :: !(Maybe [PlayerSession])
, _crsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
createPlayerSessionsResponse
:: Int
-> CreatePlayerSessionsResponse
createPlayerSessionsResponse pResponseStatus_ =
CreatePlayerSessionsResponse'
{ _crsPlayerSessions = Nothing
, _crsResponseStatus = pResponseStatus_
}
crsPlayerSessions :: Lens' CreatePlayerSessionsResponse [PlayerSession]
crsPlayerSessions = lens _crsPlayerSessions (\ s a -> s{_crsPlayerSessions = a}) . _Default . _Coerce;
crsResponseStatus :: Lens' CreatePlayerSessionsResponse Int
crsResponseStatus = lens _crsResponseStatus (\ s a -> s{_crsResponseStatus = a});
instance NFData CreatePlayerSessionsResponse