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

[ETL-628] Rework S3 event config lambda #108

Merged
merged 4 commits into from
Mar 5, 2024
Merged

[ETL-628] Rework S3 event config lambda #108

merged 4 commits into from
Mar 5, 2024

Conversation

philerooski
Copy link
Contributor

Significant changes in the S3 event config lambda to support indexing individual configurations based on their S3 prefix/suffix overlap.

.github/workflows/upload-and-deploy-to-prod-main.yaml and .github/workflows/upload-and-deploy.yaml

  • Delete the potentially preexisting notification configuration for a namespace before creation.

src/lambda_function/s3_event_config/app.py

  • We introduce three new classes that abstract the API objects relevant to S3 event notifications:
    • NotificationConfiguration: creates a common interface for interacting with individual notification configurations.
    • NotificationConfigurationType: subsets the Enum class to restrict the types allowed for a NotificationConfiguration to Queue, Topic, and LambdaFunction.
    • BucketNotificationConfigurations: A convenience class which wraps a collection of NotificationConfiguration objects and provides a method for converting them back into a dict representation which can be used with put_bucket_notification_configuration.
  • We change the behavior of some functions:
    • add_notification is now more strict. Notification configurations can be added, but not updated. See the docstring for more details.
    • delete_notification now uses the prefix filter rules to identify which notification needs deletion.

Copy link
Contributor

@rxu17 rxu17 left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@BryanFauble BryanFauble left a comment

Choose a reason for hiding this comment

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

Just a few small comments! Otherwise LGTM!

There is a bug in moto/AWS where moto only allows filter rules with lowercase
`Name` values in put_bucket_notification_configuration calls. So to normalize
our notification configurations when comparing configurations obtained via a
GET with configurations to be utilized in a PUT (as we do in the function
`notification_configuration_matches`), we make the `Name` values lower case in
when comparing notification configurations.

When calling get_bucket_notification_configuration, the `Name` value is
always capitalized, whereas moto requires us to use lowercase `Name`
values when calling put_bucket_notification_configuration.
Copy link

sonarqubecloud bot commented Mar 4, 2024

Quality Gate Passed Quality Gate passed

Issues
80 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@philerooski philerooski merged commit 127c175 into main Mar 5, 2024
15 checks passed
@philerooski philerooski deleted the etl-628 branch March 5, 2024 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants