listJobs method
Lists jobs.
May throw InvalidRequestException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ServiceUnavailableException.
Parameter maxResults
:
The maximum number of results to return 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, AWS 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.
Parameter targetSelection
:
Specifies whether the job will continue to run (CONTINUOUS), or will be
complete after all those things specified as targets have completed the
job (SNAPSHOT). If continuous, the job may also be run on a thing when a
change is detected in a target. For example, a job will run on a thing
when the thing is added to a target group, even after the job was
completed by all things originally in the group.
Parameter thingGroupId
:
A filter that limits the returned jobs to those for the specified group.
Parameter thingGroupName
:
A filter that limits the returned jobs to those for the specified group.
Implementation
Future<ListJobsResponse> listJobs({
int? maxResults,
String? namespaceId,
String? nextToken,
JobStatus? status,
TargetSelection? targetSelection,
String? thingGroupId,
String? thingGroupName,
}) async {
_s.validateNumRange(
'maxResults',
maxResults,
1,
250,
);
_s.validateStringLength(
'namespaceId',
namespaceId,
1,
64,
);
_s.validateStringLength(
'thingGroupId',
thingGroupId,
1,
128,
);
_s.validateStringLength(
'thingGroupName',
thingGroupName,
1,
128,
);
final $query = <String, List<String>>{
if (maxResults != null) 'maxResults': [maxResults.toString()],
if (namespaceId != null) 'namespaceId': [namespaceId],
if (nextToken != null) 'nextToken': [nextToken],
if (status != null) 'status': [status.toValue()],
if (targetSelection != null)
'targetSelection': [targetSelection.toValue()],
if (thingGroupId != null) 'thingGroupId': [thingGroupId],
if (thingGroupName != null) 'thingGroupName': [thingGroupName],
};
final response = await _protocol.send(
payload: null,
method: 'GET',
requestUri: '/jobs',
queryParams: $query,
exceptionFnMap: _exceptionFns,
);
return ListJobsResponse.fromJson(response);
}