deregisterTargets method

Future<void> deregisterTargets({
  1. required String targetGroupArn,
  2. required List<TargetDescription> targets,
})

Deregisters the specified targets from the specified target group. After the targets are deregistered, they no longer receive traffic from the load balancer.

The load balancer stops sending requests to targets that are deregistering, but uses connection draining to ensure that in-flight traffic completes on the existing connections. This deregistration delay is configured by default but can be updated for each target group.

For more information, see the following:

Note: If the specified target does not exist, the action returns successfully.

May throw InvalidTargetException. May throw TargetGroupNotFoundException.

Parameter targetGroupArn : The Amazon Resource Name (ARN) of the target group.

Parameter targets : The targets. If you specified a port override when you registered a target, you must specify both the target ID and the port when you deregister it.

Implementation

Future<void> deregisterTargets({
  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: 'DeregisterTargets',
    version: '2015-12-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'DeregisterTargetsResult',
  );
}