createLoadBalancerPolicy method
Creates a policy with the specified attributes for the specified load balancer.
Policies are settings that are saved for your load balancer and that can be applied to the listener or the application server, depending on the policy type.
May throw AccessPointNotFoundException.
May throw DuplicatePolicyNameException.
May throw InvalidConfigurationRequestException.
May throw PolicyTypeNotFoundException.
May throw TooManyPoliciesException.
Parameter loadBalancerName :
The name of the load balancer.
Parameter policyName :
The name of the load balancer policy to be created. This name must be
unique within the set of policies for this load balancer.
Parameter policyTypeName :
The name of the base policy type. To get the list of policy types, use
DescribeLoadBalancerPolicyTypes.
Parameter policyAttributes :
The policy attributes.
Implementation
Future<void> createLoadBalancerPolicy({
required String loadBalancerName,
required String policyName,
required String policyTypeName,
List<PolicyAttribute>? policyAttributes,
}) async {
final $request = <String, String>{
'LoadBalancerName': loadBalancerName,
'PolicyName': policyName,
'PolicyTypeName': policyTypeName,
if (policyAttributes != null)
if (policyAttributes.isEmpty)
'PolicyAttributes': ''
else
for (var i1 = 0; i1 < policyAttributes.length; i1++)
for (var e3 in policyAttributes[i1].toQueryMap().entries)
'PolicyAttributes.member.${i1 + 1}.${e3.key}': e3.value,
};
await _protocol.send(
$request,
action: 'CreateLoadBalancerPolicy',
version: '2012-06-01',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
resultWrapper: 'CreateLoadBalancerPolicyResult',
);
}