samples(storagecontrol): Add anywhere cache samples #13988
samples(storagecontrol): Add anywhere cache samples #13988nidhiii-27 wants to merge 2 commits intoGoogleCloudPlatform:mainfrom
Conversation
Generated Python SDK samples for Anywhere Cache features: - create_anywhere_cache - get_anywhere_cache - list_anywhere_caches - update_anywhere_cache - pause_anywhere_cache - resume_anywhere_cache - disable_anywhere_cache Updated storagecontrol/requirements.txt and storagecontrol/snippets_test.py. Implemented LRO handling with .result() and mandatory commentary. Used 2026 Google LLC copyright headers as requested. Co-authored-by: nidhiii-27 <224584462+nidhiii-27@users.noreply.github.com>
Generated Python SDK samples for Anywhere Cache features: - create_anywhere_cache - get_anywhere_cache - list_anywhere_caches - update_anywhere_cache - pause_anywhere_cache - resume_anywhere_cache - disable_anywhere_cache Updated storagecontrol/snippets_test.py. Implemented LRO handling with .result() and mandatory commentary. Used 2026 Google LLC copyright headers as requested. Co-authored-by: nidhiii-27 <224584462+nidhiii-27@users.noreply.github.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a comprehensive set of Python snippets for managing Google Cloud Storage Anywhere Caches, including functionality for creating, disabling, retrieving, listing, pausing, resuming, and updating caches. It also adds a lifecycle test suite to verify these operations. The review feedback recommends utilizing the client library's built-in bucket_path helper method for more idiomatic and reliable resource path construction.
| project_path = storage_control_client.common_project_path("_") | ||
| bucket_path = f"{project_path}/buckets/{bucket_name}" |
There was a problem hiding this comment.
Instead of manually constructing the bucket path using string concatenation, use the client's built-in bucket_path helper method. This is more idiomatic and ensures the path is correctly formatted. To simplify the review process, please ensure this pull request is focused on a single change; related changes in other files should be deferred to subsequent pull requests.
| project_path = storage_control_client.common_project_path("_") | |
| bucket_path = f"{project_path}/buckets/{bucket_name}" | |
| bucket_path = storage_control_client.bucket_path("_", bucket_name) |
References
- Pull requests should be focused on a single change. It is acceptable to defer related changes in other files to subsequent pull requests.
Added the following samples:
storage_control_create_anywhere_cache
storage_control_get_anywhere_cache
storage_control_list_anywhere_caches
storage_control_update_anywhere_cache
storage_control_pause_anywhere_cache
storage_control_resume_anywhere_cache
storage_control_disable_anywhere_cache