MailManager / Client / get_rule_set
get_rule_set#
- MailManager.Client.get_rule_set(**kwargs)#
Fetch attributes of a rule set.
See also: AWS API Documentation
Request Syntax
response = client.get_rule_set( RuleSetId='string' )
- Parameters:
RuleSetId (string) –
[REQUIRED]
The identifier of an existing rule set to be retrieved.
- Return type:
dict
- Returns:
Response Syntax
{ 'CreatedDate': datetime(2015, 1, 1), 'LastModificationDate': datetime(2015, 1, 1), 'RuleSetArn': 'string', 'RuleSetId': 'string', 'RuleSetName': 'string', 'Rules': [ { 'Actions': [ { 'AddHeader': { 'HeaderName': 'string', 'HeaderValue': 'string' }, 'Archive': { 'ActionFailurePolicy': 'CONTINUE'|'DROP', 'TargetArchive': 'string' }, 'DeliverToMailbox': { 'ActionFailurePolicy': 'CONTINUE'|'DROP', 'MailboxArn': 'string', 'RoleArn': 'string' }, 'Drop': {}, 'Relay': { 'ActionFailurePolicy': 'CONTINUE'|'DROP', 'MailFrom': 'REPLACE'|'PRESERVE', 'Relay': 'string' }, 'ReplaceRecipient': { 'ReplaceWith': [ 'string', ] }, 'Send': { 'ActionFailurePolicy': 'CONTINUE'|'DROP', 'RoleArn': 'string' }, 'WriteToS3': { 'ActionFailurePolicy': 'CONTINUE'|'DROP', 'RoleArn': 'string', 'S3Bucket': 'string', 'S3Prefix': 'string', 'S3SseKmsKeyId': 'string' } }, ], 'Conditions': [ { 'BooleanExpression': { 'Evaluate': { 'Attribute': 'READ_RECEIPT_REQUESTED'|'TLS'|'TLS_WRAPPED' }, 'Operator': 'IS_TRUE'|'IS_FALSE' }, 'DmarcExpression': { 'Operator': 'EQUALS'|'NOT_EQUALS', 'Values': [ 'NONE'|'QUARANTINE'|'REJECT', ] }, 'IpExpression': { 'Evaluate': { 'Attribute': 'SOURCE_IP' }, 'Operator': 'CIDR_MATCHES'|'NOT_CIDR_MATCHES', 'Values': [ 'string', ] }, 'NumberExpression': { 'Evaluate': { 'Attribute': 'MESSAGE_SIZE' }, 'Operator': 'EQUALS'|'NOT_EQUALS'|'LESS_THAN'|'GREATER_THAN'|'LESS_THAN_OR_EQUAL'|'GREATER_THAN_OR_EQUAL', 'Value': 123.0 }, 'StringExpression': { 'Evaluate': { 'Attribute': 'MAIL_FROM'|'HELO'|'RECIPIENT'|'SENDER'|'FROM'|'SUBJECT'|'TO'|'CC', 'MimeHeaderAttribute': 'string' }, 'Operator': 'EQUALS'|'NOT_EQUALS'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS', 'Values': [ 'string', ] }, 'VerdictExpression': { 'Evaluate': { 'Analysis': { 'Analyzer': 'string', 'ResultField': 'string' }, 'Attribute': 'SPF'|'DKIM' }, 'Operator': 'EQUALS'|'NOT_EQUALS', 'Values': [ 'PASS'|'FAIL'|'GRAY'|'PROCESSING_FAILED', ] } }, ], 'Name': 'string', 'Unless': [ { 'BooleanExpression': { 'Evaluate': { 'Attribute': 'READ_RECEIPT_REQUESTED'|'TLS'|'TLS_WRAPPED' }, 'Operator': 'IS_TRUE'|'IS_FALSE' }, 'DmarcExpression': { 'Operator': 'EQUALS'|'NOT_EQUALS', 'Values': [ 'NONE'|'QUARANTINE'|'REJECT', ] }, 'IpExpression': { 'Evaluate': { 'Attribute': 'SOURCE_IP' }, 'Operator': 'CIDR_MATCHES'|'NOT_CIDR_MATCHES', 'Values': [ 'string', ] }, 'NumberExpression': { 'Evaluate': { 'Attribute': 'MESSAGE_SIZE' }, 'Operator': 'EQUALS'|'NOT_EQUALS'|'LESS_THAN'|'GREATER_THAN'|'LESS_THAN_OR_EQUAL'|'GREATER_THAN_OR_EQUAL', 'Value': 123.0 }, 'StringExpression': { 'Evaluate': { 'Attribute': 'MAIL_FROM'|'HELO'|'RECIPIENT'|'SENDER'|'FROM'|'SUBJECT'|'TO'|'CC', 'MimeHeaderAttribute': 'string' }, 'Operator': 'EQUALS'|'NOT_EQUALS'|'STARTS_WITH'|'ENDS_WITH'|'CONTAINS', 'Values': [ 'string', ] }, 'VerdictExpression': { 'Evaluate': { 'Analysis': { 'Analyzer': 'string', 'ResultField': 'string' }, 'Attribute': 'SPF'|'DKIM' }, 'Operator': 'EQUALS'|'NOT_EQUALS', 'Values': [ 'PASS'|'FAIL'|'GRAY'|'PROCESSING_FAILED', ] } }, ] }, ] }
Response Structure
(dict) –
CreatedDate (datetime) –
The date of when then rule set was created.
LastModificationDate (datetime) –
The date of when the rule set was last modified.
RuleSetArn (string) –
The Amazon Resource Name (ARN) of the rule set resource.
RuleSetId (string) –
The identifier of the rule set resource.
RuleSetName (string) –
A user-friendly name for the rule set resource.
Rules (list) –
The rules contained in the rule set.
(dict) –
A rule contains conditions, “unless conditions” and actions. For each envelope recipient of an email, if all conditions match and none of the “unless conditions” match, then all of the actions are executed sequentially. If no conditions are provided, the rule always applies and the actions are implicitly executed. If only “unless conditions” are provided, the rule applies if the email does not match the evaluation of the “unless conditions”.
Actions (list) –
The list of actions to execute when the conditions match the incoming email, and none of the “unless conditions” match.
(dict) –
The action for a rule to take. Only one of the contained actions can be set.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
AddHeader
,Archive
,DeliverToMailbox
,Drop
,Relay
,ReplaceRecipient
,Send
,WriteToS3
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
AddHeader (dict) –
This action adds a header. This can be used to add arbitrary email headers.
HeaderName (string) –
The name of the header to add to an email. The header must be prefixed with “X-”. Headers are added regardless of whether the header name pre-existed in the email.
HeaderValue (string) –
The value of the header to add to the email.
Archive (dict) –
This action archives the email. This can be used to deliver an email to an archive.
ActionFailurePolicy (string) –
A policy that states what to do in the case of failure. The action will fail if there are configuration errors. For example, the specified archive has been deleted.
TargetArchive (string) –
The identifier of the archive to send the email to.
DeliverToMailbox (dict) –
This action delivers an email to a WorkMail mailbox.
ActionFailurePolicy (string) –
A policy that states what to do in the case of failure. The action will fail if there are configuration errors. For example, the mailbox ARN is no longer valid.
MailboxArn (string) –
The Amazon Resource Name (ARN) of a WorkMail organization to deliver the email to.
RoleArn (string) –
The Amazon Resource Name (ARN) of an IAM role to use to execute this action. The role must have access to the workmail:DeliverToMailbox API.
Drop (dict) –
This action terminates the evaluation of rules in the rule set.
Relay (dict) –
This action relays the email to another SMTP server.
ActionFailurePolicy (string) –
A policy that states what to do in the case of failure. The action will fail if there are configuration errors. For example, the specified relay has been deleted.
MailFrom (string) –
This action specifies whether to preserve or replace original mail from address while relaying received emails to a destination server.
Relay (string) –
The identifier of the relay resource to be used when relaying an email.
ReplaceRecipient (dict) –
The action replaces certain or all recipients with a different set of recipients.
ReplaceWith (list) –
This action specifies the replacement recipient email addresses to insert.
(string) –
Send (dict) –
This action sends the email to the internet.
ActionFailurePolicy (string) –
A policy that states what to do in the case of failure. The action will fail if there are configuration errors. For example, the caller does not have the permissions to call the sendRawEmail API.
RoleArn (string) –
The Amazon Resource Name (ARN) of the role to use for this action. This role must have access to the ses:SendRawEmail API.
WriteToS3 (dict) –
This action writes the MIME content of the email to an S3 bucket.
ActionFailurePolicy (string) –
A policy that states what to do in the case of failure. The action will fail if there are configuration errors. For example, the specified the bucket has been deleted.
RoleArn (string) –
The Amazon Resource Name (ARN) of the IAM Role to use while writing to S3. This role must have access to the s3:PutObject, kms:Encrypt, and kms:GenerateDataKey APIs for the given bucket.
S3Bucket (string) –
The bucket name of the S3 bucket to write to.
S3Prefix (string) –
The S3 prefix to use for the write to the s3 bucket.
S3SseKmsKeyId (string) –
The KMS Key ID to use to encrypt the message in S3.
Conditions (list) –
The conditions of this rule. All conditions must match the email for the actions to be executed. An empty list of conditions means that all emails match, but are still subject to any “unless conditions”
(dict) –
The conditional expression used to evaluate an email for determining if a rule action should be taken.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
BooleanExpression
,DmarcExpression
,IpExpression
,NumberExpression
,StringExpression
,VerdictExpression
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
BooleanExpression (dict) –
The condition applies to a boolean expression passed in this field.
Evaluate (dict) –
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 will be set:
Attribute
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
Attribute (string) –
The boolean type representing the allowed attribute types for an email.
Operator (string) –
The matching operator for a boolean condition expression.
DmarcExpression (dict) –
The condition applies to a DMARC policy expression passed in this field.
Operator (string) –
The operator to apply to the DMARC policy of the incoming email.
Values (list) –
The values to use for the given DMARC policy operator. For the operator EQUALS, if multiple values are given, they are evaluated as an OR. That is, if any of the given values match, the condition is deemed to match. For the operator NOT_EQUALS, if multiple values are given, they are evaluated as an AND. That is, only if the email’s DMARC policy is not equal to any of the given values, then the condition is deemed to match.
(string) –
IpExpression (dict) –
The condition applies to an IP address expression passed in this field.
Evaluate (dict) –
The IP address to evaluate in this condition.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
Attribute
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
Attribute (string) –
The attribute of the email to evaluate.
Operator (string) –
The operator to evaluate the IP address.
Values (list) –
The IP CIDR blocks in format “x.y.z.w/n” (eg 10.0.0.0/8) to match with the email’s IP address. For the operator CIDR_MATCHES, if multiple values are given, they are evaluated as an OR. That is, if the IP address is contained within any of the given CIDR ranges, the condition is deemed to match. For NOT_CIDR_MATCHES, if multiple CIDR ranges are given, the condition is deemed to match if the IP address is not contained in any of the given CIDR ranges.
(string) –
NumberExpression (dict) –
The condition applies to a number expression passed in this field.
Evaluate (dict) –
The number to evaluate in a numeric condition expression.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
Attribute
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
Attribute (string) –
An email attribute that is used as the number to evaluate.
Operator (string) –
The operator for a numeric condition expression.
Value (float) –
The value to evaluate in a numeric condition expression.
StringExpression (dict) –
The condition applies to a string expression passed in this field.
Evaluate (dict) –
The string to evaluate in a string condition expression.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
Attribute
,MimeHeaderAttribute
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
Attribute (string) –
The email attribute to evaluate in a string condition expression.
MimeHeaderAttribute (string) –
The email MIME X-Header attribute to evaluate in a string condition expression.
Operator (string) –
The matching operator for a string condition expression.
Values (list) –
The string(s) to be evaluated in a string condition expression. For all operators, except for NOT_EQUALS, if multiple values are given, the values are processed as an OR. That is, if any of the values match the email’s string using the given operator, the condition is deemed to match. However, for NOT_EQUALS, the condition is only deemed to match if none of the given strings match the email’s string.
(string) –
VerdictExpression (dict) –
The condition applies to a verdict expression passed in this field.
Evaluate (dict) –
The verdict to evaluate in a verdict condition expression.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
Analysis
,Attribute
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
Analysis (dict) –
The Add On ARN and its returned value to evaluate in a verdict condition expression.
Analyzer (string) –
The Amazon Resource Name (ARN) of an Add On.
ResultField (string) –
The returned value from an Add On.
Attribute (string) –
The email verdict attribute to evaluate in a string verdict expression.
Operator (string) –
The matching operator for a verdict condition expression.
Values (list) –
The values to match with the email’s verdict using the given operator. For the EQUALS operator, if multiple values are given, the condition is deemed to match if any of the given verdicts match that of the email. For the NOT_EQUALS operator, if multiple values are given, the condition is deemed to match of none of the given verdicts match the verdict of the email.
(string) –
Name (string) –
The user-friendly name of the rule.
Unless (list) –
The “unless conditions” of this rule. None of the conditions can match the email for the actions to be executed. If any of these conditions do match the email, then the actions are not executed.
(dict) –
The conditional expression used to evaluate an email for determining if a rule action should be taken.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
BooleanExpression
,DmarcExpression
,IpExpression
,NumberExpression
,StringExpression
,VerdictExpression
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
BooleanExpression (dict) –
The condition applies to a boolean expression passed in this field.
Evaluate (dict) –
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 will be set:
Attribute
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
Attribute (string) –
The boolean type representing the allowed attribute types for an email.
Operator (string) –
The matching operator for a boolean condition expression.
DmarcExpression (dict) –
The condition applies to a DMARC policy expression passed in this field.
Operator (string) –
The operator to apply to the DMARC policy of the incoming email.
Values (list) –
The values to use for the given DMARC policy operator. For the operator EQUALS, if multiple values are given, they are evaluated as an OR. That is, if any of the given values match, the condition is deemed to match. For the operator NOT_EQUALS, if multiple values are given, they are evaluated as an AND. That is, only if the email’s DMARC policy is not equal to any of the given values, then the condition is deemed to match.
(string) –
IpExpression (dict) –
The condition applies to an IP address expression passed in this field.
Evaluate (dict) –
The IP address to evaluate in this condition.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
Attribute
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
Attribute (string) –
The attribute of the email to evaluate.
Operator (string) –
The operator to evaluate the IP address.
Values (list) –
The IP CIDR blocks in format “x.y.z.w/n” (eg 10.0.0.0/8) to match with the email’s IP address. For the operator CIDR_MATCHES, if multiple values are given, they are evaluated as an OR. That is, if the IP address is contained within any of the given CIDR ranges, the condition is deemed to match. For NOT_CIDR_MATCHES, if multiple CIDR ranges are given, the condition is deemed to match if the IP address is not contained in any of the given CIDR ranges.
(string) –
NumberExpression (dict) –
The condition applies to a number expression passed in this field.
Evaluate (dict) –
The number to evaluate in a numeric condition expression.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
Attribute
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
Attribute (string) –
An email attribute that is used as the number to evaluate.
Operator (string) –
The operator for a numeric condition expression.
Value (float) –
The value to evaluate in a numeric condition expression.
StringExpression (dict) –
The condition applies to a string expression passed in this field.
Evaluate (dict) –
The string to evaluate in a string condition expression.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
Attribute
,MimeHeaderAttribute
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
Attribute (string) –
The email attribute to evaluate in a string condition expression.
MimeHeaderAttribute (string) –
The email MIME X-Header attribute to evaluate in a string condition expression.
Operator (string) –
The matching operator for a string condition expression.
Values (list) –
The string(s) to be evaluated in a string condition expression. For all operators, except for NOT_EQUALS, if multiple values are given, the values are processed as an OR. That is, if any of the values match the email’s string using the given operator, the condition is deemed to match. However, for NOT_EQUALS, the condition is only deemed to match if none of the given strings match the email’s string.
(string) –
VerdictExpression (dict) –
The condition applies to a verdict expression passed in this field.
Evaluate (dict) –
The verdict to evaluate in a verdict condition expression.
Note
This is a Tagged Union structure. Only one of the following top level keys will be set:
Analysis
,Attribute
. If a client receives an unknown member it will setSDK_UNKNOWN_MEMBER
as the top level key, which maps to the name or tag of the unknown member. The structure ofSDK_UNKNOWN_MEMBER
is as follows:'SDK_UNKNOWN_MEMBER': {'name': 'UnknownMemberName'}
Analysis (dict) –
The Add On ARN and its returned value to evaluate in a verdict condition expression.
Analyzer (string) –
The Amazon Resource Name (ARN) of an Add On.
ResultField (string) –
The returned value from an Add On.
Attribute (string) –
The email verdict attribute to evaluate in a string verdict expression.
Operator (string) –
The matching operator for a verdict condition expression.
Values (list) –
The values to match with the email’s verdict using the given operator. For the EQUALS operator, if multiple values are given, the condition is deemed to match if any of the given verdicts match that of the email. For the NOT_EQUALS operator, if multiple values are given, the condition is deemed to match of none of the given verdicts match the verdict of the email.
(string) –
Exceptions
MailManager.Client.exceptions.ValidationException
MailManager.Client.exceptions.ResourceNotFoundException