updateRuleVersion method

Future<UpdateRuleVersionResult> updateRuleVersion({
  1. required String expression,
  2. required Language language,
  3. required List<String> outcomes,
  4. required Rule rule,
  5. String? description,
  6. List<Tag>? tags,
})

Updates a rule version resulting in a new rule version. Updates a rule version resulting in a new rule version (version 1, 2, 3 ...).

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

Parameter expression : The rule expression.

Parameter language : The language.

Parameter outcomes : The outcomes.

Parameter rule : The rule to update.

Parameter description : The description.

Parameter tags : The tags to assign to the rule version.

Implementation

Future<UpdateRuleVersionResult> updateRuleVersion({
  required String expression,
  required Language language,
  required List<String> outcomes,
  required Rule rule,
  String? description,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(expression, 'expression');
  _s.validateStringLength(
    'expression',
    expression,
    1,
    4096,
    isRequired: true,
  );
  ArgumentError.checkNotNull(language, 'language');
  ArgumentError.checkNotNull(outcomes, 'outcomes');
  ArgumentError.checkNotNull(rule, 'rule');
  _s.validateStringLength(
    'description',
    description,
    1,
    128,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSHawksNestServiceFacade.UpdateRuleVersion'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'expression': expression,
      'language': language.toValue(),
      'outcomes': outcomes,
      'rule': rule,
      if (description != null) 'description': description,
      if (tags != null) 'tags': tags,
    },
  );

  return UpdateRuleVersionResult.fromJson(jsonResponse.body);
}