feat: add support for bucket encryption enforcement config#1742
feat: add support for bucket encryption enforcement config#1742nidhiii-27 merged 15 commits intomainfrom
Conversation
This change introduces support for configuring bucket encryption enforcement, including: - `defaultKmsKeyName` (via `BucketEncryption`) - `googleManagedEncryptionEnforcementConfig` - `customerManagedEncryptionEnforcementConfig` - `customerSuppliedEncryptionEnforcementConfig` New classes `EncryptionEnforcementConfig` and `BucketEncryption` are added to `google/cloud/storage/bucket.py` to wrap the API configuration. The `Bucket` class now exposes an `encryption` property. Tests are added in `tests/unit/test_bucket.py`. Co-authored-by: rajeevpodar <3637722+rajeevpodar@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Summary of ChangesHello @rajeevpodar, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the Google Cloud Storage client library by introducing robust support for managing bucket encryption enforcement configurations. It provides a structured API for users to define and apply various encryption policies, including setting restriction modes and handling different types of encryption (Google-managed, customer-managed, and customer-supplied) directly through the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for bucket encryption enforcement configuration, introducing EncryptionEnforcementConfig and BucketEncryption classes and adding an encryption property to the Bucket class. The changes are well-structured and include corresponding unit tests. I have a few suggestions to improve code quality and test robustness.
This change introduces support for configuring bucket encryption enforcement, including: - `defaultKmsKeyName` (via `BucketEncryption`) - `googleManagedEncryptionEnforcementConfig` - `customerManagedEncryptionEnforcementConfig` - `customerSuppliedEncryptionEnforcementConfig` New classes `EncryptionEnforcementConfig` and `BucketEncryption` are added to `google/cloud/storage/bucket.py` to wrap the API configuration. The `Bucket` class now exposes an `encryption` property. Tests are added in `tests/unit/test_bucket.py` and `tests/system/test_bucket.py`. Co-authored-by: rajeevpodar <3637722+rajeevpodar@users.noreply.github.com>
This change introduces support for configuring bucket encryption enforcement, including: - `defaultKmsKeyName` (via `BucketEncryption`) - `googleManagedEncryptionEnforcementConfig` - `customerManagedEncryptionEnforcementConfig` - `customerSuppliedEncryptionEnforcementConfig` New classes `EncryptionEnforcementConfig` and `BucketEncryption` are added to `google/cloud/storage/bucket.py` to wrap the API configuration. The `Bucket` class now exposes an `encryption` property. Tests are added in `tests/unit/test_bucket.py` and `tests/system/test_bucket.py`. Addressed review comments regarding kwargs handling, constants usage in tests, and null safety in getters. Co-authored-by: rajeevpodar <3637722+rajeevpodar@users.noreply.github.com>
This change introduces support for configuring bucket encryption enforcement, including: - `defaultKmsKeyName` (via `BucketEncryption`) - `googleManagedEncryptionEnforcementConfig` - `customerManagedEncryptionEnforcementConfig` - `customerSuppliedEncryptionEnforcementConfig` New classes `EncryptionEnforcementConfig` and `BucketEncryption` are added to `google/cloud/storage/bucket.py` to wrap the API configuration. The `Bucket` class now exposes an `encryption` property. Tests are added in `tests/unit/test_bucket.py` and `tests/system/test_bucket.py`. Addressed review comments: - Handling `**kw` in `EncryptionEnforcementConfig.__init__` for forward compatibility. - Using constants for restriction modes in tests. - Improving test robustness. - Formatting with black. Co-authored-by: rajeevpodar <3637722+rajeevpodar@users.noreply.github.com>
|
Migration Notice: This library is moving to the google-cloud-python monorepo soon. We closed this PR due to inactivity to ensure a clean migration. Please re-open this work in the new monorepo once the migration is complete! |
PR created by the Librarian CLI to initialize a release. Merging this PR will auto trigger a release. Librarian Version: v1.0.2-0.20251119154421-36c3e21ad3ac Language Image: us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:8e2c32496077054105bd06c54a59d6a6694287bc053588e24debe6da6920ad91 <details><summary>google-cloud-storage: 3.10.0</summary> ## [3.10.0](v3.9.0...v3.10.0) (2026-03-18) ### Features * [Bucket Encryption Enforcement] add support for bucket encryption enforcement config (#1742) ([2a6e8b0](2a6e8b0)) ### Perf Improvments * [Rapid Buckets Reads] Use raw proto access for read resumption strategy (#1764) ([14cfd61](14cfd61)) * [Rapid Buckets Benchmarks] init mp pool & grpc client once, use os.sched_setaffinity (#1751) ([a9eb82c](a9eb82c)) * [Rapid Buckets Writes] don't flush at every append, results in bad perf (#1746) ([ab62d72](ab62d72)) ### Bug Fixes * [Windows] skip downloading blobs whose name contain `":" ` eg: `C:` `D:` etc when application runs in Windows. (#1774) ([5581988](5581988)) * [Path Traversal] Prevent path traversal in `download_many_to_path` (#1768) ([700fec3](700fec3)) * [Rapid Buckets] pass token correctly, '&' instead of ',' (#1756) ([d8dd1e0](d8dd1e0)) </details>
Implemented bucket encryption enforcement configuration support.
Added
EncryptionEnforcementConfigandBucketEncryptionclasses.Added
encryptionproperty toBucket.Added unit tests.
PR created automatically by Jules for task 10151670798613550332 started by @rajeevpodar