createTrafficPolicy method
Provision a new traffic policy resource.
May throw ConflictException.
May throw ServiceQuotaExceededException.
May throw ValidationException.
Parameter defaultAction :
Default action instructs the traffic policy to either Allow or Deny (block)
messages that fall outside of (or not addressed by) the conditions of your
policy statements
Parameter policyStatements :
Conditional statements for filtering email traffic.
Parameter trafficPolicyName :
A user-friendly name for the traffic policy resource.
Parameter clientToken :
A unique token that Amazon SES uses to recognize subsequent retries of the
same request.
Parameter maxMessageSizeBytes :
The maximum message size in bytes of email which is allowed in by this
traffic policy—anything larger will be blocked.
Parameter tags :
The tags used to organize, track, or control access for the resource. For
example, { "tags": {"key1":"value1", "key2":"value2"} }.
Implementation
Future<CreateTrafficPolicyResponse> createTrafficPolicy({
required AcceptAction defaultAction,
required List<PolicyStatement> policyStatements,
required String trafficPolicyName,
String? clientToken,
int? maxMessageSizeBytes,
List<Tag>? tags,
}) async {
_s.validateNumRange(
'maxMessageSizeBytes',
maxMessageSizeBytes,
1,
1152921504606846976,
);
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.0',
'X-Amz-Target': 'MailManagerSvc.CreateTrafficPolicy'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'DefaultAction': defaultAction.value,
'PolicyStatements': policyStatements,
'TrafficPolicyName': trafficPolicyName,
'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
if (maxMessageSizeBytes != null)
'MaxMessageSizeBytes': maxMessageSizeBytes,
if (tags != null) 'Tags': tags,
},
);
return CreateTrafficPolicyResponse.fromJson(jsonResponse.body);
}