attachLoadBalancerTargetGroups method
Attaches one or more target groups to the specified Auto Scaling group.
This operation is used with the following load balancer types:
- Application Load Balancer - Operates at the application layer (layer 7) and supports HTTP and HTTPS.
- Network Load Balancer - Operates at the transport layer (layer 4) and supports TCP, TLS, and UDP.
- Gateway Load Balancer - Operates at the network layer (layer 3).
For more information, see Elastic Load Balancing and Amazon EC2 Auto Scaling in the Amazon EC2 Auto Scaling User Guide.
May throw ResourceContentionFault. May throw ServiceLinkedRoleFailure.
Parameter autoScalingGroupName
:
The name of the Auto Scaling group.
Parameter targetGroupARNs
:
The Amazon Resource Names (ARN) of the target groups. You can specify up
to 10 target groups. To get the ARN of a target group, use the Elastic
Load Balancing DescribeTargetGroups
API operation.
Implementation
Future<void> attachLoadBalancerTargetGroups({
required String autoScalingGroupName,
required List<String> targetGroupARNs,
}) async {
ArgumentError.checkNotNull(autoScalingGroupName, 'autoScalingGroupName');
_s.validateStringLength(
'autoScalingGroupName',
autoScalingGroupName,
1,
255,
isRequired: true,
);
ArgumentError.checkNotNull(targetGroupARNs, 'targetGroupARNs');
final $request = <String, dynamic>{};
$request['AutoScalingGroupName'] = autoScalingGroupName;
$request['TargetGroupARNs'] = targetGroupARNs;
await _protocol.send(
$request,
action: 'AttachLoadBalancerTargetGroups',
version: '2011-01-01',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
shape: shapes['AttachLoadBalancerTargetGroupsType'],
shapes: shapes,
resultWrapper: 'AttachLoadBalancerTargetGroupsResult',
);
}