describeSessions method
Future<DescribeSessionsResponse>
describeSessions({
- required SessionState state,
- List<
SessionFilter> ? filters, - int? maxResults,
- String? nextToken,
Retrieves a list of all active sessions (both connected and disconnected) or terminated sessions from the past 30 days.
May throw InternalServerError. May throw InvalidFilterKey. May throw InvalidNextToken.
Parameter state
:
The session status to retrieve a list of sessions for. For example,
"Active".
Parameter filters
:
One or more filters to limit the type of sessions returned by the request.
Parameter maxResults
:
The maximum number of items to return for this call. The call also returns
a token that you can specify in a subsequent call to get the next set of
results.
Parameter nextToken
:
The token for the next set of items to return. (You received this token
from a previous call.)
Implementation
Future<DescribeSessionsResponse> describeSessions({
required SessionState state,
List<SessionFilter>? filters,
int? maxResults,
String? nextToken,
}) async {
ArgumentError.checkNotNull(state, 'state');
_s.validateNumRange(
'maxResults',
maxResults,
1,
200,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonSSM.DescribeSessions'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'State': state.toValue(),
if (filters != null) 'Filters': filters,
if (maxResults != null) 'MaxResults': maxResults,
if (nextToken != null) 'NextToken': nextToken,
},
);
return DescribeSessionsResponse.fromJson(jsonResponse.body);
}