listJobs method

Future<ListJobsResponse> listJobs({
  1. String? arrayJobId,
  2. String? jobQueue,
  3. JobStatus? jobStatus,
  4. int? maxResults,
  5. String? multiNodeJobId,
  6. String? nextToken,
})

Returns a list of AWS Batch jobs.

You must specify only one of the following items:

  • A job queue ID to return a list of jobs in that job queue
  • A multi-node parallel job ID to return a list of that job's nodes
  • An array job ID to return a list of that job's children
You can filter the results by job status with the jobStatus parameter. If you don't specify a status, only RUNNING jobs are returned.

May throw ClientException. May throw ServerException.

Parameter arrayJobId : The job ID for an array job. Specifying an array job ID with this parameter lists all child jobs from within the specified array.

Parameter jobQueue : The name or full Amazon Resource Name (ARN) of the job queue used to list jobs.

Parameter jobStatus : The job status used to filter jobs in the specified queue. If you don't specify a status, only RUNNING jobs are returned.

Parameter maxResults : The maximum number of results returned by ListJobs in paginated output. When this parameter is used, ListJobs only returns maxResults results in a single page along with a nextToken response element. The remaining results of the initial request can be seen by sending another ListJobs request with the returned nextToken value. This value can be between 1 and 100. If this parameter isn't used, then ListJobs returns up to 100 results and a nextToken value if applicable.

Parameter multiNodeJobId : The job ID for a multi-node parallel job. Specifying a multi-node parallel job ID with this parameter lists all nodes that are associated with the specified job.

Parameter nextToken : The nextToken value returned from a previous paginated ListJobs request where maxResults was used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned the nextToken value. This value is null when there are no more results to return.

Implementation

Future<ListJobsResponse> listJobs({
  String? arrayJobId,
  String? jobQueue,
  JobStatus? jobStatus,
  int? maxResults,
  String? multiNodeJobId,
  String? nextToken,
}) async {
  final $payload = <String, dynamic>{
    if (arrayJobId != null) 'arrayJobId': arrayJobId,
    if (jobQueue != null) 'jobQueue': jobQueue,
    if (jobStatus != null) 'jobStatus': jobStatus.toValue(),
    if (maxResults != null) 'maxResults': maxResults,
    if (multiNodeJobId != null) 'multiNodeJobId': multiNodeJobId,
    if (nextToken != null) 'nextToken': nextToken,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v1/listjobs',
    exceptionFnMap: _exceptionFns,
  );
  return ListJobsResponse.fromJson(response);
}