listJobs method

Future<ListJobsResult> listJobs({
  1. required String accountId,
  2. List<JobStatus>? jobStatuses,
  3. int? maxResults,
  4. String? nextToken,
})

Lists current S3 Batch Operations jobs as well as the jobs that have ended within the last 90 days for the Amazon Web Services account making the request. For more information, see S3 Batch Operations in the Amazon S3 User Guide.

Permissions
To use the ListJobs operation, you must have permission to perform the s3:ListJobs action.
Related actions include:

May throw InternalServiceException. May throw InvalidNextTokenException. May throw InvalidRequestException.

Parameter accountId : The Amazon Web Services account ID associated with the S3 Batch Operations job.

Parameter jobStatuses : The List Jobs request returns jobs that match the statuses listed in this element.

Parameter maxResults : The maximum number of jobs that Amazon S3 will include in the List Jobs response. If there are more jobs than this number, the response will include a pagination token in the NextToken field to enable you to retrieve the next page of results.

Parameter nextToken : A pagination token to request the next page of results. Use the token that Amazon S3 returned in the NextToken element of the ListJobsResult from the previous List Jobs request.

Implementation

Future<ListJobsResult> listJobs({
  required String accountId,
  List<JobStatus>? jobStatuses,
  int? maxResults,
  String? nextToken,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    0,
    1000,
  );
  final headers = <String, String>{
    'x-amz-account-id': accountId.toString(),
  };
  final $query = <String, List<String>>{
    if (jobStatuses != null)
      'jobStatuses': jobStatuses.map((e) => e.value).toList(),
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
  };
  final $result = await _protocol.send(
    method: 'GET',
    requestUri: '/v20180820/jobs',
    queryParams: $query,
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return ListJobsResult.fromXml($result.body);
}