Skip to content

feat(docs): add devsite-help and snippets for Retries, Update Masks, and OCC#15308

Closed
bshaffer wants to merge 5 commits intomainfrom
add-client-help-docs
Closed

feat(docs): add devsite-help and snippets for Retries, Update Masks, and OCC#15308
bshaffer wants to merge 5 commits intomainfrom
add-client-help-docs

Conversation

@bshaffer
Copy link
Copy Markdown
Contributor

@bshaffer bshaffer commented Dec 8, 2025

I followed the examples of other pages in docs/devsite-help, but it's quite possible I'm missing a critical aspect. I also am not sure how these will be tested.

I ran all samples locally to verify they worked but please take a look and review

  1. Docs content
  2. Sample code
  3. How I've connected things up

@bshaffer bshaffer requested a review from a team December 8, 2025 21:41
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @bshaffer, 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 significantly enhances the documentation for Google Cloud .NET client libraries by introducing three new guides focused on advanced usage patterns. These guides cover Optimistic Concurrency Control for IAM policies, flexible retry and timeout configurations, and efficient partial resource updates using update masks. Each guide is complemented by practical C# code snippets, providing developers with clear instructions and examples to implement these critical features effectively.

Highlights

  • New Documentation Pages: Added comprehensive guides for Optimistic Concurrency Control (OCC) for IAM, configuring Retries and Timeouts, and utilizing Update Masks.
  • C# Code Snippets: Introduced corresponding C# code examples to illustrate the practical application of OCC, retry mechanisms, and update masks within Google Cloud .NET client libraries.
  • Table of Contents Integration: Updated the docs/devsite-help/toc.yml file to ensure the new documentation pages are discoverable and properly linked within the documentation structure.
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.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Dec 8, 2025

Pull request diff results
No APIs have changed in this PR. Exiting diff.

Copy link
Copy Markdown
Contributor

@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 adds valuable documentation and examples for Retries, Update Masks, and Optimistic Concurrency Control for IAM. The documentation content is clear and well-structured. However, all the new C# code snippets contain several compilation errors that need to be addressed. These include incorrect async method signatures, use of an undefined _fixture variable, a missing semicolon, and unused using directives. I've left specific comments with suggestions to fix these issues. Once these are resolved, the snippets will be great examples for users.

Comment thread tools/Google.Cloud.Docs.Snippets/OccForIamSnippets.cs Outdated
Comment thread tools/Google.Cloud.Docs.Snippets/OccForIamSnippets.cs Outdated
Comment thread tools/Google.Cloud.Docs.Snippets/RetriesSnippets.cs Outdated
Comment thread tools/Google.Cloud.Docs.Snippets/RetriesSnippets.cs Outdated
Comment thread tools/Google.Cloud.Docs.Snippets/RetriesSnippets.cs Outdated
Comment thread tools/Google.Cloud.Docs.Snippets/UpdateMaskSnippets.cs Outdated
Comment thread tools/Google.Cloud.Docs.Snippets/OccForIamSnippets.cs Outdated
Comment thread tools/Google.Cloud.Docs.Snippets/OccForIamSnippets.cs Outdated
Comment thread tools/Google.Cloud.Docs.Snippets/RetriesSnippets.cs Outdated
Comment thread tools/Google.Cloud.Docs.Snippets/UpdateMaskSnippets.cs Outdated
@bshaffer bshaffer force-pushed the add-client-help-docs branch from ad64163 to cd55d59 Compare December 10, 2025 22:13
@googleapis googleapis deleted a comment from github-actions Bot Dec 10, 2025
@github-actions
Copy link
Copy Markdown

Pull request diff results
No APIs have changed in this PR. Exiting diff.

Copy link
Copy Markdown
Contributor

@amanda-tarafa amanda-tarafa left a comment

Choose a reason for hiding this comment

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

Let me know how I can help.

Comment thread tools/Google.Cloud.Docs.Snippets/UpdateMaskSnippets.cs Outdated
Comment thread tools/Google.Cloud.Docs.Snippets/UpdateMaskSnippets.cs Outdated
Comment on lines +25 to +26
string projectId = "your-project-id";
string secretId = "test-secret";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

