Skip to content

Comments

samples(Storage): Add samples and tests for bucket encryption enforcement configuration#3313

Open
mahendra-google wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
mahendra-google:bucket-encryption-enforcement-config
Open

samples(Storage): Add samples and tests for bucket encryption enforcement configuration#3313
mahendra-google wants to merge 1 commit intoGoogleCloudPlatform:mainfrom
mahendra-google:bucket-encryption-enforcement-config

Conversation

@mahendra-google
Copy link
Contributor

This PR includes samples and tests for the following bucket encryption enforcement operations:

  • Set encryption enforcement configuration for bucket
  • Get encryption enforcement configuration of bucket
  • Remove all encryption enforcement configuration of bucket

Please see b/465329369.

@mahendra-google mahendra-google requested review from a team as code owners February 12, 2026 13:50
@snippet-bot
Copy link

snippet-bot bot commented Feb 12, 2026

Here is the summary of changes.

You are about to add 3 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

@product-auto-label product-auto-label bot added api: storage Issues related to the Cloud Storage API. samples Issues that are directly related to samples. labels Feb 12, 2026
@gemini-code-assist
Copy link

Summary of Changes

Hello @mahendra-google, 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 C# samples by introducing new functionalities for managing bucket encryption enforcement. It provides developers with clear examples and robust tests for setting, retrieving, and removing encryption policies, thereby improving data security and compliance options for their storage buckets.

Highlights

  • New Samples for Encryption Enforcement: Added C# samples for managing bucket encryption enforcement configurations in Google Cloud Storage. These samples cover setting, getting, and removing encryption policies.
  • Set Encryption Enforcement: Introduced a sample to configure encryption enforcement for a bucket, allowing specification of Customer-Managed Encryption Keys (CMEK), Google-Managed Encryption Keys (GMEK), and restrictions on Customer-Supplied Encryption Keys (CSEK).
  • Get Encryption Enforcement: Provided a sample to retrieve the current encryption enforcement configuration of a bucket, detailing the restriction modes for CMEK, GMEK, and CSEK.
  • Remove Encryption Enforcement: Included a sample to remove all encryption enforcement configurations from a bucket, effectively resetting the policies while retaining the default KMS key if one was set.
  • Comprehensive Testing: Accompanying xUnit tests were added for each new sample to ensure correct functionality and validate the various encryption enforcement scenarios.
Changelog
  • storage/api/Storage.Samples.Tests/BucketGetEncryptionEnforcementConfigTest.cs
    • Added a new xUnit test to verify the functionality of getting bucket encryption enforcement configuration.
  • storage/api/Storage.Samples.Tests/BucketRemoveAllEncryptionEnforcementConfigTest.cs
    • Added a new xUnit test to confirm the removal of all encryption enforcement configurations from a bucket.
  • storage/api/Storage.Samples.Tests/BucketSetEncryptionEnforcementConfigTest.cs
    • Added a new xUnit test with InlineData to cover different scenarios for setting bucket encryption enforcement configurations (CMEK, GMEK, CSEK).
  • storage/api/Storage.Samples/BucketGetEncryptionEnforcementConfig.cs
    • Introduced a new C# sample demonstrating how to fetch the encryption enforcement settings for a bucket, including GMEK, CMEK, and CSEK details.
  • storage/api/Storage.Samples/BucketRemoveAllEncryptionEnforcementConfig.cs
    • Introduced a new C# sample demonstrating how to clear all encryption enforcement configurations from a bucket, preserving the default KMS key if set.
  • storage/api/Storage.Samples/BucketSetEncryptionEnforcementConfig.cs
    • Introduced a new C# sample demonstrating how to configure encryption enforcement for a bucket, supporting CMEK, GMEK, and CSEK restrictions.
Activity
  • No human activity has occurred on this pull request yet.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces new samples and corresponding tests for managing bucket encryption enforcement configurations, including setting, getting, and removing them. The new code is well-structured and the tests provide good coverage for the new samples. I have one suggestion to refactor a small part of the logic in one of the samples to improve its clarity and maintainability. Overall, this is a solid contribution.

@mahendra-google mahendra-google force-pushed the bucket-encryption-enforcement-config branch 2 times, most recently from b9b9c6f to b375f88 Compare February 12, 2026 14:08
@bajajneha27 bajajneha27 removed their assignment Feb 16, 2026
@mahendra-google mahendra-google force-pushed the bucket-encryption-enforcement-config branch from 4d58b52 to c3096a6 Compare February 16, 2026 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API. samples Issues that are directly related to samples.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants