detachInstancesFromLoadBalancer method
Detaches the specified instances from a Lightsail load balancer.
This operation waits until the instances are no longer needed before they are detached from the load balancer.
The detach instances from load balancer
operation supports
tag-based access control via resource tags applied to the resource
identified by load balancer name
. For more information, see
the Lightsail
Dev Guide.
May throw ServiceException. May throw InvalidInputException. May throw NotFoundException. May throw OperationFailureException. May throw AccessDeniedException. May throw AccountSetupInProgressException. May throw UnauthenticatedException.
Parameter instanceNames
:
An array of strings containing the names of the instances you want to
detach from the load balancer.
Parameter loadBalancerName
:
The name of the Lightsail load balancer.
Implementation
Future<DetachInstancesFromLoadBalancerResult>
detachInstancesFromLoadBalancer({
required List<String> instanceNames,
required String loadBalancerName,
}) async {
ArgumentError.checkNotNull(instanceNames, 'instanceNames');
ArgumentError.checkNotNull(loadBalancerName, 'loadBalancerName');
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'Lightsail_20161128.DetachInstancesFromLoadBalancer'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'instanceNames': instanceNames,
'loadBalancerName': loadBalancerName,
},
);
return DetachInstancesFromLoadBalancerResult.fromJson(jsonResponse.body);
}