Skip to content

Commit

Permalink
feat: add Context Cache to v1
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 714842212

Source-Link: googleapis/googleapis@51b75ed

Source-Link: googleapis/googleapis-gen@2689f70
Copy-Tag: eyJwIjoiYXBpcy9Hb29nbGUuQ2xvdWQuQUlQbGF0Zm9ybS5WMS8uT3dsQm90LnlhbWwiLCJoIjoiMjY4OWY3MGQyYmRhMThmMjI2YTdlZGU2NDgzZGUxMTk2N2U4MTE1NCJ9
  • Loading branch information
gcf-owl-bot[bot] authored and jskeet committed Jan 13, 2025
1 parent 31f0b69 commit 9997d14
Show file tree
Hide file tree
Showing 45 changed files with 8,444 additions and 114 deletions.
Original file line number Diff line number Diff line change
@@ -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.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1_generated_GenAiCacheService_CreateCachedContent_async_flattened]
using Google.Cloud.AIPlatform.V1;
using System.Threading.Tasks;

public sealed partial class GeneratedGenAiCacheServiceClientSnippets
{
/// <summary>Snippet for CreateCachedContentAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task CreateCachedContentAsync()
{
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
CachedContent cachedContent = new CachedContent();
// Make the request
CachedContent response = await genAiCacheServiceClient.CreateCachedContentAsync(parent, cachedContent);
}
}
// [END aiplatform_v1_generated_GenAiCacheService_CreateCachedContent_async_flattened]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// 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.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1_generated_GenAiCacheService_CreateCachedContent_async]
using Google.Api.Gax.ResourceNames;
using Google.Cloud.AIPlatform.V1;
using System.Threading.Tasks;

public sealed partial class GeneratedGenAiCacheServiceClientSnippets
{
/// <summary>Snippet for CreateCachedContentAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task CreateCachedContentRequestObjectAsync()
{
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
CreateCachedContentRequest request = new CreateCachedContentRequest
{
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
CachedContent = new CachedContent(),
};
// Make the request
CachedContent response = await genAiCacheServiceClient.CreateCachedContentAsync(request);
}
}
// [END aiplatform_v1_generated_GenAiCacheService_CreateCachedContent_async]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// 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.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1_generated_GenAiCacheService_CreateCachedContent_sync]
using Google.Api.Gax.ResourceNames;
using Google.Cloud.AIPlatform.V1;

public sealed partial class GeneratedGenAiCacheServiceClientSnippets
{
/// <summary>Snippet for CreateCachedContent</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public void CreateCachedContentRequestObject()
{
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.Create();
// Initialize request argument(s)
CreateCachedContentRequest request = new CreateCachedContentRequest
{
ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
CachedContent = new CachedContent(),
};
// Make the request
CachedContent response = genAiCacheServiceClient.CreateCachedContent(request);
}
}
// [END aiplatform_v1_generated_GenAiCacheService_CreateCachedContent_sync]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// 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.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1_generated_GenAiCacheService_CreateCachedContent_async_flattened_resourceNames]
using Google.Api.Gax.ResourceNames;
using Google.Cloud.AIPlatform.V1;
using System.Threading.Tasks;

public sealed partial class GeneratedGenAiCacheServiceClientSnippets
{
/// <summary>Snippet for CreateCachedContentAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task CreateCachedContentResourceNamesAsync()
{
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
CachedContent cachedContent = new CachedContent();
// Make the request
CachedContent response = await genAiCacheServiceClient.CreateCachedContentAsync(parent, cachedContent);
}
}
// [END aiplatform_v1_generated_GenAiCacheService_CreateCachedContent_async_flattened_resourceNames]
}
Original file line number Diff line number Diff line change
@@ -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.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1_generated_GenAiCacheService_CreateCachedContent_sync_flattened_resourceNames]
using Google.Api.Gax.ResourceNames;
using Google.Cloud.AIPlatform.V1;

public sealed partial class GeneratedGenAiCacheServiceClientSnippets
{
/// <summary>Snippet for CreateCachedContent</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public void CreateCachedContentResourceNames()
{
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
CachedContent cachedContent = new CachedContent();
// Make the request
CachedContent response = genAiCacheServiceClient.CreateCachedContent(parent, cachedContent);
}
}
// [END aiplatform_v1_generated_GenAiCacheService_CreateCachedContent_sync_flattened_resourceNames]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// 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.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1_generated_GenAiCacheService_CreateCachedContent_sync_flattened]
using Google.Cloud.AIPlatform.V1;

public sealed partial class GeneratedGenAiCacheServiceClientSnippets
{
/// <summary>Snippet for CreateCachedContent</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public void CreateCachedContent()
{
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
CachedContent cachedContent = new CachedContent();
// Make the request
CachedContent response = genAiCacheServiceClient.CreateCachedContent(parent, cachedContent);
}
}
// [END aiplatform_v1_generated_GenAiCacheService_CreateCachedContent_sync_flattened]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// 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.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1_generated_GenAiCacheService_DeleteCachedContent_async_flattened]
using Google.Cloud.AIPlatform.V1;
using System.Threading.Tasks;

public sealed partial class GeneratedGenAiCacheServiceClientSnippets
{
/// <summary>Snippet for DeleteCachedContentAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task DeleteCachedContentAsync()
{
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/cachedContents/[CACHED_CONTENT]";
// Make the request
await genAiCacheServiceClient.DeleteCachedContentAsync(name);
}
}
// [END aiplatform_v1_generated_GenAiCacheService_DeleteCachedContent_async_flattened]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// 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.

// Generated code. DO NOT EDIT!

namespace GoogleCSharpSnippets
{
// [START aiplatform_v1_generated_GenAiCacheService_DeleteCachedContent_async]
using Google.Cloud.AIPlatform.V1;
using System.Threading.Tasks;

public sealed partial class GeneratedGenAiCacheServiceClientSnippets
{
/// <summary>Snippet for DeleteCachedContentAsync</summary>
/// <remarks>
/// This snippet has been automatically generated and should be regarded as a code template only.
/// It will require modifications to work:
/// - It may require correct/in-range values for request initialization.
/// - It may require specifying regional endpoints when creating the service client as shown in
/// https://cloud.google.com/dotnet/docs/reference/help/client-configuration#endpoint.
/// </remarks>
public async Task DeleteCachedContentRequestObjectAsync()
{
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
DeleteCachedContentRequest request = new DeleteCachedContentRequest
{
CachedContentName = CachedContentName.FromProjectLocationCachedContent("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]"),
};
// Make the request
await genAiCacheServiceClient.DeleteCachedContentAsync(request);
}
}
// [END aiplatform_v1_generated_GenAiCacheService_DeleteCachedContent_async]
}
Loading

0 comments on commit 9997d14

Please sign in to comment.