Skip to content

Commit 2da8681

Browse files
Introducing new RuleSet rule PublishToSns action, which allows customers to publish email notifications to an Amazon SNS topic. New PublishToSns action enables customers to easily integrate their email workflows via Amazon SNS, allowing them to notify other systems about important email events.
1 parent b07ba90 commit 2da8681

File tree

12 files changed

+613
-9
lines changed

12 files changed

+613
-9
lines changed

generator/ServiceModels/mailmanager/mailmanager-2023-10-17.api.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2830,6 +2830,7 @@
28302830
"DeliverToMailbox":{"shape":"DeliverToMailboxAction"},
28312831
"DeliverToQBusiness":{"shape":"DeliverToQBusinessAction"},
28322832
"Drop":{"shape":"DropAction"},
2833+
"PublishToSns":{"shape":"SnsAction"},
28332834
"Relay":{"shape":"RelayAction"},
28342835
"ReplaceRecipient":{"shape":"ReplaceRecipientAction"},
28352836
"Send":{"shape":"SendAction"},
@@ -3299,6 +3300,40 @@
32993300
"pattern":"^[A-Za-z0-9!@#$%^&*()_+\\-=\\[\\]{}|.,?]+$",
33003301
"sensitive":true
33013302
},
3303+
"SnsAction":{
3304+
"type":"structure",
3305+
"required":[
3306+
"RoleArn",
3307+
"TopicArn"
3308+
],
3309+
"members":{
3310+
"ActionFailurePolicy":{"shape":"ActionFailurePolicy"},
3311+
"Encoding":{"shape":"SnsNotificationEncoding"},
3312+
"PayloadType":{"shape":"SnsNotificationPayloadType"},
3313+
"RoleArn":{"shape":"IamRoleArn"},
3314+
"TopicArn":{"shape":"SnsTopicArn"}
3315+
}
3316+
},
3317+
"SnsNotificationEncoding":{
3318+
"type":"string",
3319+
"enum":[
3320+
"UTF-8",
3321+
"BASE64"
3322+
]
3323+
},
3324+
"SnsNotificationPayloadType":{
3325+
"type":"string",
3326+
"enum":[
3327+
"HEADERS",
3328+
"CONTENT"
3329+
]
3330+
},
3331+
"SnsTopicArn":{
3332+
"type":"string",
3333+
"max":2048,
3334+
"min":20,
3335+
"pattern":"^arn:(aws|aws-cn|aws-us-gov):sns:[a-z]{2}-[a-z]+-\\d{1}:\\d{12}:[\\w\\-]{1,256}$"
3336+
},
33023337
"StartAddressListImportJobRequest":{
33033338
"type":"structure",
33043339
"required":["JobId"],

generator/ServiceModels/mailmanager/mailmanager-2023-10-17.docs.json

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,11 @@
8484
"refs": {
8585
"ArchiveAction$ActionFailurePolicy": "<p>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.</p>",
8686
"DeliverToMailboxAction$ActionFailurePolicy": "<p>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.</p>",
87-
"DeliverToQBusinessAction$ActionFailurePolicy": "<p>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 application has been deleted or the role lacks necessary permissions to call the qbusiness:BatchPutDocument API.</p>",
87+
"DeliverToQBusinessAction$ActionFailurePolicy": "<p>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 application has been deleted or the role lacks necessary permissions to call the <code>qbusiness:BatchPutDocument</code> API.</p>",
8888
"RelayAction$ActionFailurePolicy": "<p>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.</p>",
8989
"S3Action$ActionFailurePolicy": "<p>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.</p>",
90-
"SendAction$ActionFailurePolicy": "<p>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.</p>"
90+
"SendAction$ActionFailurePolicy": "<p>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.</p>",
91+
"SnsAction$ActionFailurePolicy": "<p>A policy that states what to do in the case of failure. The action will fail if there are configuration errors. For example, specified SNS topic has been deleted or the role lacks necessary permissions to call the <code>sns:Publish</code> API.</p>"
9192
}
9293
},
9394
"AddHeaderAction": {
@@ -868,9 +869,10 @@
868869
"base": null,
869870
"refs": {
870871
"DeliverToMailboxAction$RoleArn": "<p>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.</p>",
871-
"DeliverToQBusinessAction$RoleArn": "<p>The Amazon Resource Name (ARN) of the IAM Role to use while delivering to Amazon Q Business. This role must have access to the qbusiness:BatchPutDocument API for the given application and index.</p>",
872+
"DeliverToQBusinessAction$RoleArn": "<p>The Amazon Resource Name (ARN) of the IAM Role to use while delivering to Amazon Q Business. This role must have access to the <code>qbusiness:BatchPutDocument</code> API for the given application and index.</p>",
872873
"S3Action$RoleArn": "<p>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.</p>",
873-
"SendAction$RoleArn": "<p>The Amazon Resource Name (ARN) of the role to use for this action. This role must have access to the ses:SendRawEmail API.</p>"
874+
"SendAction$RoleArn": "<p>The Amazon Resource Name (ARN) of the role to use for this action. This role must have access to the ses:SendRawEmail API.</p>",
875+
"SnsAction$RoleArn": "<p>The Amazon Resource Name (ARN) of the IAM Role to use while writing to Amazon SNS. This role must have access to the <code>sns:Publish</code> API for the given topic.</p>"
874876
}
875877
},
876878
"IdOrArn": {
@@ -2041,6 +2043,30 @@
20412043
"IngressPointConfiguration$SmtpPassword": "<p>The password of the ingress endpoint resource.</p>"
20422044
}
20432045
},
2046+
"SnsAction": {
2047+
"base": "<p>The action to publish the email content to an Amazon SNS topic. When executed, this action will send the email as a notification to the specified SNS topic.</p>",
2048+
"refs": {
2049+
"RuleAction$PublishToSns": "<p>This action publishes the email content to an Amazon SNS topic.</p>"
2050+
}
2051+
},
2052+
"SnsNotificationEncoding": {
2053+
"base": null,
2054+
"refs": {
2055+
"SnsAction$Encoding": "<p>The encoding to use for the email within the Amazon SNS notification. The default value is <code>UTF-8</code>. Use <code>BASE64</code> if you need to preserve all special characters, especially when the original message uses a different encoding format.</p>"
2056+
}
2057+
},
2058+
"SnsNotificationPayloadType": {
2059+
"base": null,
2060+
"refs": {
2061+
"SnsAction$PayloadType": "<p>The expected payload type within the Amazon SNS notification. <code>CONTENT</code> attempts to publish the full email content with 20KB of headers content. <code>HEADERS</code> extracts up to 100KB of header content to include in the notification, email content will not be included to the notification. The default value is <code>CONTENT</code>.</p>"
2062+
}
2063+
},
2064+
"SnsTopicArn": {
2065+
"base": null,
2066+
"refs": {
2067+
"SnsAction$TopicArn": "<p>The Amazon Resource Name (ARN) of the Amazon SNS Topic to which notification for the email received will be published.</p>"
2068+
}
2069+
},
20442070
"StartAddressListImportJobRequest": {
20452071
"base": null,
20462072
"refs": {

generator/ServiceModels/mailmanager/mailmanager-2023-10-17.normal.json

Lines changed: 56 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1888,7 +1888,7 @@
18881888
"members":{
18891889
"ActionFailurePolicy":{
18901890
"shape":"ActionFailurePolicy",
1891-
"documentation":"<p>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 application has been deleted or the role lacks necessary permissions to call the qbusiness:BatchPutDocument API.</p>"
1891+
"documentation":"<p>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 application has been deleted or the role lacks necessary permissions to call the <code>qbusiness:BatchPutDocument</code> API.</p>"
18921892
},
18931893
"ApplicationId":{
18941894
"shape":"QBusinessApplicationId",
@@ -1900,7 +1900,7 @@
19001900
},
19011901
"RoleArn":{
19021902
"shape":"IamRoleArn",
1903-
"documentation":"<p>The Amazon Resource Name (ARN) of the IAM Role to use while delivering to Amazon Q Business. This role must have access to the qbusiness:BatchPutDocument API for the given application and index.</p>"
1903+
"documentation":"<p>The Amazon Resource Name (ARN) of the IAM Role to use while delivering to Amazon Q Business. This role must have access to the <code>qbusiness:BatchPutDocument</code> API for the given application and index.</p>"
19041904
}
19051905
},
19061906
"documentation":"<p>The action to deliver incoming emails to an Amazon Q Business application for indexing.</p>"
@@ -4118,6 +4118,10 @@
41184118
"shape":"DropAction",
41194119
"documentation":"<p>This action terminates the evaluation of rules in the rule set.</p>"
41204120
},
4121+
"PublishToSns":{
4122+
"shape":"SnsAction",
4123+
"documentation":"<p>This action publishes the email content to an Amazon SNS topic.</p>"
4124+
},
41214125
"Relay":{
41224126
"shape":"RelayAction",
41234127
"documentation":"<p>This action relays the email to another SMTP server.</p>"
@@ -4780,6 +4784,56 @@
47804784
"pattern":"^[A-Za-z0-9!@#$%^&*()_+\\-=\\[\\]{}|.,?]+$",
47814785
"sensitive":true
47824786
},
4787+
"SnsAction":{
4788+
"type":"structure",
4789+
"required":[
4790+
"RoleArn",
4791+
"TopicArn"
4792+
],
4793+
"members":{
4794+
"ActionFailurePolicy":{
4795+
"shape":"ActionFailurePolicy",
4796+
"documentation":"<p>A policy that states what to do in the case of failure. The action will fail if there are configuration errors. For example, specified SNS topic has been deleted or the role lacks necessary permissions to call the <code>sns:Publish</code> API.</p>"
4797+
},
4798+
"Encoding":{
4799+
"shape":"SnsNotificationEncoding",
4800+
"documentation":"<p>The encoding to use for the email within the Amazon SNS notification. The default value is <code>UTF-8</code>. Use <code>BASE64</code> if you need to preserve all special characters, especially when the original message uses a different encoding format.</p>"
4801+
},
4802+
"PayloadType":{
4803+
"shape":"SnsNotificationPayloadType",
4804+
"documentation":"<p>The expected payload type within the Amazon SNS notification. <code>CONTENT</code> attempts to publish the full email content with 20KB of headers content. <code>HEADERS</code> extracts up to 100KB of header content to include in the notification, email content will not be included to the notification. The default value is <code>CONTENT</code>.</p>"
4805+
},
4806+
"RoleArn":{
4807+
"shape":"IamRoleArn",
4808+
"documentation":"<p>The Amazon Resource Name (ARN) of the IAM Role to use while writing to Amazon SNS. This role must have access to the <code>sns:Publish</code> API for the given topic.</p>"
4809+
},
4810+
"TopicArn":{
4811+
"shape":"SnsTopicArn",
4812+
"documentation":"<p>The Amazon Resource Name (ARN) of the Amazon SNS Topic to which notification for the email received will be published.</p>"
4813+
}
4814+
},
4815+
"documentation":"<p>The action to publish the email content to an Amazon SNS topic. When executed, this action will send the email as a notification to the specified SNS topic.</p>"
4816+
},
4817+
"SnsNotificationEncoding":{
4818+
"type":"string",
4819+
"enum":[
4820+
"UTF-8",
4821+
"BASE64"
4822+
]
4823+
},
4824+
"SnsNotificationPayloadType":{
4825+
"type":"string",
4826+
"enum":[
4827+
"HEADERS",
4828+
"CONTENT"
4829+
]
4830+
},
4831+
"SnsTopicArn":{
4832+
"type":"string",
4833+
"max":2048,
4834+
"min":20,
4835+
"pattern":"^arn:(aws|aws-cn|aws-us-gov):sns:[a-z]{2}-[a-z]+-\\d{1}:\\d{12}:[\\w\\-]{1,256}$"
4836+
},
47834837
"StartAddressListImportJobRequest":{
47844838
"type":"structure",
47854839
"required":["JobId"],

sdk/code-analysis/ServiceAnalysis/MailManager/Generated/PropertyValueRules.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1082,6 +1082,18 @@
10821082
<max>2048</max>
10831083
<pattern>^[a-zA-Z0-9:_/+=,@.#-]+$</pattern>
10841084
</property-value-rule>
1085+
<property-value-rule>
1086+
<property>Amazon.MailManager.Model.SnsAction.RoleArn</property>
1087+
<min>20</min>
1088+
<max>2048</max>
1089+
<pattern>^[a-zA-Z0-9:_/+=,@.#-]+$</pattern>
1090+
</property-value-rule>
1091+
<property-value-rule>
1092+
<property>Amazon.MailManager.Model.SnsAction.TopicArn</property>
1093+
<min>20</min>
1094+
<max>2048</max>
1095+
<pattern>^arn:(aws|aws-cn|aws-us-gov):sns:[a-z]{2}-[a-z]+-\d{1}:\d{12}:[\w\-]{1,256}$</pattern>
1096+
</property-value-rule>
10851097
<property-value-rule>
10861098
<property>Amazon.MailManager.Model.Tag.Key</property>
10871099
<min>1</min>

sdk/src/Services/MailManager/Generated/Model/DeliverToQBusinessAction.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public partial class DeliverToQBusinessAction
4444
/// <para>
4545
/// A policy that states what to do in the case of failure. The action will fail if there
4646
/// are configuration errors. For example, the specified application has been deleted
47-
/// or the role lacks necessary permissions to call the qbusiness:BatchPutDocument API.
47+
/// or the role lacks necessary permissions to call the <c>qbusiness:BatchPutDocument</c>
48+
/// API.
4849
/// </para>
4950
/// </summary>
5051
public ActionFailurePolicy ActionFailurePolicy
@@ -103,8 +104,8 @@ internal bool IsSetIndexId()
103104
/// Gets and sets the property RoleArn.
104105
/// <para>
105106
/// The Amazon Resource Name (ARN) of the IAM Role to use while delivering to Amazon Q
106-
/// Business. This role must have access to the qbusiness:BatchPutDocument API for the
107-
/// given application and index.
107+
/// Business. This role must have access to the <c>qbusiness:BatchPutDocument</c> API
108+
/// for the given application and index.
108109
/// </para>
109110
/// </summary>
110111
[AWSProperty(Required=true, Min=20, Max=2048)]

sdk/src/Services/MailManager/Generated/Model/Internal/MarshallTransformations/RuleActionMarshaller.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,17 @@ public void Marshall(RuleAction requestObject, JsonMarshallerContext context)
101101
context.Writer.WriteEndObject();
102102
}
103103

104+
if(requestObject.IsSetPublishToSns())
105+
{
106+
context.Writer.WritePropertyName("PublishToSns");
107+
context.Writer.WriteStartObject();
108+
109+
var marshaller = SnsActionMarshaller.Instance;
110+
marshaller.Marshall(requestObject.PublishToSns, context);
111+
112+
context.Writer.WriteEndObject();
113+
}
114+
104115
if(requestObject.IsSetRelay())
105116
{
106117
context.Writer.WritePropertyName("Relay");

sdk/src/Services/MailManager/Generated/Model/Internal/MarshallTransformations/RuleActionUnmarshaller.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,12 @@ public RuleAction Unmarshall(JsonUnmarshallerContext context, ref StreamingUtf8J
8686
unmarshalledObject.Drop = unmarshaller.Unmarshall(context, ref reader);
8787
continue;
8888
}
89+
if (context.TestExpression("PublishToSns", targetDepth))
90+
{
91+
var unmarshaller = SnsActionUnmarshaller.Instance;
92+
unmarshalledObject.PublishToSns = unmarshaller.Unmarshall(context, ref reader);
93+
continue;
94+
}
8995
if (context.TestExpression("Relay", targetDepth))
9096
{
9197
var unmarshaller = RelayActionUnmarshaller.Instance;
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
/*
17+
* Do not modify this file. This file is generated from the mailmanager-2023-10-17.normal.json service model.
18+
*/
19+
using System;
20+
using System.Collections.Generic;
21+
using System.Globalization;
22+
using System.IO;
23+
using System.Text;
24+
using System.Xml.Serialization;
25+
26+
using Amazon.MailManager.Model;
27+
using Amazon.Runtime;
28+
using Amazon.Runtime.Internal;
29+
using Amazon.Runtime.Internal.Transform;
30+
using Amazon.Runtime.Internal.Util;
31+
#pragma warning disable CS0612,CS0618
32+
namespace Amazon.MailManager.Model.Internal.MarshallTransformations
33+
{
34+
/// <summary>
35+
/// SnsAction Marshaller
36+
/// </summary>
37+
public class SnsActionMarshaller : IRequestMarshaller<SnsAction, JsonMarshallerContext>
38+
{
39+
/// <summary>
40+
/// Unmarshaller the response from the service to the response class.
41+
/// </summary>
42+
/// <param name="requestObject"></param>
43+
/// <param name="context"></param>
44+
/// <returns></returns>
45+
public void Marshall(SnsAction requestObject, JsonMarshallerContext context)
46+
{
47+
if(requestObject == null)
48+
return;
49+
if(requestObject.IsSetActionFailurePolicy())
50+
{
51+
context.Writer.WritePropertyName("ActionFailurePolicy");
52+
context.Writer.WriteStringValue(requestObject.ActionFailurePolicy);
53+
}
54+
55+
if(requestObject.IsSetEncoding())
56+
{
57+
context.Writer.WritePropertyName("Encoding");
58+
context.Writer.WriteStringValue(requestObject.Encoding);
59+
}
60+
61+
if(requestObject.IsSetPayloadType())
62+
{
63+
context.Writer.WritePropertyName("PayloadType");
64+
context.Writer.WriteStringValue(requestObject.PayloadType);
65+
}
66+
67+
if(requestObject.IsSetRoleArn())
68+
{
69+
context.Writer.WritePropertyName("RoleArn");
70+
context.Writer.WriteStringValue(requestObject.RoleArn);
71+
}
72+
73+
if(requestObject.IsSetTopicArn())
74+
{
75+
context.Writer.WritePropertyName("TopicArn");
76+
context.Writer.WriteStringValue(requestObject.TopicArn);
77+
}
78+
79+
}
80+
81+
/// <summary>
82+
/// Singleton Marshaller.
83+
/// </summary>
84+
public readonly static SnsActionMarshaller Instance = new SnsActionMarshaller();
85+
86+
}
87+
}

0 commit comments

Comments
 (0)