registerTargets method
Registers the specified targets with the specified target group.
If the target is an EC2 instance, it must be in the running
state when you register it.
By default, the load balancer routes requests to registered targets using the protocol and port for the target group. Alternatively, you can override the port for a target when you register it. You can register each EC2 instance or IP address with the same target group multiple times using different ports.
For more information, see the following:
- Register targets for your Application Load Balancer
- Register targets for your Network Load Balancer
- Register targets for your Gateway Load Balancer
May throw InvalidTargetException.
May throw TargetGroupNotFoundException.
May throw TooManyRegistrationsForTargetIdException.
May throw TooManyTargetsException.
Parameter targetGroupArn :
The Amazon Resource Name (ARN) of the target group.
Parameter targets :
The targets.
Implementation
Future<void> registerTargets({
required String targetGroupArn,
required List<TargetDescription> targets,
}) async {
final $request = <String, String>{
'TargetGroupArn': targetGroupArn,
if (targets.isEmpty)
'Targets': ''
else
for (var i1 = 0; i1 < targets.length; i1++)
for (var e3 in targets[i1].toQueryMap().entries)
'Targets.member.${i1 + 1}.${e3.key}': e3.value,
};
await _protocol.send(
$request,
action: 'RegisterTargets',
version: '2015-12-01',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
resultWrapper: 'RegisterTargetsResult',
);
}