Skip to content

Conversation

@mahendra-google
Copy link
Owner

@mahendra-google mahendra-google commented Jul 28, 2025

This internal PR adds sample code for the anywhere cache feature, allowing users to:

  • Create anywhere cache
  • Get anywhere cache
  • List anywhere cache
  • Update anywhere cache
  • Pause anywhere cache
  • Disable anywhere cache
  • Resume anywhere cache

Canonical PR used as a guide :- PR

Note

Sample tests are not included because of the long operation time.

@mahendra-google mahendra-google force-pushed the anywhere_cache_storage_control branch 4 times, most recently from ed7ce6d to 7d2e947 Compare July 31, 2025 13:21
samples(storage): add sample for create anywhere cache

samples(storage): add samples for anywhere cache

samples(storage): add sample to create anywhere cache

samples(storage): add sample to disable anywhere cahce
@mahendra-google mahendra-google force-pushed the anywhere_cache_storage_control branch from 6603ae8 to ca82d74 Compare August 6, 2025 05:26
@mahendra-google mahendra-google marked this pull request as ready for review August 21, 2025 05:00
@mahendra-google
Copy link
Owner Author

/gemini review

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 adds new samples for Storage Control Anywhere Cache and Model Armor features, along with corresponding tests. The changes are generally well-implemented. I've identified a couple of areas for improvement in the test files: one regarding resource cleanup in a test, which could lead to resource leaks, and another concerning code duplication in another test. Addressing these points will improve the robustness and maintainability of the test suite.

@mahendra-google
Copy link
Owner Author

/gemini summary

@gemini-code-assist
Copy link

Summary of Changes

This pull request introduces a comprehensive set of C# sample code for managing Google Cloud Storage's new "anywhere cache" feature, demonstrating how to create, retrieve, list, update, pause, disable, and resume anywhere cache instances. Additionally, it includes new samples and tests for Google Cloud Model Armor, focusing on template creation with labels and metadata, providing practical examples for developers to integrate these functionalities into their applications.

Highlights

  • Google Cloud Storage Control Anywhere Cache Samples: New C# samples have been added for Google Cloud Storage Control's "anywhere cache" feature, covering essential lifecycle operations such as creation, retrieval, listing, updating, pausing, disabling, and resuming cache instances.
  • Google Cloud Model Armor Samples and Tests: This PR introduces new C# samples and corresponding tests for Google Cloud Model Armor, specifically demonstrating how to create templates with custom labels and metadata.
  • Model Armor Test Cleanup: A minor cleanup was performed in an existing Model Armor quickstart test, removing a redundant resource cleanup registration to improve test efficiency and prevent potential resource leaks.
