applySecurityGroupsToLoadBalancer method
Associates one or more security groups with your load balancer in a virtual private cloud (VPC). The specified security groups override the previously associated security groups.
For more information, see Security Groups for Load Balancers in a VPC in the Classic Load Balancers Guide.
May throw AccessPointNotFoundException. May throw InvalidConfigurationRequestException. May throw InvalidSecurityGroupException.
Parameter loadBalancerName
:
The name of the load balancer.
Parameter securityGroups
:
The IDs of the security groups to associate with the load balancer. Note
that you cannot specify the name of the security group.
Implementation
Future<ApplySecurityGroupsToLoadBalancerOutput>
applySecurityGroupsToLoadBalancer({
required String loadBalancerName,
required List<String> securityGroups,
}) async {
ArgumentError.checkNotNull(loadBalancerName, 'loadBalancerName');
ArgumentError.checkNotNull(securityGroups, 'securityGroups');
final $request = <String, dynamic>{};
$request['LoadBalancerName'] = loadBalancerName;
$request['SecurityGroups'] = securityGroups;
final $result = await _protocol.send(
$request,
action: 'ApplySecurityGroupsToLoadBalancer',
version: '2012-06-01',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
shape: shapes['ApplySecurityGroupsToLoadBalancerInput'],
shapes: shapes,
resultWrapper: 'ApplySecurityGroupsToLoadBalancerResult',
);
return ApplySecurityGroupsToLoadBalancerOutput.fromXml($result);
}