MailManager / Client / create_traffic_policy

create_traffic_policy#

MailManager.Client.create_traffic_policy(**kwargs)#

Provision a new traffic policy resource.

See also: AWS API Documentation

Request Syntax

response = client.create_traffic_policy(
    ClientToken='string',
    DefaultAction='ALLOW'|'DENY',
    MaxMessageSizeBytes=123,
    PolicyStatements=[
        {
            'Action': 'ALLOW'|'DENY',
            'Conditions': [
                {
                    'BooleanExpression': {
                        'Evaluate': {
                            'Analysis': {
                                'Analyzer': 'string',
                                'ResultField': 'string'
                            }
                        },
                        'Operator': 'IS_TRUE'|'IS_FALSE'
                    },
                    'IpExpression': {
                        'Evaluate': {
                            'Attribute': 'SENDER_IP'
                        },
                        'Operator': 'CIDR_MATCHES'|'NOT_CIDR_MATCHES',
                        'Values': [
                            'string',
                        ]
                    },
                    'StringExpression': {
                        'Evaluate': {
                            'Attribute': 'RECIPIENT'
                        },
                        'Operator': 'EQUALS'|'NOT_EQUALS'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS',
                        'Values': [
                            'string',
                        ]
                    },
                    'TlsExpression': {
                        'Evaluate': {
                            'Attribute': 'TLS_PROTOCOL'
                        },
                        'Operator': 'MINIMUM_TLS_VERSION'|'IS',
                        'Value': 'TLS1_2'|'TLS1_3'
                    }
                },
            ]
        },
    ],
    Tags=[
        {
            'Key': 'string',
            'Value': 'string'
        },
    ],
    TrafficPolicyName='string'
)
Parameters:
  • ClientToken (string) –

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

    This field is autopopulated if not provided.

  • DefaultAction (string) –

    [REQUIRED]

    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

  • MaxMessageSizeBytes (integer) – The maximum message size in bytes of email which is allowed in by this traffic policy—anything larger will be blocked.

  • PolicyStatements (list) –

    [REQUIRED]

    Conditional statements for filtering email traffic.

    • (dict) –

      The structure containing traffic policy conditions and actions.

      • Action (string) – [REQUIRED]

        The action that informs a traffic policy resource to either allow or block the email if it matches a condition in the policy statement.

      • Conditions (list) – [REQUIRED]

        The list of conditions to apply to incoming messages for filtering email traffic.

        • (dict) –

          The email traffic filtering conditions which are contained in a traffic policy resource.

          Note

          This is a Tagged Union structure. Only one of the following top level keys can be set: BooleanExpression, IpExpression, StringExpression, TlsExpression.

          • BooleanExpression (dict) –

            This represents a boolean type condition matching on the incoming mail. It performs the boolean operation configured in ‘Operator’ and evaluates the ‘Protocol’ object against the ‘Value’.

            • Evaluate (dict) – [REQUIRED]

              The operand on which to perform a boolean condition operation.

              Note

              This is a Tagged Union structure. Only one of the following top level keys can be set: Analysis.

              • Analysis (dict) –

                The structure type for a boolean condition stating the Add On ARN and its returned value.

                • Analyzer (string) – [REQUIRED]

                  The Amazon Resource Name (ARN) of an Add On.

                • ResultField (string) – [REQUIRED]

                  The returned value from an Add On.

            • Operator (string) – [REQUIRED]

              The matching operator for a boolean condition expression.

          • IpExpression (dict) –

            This represents an IP based condition matching on the incoming mail. It performs the operation configured in ‘Operator’ and evaluates the ‘Protocol’ object against the ‘Value’.

            • Evaluate (dict) – [REQUIRED]

              The left hand side argument of an IP condition expression.

              Note

              This is a Tagged Union structure. Only one of the following top level keys can be set: Attribute.

              • Attribute (string) –

                An enum type representing the allowed attribute types for an IP condition.

            • Operator (string) – [REQUIRED]

              The matching operator for an IP condition expression.

            • Values (list) – [REQUIRED]

              The right hand side argument of an IP condition expression.

              • (string) –

          • StringExpression (dict) –

            This represents a string based condition matching on the incoming mail. It performs the string operation configured in ‘Operator’ and evaluates the ‘Protocol’ object against the ‘Value’.

            • Evaluate (dict) – [REQUIRED]

              The left hand side argument of a string condition expression.

              Note

              This is a Tagged Union structure. Only one of the following top level keys can be set: Attribute.

              • Attribute (string) –

                The enum type representing the allowed attribute types for a string condition.

            • Operator (string) – [REQUIRED]

              The matching operator for a string condition expression.

            • Values (list) – [REQUIRED]

              The right hand side argument of a string condition expression.

              • (string) –

          • TlsExpression (dict) –

            This represents a TLS based condition matching on the incoming mail. It performs the operation configured in ‘Operator’ and evaluates the ‘Protocol’ object against the ‘Value’.

            • Evaluate (dict) – [REQUIRED]

              The left hand side argument of a TLS condition expression.

              Note

              This is a Tagged Union structure. Only one of the following top level keys can be set: Attribute.

              • Attribute (string) –

                The enum type representing the allowed attribute types for the TLS condition.

            • Operator (string) – [REQUIRED]

              The matching operator for a TLS condition expression.

            • Value (string) – [REQUIRED]

              The right hand side argument of a TLS condition expression.

  • Tags (list) –

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

    • (dict) –

      A key-value pair (the value is optional), that you can define and assign to Amazon Web Services resources.

      • Key (string) – [REQUIRED]

        The key of the key-value tag.

      • Value (string) – [REQUIRED]

        The value of the key-value tag.

  • TrafficPolicyName (string) –

    [REQUIRED]

    A user-friendly name for the traffic policy resource.

Return type:

dict

Returns:

Response Syntax

{
    'TrafficPolicyId': 'string'
}

Response Structure

  • (dict) –

    • TrafficPolicyId (string) –

      The identifier of the traffic policy resource.

Exceptions