Changelog
  • modelarmor/api/ModelArmor.Samples.Tests/CreateTemplateTest.cs
    • Added a new test for creating a Model Armor template with predefined RAI filter settings.
  • modelarmor/api/ModelArmor.Samples.Tests/CreateTemplateWithLabelsTest.cs
    • Added a new test to verify the creation of a Model Armor template with custom labels.
  • modelarmor/api/ModelArmor.Samples.Tests/CreateTemplateWithMetadataTest.cs
    • Added a new test to confirm the creation of a Model Armor template with specific metadata settings.
  • modelarmor/api/ModelArmor.Samples.Tests/QuickStartTest.cs
    • Modified to remove a redundant call to _fixture.RegisterTemplateForCleanup, streamlining the test setup.
  • modelarmor/api/ModelArmor.Samples/CreateTemplateWithLabels.cs
    • Added a new sample demonstrating how to create a Model Armor template with user-defined labels.
  • modelarmor/api/ModelArmor.Samples/CreateTemplateWithMetadata.cs
    • Added a new sample illustrating the creation of a Model Armor template with custom metadata.
  • modelarmor/api/ModelArmor.Samples/ModelArmor.Samples.csproj
    • Minor modification to the project file, likely a formatting fix (removed a BOM character).
  • storage/api/README.md
    • Minor formatting adjustment, specifically removing a newline character at the end of the file.
  • storage/api/Storage.Samples/StorageControlCreateAnywhereCache.cs
    • Added a new sample for creating an anywhere cache instance within a specified bucket and zone.
  • storage/api/Storage.Samples/StorageControlDisableAnywhereCache.cs
    • Added a new sample for disabling an existing anywhere cache instance.
  • storage/api/Storage.Samples/StorageControlGetAnywhereCache.cs
    • Added a new sample for retrieving details of a specific anywhere cache instance.
  • storage/api/Storage.Samples/StorageControlListAnywhereCaches.cs
    • Added a new sample for listing all anywhere cache instances associated with a given bucket.
  • storage/api/Storage.Samples/StorageControlPauseAnywhereCache.cs
    • Added a new sample for pausing an active anywhere cache instance.
  • storage/api/Storage.Samples/StorageControlResumeAnywhereCache.cs
    • Added a new sample for resuming a previously disabled or paused anywhere cache instance.
  • storage/api/Storage.Samples/StorageControlUpdateAnywhereCache.cs
    • Added a new sample for updating the admission policy of an anywhere cache instance.
Activity
  • mahendra-google initiated a review of the pull request.
  • gemini-code-assist[bot] provided a high-priority comment regarding potential resource leaks in modelarmor/api/ModelArmor.Samples.Tests/QuickStartTest.cs due to a removed cleanup registration.
  • gemini-code-assist[bot] provided a medium-priority comment suggesting code simplification in modelarmor/api/ModelArmor.Samples.Tests/CreateTemplateWithLabelsTest.cs by reusing an existing client instance.
  • mahendra-google requested a summary of the pull request.

@mahendra-google
Copy link
Owner Author

/Gemini help

@gemini-code-assist
Copy link

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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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.

@mahendra-google mahendra-google changed the title samples(storage control): add samples for anywhere cache samples(storage control): add samples and test cases for anywhere cache Sep 4, 2025
@mahendra-google
Copy link
Owner Author

/Gemini review

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 the Model Armor and Storage Control APIs, specifically for the 'anywhere cache' feature. The changes are well-structured and cover the intended functionality. I've provided a few suggestions to improve code consistency, readability, and adherence to best practices, such as using collection initializers, reusing test fixture resources, ensuring consistent namespacing, and correcting license header formatting.

@mahendra-google mahendra-google changed the title samples(storage control): add samples and test cases for anywhere cache samples(storage control): add samples for anywhere cache Sep 8, 2025
@mahendra-google
Copy link
Owner Author

/Gemini review

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 adds new samples for Storage Control's Anywhere Cache feature and also includes new samples and tests for Model Armor. My review focuses on improving code consistency, fixing potential bugs, and addressing style issues. Key points include correcting a potential resource leak in a test, fixing an incorrect property name that would cause a compilation error, and improving consistency across sample files. I've also noted some minor issues in the license headers and documentation.

Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
@gurusai-voleti
Copy link
Collaborator

@mahendra-google why those modelarmor files are needed in this PR

@mahendra-google
Copy link
Owner Author

@mahendra-google why those modelarmor files are needed in this PR

This pull request does not include any Model Armor code changes. I rebased the branch to sync with the latest upstream changes and prevent merge conflicts

@mahendra-google mahendra-google changed the title samples(storage control): add samples for anywhere cache samples(storagecontrol): add samples for anywhere cache Sep 10, 2025
Copy link
Collaborator

@thiyaguk09 thiyaguk09 left a comment

Choose a reason for hiding this comment

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

I’ve added a few comments—please address them. Otherwise, everything looks good to me.

Copy link
Collaborator

@thiyaguk09 thiyaguk09 left a comment

Choose a reason for hiding this comment

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

LGTM

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.

5 participants