Created
April 24, 2023 22:32
-
-
Save leandrodamascena/69cad79e01fcff4697c3672f5db14f67 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/aws_lambda_powertools/utilities/parser/models/s3_event_notification.py b/aws_lambda_powertools/utilities/parser/models/s3_event_notification.py | |
index 37d77821..e3bedb2b 100644 | |
--- a/aws_lambda_powertools/utilities/parser/models/s3_event_notification.py | |
+++ b/aws_lambda_powertools/utilities/parser/models/s3_event_notification.py | |
@@ -3,7 +3,7 @@ from typing import List | |
from pydantic import Json | |
from aws_lambda_powertools.utilities.parser.models.s3 import S3Model | |
-from aws_lambda_powertools.utilities.parser.models.sqs import SqsRecordModel, SqsModel | |
+from aws_lambda_powertools.utilities.parser.models.sqs import SqsModel, SqsRecordModel | |
class SqsS3EventNotificationRecordModel(SqsRecordModel): | |
diff --git a/aws_lambda_powertools/utilities/parser/models/sqs.py b/aws_lambda_powertools/utilities/parser/models/sqs.py | |
index c92a8361..a1c172c2 100644 | |
--- a/aws_lambda_powertools/utilities/parser/models/sqs.py | |
+++ b/aws_lambda_powertools/utilities/parser/models/sqs.py | |
@@ -1,5 +1,5 @@ | |
from datetime import datetime | |
-from typing import Dict, List, Optional, Type, Union | |
+from typing import Dict, List, Optional, Sequence, Type, Union | |
from pydantic import BaseModel | |
@@ -63,4 +63,4 @@ class SqsRecordModel(BaseModel): | |
class SqsModel(BaseModel): | |
- Records: List[SqsRecordModel] | |
+ Records: Sequence[SqsRecordModel] | |
diff --git a/docs/utilities/parser.md b/docs/utilities/parser.md | |
index 66103ad4..9b450e3a 100644 | |
--- a/docs/utilities/parser.md | |
+++ b/docs/utilities/parser.md | |
@@ -175,6 +175,7 @@ Parser comes with the following built-in models: | |
| **LambdaFunctionUrlModel** | Lambda Event Source payload for Lambda Function URL payload | | |
| **KafkaSelfManagedEventModel** | Lambda Event Source payload for self managed Kafka payload | | |
| **KafkaMskEventModel** | Lambda Event Source payload for AWS MSK payload | | |
+| **SqsS3EventNotificationModel** | Lambda Event Source payload for SQS-wrapped S3 event notifications | | |
#### Extending built-in models | |
diff --git a/tests/functional/parser/test_sqs_s3_event_notification.py b/tests/functional/parser/test_sqs_s3_event_notification.py | |
index 75c35af7..21b0781a 100644 | |
--- a/tests/functional/parser/test_sqs_s3_event_notification.py | |
+++ b/tests/functional/parser/test_sqs_s3_event_notification.py | |
@@ -18,7 +18,9 @@ def test_handle_sqs_json_body_containing_s3_notifications(): | |
for record in sqs_event_dict["Records"]: | |
record["body"] = json_serialize(s3_event_notification_dict) | |
- parsed_event: SqsS3EventNotificationModel = handle_sqs_json_body_containing_s3_notifications(sqs_event_dict, LambdaContext()) | |
+ parsed_event: SqsS3EventNotificationModel = handle_sqs_json_body_containing_s3_notifications( | |
+ sqs_event_dict, LambdaContext() | |
+ ) | |
assert len(parsed_event.Records) == 2 | |
for parsed_sqs_record in parsed_event.Records: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment