From 4386d21bb939c6a407244fb530529b4d9ff4981b Mon Sep 17 00:00:00 2001 From: Mahendra Date: Tue, 16 Sep 2025 13:46:02 +0530 Subject: [PATCH 1/6] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index d999a822e06..fd3b17e5efd 100644 --- a/README.md +++ b/README.md @@ -41,3 +41,7 @@ But no sample will work until you ## Testing * See [TESTING.md](TESTING.md) + +## Note + +Tests for the Anywhere Cache samples are not included because creating an AnywhereCache can take an extremely long time, sometimes up to 48 hours. From 51d262dfceef8125237811cd8414edafb5d16262 Mon Sep 17 00:00:00 2001 From: mahendra-google Date: Tue, 16 Sep 2025 01:13:54 -0700 Subject: [PATCH 2/6] samples(StorageControl): Add samples for anywhere cache --- .../StorageControlCreateAnywhereCache.cs | 56 +++++++++++++++++ .../StorageControlDisableAnywhereCache.cs | 45 ++++++++++++++ .../StorageControlGetAnywhereCache.cs | 45 ++++++++++++++ .../StorageControlListAnywhereCaches.cs | 50 +++++++++++++++ .../StorageControlPauseAnywhereCache.cs | 45 ++++++++++++++ .../StorageControlResumeAnywhereCache.cs | 45 ++++++++++++++ .../StorageControlUpdateAnywhereCache.cs | 61 +++++++++++++++++++ 7 files changed, 347 insertions(+) create mode 100644 storage/api/Storage.Samples/StorageControlCreateAnywhereCache.cs create mode 100644 storage/api/Storage.Samples/StorageControlDisableAnywhereCache.cs create mode 100644 storage/api/Storage.Samples/StorageControlGetAnywhereCache.cs create mode 100644 storage/api/Storage.Samples/StorageControlListAnywhereCaches.cs create mode 100644 storage/api/Storage.Samples/StorageControlPauseAnywhereCache.cs create mode 100644 storage/api/Storage.Samples/StorageControlResumeAnywhereCache.cs create mode 100644 storage/api/Storage.Samples/StorageControlUpdateAnywhereCache.cs diff --git a/storage/api/Storage.Samples/StorageControlCreateAnywhereCache.cs b/storage/api/Storage.Samples/StorageControlCreateAnywhereCache.cs new file mode 100644 index 00000000000..5a6ec5a75d3 --- /dev/null +++ b/storage/api/Storage.Samples/StorageControlCreateAnywhereCache.cs @@ -0,0 +1,56 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START storage_control_create_anywhere_cache] + +using Google.Cloud.Storage.Control.V2; +using Google.LongRunning; +using System; + +public class StorageControlCreateAnywhereCacheSample +{ + /// Creates an anywhere cache instance in the specified bucket. + /// The name of the bucket. + /// The name of the zone in which the cache instance will run. + public Operation StorageControlCreateAnywhereCache(string bucketName = "your-unique-bucket-name", + string zoneName = "us-east1-a") + { + StorageControlClient storageControlClient = StorageControlClient.Create(); + + // Set project to "_" to signify globally scoped bucket. + string parent = $"projects/_/buckets/{bucketName}"; + + AnywhereCache anywhereCache = new AnywhereCache + { + Zone = zoneName + }; + + var request = new CreateAnywhereCacheRequest + { + AnywhereCache = anywhereCache, + Parent = parent + }; + + // Start a long-running operation (LRO). + Operation createdCacheOperation = storageControlClient.CreateAnywhereCache(request); + + // Await the LROs completion. + var createdCache = createdCacheOperation.PollUntilCompleted(); + + Console.WriteLine($"Created Anywhere Cache Instance: {createdCache.Result.AnywhereCacheName}"); + + return createdCache; + } +} +// [END storage_control_create_anywhere_cache] diff --git a/storage/api/Storage.Samples/StorageControlDisableAnywhereCache.cs b/storage/api/Storage.Samples/StorageControlDisableAnywhereCache.cs new file mode 100644 index 00000000000..c68fae03167 --- /dev/null +++ b/storage/api/Storage.Samples/StorageControlDisableAnywhereCache.cs @@ -0,0 +1,45 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START storage_control_disable_anywhere_cache] + +using Google.Cloud.Storage.Control.V2; +using System; + +public class StorageControlDisableAnywhereCacheSample +{ + /// Disables the anywhere cache instance in the specified bucket. + /// The name of the bucket that owns the anywhere cache instance. + /// The unique identifier of the cache instance to disable. + public AnywhereCache StorageControlDisableAnywhereCache(string bucketName = "your-unique-bucket-name", + string anywhereCacheId = "us-east1-a") + { + StorageControlClient storageControlClient = StorageControlClient.Create(); + + // Set project to "_" to signify globally scoped bucket. + string anywhereCacheName = $"projects/_/buckets/{bucketName}/anywhereCaches/{anywhereCacheId}"; + + var request = new DisableAnywhereCacheRequest + { + Name = anywhereCacheName + }; + + AnywhereCache disabledCache = storageControlClient.DisableAnywhereCache(request); + + Console.WriteLine($"Disabled Anywhere Cache Instance: {disabledCache.Name}"); + + return disabledCache; + } +} +// [END storage_control_disable_anywhere_cache] diff --git a/storage/api/Storage.Samples/StorageControlGetAnywhereCache.cs b/storage/api/Storage.Samples/StorageControlGetAnywhereCache.cs new file mode 100644 index 00000000000..0f88ca2ad84 --- /dev/null +++ b/storage/api/Storage.Samples/StorageControlGetAnywhereCache.cs @@ -0,0 +1,45 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START storage_control_get_anywhere_cache] + +using Google.Cloud.Storage.Control.V2; +using System; + +public class StorageControlGetAnywhereCacheSample +{ + /// Gets an anywhere cache instance for the specified bucket. + /// The name of the bucket that owns the anywhere cache instance. + /// The unique identifier of the cache instance. + public AnywhereCache StorageControlGetAnywhereCache(string bucketName = "your-unique-bucket-name", + string anywhereCacheId = "us-east1-a") + { + StorageControlClient storageControlClient = StorageControlClient.Create(); + + // Set project to "_" to signify globally scoped bucket. + string anywhereCacheName = $"projects/_/buckets/{bucketName}/anywhereCaches/{anywhereCacheId}"; + + var request = new GetAnywhereCacheRequest + { + Name = anywhereCacheName + }; + + AnywhereCache retrievedCache = storageControlClient.GetAnywhereCache(request); + + Console.WriteLine($"Got Anywhere Cache Instance: {retrievedCache.Name}"); + + return retrievedCache; + } +} +// [END storage_control_get_anywhere_cache] diff --git a/storage/api/Storage.Samples/StorageControlListAnywhereCaches.cs b/storage/api/Storage.Samples/StorageControlListAnywhereCaches.cs new file mode 100644 index 00000000000..7934e192ea3 --- /dev/null +++ b/storage/api/Storage.Samples/StorageControlListAnywhereCaches.cs @@ -0,0 +1,50 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START storage_control_list_anywhere_caches] + +using Google.Api.Gax; +using Google.Cloud.Storage.Control.V2; +using System; +using System.Collections.Generic; + +public class StorageControlListAnywhereCachesSample +{ + /// Lists all anywhere cache instances for the specified bucket. + /// The name of the bucket that owns the anywhere cache instance. + public IEnumerable StorageControlListAnywhereCaches(string bucketName = "your-unique-bucket-name") + { + StorageControlClient storageControlClient = StorageControlClient.Create(); + + // Set project to "_" to signify globally scoped bucket. + string parent = $"projects/_/buckets/{bucketName}"; + + var request = new ListAnywhereCachesRequest + { + Parent = parent + }; + + PagedEnumerable anywhereCaches = storageControlClient.ListAnywhereCaches(request); + + Console.WriteLine($"The Names of Anywhere Cache Instances are as follows:"); + + foreach (AnywhereCache cache in anywhereCaches) + { + Console.WriteLine($"Anywhere Cache Instance: {cache.Name}"); + } + + return anywhereCaches; + } +} +// [END storage_control_list_anywhere_caches] diff --git a/storage/api/Storage.Samples/StorageControlPauseAnywhereCache.cs b/storage/api/Storage.Samples/StorageControlPauseAnywhereCache.cs new file mode 100644 index 00000000000..9ad7ffb713a --- /dev/null +++ b/storage/api/Storage.Samples/StorageControlPauseAnywhereCache.cs @@ -0,0 +1,45 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START storage_control_pause_anywhere_cache] + +using Google.Cloud.Storage.Control.V2; +using System; + +public class StorageControlPauseAnywhereCacheSample +{ + /// Pauses an anywhere cache instance in the specified bucket. + /// The name of the bucket that owns the anywhere cache instance. + /// The unique identifier of the cache instance to pause. + public AnywhereCache StorageControlPauseAnywhereCache(string bucketName = "your-unique-bucket-name", + string anywhereCacheId = "us-east1-a") + { + StorageControlClient storageControlClient = StorageControlClient.Create(); + + // Set project to "_" to signify globally scoped bucket. + string anywhereCacheName = $"projects/_/buckets/{bucketName}/anywhereCaches/{anywhereCacheId}"; + + var request = new PauseAnywhereCacheRequest + { + Name = anywhereCacheName + }; + + AnywhereCache pausedCache = storageControlClient.PauseAnywhereCache(request); + + Console.WriteLine($"Paused Anywhere Cache Instance: {pausedCache.Name}"); + + return pausedCache; + } +} +// [END storage_control_pause_anywhere_cache] diff --git a/storage/api/Storage.Samples/StorageControlResumeAnywhereCache.cs b/storage/api/Storage.Samples/StorageControlResumeAnywhereCache.cs new file mode 100644 index 00000000000..94a97865460 --- /dev/null +++ b/storage/api/Storage.Samples/StorageControlResumeAnywhereCache.cs @@ -0,0 +1,45 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START storage_control_resume_anywhere_cache] + +using Google.Cloud.Storage.Control.V2; +using System; + +public class StorageControlResumeAnywhereCacheSample +{ + /// Resumes the disabled or paused anywhere cache instance in the specified bucket. + /// The name of the bucket that owns the anywhere cache instance. + /// The unique identifier of the cache instance to resume. + public AnywhereCache StorageControlResumeAnywhereCache(string bucketName = "your-unique-bucket-name", + string anywhereCacheId = "us-east1-a") + { + StorageControlClient storageControlClient = StorageControlClient.Create(); + + // Set project to "_" to signify globally scoped bucket. + string anywhereCacheName = $"projects/_/buckets/{bucketName}/anywhereCaches/{anywhereCacheId}"; + + var request = new ResumeAnywhereCacheRequest + { + Name = anywhereCacheName + }; + + AnywhereCache resumedCache = storageControlClient.ResumeAnywhereCache(request); + + Console.WriteLine($"Resumed Anywhere Cache Instance: {resumedCache.Name}"); + + return resumedCache; + } +} +// [END storage_control_resume_anywhere_cache] diff --git a/storage/api/Storage.Samples/StorageControlUpdateAnywhereCache.cs b/storage/api/Storage.Samples/StorageControlUpdateAnywhereCache.cs new file mode 100644 index 00000000000..bc654bc6703 --- /dev/null +++ b/storage/api/Storage.Samples/StorageControlUpdateAnywhereCache.cs @@ -0,0 +1,61 @@ +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"). +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// [START storage_control_update_anywhere_cache] + +using Google.Cloud.Storage.Control.V2; +using Google.LongRunning; +using Google.Protobuf.WellKnownTypes; +using System; + +public class StorageControlUpdateAnywhereCacheSample +{ + /// Updates the running anywhere cache instance for the specified bucket. + /// The name of the bucket that owns the anywhere cache instance. + /// The unique identifier of the cache instance to update. + /// The cache's admission policy. Values can be admit-on-first-miss or admit-on-second-miss. If not specified, it defaults to admit-on-first-miss. + public Operation StorageControlUpdateAnywhereCache(string bucketName = "your-bucket-name", + string anywhereCacheId = "us-east1-a", + string admissionPolicy = "admit-on-first-miss") + { + StorageControlClient storageControlClient = StorageControlClient.Create(); + + // Set project to "_" to signify globally scoped bucket. + string anywhereCacheName = $"projects/_/buckets/{bucketName}/anywhereCaches/{anywhereCacheId}"; + + var anywhereCache = new AnywhereCache + { + Name = anywhereCacheName, + AdmissionPolicy = admissionPolicy + }; + FieldMask fieldMask = new FieldMask { Paths = { "admission_policy" } }; + + var request = new UpdateAnywhereCacheRequest + { + AnywhereCache = anywhereCache, + UpdateMask = fieldMask + }; + + // Start a long-running operation (LRO). + Operation updatedCacheOperation = storageControlClient.UpdateAnywhereCache(request); + + // Await the LROs completion. + var updatedCache = updatedCacheOperation.PollUntilCompleted(); + + Console.WriteLine($"Updated Anywhere Cache Instance: {updatedCache.Result.Name}, New Cache Admission Policy: {updatedCache.Result.AdmissionPolicy}"); + + return updatedCache; + } +} +// [END storage_control_update_anywhere_cache] From da6def1c792352cd4cf5f9fc4ed6712e4e7621bb Mon Sep 17 00:00:00 2001 From: mahendra-google Date: Tue, 7 Oct 2025 04:30:37 -0700 Subject: [PATCH 3/6] samples(StorageControl): Modify zone name in anywhere cache samples --- .../api/Storage.Samples/StorageControlCreateAnywhereCache.cs | 2 +- .../api/Storage.Samples/StorageControlDisableAnywhereCache.cs | 2 +- storage/api/Storage.Samples/StorageControlGetAnywhereCache.cs | 2 +- storage/api/Storage.Samples/StorageControlPauseAnywhereCache.cs | 2 +- .../api/Storage.Samples/StorageControlResumeAnywhereCache.cs | 2 +- .../api/Storage.Samples/StorageControlUpdateAnywhereCache.cs | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/storage/api/Storage.Samples/StorageControlCreateAnywhereCache.cs b/storage/api/Storage.Samples/StorageControlCreateAnywhereCache.cs index 5a6ec5a75d3..1d5d4d68550 100644 --- a/storage/api/Storage.Samples/StorageControlCreateAnywhereCache.cs +++ b/storage/api/Storage.Samples/StorageControlCreateAnywhereCache.cs @@ -24,7 +24,7 @@ public class StorageControlCreateAnywhereCacheSample /// The name of the bucket. /// The name of the zone in which the cache instance will run. public Operation StorageControlCreateAnywhereCache(string bucketName = "your-unique-bucket-name", - string zoneName = "us-east1-a") + string zoneName = "us-east1-b") { StorageControlClient storageControlClient = StorageControlClient.Create(); diff --git a/storage/api/Storage.Samples/StorageControlDisableAnywhereCache.cs b/storage/api/Storage.Samples/StorageControlDisableAnywhereCache.cs index c68fae03167..74b10477f5b 100644 --- a/storage/api/Storage.Samples/StorageControlDisableAnywhereCache.cs +++ b/storage/api/Storage.Samples/StorageControlDisableAnywhereCache.cs @@ -23,7 +23,7 @@ public class StorageControlDisableAnywhereCacheSample /// The name of the bucket that owns the anywhere cache instance. /// The unique identifier of the cache instance to disable. public AnywhereCache StorageControlDisableAnywhereCache(string bucketName = "your-unique-bucket-name", - string anywhereCacheId = "us-east1-a") + string anywhereCacheId = "us-east1-b") { StorageControlClient storageControlClient = StorageControlClient.Create(); diff --git a/storage/api/Storage.Samples/StorageControlGetAnywhereCache.cs b/storage/api/Storage.Samples/StorageControlGetAnywhereCache.cs index 0f88ca2ad84..f664993aaf4 100644 --- a/storage/api/Storage.Samples/StorageControlGetAnywhereCache.cs +++ b/storage/api/Storage.Samples/StorageControlGetAnywhereCache.cs @@ -23,7 +23,7 @@ public class StorageControlGetAnywhereCacheSample /// The name of the bucket that owns the anywhere cache instance. /// The unique identifier of the cache instance. public AnywhereCache StorageControlGetAnywhereCache(string bucketName = "your-unique-bucket-name", - string anywhereCacheId = "us-east1-a") + string anywhereCacheId = "us-east1-b") { StorageControlClient storageControlClient = StorageControlClient.Create(); diff --git a/storage/api/Storage.Samples/StorageControlPauseAnywhereCache.cs b/storage/api/Storage.Samples/StorageControlPauseAnywhereCache.cs index 9ad7ffb713a..98e95a091dc 100644 --- a/storage/api/Storage.Samples/StorageControlPauseAnywhereCache.cs +++ b/storage/api/Storage.Samples/StorageControlPauseAnywhereCache.cs @@ -23,7 +23,7 @@ public class StorageControlPauseAnywhereCacheSample /// The name of the bucket that owns the anywhere cache instance. /// The unique identifier of the cache instance to pause. public AnywhereCache StorageControlPauseAnywhereCache(string bucketName = "your-unique-bucket-name", - string anywhereCacheId = "us-east1-a") + string anywhereCacheId = "us-east1-b") { StorageControlClient storageControlClient = StorageControlClient.Create(); diff --git a/storage/api/Storage.Samples/StorageControlResumeAnywhereCache.cs b/storage/api/Storage.Samples/StorageControlResumeAnywhereCache.cs index 94a97865460..8eedf20c9da 100644 --- a/storage/api/Storage.Samples/StorageControlResumeAnywhereCache.cs +++ b/storage/api/Storage.Samples/StorageControlResumeAnywhereCache.cs @@ -23,7 +23,7 @@ public class StorageControlResumeAnywhereCacheSample /// The name of the bucket that owns the anywhere cache instance. /// The unique identifier of the cache instance to resume. public AnywhereCache StorageControlResumeAnywhereCache(string bucketName = "your-unique-bucket-name", - string anywhereCacheId = "us-east1-a") + string anywhereCacheId = "us-east1-b") { StorageControlClient storageControlClient = StorageControlClient.Create(); diff --git a/storage/api/Storage.Samples/StorageControlUpdateAnywhereCache.cs b/storage/api/Storage.Samples/StorageControlUpdateAnywhereCache.cs index bc654bc6703..9067eaeb00a 100644 --- a/storage/api/Storage.Samples/StorageControlUpdateAnywhereCache.cs +++ b/storage/api/Storage.Samples/StorageControlUpdateAnywhereCache.cs @@ -26,7 +26,7 @@ public class StorageControlUpdateAnywhereCacheSample /// The unique identifier of the cache instance to update. /// The cache's admission policy. Values can be admit-on-first-miss or admit-on-second-miss. If not specified, it defaults to admit-on-first-miss. public Operation StorageControlUpdateAnywhereCache(string bucketName = "your-bucket-name", - string anywhereCacheId = "us-east1-a", + string anywhereCacheId = "us-east1-b", string admissionPolicy = "admit-on-first-miss") { StorageControlClient storageControlClient = StorageControlClient.Create(); From 754f575235193545c0403496d384f09594e37f7f Mon Sep 17 00:00:00 2001 From: mahendra-google Date: Wed, 8 Oct 2025 03:23:39 -0700 Subject: [PATCH 4/6] samples(storageControl): Add pageSize parameter in listAnywhereCache --- .../StorageControlListAnywhereCaches.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/storage/api/Storage.Samples/StorageControlListAnywhereCaches.cs b/storage/api/Storage.Samples/StorageControlListAnywhereCaches.cs index 7934e192ea3..b106d2fec1b 100644 --- a/storage/api/Storage.Samples/StorageControlListAnywhereCaches.cs +++ b/storage/api/Storage.Samples/StorageControlListAnywhereCaches.cs @@ -23,7 +23,8 @@ public class StorageControlListAnywhereCachesSample { /// Lists all anywhere cache instances for the specified bucket. /// The name of the bucket that owns the anywhere cache instance. - public IEnumerable StorageControlListAnywhereCaches(string bucketName = "your-unique-bucket-name") + /// The maximum number of anywhere cache instances to return in a single response. + public IEnumerable StorageControlListAnywhereCaches(string bucketName = "your-unique-bucket-name", int pageSize = 10) { StorageControlClient storageControlClient = StorageControlClient.Create(); @@ -32,7 +33,8 @@ public IEnumerable StorageControlListAnywhereCaches(string bucket var request = new ListAnywhereCachesRequest { - Parent = parent + Parent = parent, + PageSize = pageSize }; PagedEnumerable anywhereCaches = storageControlClient.ListAnywhereCaches(request); @@ -44,6 +46,16 @@ public IEnumerable StorageControlListAnywhereCaches(string bucket Console.WriteLine($"Anywhere Cache Instance: {cache.Name}"); } + // Retrieve a single page of page size (unless it's the final page). + Page singlePage = anywhereCaches.ReadPage(pageSize); + + Console.WriteLine($"The Names of Anywhere Cache Instances in the Page of Page Size {pageSize} are as follows:"); + + foreach (AnywhereCache cache in singlePage) + { + Console.WriteLine($"Anywhere Cache Instance: {cache.Name}"); + } + return anywhereCaches; } } From 370d620cc6cd87c2e28d5506b80cf71f9ee20df5 Mon Sep 17 00:00:00 2001 From: mahendra-google Date: Thu, 9 Oct 2025 04:13:05 -0700 Subject: [PATCH 5/6] samples(StorageControl): Modify list anywhere cache to iterate over all pages --- .../StorageControlListAnywhereCaches.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/storage/api/Storage.Samples/StorageControlListAnywhereCaches.cs b/storage/api/Storage.Samples/StorageControlListAnywhereCaches.cs index b106d2fec1b..6988cb4e292 100644 --- a/storage/api/Storage.Samples/StorageControlListAnywhereCaches.cs +++ b/storage/api/Storage.Samples/StorageControlListAnywhereCaches.cs @@ -46,10 +46,21 @@ public IEnumerable StorageControlListAnywhereCaches(string bucket Console.WriteLine($"Anywhere Cache Instance: {cache.Name}"); } - // Retrieve a single page of page size (unless it's the final page). + Console.WriteLine($"The Names of Anywhere Cache Instances Over All Pages are as follows:"); + + // Iterate over all pages + foreach (ListAnywhereCachesResponse page in anywhereCaches.AsRawResponses()) + { + foreach (AnywhereCache cache in page) + { + Console.WriteLine($"Anywhere Cache Instance: {cache.Name}"); + } + } + + // Retrieve a single page of page size (unless it's the final page) Page singlePage = anywhereCaches.ReadPage(pageSize); - Console.WriteLine($"The Names of Anywhere Cache Instances in the Page of Page Size {pageSize} are as follows:"); + Console.WriteLine($"The Names of Anywhere Cache Instances in the First Page of Page Size {pageSize} are as follows:"); foreach (AnywhereCache cache in singlePage) { From 9d8a5b223923d6880274b53579084cd6c3d4b169 Mon Sep 17 00:00:00 2001 From: mahendra-google Date: Sun, 22 Feb 2026 23:47:02 -0800 Subject: [PATCH 6/6] tests(Storage): Skip ACL test --- storage/api/Storage.Samples.Tests/PrintFileAclForUserTest.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/api/Storage.Samples.Tests/PrintFileAclForUserTest.cs b/storage/api/Storage.Samples.Tests/PrintFileAclForUserTest.cs index 1efdfb93d57..a62a48211fa 100644 --- a/storage/api/Storage.Samples.Tests/PrintFileAclForUserTest.cs +++ b/storage/api/Storage.Samples.Tests/PrintFileAclForUserTest.cs @@ -1,4 +1,4 @@ -// Copyright 2020 Google Inc. +// Copyright 2020 Google Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -24,7 +24,7 @@ public PrintFileAclForUserTest(StorageFixture fixture) _fixture = fixture; } - [Fact] + [Fact(Skip = "b/478003908")] public void TestPrintFileAclForUser() { PrintFileAclForUserSample printFileAclForUserSample = new PrintFileAclForUserSample();