Skip to content

feat: add storage control anywhere cache samples#1

Open
thiyaguk09 wants to merge 41 commits into
mainfrom
anywhere-cache-samples
Open

feat: add storage control anywhere cache samples#1
thiyaguk09 wants to merge 41 commits into
mainfrom
anywhere-cache-samples

Conversation

@thiyaguk09
Copy link
Copy Markdown
Owner

Description

Fixes #

Note: Before submitting a pull request, please open an issue for discussion if you are not associated with Google.

Checklist

  • I have followed guidelines from CONTRIBUTING.MD and Samples Style Guide
  • Tests pass: npm test (see Testing)
  • Lint pass: npm run lint (see Style)
  • Required CI tests pass (see CI testing)
  • These samples need a new API enabled in testing projects to pass (let us know which ones)
  • These samples need a new/updated env vars in testing projects set to pass (let us know which ones)
  • This pull request is from a branch created directly off of GoogleCloudPlatform/nodejs-docs-samples. Not a fork.
  • This sample adds a new sample directory, and I updated the CODEOWNERS file with the codeowners for this sample
  • This sample adds a new sample directory, and I created GitHub Actions workflow for this sample
  • This sample adds a new Product API, and I updated the Blunderbuss issue/PR auto-assigner with the codeowners for this sample
  • Please merge this PR for me once it is approved

Note: Any check with (dev), (experimental), or (legacy) can be ignored and should not block your PR from merging (see CI testing).

Copy link
Copy Markdown

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

Summary of Changes

Hello @thiyaguk09, 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 expands the Node.js samples for Google Cloud Storage by introducing a complete set of examples for managing Anywhere Cache instances. These additions provide developers with practical code snippets to programmatically interact with and control their cache resources, enhancing the utility and coverage of the existing sample library.

Highlights

  • New Anywhere Cache Samples: Added a comprehensive set of Node.js sample files demonstrating various operations for Google Cloud Storage Anywhere Caches, including creation, retrieval, listing, updating, pausing, resuming, and disabling caches.
  • New System Tests: Introduced a new system test suite (anywhereCache.test.js) to ensure the correctness and functionality of all newly added Anywhere Cache samples.
  • Dependency Updates: Updated the @google-cloud/storage and @google-cloud/storage-control dependencies in package.json to their latest versions.
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.

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
Copy Markdown

@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 features. My review focuses on improving the implementation of the createAnywhereCache sample and fixing a related bug in the system tests. Specifically, I've suggested simplifying the handling of long-running operations by using the client library's built-in features instead of custom polling. I also pointed out an issue in the request object structure for creating a cache and a bug in the system test where incorrect arguments were being passed, which would cause the test to fail.

Comment thread storage-control/createAnywhereCache.js Outdated
Comment thread storage-control/system-test/anywhereCache.test.js Outdated
Comment thread storage-control/createAnywhereCache.js
@thiyaguk09
Copy link
Copy Markdown
Owner Author

@gurusai-voleti All changes have been addressed. Please review again.

@thiyaguk09 thiyaguk09 force-pushed the anywhere-cache-samples branch from e83ba77 to b5e4d63 Compare September 12, 2025 07:54
@thiyaguk09 thiyaguk09 force-pushed the anywhere-cache-samples branch from b5e4d63 to a15ae91 Compare September 22, 2025 08:14
@thiyaguk09 thiyaguk09 force-pushed the anywhere-cache-samples branch 2 times, most recently from fd4b63b to 572f7f1 Compare October 8, 2025 09:57
Improve Anywhere Cache API samples (Documentation & Error Handling)

* Wraps all asynchronous Anywhere Cache API samples (Create, Get, List,
Disable, Pause, Resume) in `try...catch` blocks for production
readiness.
* Adds specific gRPC error code checks (NOT_FOUND, FAILED_PRECONDITION)
to provide better diagnostic feedback to users.
* Clarifies documentation regarding the optional nature and default
values of `ttl` and `admissionPolicy` for cache creation.
…rage

Updates tests for all Anywhere Cache management methods (Create, Get,
List, Resume, Disable, Pause) to align with enhanced sample script
output.

**(Tests were skipped due to reliance on Long-Running Operations (LROs)
in the sample code.)**

