- Notifications
You must be signed in to change notification settings - Fork1.2k
Samples(Storage): Add sample and test for ListBuckets With Partial Success#3279
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Here is the summary of changes. You are about to add 1 region tag.
This comment is generated bysnippet-bot.
|
Summary of ChangesHello@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 introduces a new C# code sample and an accompanying test for the Google Cloud Storage client library. The sample demonstrates how to effectively use the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on ourdocumentation 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 uphere. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with theGemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
This pull request introduces a new code sample and corresponding test for listing buckets with partial success enabled. The changes are well-implemented, and the test correctly verifies the functionality while avoiding flakiness. I have one suggestion to improve the clarity and robustness of the new sample code by removing an optional parameter that could lead to unhandled exceptions.
| public (IReadOnlyList<Bucket> Reachable, IReadOnlyList<string> Unreachable) ListBucketsWithPartialSuccess | ||
| (string projectId = "your-project-id", bool returnPartialSuccess = true) | ||
| { | ||
| var storage = StorageClient.Create(); | ||
| var pagedResult = storage.ListBuckets(projectId, options: new ListBucketsOptions | ||
| { | ||
| ReturnPartialSuccess = returnPartialSuccess | ||
| }); |
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.
The method is namedListBucketsWithPartialSuccess, which strongly implies that theReturnPartialSuccess option is always enabled. Exposing areturnPartialSuccess parameter to disable this feature can be confusing for users of this sample.
Furthermore, if this method is called withreturnPartialSuccess: false and some storage locations are unreachable, thestorage.ListBuckets call will throw an exception. Since this sample doesn't include error handling for that scenario, it could lead to an unexpected crash.
To make the sample more focused, clear, and robust, I suggest removing thereturnPartialSuccess parameter and hardcoding the option totrue.
Please also remove the corresponding<param name="returnPartialSuccess"> documentation block from lines 30-32.
public(IReadOnlyList<Bucket>Reachable,IReadOnlyList<string>Unreachable)ListBucketsWithPartialSuccess(stringprojectId="your-project-id"){varstorage=StorageClient.Create();varpagedResult=storage.ListBuckets(projectId,options:newListBucketsOptions{ReturnPartialSuccess=true});
mahendra-google commentedDec 9, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Converting this PR into draft mode as the latest Nuget package for |
…return partial success
ef03f67 to7c0bb19Compare
Uh oh!
There was an error while loading.Please reload this page.
This PR adds a new code sample and test for the
ListBucketsoperation using theReturnPartialSuccessparameter inListBucketOptions.The
ReturnPartialSuccessflag allows the API to return a list of buckets even if specific regions are temporarily unavailable, rather than failing the entire request. This sample demonstrates how to consume the resulting Reachable and Unreachable collections. Please seeb/459649174.Note: - PR will be marked as ready to review onceGoogle.Cloud.Storage.V1 new package is released.