Skip to content

Commit b7eebeb

Browse files
feat: Add Anywhere cache control APIs (googleapis#14427)
docs: Added comments for Anywhere cache messages PiperOrigin-RevId: 735570925 Source-Link: googleapis/googleapis@66ab6ce Source-Link: https://github.com/googleapis/googleapis-gen/commit/8f7d5dba0f0418d1f03ce56a767f251b8b69ca3e Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuU3RvcmFnZS5Db250cm9sLlYyLy5Pd2xCb3QueWFtbCIsImgiOiI4ZjdkNWRiYTBmMDQxOGQxZjAzY2U1NmE3NjdmMjUxYjhiNjljYTNlIn0= Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent f193143 commit b7eebeb

File tree

47 files changed

+11299
-309
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+11299
-309
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Copyright 2025 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Generated code. DO NOT EDIT!
16+
17+
namespace GoogleCSharpSnippets
18+
{
19+
// [START storage_v2_generated_StorageControl_CreateAnywhereCache_async_flattened]
20+
using Google.Cloud.Storage.Control.V2;
21+
using Google.LongRunning;
22+
using System.Threading.Tasks;
23+
24+
public sealed partial class GeneratedStorageControlClientSnippets
25+
{
26+
/// <summary>Snippet for CreateAnywhereCacheAsync</summary>
27+
/// <remarks>
28+
/// This snippet has been automatically generated and should be regarded as a code template only.
29+
/// It will require modifications to work:
30+
/// - It may require correct/in-range values for request initialization.
31+
/// - It may require specifying regional endpoints when creating the service client as shown in
32+
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
33+
/// </remarks>
34+
public async Task CreateAnywhereCacheAsync()
35+
{
36+
// Create client
37+
StorageControlClient storageControlClient = await StorageControlClient.CreateAsync();
38+
// Initialize request argument(s)
39+
string parent = "projects/[PROJECT]/buckets/[BUCKET]";
40+
AnywhereCache anywhereCache = new AnywhereCache();
41+
string anywhereCacheId = "";
42+
// Make the request
43+
Operation<AnywhereCache, CreateAnywhereCacheMetadata> response = await storageControlClient.CreateAnywhereCacheAsync(parent, anywhereCache, anywhereCacheId);
44+
45+
// Poll until the returned long-running operation is complete
46+
Operation<AnywhereCache, CreateAnywhereCacheMetadata> completedResponse = await response.PollUntilCompletedAsync();
47+
// Retrieve the operation result
48+
AnywhereCache result = completedResponse.Result;
49+
50+
// Or get the name of the operation
51+
string operationName = response.Name;
52+
// This name can be stored, then the long-running operation retrieved later by name
53+
Operation<AnywhereCache, CreateAnywhereCacheMetadata> retrievedResponse = await storageControlClient.PollOnceCreateAnywhereCacheAsync(operationName);
54+
// Check if the retrieved long-running operation has completed
55+
if (retrievedResponse.IsCompleted)
56+
{
57+
// If it has completed, then access the result
58+
AnywhereCache retrievedResult = retrievedResponse.Result;
59+
}
60+
}
61+
}
62+
// [END storage_v2_generated_StorageControl_CreateAnywhereCache_async_flattened]
63+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
// Copyright 2025 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Generated code. DO NOT EDIT!
16+
17+
namespace GoogleCSharpSnippets
18+
{
19+
// [START storage_v2_generated_StorageControl_CreateAnywhereCache_async]
20+
using Google.Cloud.Storage.Control.V2;
21+
using Google.LongRunning;
22+
using System.Threading.Tasks;
23+
24+
public sealed partial class GeneratedStorageControlClientSnippets
25+
{
26+
/// <summary>Snippet for CreateAnywhereCacheAsync</summary>
27+
/// <remarks>
28+
/// This snippet has been automatically generated and should be regarded as a code template only.
29+
/// It will require modifications to work:
30+
/// - It may require correct/in-range values for request initialization.
31+
/// - It may require specifying regional endpoints when creating the service client as shown in
32+
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
33+
/// </remarks>
34+
public async Task CreateAnywhereCacheRequestObjectAsync()
35+
{
36+
// Create client
37+
StorageControlClient storageControlClient = await StorageControlClient.CreateAsync();
38+
// Initialize request argument(s)
39+
CreateAnywhereCacheRequest request = new CreateAnywhereCacheRequest
40+
{
41+
ParentAsBucketName = BucketName.FromProjectBucket("[PROJECT]", "[BUCKET]"),
42+
AnywhereCacheId = "",
43+
AnywhereCache = new AnywhereCache(),
44+
RequestId = "",
45+
};
46+
// Make the request
47+
Operation<AnywhereCache, CreateAnywhereCacheMetadata> response = await storageControlClient.CreateAnywhereCacheAsync(request);
48+
49+
// Poll until the returned long-running operation is complete
50+
Operation<AnywhereCache, CreateAnywhereCacheMetadata> completedResponse = await response.PollUntilCompletedAsync();
51+
// Retrieve the operation result
52+
AnywhereCache result = completedResponse.Result;
53+
54+
// Or get the name of the operation
55+
string operationName = response.Name;
56+
// This name can be stored, then the long-running operation retrieved later by name
57+
Operation<AnywhereCache, CreateAnywhereCacheMetadata> retrievedResponse = await storageControlClient.PollOnceCreateAnywhereCacheAsync(operationName);
58+
// Check if the retrieved long-running operation has completed
59+
if (retrievedResponse.IsCompleted)
60+
{
61+
// If it has completed, then access the result
62+
AnywhereCache retrievedResult = retrievedResponse.Result;
63+
}
64+
}
65+
}
66+
// [END storage_v2_generated_StorageControl_CreateAnywhereCache_async]
67+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
// Copyright 2025 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Generated code. DO NOT EDIT!
16+
17+
namespace GoogleCSharpSnippets
18+
{
19+
// [START storage_v2_generated_StorageControl_CreateAnywhereCache_sync]
20+
using Google.Cloud.Storage.Control.V2;
21+
using Google.LongRunning;
22+
23+
public sealed partial class GeneratedStorageControlClientSnippets
24+
{
25+
/// <summary>Snippet for CreateAnywhereCache</summary>
26+
/// <remarks>
27+
/// This snippet has been automatically generated and should be regarded as a code template only.
28+
/// It will require modifications to work:
29+
/// - It may require correct/in-range values for request initialization.
30+
/// - It may require specifying regional endpoints when creating the service client as shown in
31+
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
32+
/// </remarks>
33+
public void CreateAnywhereCacheRequestObject()
34+
{
35+
// Create client
36+
StorageControlClient storageControlClient = StorageControlClient.Create();
37+
// Initialize request argument(s)
38+
CreateAnywhereCacheRequest request = new CreateAnywhereCacheRequest
39+
{
40+
ParentAsBucketName = BucketName.FromProjectBucket("[PROJECT]", "[BUCKET]"),
41+
AnywhereCacheId = "",
42+
AnywhereCache = new AnywhereCache(),
43+
RequestId = "",
44+
};
45+
// Make the request
46+
Operation<AnywhereCache, CreateAnywhereCacheMetadata> response = storageControlClient.CreateAnywhereCache(request);
47+
48+
// Poll until the returned long-running operation is complete
49+
Operation<AnywhereCache, CreateAnywhereCacheMetadata> completedResponse = response.PollUntilCompleted();
50+
// Retrieve the operation result
51+
AnywhereCache result = completedResponse.Result;
52+
53+
// Or get the name of the operation
54+
string operationName = response.Name;
55+
// This name can be stored, then the long-running operation retrieved later by name
56+
Operation<AnywhereCache, CreateAnywhereCacheMetadata> retrievedResponse = storageControlClient.PollOnceCreateAnywhereCache(operationName);
57+
// Check if the retrieved long-running operation has completed
58+
if (retrievedResponse.IsCompleted)
59+
{
60+
// If it has completed, then access the result
61+
AnywhereCache retrievedResult = retrievedResponse.Result;
62+
}
63+
}
64+
}
65+
// [END storage_v2_generated_StorageControl_CreateAnywhereCache_sync]
66+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
// Copyright 2025 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Generated code. DO NOT EDIT!
16+
17+
namespace GoogleCSharpSnippets
18+
{
19+
// [START storage_v2_generated_StorageControl_CreateAnywhereCache_async_flattened_resourceNames]
20+
using Google.Cloud.Storage.Control.V2;
21+
using Google.LongRunning;
22+
using System.Threading.Tasks;
23+
24+
public sealed partial class GeneratedStorageControlClientSnippets
25+
{
26+
/// <summary>Snippet for CreateAnywhereCacheAsync</summary>
27+
/// <remarks>
28+
/// This snippet has been automatically generated and should be regarded as a code template only.
29+
/// It will require modifications to work:
30+
/// - It may require correct/in-range values for request initialization.
31+
/// - It may require specifying regional endpoints when creating the service client as shown in
32+
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
33+
/// </remarks>
34+
public async Task CreateAnywhereCacheResourceNamesAsync()
35+
{
36+
// Create client
37+
StorageControlClient storageControlClient = await StorageControlClient.CreateAsync();
38+
// Initialize request argument(s)
39+
BucketName parent = BucketName.FromProjectBucket("[PROJECT]", "[BUCKET]");
40+
AnywhereCache anywhereCache = new AnywhereCache();
41+
string anywhereCacheId = "";
42+
// Make the request
43+
Operation<AnywhereCache, CreateAnywhereCacheMetadata> response = await storageControlClient.CreateAnywhereCacheAsync(parent, anywhereCache, anywhereCacheId);
44+
45+
// Poll until the returned long-running operation is complete
46+
Operation<AnywhereCache, CreateAnywhereCacheMetadata> completedResponse = await response.PollUntilCompletedAsync();
47+
// Retrieve the operation result
48+
AnywhereCache result = completedResponse.Result;
49+
50+
// Or get the name of the operation
51+
string operationName = response.Name;
52+
// This name can be stored, then the long-running operation retrieved later by name
53+
Operation<AnywhereCache, CreateAnywhereCacheMetadata> retrievedResponse = await storageControlClient.PollOnceCreateAnywhereCacheAsync(operationName);
54+
// Check if the retrieved long-running operation has completed
55+
if (retrievedResponse.IsCompleted)
56+
{
57+
// If it has completed, then access the result
58+
AnywhereCache retrievedResult = retrievedResponse.Result;
59+
}
60+
}
61+
}
62+
// [END storage_v2_generated_StorageControl_CreateAnywhereCache_async_flattened_resourceNames]
63+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Copyright 2025 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Generated code. DO NOT EDIT!
16+
17+
namespace GoogleCSharpSnippets
18+
{
19+
// [START storage_v2_generated_StorageControl_CreateAnywhereCache_sync_flattened_resourceNames]
20+
using Google.Cloud.Storage.Control.V2;
21+
using Google.LongRunning;
22+
23+
public sealed partial class GeneratedStorageControlClientSnippets
24+
{
25+
/// <summary>Snippet for CreateAnywhereCache</summary>
26+
/// <remarks>
27+
/// This snippet has been automatically generated and should be regarded as a code template only.
28+
/// It will require modifications to work:
29+
/// - It may require correct/in-range values for request initialization.
30+
/// - It may require specifying regional endpoints when creating the service client as shown in
31+
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
32+
/// </remarks>
33+
public void CreateAnywhereCacheResourceNames()
34+
{
35+
// Create client
36+
StorageControlClient storageControlClient = StorageControlClient.Create();
37+
// Initialize request argument(s)
38+
BucketName parent = BucketName.FromProjectBucket("[PROJECT]", "[BUCKET]");
39+
AnywhereCache anywhereCache = new AnywhereCache();
40+
string anywhereCacheId = "";
41+
// Make the request
42+
Operation<AnywhereCache, CreateAnywhereCacheMetadata> response = storageControlClient.CreateAnywhereCache(parent, anywhereCache, anywhereCacheId);
43+
44+
// Poll until the returned long-running operation is complete
45+
Operation<AnywhereCache, CreateAnywhereCacheMetadata> completedResponse = response.PollUntilCompleted();
46+
// Retrieve the operation result
47+
AnywhereCache result = completedResponse.Result;
48+
49+
// Or get the name of the operation
50+
string operationName = response.Name;
51+
// This name can be stored, then the long-running operation retrieved later by name
52+
Operation<AnywhereCache, CreateAnywhereCacheMetadata> retrievedResponse = storageControlClient.PollOnceCreateAnywhereCache(operationName);
53+
// Check if the retrieved long-running operation has completed
54+
if (retrievedResponse.IsCompleted)
55+
{
56+
// If it has completed, then access the result
57+
AnywhereCache retrievedResult = retrievedResponse.Result;
58+
}
59+
}
60+
}
61+
// [END storage_v2_generated_StorageControl_CreateAnywhereCache_sync_flattened_resourceNames]
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
// Copyright 2025 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// https://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
// Generated code. DO NOT EDIT!
16+
17+
namespace GoogleCSharpSnippets
18+
{
19+
// [START storage_v2_generated_StorageControl_CreateAnywhereCache_sync_flattened]
20+
using Google.Cloud.Storage.Control.V2;
21+
using Google.LongRunning;
22+
23+
public sealed partial class GeneratedStorageControlClientSnippets
24+
{
25+
/// <summary>Snippet for CreateAnywhereCache</summary>
26+
/// <remarks>
27+
/// This snippet has been automatically generated and should be regarded as a code template only.
28+
/// It will require modifications to work:
29+
/// - It may require correct/in-range values for request initialization.
30+
/// - It may require specifying regional endpoints when creating the service client as shown in
31+
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
32+
/// </remarks>
33+
public void CreateAnywhereCache()
34+
{
35+
// Create client
36+
StorageControlClient storageControlClient = StorageControlClient.Create();
37+
// Initialize request argument(s)
38+
string parent = "projects/[PROJECT]/buckets/[BUCKET]";
39+
AnywhereCache anywhereCache = new AnywhereCache();
40+
string anywhereCacheId = "";
41+
// Make the request
42+
Operation<AnywhereCache, CreateAnywhereCacheMetadata> response = storageControlClient.CreateAnywhereCache(parent, anywhereCache, anywhereCacheId);
43+
44+
// Poll until the returned long-running operation is complete
45+
Operation<AnywhereCache, CreateAnywhereCacheMetadata> completedResponse = response.PollUntilCompleted();
46+
// Retrieve the operation result
47+
AnywhereCache result = completedResponse.Result;
48+
49+
// Or get the name of the operation
50+
string operationName = response.Name;
51+
// This name can be stored, then the long-running operation retrieved later by name
52+
Operation<AnywhereCache, CreateAnywhereCacheMetadata> retrievedResponse = storageControlClient.PollOnceCreateAnywhereCache(operationName);
53+
// Check if the retrieved long-running operation has completed
54+
if (retrievedResponse.IsCompleted)
55+
{
56+
// If it has completed, then access the result
57+
AnywhereCache retrievedResult = retrievedResponse.Result;
58+
}
59+
}
60+
}
61+
// [END storage_v2_generated_StorageControl_CreateAnywhereCache_sync_flattened]
62+
}

0 commit comments

Comments
 (0)