samples: add samples for bucket encryption enforcement config#1772
samples: add samples for bucket encryption enforcement config#1772nidhiii-27 wants to merge 5 commits intomainfrom
Conversation
Co-authored-by: nidhiii-27 <224584462+nidhiii-27@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. |
|
Here is the summary of changes. You are about to add 3 region tags.
This comment is generated by snippet-bot.
|
Summary of ChangesHello, 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 introduces a suite of Python samples designed to provide practical guidance on managing bucket encryption enforcement configurations within Google Cloud Storage. These samples cover the full lifecycle of encryption policy management, from initial setup to retrieval, modification, and removal, ensuring developers have clear examples for implementing robust data security measures. 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 new Python samples and an integration test for managing bucket encryption enforcement configurations. The code is well-structured and the test coverage is good. I've identified a few areas for improvement regarding Python best practices and error handling to enhance code quality and robustness.
samples/snippets/storage_set_bucket_encryption_enforcement_config.py
Outdated
Show resolved
Hide resolved
samples/snippets/storage_update_encryption_enforcement_config.py
Outdated
Show resolved
Hide resolved
Co-authored-by: nidhiii-27 <224584462+nidhiii-27@users.noreply.github.com>
Co-authored-by: nidhiii-27 <224584462+nidhiii-27@users.noreply.github.com>
Co-authored-by: nidhiii-27 <224584462+nidhiii-27@users.noreply.github.com>
| storage_client = storage.Client() | ||
| bucket = storage_client.bucket(bucket_name) | ||
|
|
||
| # Restriction mode can be "FullyRestricted" or "NotRestricted" |
There was a problem hiding this comment.
This section seems a little confusing to me. you've got 3 options, and very similar named and the difference is in managed versus supplied. if you set the restriction mode that feels like the customer is customizing it. but then you also have google_managed_encryption_enforcement_config versus customer .. and maybe this is 3 different enforcements of Fully Restricted, Not Restricted, and no enforcement?
I might suggest doing something like the following where only one line is fully visible or adding more space between with comments and then slicing the specific example with a region tag. It's not standalone but then you can have it be copy-paste runnable while also being able to highlight the difference in documentation.
# Setting restriction_mode to "FullyRestricted" means objects cannot
# be created using GMEK.
bucket.google_managed_encryption_enforcement_config = EncryptionEnforcementConfig(
restriction_mode="FullyRestricted"
)
# Setting restriction_mode to "NotRestricted" ensures CMEK is permitted.
# bucket.customer_managed_encryption_enforcement_config = EncryptionEnforcementConfig(
restriction_mode="NotRestricted"
)
Co-authored-by: nidhiii-27 <224584462+nidhiii-27@users.noreply.github.com>
Add Python samples demonstrating how to set, get, update, and remove bucket encryption enforcement configuration. Includes an integration test.
PR created automatically by Jules for task 3410657303470871774 started by @nidhiii-27