-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(parser): Add S3 Object Lambda Event #362
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@property
to 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
docs/utilities/parser.md
Outdated
| **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 | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| **S3ObjectLambdaEvent** | Lambda Event Source payload for Amazon S3 Object Access | | |
| **S3ObjectLambdaEvent** | Lambda Event Source payload for Amazon S3 Object Lambda | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thx! pushed the code fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
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>
.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you once again! Merging now
* 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 <[email protected]>
implements #361
also added missing imports in init file