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 and jobs that have ended within the last 30 days for the AWS account making the request. For more information, see S3 Batch Operations in the Amazon Simple Storage Service Developer Guide.

Related actions include:

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

Parameter accountId :

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 {
  ArgumentError.checkNotNull(accountId, 'accountId');
  _s.validateStringLength(
    'accountId',
    accountId,
    0,
    64,
    isRequired: true,
  );
  _s.validateNumRange(
    'maxResults',
    maxResults,
    0,
    1000,
  );
  _s.validateStringLength(
    'nextToken',
    nextToken,
    1,
    1024,
  );
  final headers = <String, String>{
    'x-amz-account-id': accountId.toString(),
  };
  final $query = <String, List<String>>{
    if (jobStatuses != null)
      'jobStatuses': jobStatuses.map((e) => e.toValue()).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);
}