startNextPendingJobExecution method
Gets and starts the next pending (status IN_PROGRESS or QUEUED) job execution for a thing.
Requires permission to access the StartNextPendingJobExecution action.
May throw CertificateValidationException.
May throw InvalidRequestException.
May throw ResourceNotFoundException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
Parameter thingName :
The name of the thing associated with the device.
Parameter statusDetails :
A collection of name/value pairs that describe the status of the job
execution. If not specified, the statusDetails are unchanged.
The maximum length of the value in the name/value pair is 1,024 characters.
Parameter stepTimeoutInMinutes :
Specifies the amount of time this device has to finish execution of this
job. If the job execution status is not set to a terminal state before
this timer expires, or before the timer is reset (by calling
UpdateJobExecution, setting the status to
IN_PROGRESS, and specifying a new timeout value in field
stepTimeoutInMinutes) the job execution status will be
automatically set to TIMED_OUT. Note that setting the step
timeout has no effect on the in progress timeout that may have been
specified when the job was created (CreateJob using field
timeoutConfig).
Valid values for this parameter range from 1 to 10080 (1 minute to 7 days).
Implementation
Future<StartNextPendingJobExecutionResponse> startNextPendingJobExecution({
required String thingName,
Map<String, String>? statusDetails,
int? stepTimeoutInMinutes,
}) async {
final $payload = <String, dynamic>{
if (statusDetails != null) 'statusDetails': statusDetails,
if (stepTimeoutInMinutes != null)
'stepTimeoutInMinutes': stepTimeoutInMinutes,
};
final response = await _protocol.send(
payload: $payload,
method: 'PUT',
requestUri: '/things/${Uri.encodeComponent(thingName)}/jobs/%24next',
exceptionFnMap: _exceptionFns,
);
return StartNextPendingJobExecutionResponse.fromJson(response);
}