Skip to content
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

Merged
merged 3 commits into from
Mar 29, 2021

Conversation

ran-isenberg
Copy link
Contributor

@ran-isenberg ran-isenberg commented Mar 25, 2021

implements #361
also added missing imports in init file

@heitorlessa heitorlessa added area/utilities feature New feature or functionality labels Mar 25, 2021
@heitorlessa heitorlessa added this to the 1.14.0 milestone Mar 29, 2021
Copy link
Contributor

@heitorlessa heitorlessa left a 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:

  1. Parser needs to use multi-inheritance (BaseModel, plus what's already defined)
  2. Parser has some pydantic types that are more explicit so ^ could help
  3. 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

| **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 |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| **S3ObjectLambdaEvent** | Lambda Event Source payload for Amazon S3 Object Access |
| **S3ObjectLambdaEvent** | Lambda Event Source payload for Amazon S3 Object Lambda |

Copy link
Contributor Author

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

Copy link
Contributor Author

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:

  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.

@heitorlessa
Copy link
Contributor

heitorlessa commented Mar 29, 2021 via email

Copy link
Contributor

@heitorlessa heitorlessa left a 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

@heitorlessa heitorlessa merged commit 28afbe4 into aws-powertools:develop Mar 29, 2021
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 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants