module Network.AWS.GameLift.DescribeGameSessions
(
describeGameSessions
, DescribeGameSessions
, dgsGameSessionId
, dgsAliasId
, dgsNextToken
, dgsStatusFilter
, dgsLimit
, dgsFleetId
, describeGameSessionsResponse
, DescribeGameSessionsResponse
, dgsrsGameSessions
, dgsrsNextToken
, dgsrsResponseStatus
) 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 DescribeGameSessions = DescribeGameSessions'
{ _dgsGameSessionId :: !(Maybe Text)
, _dgsAliasId :: !(Maybe Text)
, _dgsNextToken :: !(Maybe Text)
, _dgsStatusFilter :: !(Maybe Text)
, _dgsLimit :: !(Maybe Nat)
, _dgsFleetId :: !(Maybe Text)
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeGameSessions
:: DescribeGameSessions
describeGameSessions =
DescribeGameSessions'
{ _dgsGameSessionId = Nothing
, _dgsAliasId = Nothing
, _dgsNextToken = Nothing
, _dgsStatusFilter = Nothing
, _dgsLimit = Nothing
, _dgsFleetId = Nothing
}
dgsGameSessionId :: Lens' DescribeGameSessions (Maybe Text)
dgsGameSessionId = lens _dgsGameSessionId (\ s a -> s{_dgsGameSessionId = a});
dgsAliasId :: Lens' DescribeGameSessions (Maybe Text)
dgsAliasId = lens _dgsAliasId (\ s a -> s{_dgsAliasId = a});
dgsNextToken :: Lens' DescribeGameSessions (Maybe Text)
dgsNextToken = lens _dgsNextToken (\ s a -> s{_dgsNextToken = a});
dgsStatusFilter :: Lens' DescribeGameSessions (Maybe Text)
dgsStatusFilter = lens _dgsStatusFilter (\ s a -> s{_dgsStatusFilter = a});
dgsLimit :: Lens' DescribeGameSessions (Maybe Natural)
dgsLimit = lens _dgsLimit (\ s a -> s{_dgsLimit = a}) . mapping _Nat;
dgsFleetId :: Lens' DescribeGameSessions (Maybe Text)
dgsFleetId = lens _dgsFleetId (\ s a -> s{_dgsFleetId = a});
instance AWSRequest DescribeGameSessions where
type Rs DescribeGameSessions =
DescribeGameSessionsResponse
request = postJSON gameLift
response
= receiveJSON
(\ s h x ->
DescribeGameSessionsResponse' <$>
(x .?> "GameSessions" .!@ mempty) <*>
(x .?> "NextToken")
<*> (pure (fromEnum s)))
instance Hashable DescribeGameSessions
instance NFData DescribeGameSessions
instance ToHeaders DescribeGameSessions where
toHeaders
= const
(mconcat
["X-Amz-Target" =#
("GameLift.DescribeGameSessions" :: ByteString),
"Content-Type" =#
("application/x-amz-json-1.1" :: ByteString)])
instance ToJSON DescribeGameSessions where
toJSON DescribeGameSessions'{..}
= object
(catMaybes
[("GameSessionId" .=) <$> _dgsGameSessionId,
("AliasId" .=) <$> _dgsAliasId,
("NextToken" .=) <$> _dgsNextToken,
("StatusFilter" .=) <$> _dgsStatusFilter,
("Limit" .=) <$> _dgsLimit,
("FleetId" .=) <$> _dgsFleetId])
instance ToPath DescribeGameSessions where
toPath = const "/"
instance ToQuery DescribeGameSessions where
toQuery = const mempty
data DescribeGameSessionsResponse = DescribeGameSessionsResponse'
{ _dgsrsGameSessions :: !(Maybe [GameSession])
, _dgsrsNextToken :: !(Maybe Text)
, _dgsrsResponseStatus :: !Int
} deriving (Eq,Read,Show,Data,Typeable,Generic)
describeGameSessionsResponse
:: Int
-> DescribeGameSessionsResponse
describeGameSessionsResponse pResponseStatus_ =
DescribeGameSessionsResponse'
{ _dgsrsGameSessions = Nothing
, _dgsrsNextToken = Nothing
, _dgsrsResponseStatus = pResponseStatus_
}
dgsrsGameSessions :: Lens' DescribeGameSessionsResponse [GameSession]
dgsrsGameSessions = lens _dgsrsGameSessions (\ s a -> s{_dgsrsGameSessions = a}) . _Default . _Coerce;
dgsrsNextToken :: Lens' DescribeGameSessionsResponse (Maybe Text)
dgsrsNextToken = lens _dgsrsNextToken (\ s a -> s{_dgsrsNextToken = a});
dgsrsResponseStatus :: Lens' DescribeGameSessionsResponse Int
dgsrsResponseStatus = lens _dgsrsResponseStatus (\ s a -> s{_dgsrsResponseStatus = a});
instance NFData DescribeGameSessionsResponse