createRuleSet method

Future<CreateRuleSetResponse> createRuleSet({
  1. required String ruleSetName,
  2. required List<Rule> rules,
  3. String? clientToken,
  4. List<Tag>? tags,
})

Provision a new rule set.

May throw ConflictException. May throw ServiceQuotaExceededException. May throw ValidationException.

Parameter ruleSetName : A user-friendly name for the rule set.

Parameter rules : Conditional rules that are evaluated for determining actions on email.

Parameter clientToken : A unique token that Amazon SES uses to recognize subsequent retries of the same request.

Parameter tags : The tags used to organize, track, or control access for the resource. For example, { "tags": {"key1":"value1", "key2":"value2"} }.

Implementation

Future<CreateRuleSetResponse> createRuleSet({
  required String ruleSetName,
  required List<Rule> rules,
  String? clientToken,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'MailManagerSvc.CreateRuleSet'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'RuleSetName': ruleSetName,
      'Rules': rules,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateRuleSetResponse.fromJson(jsonResponse.body);
}