createRule method
Creates a rule for the specified listener. The listener must be associated with an Application Load Balancer.
Each rule consists of a priority, one or more actions, and one or more conditions. Rules are evaluated in priority order, from the lowest value to the highest value. When the conditions for a rule are met, its actions are performed. If the conditions for no rules are met, the actions for the default rule are performed. For more information, see Listener rules in the Application Load Balancers Guide.
May throw PriorityInUseException. May throw TooManyTargetGroupsException. May throw TooManyRulesException. May throw TargetGroupAssociationLimitException. May throw IncompatibleProtocolsException. May throw ListenerNotFoundException. May throw TargetGroupNotFoundException. May throw InvalidConfigurationRequestException. May throw TooManyRegistrationsForTargetIdException. May throw TooManyTargetsException. May throw UnsupportedProtocolException. May throw TooManyActionsException. May throw InvalidLoadBalancerActionException. May throw TooManyUniqueTargetGroupsPerLoadBalancerException. May throw TooManyTagsException.
Parameter actions
:
The actions.
Parameter conditions
:
The conditions.
Parameter listenerArn
:
The Amazon Resource Name (ARN) of the listener.
Parameter priority
:
The rule priority. A listener can't have multiple rules with the same
priority.
Parameter tags
:
The tags to assign to the rule.
Implementation
Future<CreateRuleOutput> createRule({
required List<Action> actions,
required List<RuleCondition> conditions,
required String listenerArn,
required int priority,
List<Tag>? tags,
}) async {
ArgumentError.checkNotNull(actions, 'actions');
ArgumentError.checkNotNull(conditions, 'conditions');
ArgumentError.checkNotNull(listenerArn, 'listenerArn');
ArgumentError.checkNotNull(priority, 'priority');
_s.validateNumRange(
'priority',
priority,
1,
50000,
isRequired: true,
);
final $request = <String, dynamic>{};
$request['Actions'] = actions;
$request['Conditions'] = conditions;
$request['ListenerArn'] = listenerArn;
$request['Priority'] = priority;
tags?.also((arg) => $request['Tags'] = arg);
final $result = await _protocol.send(
$request,
action: 'CreateRule',
version: '2015-12-01',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
shape: shapes['CreateRuleInput'],
shapes: shapes,
resultWrapper: 'CreateRuleResult',
);
return CreateRuleOutput.fromXml($result);
}