updateRule method

Future<UpdateRuleResponse> updateRule({
  1. required String listenerIdentifier,
  2. required String ruleIdentifier,
  3. required String serviceIdentifier,
  4. RuleAction? action,
  5. RuleMatch? match,
  6. int? priority,
})

Updates a specified rule for the listener. You can't modify a default listener rule. To modify a default listener rule, use UpdateListener.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter listenerIdentifier : The ID or ARN of the listener.

Parameter ruleIdentifier : The ID or ARN of the rule.

Parameter serviceIdentifier : The ID or ARN of the service.

Parameter action : Information about the action for the specified listener rule.

Parameter match : The rule match.

Parameter priority : The rule priority. A listener can't have multiple rules with the same priority.

Implementation

Future<UpdateRuleResponse> updateRule({
  required String listenerIdentifier,
  required String ruleIdentifier,
  required String serviceIdentifier,
  RuleAction? action,
  RuleMatch? match,
  int? priority,
}) async {
  _s.validateNumRange(
    'priority',
    priority,
    1,
    2000,
  );
  final $payload = <String, dynamic>{
    if (action != null) 'action': action,
    if (match != null) 'match': match,
    if (priority != null) 'priority': priority,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'PATCH',
    requestUri:
        '/services/${Uri.encodeComponent(serviceIdentifier)}/listeners/${Uri.encodeComponent(listenerIdentifier)}/rules/${Uri.encodeComponent(ruleIdentifier)}',
    exceptionFnMap: _exceptionFns,
  );
  return UpdateRuleResponse.fromJson(response);
}