listSessions method
Lists the sessions on a cluster. You can filter the results by session state. Newer sessions are returned first.
May throw InternalServerException.
May throw InvalidRequestException.
Parameter clusterId :
The ID of the cluster to list sessions for.
Parameter maxResults :
The maximum number of sessions to return in each page of results.
Parameter nextToken :
The pagination token returned by a previous ListSessions
call. Use it to retrieve the next page of results.
Parameter sessionStates :
An optional filter that limits the results to sessions in the specified
states.
Implementation
Future<ListSessionsOutput> listSessions({
required String clusterId,
int? maxResults,
String? nextToken,
List<SessionState>? sessionStates,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
100,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'ElasticMapReduce.ListSessions'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'ClusterId': clusterId,
if (maxResults != null) 'MaxResults': maxResults,
if (nextToken != null) 'NextToken': nextToken,
if (sessionStates != null)
'SessionStates': sessionStates.map((e) => e.value).toList(),
},
);
return ListSessionsOutput.fromJson(jsonResponse.body);
}