listSessions method
Lists the sessions in a workgroup that are in an active state like
CREATING, CREATED, IDLE, or
BUSY. Newer sessions are listed first; older sessions are
listed later.
May throw InternalServerException.
May throw InvalidRequestException.
May throw ResourceNotFoundException.
Parameter workGroup :
The workgroup to which the session belongs.
Parameter maxResults :
The maximum number of sessions to return.
Parameter nextToken :
A token generated by the Athena service that specifies where to continue
pagination if a previous request was truncated. To obtain the next set of
pages, pass in the NextToken from the response object of the
previous page call.
Parameter stateFilter :
A filter for a specific session state. A description of each state
follows.
CREATING - The session is being started, including acquiring
resources.
CREATED - The session has been started.
IDLE - The session is able to accept a calculation.
BUSY - The session is processing another task and is unable
to accept a calculation.
TERMINATING - The session is in the process of shutting down.
TERMINATED - The session and its resources are no longer
running.
DEGRADED - The session has no healthy coordinators.
FAILED - Due to a failure, the session and its resources are
no longer running.
Implementation
Future<ListSessionsResponse> listSessions({
required String workGroup,
int? maxResults,
String? nextToken,
SessionState? stateFilter,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
100,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AmazonAthena.ListSessions'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'WorkGroup': workGroup,
if (maxResults != null) 'MaxResults': maxResults,
if (nextToken != null) 'NextToken': nextToken,
if (stateFilter != null) 'StateFilter': stateFilter.value,
},
);
return ListSessionsResponse.fromJson(jsonResponse.body);
}