setSecurityGroups method
Associates the specified security groups with the specified Application Load Balancer or Network Load Balancer. The specified security groups override the previously associated security groups.
You can't perform this operation on a Network Load Balancer unless you specified a security group for the load balancer when you created it.
You can't associate a security group with a Gateway Load Balancer.
May throw InvalidConfigurationRequestException.
May throw InvalidSecurityGroupException.
May throw LoadBalancerNotFoundException.
Parameter loadBalancerArn :
The Amazon Resource Name (ARN) of the load balancer.
Parameter securityGroups :
The IDs of the security groups.
Parameter enforceSecurityGroupInboundRulesOnPrivateLinkTraffic :
Indicates whether to evaluate inbound security group rules for traffic
sent to a Network Load Balancer through Amazon Web Services PrivateLink.
Applies only if the load balancer has an associated security group. The
default is on.
Implementation
Future<SetSecurityGroupsOutput> setSecurityGroups({
required String loadBalancerArn,
required List<String> securityGroups,
EnforceSecurityGroupInboundRulesOnPrivateLinkTrafficEnum?
enforceSecurityGroupInboundRulesOnPrivateLinkTraffic,
}) async {
final $request = <String, String>{
'LoadBalancerArn': loadBalancerArn,
if (securityGroups.isEmpty)
'SecurityGroups': ''
else
for (var i1 = 0; i1 < securityGroups.length; i1++)
'SecurityGroups.member.${i1 + 1}': securityGroups[i1],
if (enforceSecurityGroupInboundRulesOnPrivateLinkTraffic != null)
'EnforceSecurityGroupInboundRulesOnPrivateLinkTraffic':
enforceSecurityGroupInboundRulesOnPrivateLinkTraffic.value,
};
final $result = await _protocol.send(
$request,
action: 'SetSecurityGroups',
version: '2015-12-01',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
resultWrapper: 'SetSecurityGroupsResult',
);
return SetSecurityGroupsOutput.fromXml($result);
}