-
Notifications
You must be signed in to change notification settings - Fork 6.5k
feat(eventarc): new sample for storage event receiver #10222
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
Conversation
Here is the summary of changes. You are about to add 4 region tags.
This comment is generated by snippet-bot.
|
The owlbot post-processor failure is unrelated to this PR (underlying error is a formatting issue with an appengine file not touched in this change). |
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.
Thanks for creating this sample. There are a couple open points here as we align around the plan.
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.
LGTM with a couple more optional comments.
eventarc/storage_handler/main.py
Outdated
|
||
# Gets the GCS bucket name from the CloudEvent data | ||
# Example: "storage.googleapis.com/projects/_/buckets/my-bucket" | ||
storage_obj = StorageObjectData(event.data) |
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.
What happens if the data isn't formatted correctly? Is the error message at all useful? Will it crash?
I almost think we should validate the event source and type, but regardless we should make sure not to crash the service if a misconfigured event trigger is created.
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.
This throws a ValueError
if there's an invalid field (standard proto-plus behavior).
i've added a try/catch for this, so bad input will result in a 400, and added a test case.
Owlbot added formatting changes to DLP files to this PR for reasons I do not understand. |
These tests compete for the same resource when there are multiple concurrent test runs. This leads to flaky tests as seen on #10222
* add unique string to dlp infotype tests These tests compete for the same resource when there are multiple concurrent test runs. This leads to flaky tests as seen on #10222 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
@muncus feel free to revert owlbot changes. PR #10310 should protect against similar situations in the future, but just to be sure I've added an |
Description
Create a new sample demonstrating receipt of Cloud Storage events with eventarc
and cloudevents.
Checklist
nox -s py-3.9
(see Test Environment Setup)nox -s lint
(see Test Environment Setup)