startNextPendingJobExecution method
Gets and starts the next pending (status IN_PROGRESS or QUEUED) job execution for a thing.
May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ServiceUnavailableException. May throw CertificateValidationException.
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.
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 this
timeout has no effect on that job execution timeout which may have been
specified when the job was created (CreateJob
using field
timeoutConfig
).
Implementation
Future<StartNextPendingJobExecutionResponse> startNextPendingJobExecution({
required String thingName,
Map<String, String>? statusDetails,
int? stepTimeoutInMinutes,
}) async {
ArgumentError.checkNotNull(thingName, 'thingName');
_s.validateStringLength(
'thingName',
thingName,
1,
128,
isRequired: true,
);
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);
}