associateTargetsWithJob method
Associates a group with a continuous job. The following criteria must be met:
- 
The job must have been created with the targetSelectionfield set to "CONTINUOUS".
- The job status must currently be "IN_PROGRESS".
- The total number of targets associated with a job must not exceed 100.
May throw InvalidRequestException. May throw ResourceNotFoundException. May throw LimitExceededException. May throw ThrottlingException. May throw ServiceUnavailableException.
Parameter jobId :
The unique identifier you assigned to this job when it was created.
Parameter targets :
A list of thing group ARNs that define the targets of the job.
Parameter comment :
An optional comment string describing why the job was associated with the
targets.
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/
Implementation
Future<AssociateTargetsWithJobResponse> associateTargetsWithJob({
  required String jobId,
  required List<String> targets,
  String? comment,
  String? namespaceId,
}) async {
  ArgumentError.checkNotNull(jobId, 'jobId');
  _s.validateStringLength(
    'jobId',
    jobId,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(targets, 'targets');
  _s.validateStringLength(
    'comment',
    comment,
    0,
    2028,
  );
  _s.validateStringLength(
    'namespaceId',
    namespaceId,
    1,
    64,
  );
  final $query = <String, List<String>>{
    if (namespaceId != null) 'namespaceId': [namespaceId],
  };
  final $payload = <String, dynamic>{
    'targets': targets,
    if (comment != null) 'comment': comment,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/jobs/${Uri.encodeComponent(jobId)}/targets',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return AssociateTargetsWithJobResponse.fromJson(response);
}