attachLoadBalancerToSubnets method

Future<AttachLoadBalancerToSubnetsOutput> attachLoadBalancerToSubnets({
  1. required String loadBalancerName,
  2. required List<String> subnets,
})

Adds one or more subnets to the set of configured subnets for the specified load balancer.

The load balancer evenly distributes requests across all registered subnets. For more information, see Add or Remove Subnets for Your Load Balancer in a VPC in the Classic Load Balancers Guide.

May throw AccessPointNotFoundException. May throw InvalidConfigurationRequestException. May throw SubnetNotFoundException. May throw InvalidSubnetException.

Parameter loadBalancerName : The name of the load balancer.

Parameter subnets : The IDs of the subnets to add. You can add only one subnet per Availability Zone.

Implementation

Future<AttachLoadBalancerToSubnetsOutput> attachLoadBalancerToSubnets({
  required String loadBalancerName,
  required List<String> subnets,
}) async {
  ArgumentError.checkNotNull(loadBalancerName, 'loadBalancerName');
  ArgumentError.checkNotNull(subnets, 'subnets');
  final $request = <String, dynamic>{};
  $request['LoadBalancerName'] = loadBalancerName;
  $request['Subnets'] = subnets;
  final $result = await _protocol.send(
    $request,
    action: 'AttachLoadBalancerToSubnets',
    version: '2012-06-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['AttachLoadBalancerToSubnetsInput'],
    shapes: shapes,
    resultWrapper: 'AttachLoadBalancerToSubnetsResult',
  );
  return AttachLoadBalancerToSubnetsOutput.fromXml($result);
}