createLoadBalancerPolicy method

Future<void> createLoadBalancerPolicy({
  1. required String loadBalancerName,
  2. required String policyName,
  3. required String policyTypeName,
  4. List<PolicyAttribute>? policyAttributes,
})

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 PolicyTypeNotFoundException. May throw DuplicatePolicyNameException. May throw TooManyPoliciesException. May throw InvalidConfigurationRequestException.

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 {
  ArgumentError.checkNotNull(loadBalancerName, 'loadBalancerName');
  ArgumentError.checkNotNull(policyName, 'policyName');
  ArgumentError.checkNotNull(policyTypeName, 'policyTypeName');
  final $request = <String, dynamic>{};
  $request['LoadBalancerName'] = loadBalancerName;
  $request['PolicyName'] = policyName;
  $request['PolicyTypeName'] = policyTypeName;
  policyAttributes?.also((arg) => $request['PolicyAttributes'] = arg);
  await _protocol.send(
    $request,
    action: 'CreateLoadBalancerPolicy',
    version: '2012-06-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['CreateLoadBalancerPolicyInput'],
    shapes: shapes,
    resultWrapper: 'CreateLoadBalancerPolicyResult',
  );
}