listTargets method

Future<ListTargetsResponse> listTargets({
  1. required String targetGroupIdentifier,
  2. int? maxResults,
  3. String? nextToken,
  4. List<Target>? targets,
})

Lists the targets for the target group. By default, all targets are included. You can use this API to check the health status of targets. You can also filter the results by target.

May throw AccessDeniedException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ThrottlingException. May throw ValidationException.

Parameter targetGroupIdentifier : The ID or ARN of the target group.

Parameter maxResults : The maximum number of results to return.

Parameter nextToken : A pagination token for the next page of results.

Parameter targets : The targets.

Implementation

Future<ListTargetsResponse> listTargets({
  required String targetGroupIdentifier,
  int? maxResults,
  String? nextToken,
  List<Target>? targets,
}) async {
  _s.validateNumRange(
    'maxResults',
    maxResults,
    1,
    100,
  );
  final $query = <String, List<String>>{
    if (maxResults != null) 'maxResults': [maxResults.toString()],
    if (nextToken != null) 'nextToken': [nextToken],
  };
  final $payload = <String, dynamic>{
    if (targets != null) 'targets': targets,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/targetgroups/${Uri.encodeComponent(targetGroupIdentifier)}/listtargets',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  return ListTargetsResponse.fromJson(response);
}