So that this is run, these need to come from the fixture.

Copy link
Copy Markdown
Contributor Author

@bshaffer bshaffer Jan 9, 2026

Choose a reason for hiding this comment

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

There is no secret in the fixture, should I add a _fixture.CreateSecret()?

Comment thread tools/Google.Cloud.Docs.Snippets/UpdateMaskSnippets.cs Outdated
Comment thread tools/Google.Cloud.Docs.Snippets/UpdateMaskSnippets.cs Outdated
Comment thread docs/devsite-help/toc.yml Outdated
Comment thread docs/devsite-help/retries.md Outdated
Comment thread docs/devsite-help/occ-for-iam.md Outdated
Comment thread docs/devsite-help/occ-for-iam.md Outdated
Comment thread docs/devsite-help/occ-for-iam.md Outdated
@googleapis googleapis deleted a comment from github-actions Bot Dec 16, 2025
@googleapis googleapis deleted a comment from github-actions Bot Jan 9, 2026
@googleapis googleapis deleted a comment from github-actions Bot Jan 10, 2026
Copy link
Copy Markdown
Contributor

@amanda-tarafa amanda-tarafa left a comment

Choose a reason for hiding this comment

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

Let me know if you prefer I do the finishing touches.

Comment thread docs/devsite-help/occ-for-iam.md Outdated
@@ -0,0 +1,22 @@
# Optimistic Concurrency Control (OCC) for IAM
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can't find the other comment but yes, I think it'd be best to refer to IAM as an example only and remove it from anywhere that's general (the titles and file names etc.) and could imply that OCC only applies to IAM resources.

Comment thread docs/devsite-help/occ-for-iam.md Outdated
Comment thread docs/devsite-help/occ-for-iam.md Outdated
Comment thread docs/devsite-help/occ-for-iam.md Outdated
Comment thread docs/devsite-help/occ-for-iam.md Outdated
Comment on lines +35 to +36
string role = "roles/cloudkms.cryptoKeyEncrypterDecrypter";
string member = "user:betterbrent@google.com";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thinking about this more, there are a couple of things that might be a problem here:

  • We are changing permissions on the project that we run tests in, and we have automation for maintaining permissions on it, that will complain about these changes.
  • It's OK to harcode these values, but we should use more inocuos roles and less specific members.

Because we can already create/destroy topics on the fixture, what about if we use the Pub/Sub Publisher client instead to update the IAM policy on the topic, and we can set the viewer role on the topic for "domain:google.com"?

Let me know if you'd prefer me to work on that one.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Without knowing more about the way these tests are set up, I can't say I follow what the issue is we're trying to solve or how to solve it. If these are changes you feel like you could do easily instead, please do so!

Comment thread tools/Google.Cloud.Docs.Snippets/UpdateMaskSnippets.cs Outdated
public void UpdateMasks()
{
string projectId = _fixture.ProjectId;;
string secretId = "test-secret";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We don't have a test-secret so this will fail. Either we create and destroy a secret on the fixture, or we change this example to use a Pub/Sub topic and use the utilities that we already have on the fixture.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Either way works for me, just let me know which you prefer (and maybe some guidance for how to set it up)

Comment thread tools/Google.Cloud.Docs.Snippets/OccForIamSnippets.cs Outdated
Comment thread tools/Google.Cloud.Docs.Snippets/OccForIamSnippets.cs Outdated
@bshaffer bshaffer changed the title feat(docs): add devsite-help and snippets for Retries, Update Masks, and OCC for IAM feat(docs): add devsite-help and snippets for Retries, Update Masks, and OCC Jan 29, 2026
Copy link
Copy Markdown
Contributor

@amanda-tarafa amanda-tarafa left a comment

Choose a reason for hiding this comment

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

I'll take it from here for the changes in the tests. Thanks!!!

And I'll send it for you to review once I've done that.

@amanda-tarafa
Copy link
Copy Markdown
Contributor

Closing in favour of #15423 which just tweks the sample code. Thanks @bshaffer !

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.

2 participants