updateJobStatus method

Future<UpdateJobStatusResult> updateJobStatus({
  1. required String accountId,
  2. required String jobId,
  3. required RequestedJobStatus requestedJobStatus,
  4. String? statusUpdateReason,
})

Updates the status for the specified job. Use this operation to confirm that you want to run a job or to cancel an existing job. For more information, see S3 Batch Operations in the Amazon Simple Storage Service Developer Guide.

Related actions include:

May throw BadRequestException. May throw TooManyRequestsException. May throw NotFoundException. May throw JobStatusException. May throw InternalServiceException.

Parameter accountId :

Parameter jobId : The ID of the job whose status you want to update.

Parameter requestedJobStatus : The status that you want to move the specified job to.

Parameter statusUpdateReason : A description of the reason why you want to change the specified job's status. This field can be any string up to the maximum length.

Implementation

Future<UpdateJobStatusResult> updateJobStatus({
  required String accountId,
  required String jobId,
  required RequestedJobStatus requestedJobStatus,
  String? statusUpdateReason,
}) async {
  ArgumentError.checkNotNull(accountId, 'accountId');
  _s.validateStringLength(
    'accountId',
    accountId,
    0,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(jobId, 'jobId');
  _s.validateStringLength(
    'jobId',
    jobId,
    5,
    36,
    isRequired: true,
  );
  ArgumentError.checkNotNull(requestedJobStatus, 'requestedJobStatus');
  _s.validateStringLength(
    'statusUpdateReason',
    statusUpdateReason,
    1,
    256,
  );
  final headers = <String, String>{
    'x-amz-account-id': accountId.toString(),
  };
  final $query = <String, List<String>>{
    'requestedJobStatus': [requestedJobStatus.toValue()],
    if (statusUpdateReason != null)
      'statusUpdateReason': [statusUpdateReason],
  };
  final $result = await _protocol.send(
    method: 'POST',
    requestUri: '/v20180820/jobs/${Uri.encodeComponent(jobId)}/status',
    queryParams: $query,
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return UpdateJobStatusResult.fromXml($result.body);
}