cancelJob method

Future<void> cancelJob({
  1. required String jobId,
  2. required String reason,
})

Cancels a job in an AWS Batch job queue. Jobs that are in the SUBMITTED, PENDING, or RUNNABLE state are canceled. Jobs that have progressed to STARTING or RUNNING are not canceled (but the API operation still succeeds, even if no job is canceled); these jobs must be terminated with the TerminateJob operation.

May throw ClientException. May throw ServerException.

Parameter jobId : The AWS Batch job ID of the job to cancel.

Parameter reason : A message to attach to the job that explains the reason for canceling it. This message is returned by future DescribeJobs operations on the job. This message is also recorded in the AWS Batch activity logs.

Implementation

Future<void> cancelJob({
  required String jobId,
  required String reason,
}) async {
  ArgumentError.checkNotNull(jobId, 'jobId');
  ArgumentError.checkNotNull(reason, 'reason');
  final $payload = <String, dynamic>{
    'jobId': jobId,
    'reason': reason,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/v1/canceljob',
    exceptionFnMap: _exceptionFns,
  );
}