-
Notifications
You must be signed in to change notification settings - Fork 429
Feature request: Support S3 Event Notifications Model for Event Bridge #1656
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
Comments
Thanks for opening your first issue here! We'll come back to you as soon as we can. |
@robert-malai thank you for the feature request! Besides the data class, are there any repetitive task that we could make it easier as part of this new data class? Added the correct labels to watch for +1 to help us prioritize. We'd welcome a PR to fast track this too! Thanks a lot! |
On a similar theme, we have a use-case for unpacking SQS-wrapped S3 event notifications, which would be nice to pull off the shelf. (Apologies if there's an existing way to achieve this, but I couldn't see anything in the docs.) A really simple additional model seems to do the trick: from aws_lambda_powertools.utilities.parser.models import SqsRecordModel, S3Model
from pydantic import Json
class SqsS3EventNotificationModel(SqsRecordModel):
body: Json[S3Model] This could then be used as just another model, e.g.: from aws_lambda_powertools.utilities.batch import BatchProcessor, EventType, batch_processor
processor = BatchProcessor(event_type=EventType.SQS, model=SqsS3EventNotificationModel)
def record_handler(record: SqsS3EventNotificationModel):
for s3_record in record.body.Records:
do_something_useful(s3_record)
@batch_processor(record_handler=record_handler, processor=processor)
def handler(event, context):
return processor.response() P.S. if there's a way to skip the intermediate step, that would be even nicer. In other words, rather than needing to define a |
@heitorlessa Not sure which other repetitive tasks would benefit out of this dataclass. Seems to be pretty specific to the EventBridge notification for S3 events. Why would someone use EventBridge events for an S3 Bucket? Well ... you can fan out events w/o using an SNS, for simple, non-extensible setups. |
Gotcha! I assumed you were also thinking on going beyond Parser use case, so we can enrich EventBridge experience. If anyone got the bandwidth, we'd welcome any PR to add a new model class for this feature request. @theipster for the |
I'll try to implement this one. |
thank you @ivica-k - Please reach out if you need any help whatsoever while you're at it. We have both #python and #contributing channel on Discord |
|
Uh oh!
There was an error while loading. Please reload this page.
Use case
With the introduction of S3 Event Notifications in Event Bridge here we need the ability to quickly unpack the event payload from the Event Bridge Envelope.
The structure of the message is described here.
Solution/User Experience
It would suffice to extend the s3 models in the the parser module.
Alternative solutions
Have the module instantiated at the project level and just use the envelope unpacking mechanism.
Acknowledgment
The text was updated successfully, but these errors were encountered: