1
- from typing import Iterator , List
1
+ from typing import Iterator , List , Optional
2
2
3
3
from aws_lambda_powertools .utilities .data_classes .common import DictWrapper
4
4
@@ -26,7 +26,7 @@ def get_from(self) -> List[str]:
26
26
return self ["from" ]
27
27
28
28
@property
29
- def date (self ) -> List [ str ] :
29
+ def date (self ) -> str :
30
30
"""The date and time when Amazon SES received the message."""
31
31
return self ["date" ]
32
32
@@ -45,6 +45,26 @@ def subject(self) -> str:
45
45
"""The value of the Subject header for the email."""
46
46
return str (self ["subject" ])
47
47
48
+ @property
49
+ def cc (self ) -> Optional [List [str ]]:
50
+ """The values in the CC header of the email."""
51
+ return self .get ("cc" )
52
+
53
+ @property
54
+ def bcc (self ) -> Optional [List [str ]]:
55
+ """The values in the BCC header of the email."""
56
+ return self .get ("bcc" )
57
+
58
+ @property
59
+ def sender (self ) -> Optional [List [str ]]:
60
+ """The values in the Sender header of the email."""
61
+ return self .get ("sender" )
62
+
63
+ @property
64
+ def reply_to (self ) -> Optional [List [str ]]:
65
+ """The values in the replyTo header of the email."""
66
+ return self .get ("replyTo" )
67
+
48
68
49
69
class SESMail (DictWrapper ):
50
70
@property
@@ -94,6 +114,10 @@ def common_headers(self) -> SESMailCommonHeaders:
94
114
class SESReceiptStatus (DictWrapper ):
95
115
@property
96
116
def status (self ) -> str :
117
+ """Receipt status
118
+
119
+ Possible values: 'PASS', 'FAIL', 'GRAY', 'PROCESSING_FAILED', 'DISABLED'
120
+ """
97
121
return str (self ["status" ])
98
122
99
123
@@ -107,18 +131,78 @@ def get_type(self) -> str:
107
131
# Note: this name conflicts with existing python builtins
108
132
return self ["type" ]
109
133
134
+ @property
135
+ def topic_arn (self ) -> Optional [str ]:
136
+ """String that contains the Amazon Resource Name (ARN) of the Amazon SNS topic to which the
137
+ notification was published."""
138
+ return self .get ("topicArn" )
139
+
110
140
@property
111
141
def function_arn (self ) -> str :
112
142
"""String that contains the ARN of the Lambda function that was triggered.
143
+
113
144
Present only for the Lambda action type."""
114
145
return self ["functionArn" ]
115
146
116
147
@property
117
148
def invocation_type (self ) -> str :
118
149
"""String that contains the invocation type of the Lambda function. Possible values are RequestResponse
119
- and Event. Present only for the Lambda action type."""
150
+ and Event.
151
+
152
+ Present only for the Lambda action type."""
120
153
return self ["invocationType" ]
121
154
155
+ @property
156
+ def bucket_name (self ) -> str :
157
+ """String that contains the name of the Amazon S3 bucket to which the message was published.
158
+
159
+ Present only for the S3 action type."""
160
+ return str (self ["bucketName" ])
161
+
162
+ @property
163
+ def object_key (self ) -> str :
164
+ """String that contains a name that uniquely identifies the email in the Amazon S3 bucket.
165
+ This is the same as the messageId in the mail object.
166
+
167
+ Present only for the S3 action type."""
168
+ return str (self ["objectKey" ])
169
+
170
+ @property
171
+ def smtp_reply_code (self ) -> str :
172
+ """String that contains the SMTP reply code, as defined by RFC 5321.
173
+
174
+ Present only for the bounce action type."""
175
+ return str (self ["smtpReplyCode" ])
176
+
177
+ @property
178
+ def status_code (self ) -> str :
179
+ """String that contains the SMTP enhanced status code, as defined by RFC 3463.
180
+
181
+ Present only for the bounce action type."""
182
+ return self ["statusCode" ]
183
+
184
+ @property
185
+ def message (self ) -> str :
186
+ """String that contains the human-readable text to include in the bounce message.
187
+
188
+ Present only for the bounce action type."""
189
+ return str (self ["message" ])
190
+
191
+ @property
192
+ def sender (self ) -> str :
193
+ """String that contains the email address of the sender of the email that bounced.
194
+ This is the address from which the bounce message was sent.
195
+
196
+ Present only for the bounce action type."""
197
+ return str (self ["sender" ])
198
+
199
+ @property
200
+ def organization_arn (self ) -> str :
201
+ """String that contains the ARN of the Amazon WorkMail organization.
202
+
203
+ Present only for the WorkMail action type."""
204
+ return str (self ["organizationArn" ])
205
+
122
206
123
207
class SESReceipt (DictWrapper ):
124
208
@property
@@ -154,12 +238,25 @@ def spf_verdict(self) -> SESReceiptStatus:
154
238
"""Object that indicates whether the Sender Policy Framework (SPF) check passed."""
155
239
return SESReceiptStatus (self ["spfVerdict" ])
156
240
241
+ @property
242
+ def dkim_verdict (self ) -> SESReceiptStatus :
243
+ """Object that indicates whether the DomainKeys Identified Mail (DKIM) check passed"""
244
+ return SESReceiptStatus (self ["dkimVerdict" ])
245
+
157
246
@property
158
247
def dmarc_verdict (self ) -> SESReceiptStatus :
159
248
"""Object that indicates whether the Domain-based Message Authentication,
160
249
Reporting & Conformance (DMARC) check passed."""
161
250
return SESReceiptStatus (self ["dmarcVerdict" ])
162
251
252
+ @property
253
+ def dmarc_policy (self ) -> Optional [str ]:
254
+ """Indicates the Domain-based Message Authentication, Reporting & Conformance (DMARC) settings for
255
+ the sending domain. This field only appears if the message fails DMARC authentication.
256
+
257
+ Possible values for this field are: none, quarantine, reject"""
258
+ return self .get ("dmarcPolicy" )
259
+
163
260
@property
164
261
def action (self ) -> SESReceiptAction :
165
262
"""Object that encapsulates information about the action that was executed."""
0 commit comments