This includes:
* **Enhanced Assertions:** Asserting against all newly added detail
fields (e.g., Name, State, TTL) to verify full API response parsing in
Get and List samples.
* **Negative Scenario Coverage:** Adding explicit **negative scenario
tests** for state-dependent operations (Disable, Pause, Resume) to
assert graceful failure on expected errors like `FAILED_PRECONDITION`.
The function was being called twice due to an oversight during a recent try/catch restructure.
@thiyaguk09 thiyaguk09 force-pushed the anywhere-cache-samples branch from e90dcdb to 41e2ade Compare October 24, 2025 06:50
thiyaguk09 and others added 21 commits April 6, 2026 12:02
…orcement (GoogleCloudPlatform#4272)

* feat(storage): add samples and system tests for bucket encryption enforcement

Adds comprehensive code samples and system tests to verify
Google-managed,
Customer-managed, and Customer-supplied encryption enforcement logic.

- Add setBucketEncryptionEnforcementConfig.js sample
- Add getBucketEncryptionEnforcementConfig.js sample
- Add updateBucketEncryptionEnforcementConfig.js sample
- Add system tests to verify CLI output and backend metadata state
- Ensure server-side effectiveTime is correctly captured and displayed

* code refactor

* test(storage): refactor encryption tests to assert state over strings

* test: skip bucket encryption enforcement tests if defaultKmsKeyName is missing

---------

Co-authored-by: Jennifer Davis <sigje@google.com>
…oudPlatform#4276)

* Feat(storage): add Object Contexts samples and system tests

- Add `setObjectContexts.js` to demonstrate CRUD and deletion of
contexts.
- Add `getObjectContexts.js` to show retrieval of structured metadata.
- Add `listObjectsWithContextFilter.js` to demonstrate server-side
filtering.
- Implement comprehensive system tests in `files.test.js` covering
  presence, absence (-), and existence (:) filter operators.
- Ensure samples use correct 'contexts' field with 'custom' map
structure.

* code refactor

* fix: typo corrections

* test(storage): refactor to state-based assertions

---------

Co-authored-by: Jennifer Davis <sigje@google.com>
…using unique UUIDs (GoogleCloudPlatform#4320)

* test(secret-manager): fix ALREADY_EXISTS in delayed destroy tests by using unique UUIDs

* test(secret-manager): ensure resource cleanup on assertion failure using try-finally
…dPlatform#4317)

* test(talent): add explicit delay to wait for job indexing

* test(talent): move indexing delay to before hook to avoid waiting on every retry

---------

Co-authored-by: Jennifer Davis <sigje@google.com>
…t api tests (GoogleCloudPlatform#4318)

* test(scc): fix concurrent modification error in custom module tests

* test(security-center): fix ALREADY_EXISTS resource leaks and unhandled API rejections

* chore(security-center): disable parallel test execution to prevent API concurrency collisions

---------

Co-authored-by: Jennifer Davis <sigje@google.com>
…ples (GoogleCloudPlatform#4321)

* fix(genai): resolve module path and naming issues in count-tokens samples

* style: ensure consistent .js extension in require statements
…public access prevention (GoogleCloudPlatform#4327)

Co-authored-by: Jennifer Davis <sigje@google.com>
…sure conversation readiness (GoogleCloudPlatform#4322)

* fix: add delay to createAnalysis test to ensure conversation readiness

* fix: use delay helper for consistent analysis test stability

* test: increase delay in createAnalysis to improve CI stability

* test: refactor CreateAnalysis test to separate conversation creation into before hook

* fix: correct exponential backoff delay in tests to prevent RESOURCE_EXHAUSTED errors

* fix: resolve RESOURCE_EXHAUSTED quota errors in CI pipeline

* test: increase delays and backoff to fix flaky GCP quota errors

* test: add try-catch block to createAnalysis to expose hidden errors in CI

* test: skip on gRPC error 13 and reduce wait time in CI

- Intercept gRPC error 13 (INTERNAL) in createAnalysis test to skip execution and avoid false red pipelines.
- Keep default retry behavior for quota or other transient errors.
- Reduce initial setTimeout delay from 65s to 5s to optimize CI speed.

---------

Co-authored-by: Jennifer Davis <sigje@google.com>
…vent 401 errors in CI pipeline (GoogleCloudPlatform#4325)

* fix: mock sendgrid SDK to prevent 401 errors in CI pipeline

* fix: mock sendgrid package and add payload assertions to function tests
…alidation (GoogleCloudPlatform#4313)

* fix(slack): replace deprecated @slack/events-api with native crypto validation

* fix(slack): inject fallback environment variables for unit test CI compatibility

* test(slack): apply code review feedback and add mock data for CI

* chore(slack): downgrade nock to v13 to support legacy Node.js versions in CI matrix

* refactor(slack): replace kgsearch callbacks with native async/await
…rors (GoogleCloudPlatform#4315)

* test(asset): add sleep retries to prevent RESOURCE_EXHAUSTED quota errors

* test(asset): removed unused Storage and BigQuery setup/teardown in org policy tests to reduce API quota consumption and execution time.

* test(asset): increase initial sleep timeout to 1 minute to mitigate ListAssets quota exhaustion

* test: add retry logic and skip fallback for ListAssets quota errors
…nai (GoogleCloudPlatform#4330)

* refactor: migrate countTokens samples to @google/genai, update config, and remove deprecated totalBillableCharacters

* refactor(samples): migrate function-calling samples to @google/genai using message structure for tool responses

* feat(generative-ai): migrate grounding samples to new GenAI SDK

* feat(generative-ai): migrate text and multimodal inference samples to @google/genai

* refactor(generative-ai): migrate first batch of inference samples to @google/genai and skip remaining tests

* refactor(generative-ai): update model to gemini-2.5-flash and fix streaming text accumulation
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.

6 participants