listJobExecutionsForThing method

Future<ListJobExecutionsForThingResponse> listJobExecutionsForThing({
  1. required String thingName,
  2. String? jobId,
  3. int? maxResults,
  4. String? namespaceId,
  5. String? nextToken,
  6. JobExecutionStatus? status,
})

Lists the job executions for the specified thing.

Requires permission to access the ListJobExecutionsForThing action.

May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ServiceUnavailableException. May throw ThrottlingException.

Parameter thingName : The thing name.

Parameter jobId : The unique identifier you assigned to this job when it was created.

Parameter maxResults : The maximum number of results to be returned per request.

Parameter namespaceId : The namespace used to indicate that a job is a customer-managed job.

When you specify a value for this parameter, Amazon Web Services IoT Core sends jobs notifications to MQTT topics that contain the value in the following format.

$aws/things/THING_NAME/jobs/JOB_ID/notify-namespace-NAMESPACE_ID/

Parameter nextToken : The token to retrieve the next set of results.

Parameter status : An optional filter that lets you search for jobs that have the specified status.

Implementation

Future<ListJobExecutionsForThingResponse> listJobExecutionsForThing({
  required String thingName,
  String? jobId,
  int? maxResults,
  String? namespaceId,
  String? nextToken,
  JobExecutionStatus? status,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    250,
  );
  final $query = <String, List<String>>{
    if (jobId != null) 'jobId': [jobId],
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (namespaceId != null) 'namespaceId': [namespaceId],
    if (nextToken != null) 'nextToken': [nextToken],
    if (status != null) 'status': [status.value],
  };
  final response = await _protocol.send(
    payload: null,
    method: 'GET',
    requestUri: '/things/${Uri.encodeComponent(thingName)}/jobs',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListJobExecutionsForThingResponse.fromJson(response);
}