cancelJob method
Cancels a job in an Batch job queue. Jobs that are in a
SUBMITTED, PENDING, or RUNNABLE
state are cancelled and the job status is updated to FAILED.
When you try to cancel an array parent job in PENDING, Batch
attempts to cancel all child jobs. The array parent job is canceled when
all child jobs are completed.
Jobs that progressed to the STARTING or RUNNING
state aren't canceled. However, 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 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. It is also recorded in the Batch activity logs.
This parameter has as limit of 1024 characters.
Implementation
Future<void> cancelJob({
required String jobId,
required String reason,
}) async {
final $payload = <String, dynamic>{
'jobId': jobId,
'reason': reason,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/v1/canceljob',
exceptionFnMap: _exceptionFns,
);
}