detachLoadBalancers method
Detaches one or more Classic Load Balancers from the specified Auto Scaling group.
This operation detaches only Classic Load Balancers. If you have Application Load Balancers, Network Load Balancers, or Gateway Load Balancers, use the DetachLoadBalancerTargetGroups API instead.
When you detach a load balancer, it enters the Removing
state
while deregistering the instances in the group. When all instances are
deregistered, then you can no longer describe the load balancer using the
DescribeLoadBalancers API call. The instances remain running.
May throw ResourceContentionFault.
Parameter autoScalingGroupName
:
The name of the Auto Scaling group.
Parameter loadBalancerNames
:
The names of the load balancers. You can specify up to 10 load balancers.
Implementation
Future<void> detachLoadBalancers({
required String autoScalingGroupName,
required List<String> loadBalancerNames,
}) async {
ArgumentError.checkNotNull(autoScalingGroupName, 'autoScalingGroupName');
_s.validateStringLength(
'autoScalingGroupName',
autoScalingGroupName,
1,
255,
isRequired: true,
);
ArgumentError.checkNotNull(loadBalancerNames, 'loadBalancerNames');
final $request = <String, dynamic>{};
$request['AutoScalingGroupName'] = autoScalingGroupName;
$request['LoadBalancerNames'] = loadBalancerNames;
await _protocol.send(
$request,
action: 'DetachLoadBalancers',
version: '2011-01-01',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
shape: shapes['DetachLoadBalancersType'],
shapes: shapes,
resultWrapper: 'DetachLoadBalancersResult',
);
}