updateTrafficPolicy method

Future<void> updateTrafficPolicy({
  1. required String trafficPolicyId,
  2. AcceptAction? defaultAction,
  3. int? maxMessageSizeBytes,
  4. List<PolicyStatement>? policyStatements,
  5. String? trafficPolicyName,
})

Update attributes of an already provisioned traffic policy resource.

May throw ConflictException. May throw ResourceNotFoundException. May throw ValidationException.

Parameter trafficPolicyId : The identifier of the traffic policy that you want to update.

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 maxMessageSizeBytes : The maximum message size in bytes of email which is allowed in by this traffic policy—anything larger will be blocked.

Parameter policyStatements : The list of conditions to be updated for filtering email traffic.

Parameter trafficPolicyName : A user-friendly name for the traffic policy resource.

Implementation

Future<void> updateTrafficPolicy({
  required String trafficPolicyId,
  AcceptAction? defaultAction,
  int? maxMessageSizeBytes,
  List<PolicyStatement>? policyStatements,
  String? trafficPolicyName,
}) async {
  _s.validateNumRange(
    'maxMessageSizeBytes',
    maxMessageSizeBytes,
    1,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'MailManagerSvc.UpdateTrafficPolicy'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'TrafficPolicyId': trafficPolicyId,
      if (defaultAction != null) 'DefaultAction': defaultAction.value,
      if (maxMessageSizeBytes != null)
        'MaxMessageSizeBytes': maxMessageSizeBytes,
      if (policyStatements != null) 'PolicyStatements': policyStatements,
      if (trafficPolicyName != null) 'TrafficPolicyName': trafficPolicyName,
    },
  );
}