module Network.AWS.GameLift.DescribePlayerSessions
(
describePlayerSessions
, DescribePlayerSessions
, dpsGameSessionId
, dpsNextToken
, dpsLimit
, dpsPlayerSessionId
, dpsPlayerId
, dpsPlayerSessionStatusFilter
, describePlayerSessionsResponse
, DescribePlayerSessionsResponse
, dpsrsNextToken
, dpsrsPlayerSessions
, dpsrsResponseStatus
) 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 DescribePlayerSessions = DescribePlayerSessions'
{ _dpsGameSessionId :: !(Maybe Text)
, _dpsNextToken :: !(Maybe Text)
, _dpsLimit :: !(Maybe Nat)
, _dpsPlayerSessionId :: !(Maybe Text)
, _dpsPlayerId :: !(Maybe Text)
, _dpsPlayerSessionStatusFilter :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describePlayerSessions
:: DescribePlayerSessions
describePlayerSessions =
DescribePlayerSessions'
{ _dpsGameSessionId = Nothing
, _dpsNextToken = Nothing
, _dpsLimit = Nothing
, _dpsPlayerSessionId = Nothing
, _dpsPlayerId = Nothing
, _dpsPlayerSessionStatusFilter = Nothing
}
dpsGameSessionId :: Lens' DescribePlayerSessions (Maybe Text)
dpsGameSessionId = lens _dpsGameSessionId (\ s a -> s{_dpsGameSessionId = a});
dpsNextToken :: Lens' DescribePlayerSessions (Maybe Text)
dpsNextToken = lens _dpsNextToken (\ s a -> s{_dpsNextToken = a});
dpsLimit :: Lens' DescribePlayerSessions (Maybe Natural)
dpsLimit = lens _dpsLimit (\ s a -> s{_dpsLimit = a}) . mapping _Nat;
dpsPlayerSessionId :: Lens' DescribePlayerSessions (Maybe Text)
dpsPlayerSessionId = lens _dpsPlayerSessionId (\ s a -> s{_dpsPlayerSessionId = a});
dpsPlayerId :: Lens' DescribePlayerSessions (Maybe Text)
dpsPlayerId = lens _dpsPlayerId (\ s a -> s{_dpsPlayerId = a});
dpsPlayerSessionStatusFilter :: Lens' DescribePlayerSessions (Maybe Text)
dpsPlayerSessionStatusFilter = lens _dpsPlayerSessionStatusFilter (\ s a -> s{_dpsPlayerSessionStatusFilter = a});
instance AWSRequest DescribePlayerSessions where
type Rs DescribePlayerSessions =
DescribePlayerSessionsResponse
request = postJSON gameLift
response
= receiveJSON
(\ s h x ->
DescribePlayerSessionsResponse' <$>
(x .?> "NextToken") <*>
(x .?> "PlayerSessions" .!@ mempty)
<*> (pure (fromEnum s)))
instance Hashable DescribePlayerSessions
instance NFData DescribePlayerSessions
instance ToHeaders DescribePlayerSessions where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("GameLift.DescribePlayerSessions" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribePlayerSessions where
toJSON DescribePlayerSessions'{..}
= object
(catMaybes
[("GameSessionId" .=) <$> _dpsGameSessionId,
("NextToken" .=) <$> _dpsNextToken,
("Limit" .=) <$> _dpsLimit,
("PlayerSessionId" .=) <$> _dpsPlayerSessionId,
("PlayerId" .=) <$> _dpsPlayerId,
("PlayerSessionStatusFilter" .=) <$>
_dpsPlayerSessionStatusFilter])
instance ToPath DescribePlayerSessions where
toPath = const "/"
instance ToQuery DescribePlayerSessions where
toQuery = const mempty
data DescribePlayerSessionsResponse = DescribePlayerSessionsResponse'
{ _dpsrsNextToken :: !(Maybe Text)
, _dpsrsPlayerSessions :: !(Maybe [PlayerSession])
, _dpsrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describePlayerSessionsResponse
:: Int
-> DescribePlayerSessionsResponse
describePlayerSessionsResponse pResponseStatus_ =
DescribePlayerSessionsResponse'
{ _dpsrsNextToken = Nothing
, _dpsrsPlayerSessions = Nothing
, _dpsrsResponseStatus = pResponseStatus_
}
dpsrsNextToken :: Lens' DescribePlayerSessionsResponse (Maybe Text)
dpsrsNextToken = lens _dpsrsNextToken (\ s a -> s{_dpsrsNextToken = a});
dpsrsPlayerSessions :: Lens' DescribePlayerSessionsResponse [PlayerSession]
dpsrsPlayerSessions = lens _dpsrsPlayerSessions (\ s a -> s{_dpsrsPlayerSessions = a}) . _Default . _Coerce;
dpsrsResponseStatus :: Lens' DescribePlayerSessionsResponse Int
dpsrsResponseStatus = lens _dpsrsResponseStatus (\ s a -> s{_dpsrsResponseStatus = a});
instance NFData DescribePlayerSessionsResponse