feat(parser): Add S3 Object Lambda Event#362
Merged
Merged
Conversation
heitorlessa
suggested changes
Mar 29, 2021
Contributor
heitorlessa
left a comment
There was a problem hiding this comment.
Looks great! One minor typo in the docs and I can merge it.
Note to self
For 2.0, I'd love to see how we can reuse data structure between Data classes and Parser. The only three key differences in here are:
- Parser needs to use multi-inheritance (BaseModel, plus what's already defined)
- Parser has some pydantic types that are more explicit so ^ could help
- Data classes use
@propertyto provide per attribute docs, so maybe there's a native way of doing this, so we could reuse code with Parser
Atm, these are the biggest raw code albeit small contributors to the package size (w/o deps)
4.0K aws_lambda_powertools/utilities/__init__.py
348K aws_lambda_powertools/utilities/data_classes
192K aws_lambda_powertools/utilities/parser
108K aws_lambda_powertools/utilities/parameters
96K aws_lambda_powertools/utilities/idempotency
48K aws_lambda_powertools/utilities/validation
44K aws_lambda_powertools/utilities/batch
40K aws_lambda_powertools/utilities/typing| | **AlbModel** | Lambda Event Source payload for Amazon Application Load Balancer | | ||
| | **CloudwatchLogsModel** | Lambda Event Source payload for Amazon CloudWatch Logs | | ||
| | **S3Model** | Lambda Event Source payload for Amazon S3 | | ||
| | **S3ObjectLambdaEvent** | Lambda Event Source payload for Amazon S3 Object Access | |
Contributor
There was a problem hiding this comment.
Suggested change
| | **S3ObjectLambdaEvent** | Lambda Event Source payload for Amazon S3 Object Access | | |
| | **S3ObjectLambdaEvent** | Lambda Event Source payload for Amazon S3 Object Lambda | |
Contributor
Author
There was a problem hiding this comment.
thx! pushed the code fix
Contributor
Author
There was a problem hiding this comment.
@heitorlessa BTW, more key differences between parser and validator are:
- We can use Literal types - i thought of using them in this PR but the documentation wasnt clear 100%.
- We can add validators and root validator. in this case for instance, the userName exists only in some cases - i could add that check to the schema.
added 2 commits
March 29, 2021 19:44
Contributor
|
Oh I know about the added value of Parser, and Literal types are part of
point 1 ;)
That note to myself is to remember what a base class for both could look
like.
…On Mon, 29 Mar 2021 at 18:48, Ran Isenberg ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In docs/utilities/parser.md
<#362 (comment)>
:
> -**SqsModel** | Lambda Event Source payload for Amazon SQS
-**AlbModel** | Lambda Event Source payload for Amazon Application Load Balancer
-**CloudwatchLogsModel** | Lambda Event Source payload for Amazon CloudWatch Logs
-**S3Model** | Lambda Event Source payload for Amazon S3
-**KinesisDataStreamModel** | Lambda Event Source payload for Amazon Kinesis Data Streams
-**SesModel** | Lambda Event Source payload for Amazon Simple Email Service
-**SnsModel** | Lambda Event Source payload for Amazon Simple Notification Service
+| Model name | Description |
+| -------------------------- | ------------------------------------------------------------------ |
+| **DynamoDBStreamModel** | Lambda Event Source payload for Amazon DynamoDB Streams |
+| **EventBridgeModel** | Lambda Event Source payload for Amazon EventBridge |
+| **SqsModel** | Lambda Event Source payload for Amazon SQS |
+| **AlbModel** | Lambda Event Source payload for Amazon Application Load Balancer |
+| **CloudwatchLogsModel** | Lambda Event Source payload for Amazon CloudWatch Logs |
+| **S3Model** | Lambda Event Source payload for Amazon S3 |
+| **S3ObjectLambdaEvent** | Lambda Event Source payload for Amazon S3 Object Access |
@heitorlessa <https://github.com/heitorlessa> BTW, more key differences
between parser and validator are:
1. We can use Literal types - i thought of using them in this PR but
the documentation wasnt clear 100%.
2. We can add validators and root validator. in this case for
instance, the userName exists only in some cases - i could add that check
to the schema.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#362 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAZPQBDELS4TKG76TCFM6HTTGCVO3ANCNFSM4ZZL5R3A>
.
|
heitorlessa
approved these changes
Mar 29, 2021
Contributor
heitorlessa
left a comment
There was a problem hiding this comment.
Thank you once again! Merging now
heitorlessa
referenced
this pull request
in heitorlessa/aws-lambda-powertools-python
Apr 4, 2021
* develop: fix(idempotent): Correctly raise IdempotencyKeyError (#378) feat(event-handler): Add AppSync handler decorator (#363) feat(parameter): add dynamodb_endpoint_url for local_testing (#376) fix(parser): S3Model support empty keys (#375) fix(data-classes): Add missing operationName (#373) fix: perf tests for Logger and fail str msgs feat(parser): Add S3 Object Lambda Event (#362) build(pre-commit): Add pre-commit to make pr (#368) fix(tracer): Correct type hint for MyPy (#365) fix(metrics): AttributeError raised by MediaManager and Typing and docs (#357) Signed-off-by: heitorlessa <lessa@amazon.co.uk>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
implements #361
also added missing imports in init file