Cloud AI Platform v1beta1 API - Class GenAiCacheServiceClient (1.0.0-beta10)

public abstract class GenAiCacheServiceClient

Reference documentation and code samples for the Cloud AI Platform v1beta1 API class GenAiCacheServiceClient.

GenAiCacheService client wrapper, for convenient use.

Inheritance

object > GenAiCacheServiceClient

Namespace

Google.Cloud.AIPlatform.V1Beta1

Assembly

Google.Cloud.AIPlatform.V1Beta1.dll

Remarks

Service for managing Vertex AI's CachedContent resource.

Properties

DefaultEndpoint

public static string DefaultEndpoint { get; }

The default endpoint for the GenAiCacheService service, which is a host of "aiplatform.googleapis.com" and a port of 443.

Property Value
Type Description
string

DefaultScopes

public static IReadOnlyList<string> DefaultScopes { get; }

The default GenAiCacheService scopes.

Property Value
Type Description
IReadOnlyListstring
Remarks

The default GenAiCacheService scopes are:

GrpcClient

public virtual GenAiCacheService.GenAiCacheServiceClient GrpcClient { get; }

The underlying gRPC GenAiCacheService client

Property Value
Type Description
GenAiCacheServiceGenAiCacheServiceClient

IAMPolicyClient

public virtual IAMPolicyClient IAMPolicyClient { get; }

The IAMPolicyClient associated with this client.

Property Value
Type Description
IAMPolicyClient

LocationsClient

public virtual LocationsClient LocationsClient { get; }

The LocationsClient associated with this client.

Property Value
Type Description
LocationsClient

ServiceMetadata

public static ServiceMetadata ServiceMetadata { get; }

The service metadata associated with this client type.

Property Value
Type Description
ServiceMetadata

Methods

Create()

public static GenAiCacheServiceClient Create()

Synchronously creates a GenAiCacheServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use GenAiCacheServiceClientBuilder.

Returns
Type Description
GenAiCacheServiceClient

The created GenAiCacheServiceClient.

CreateAsync(CancellationToken)

public static Task<GenAiCacheServiceClient> CreateAsync(CancellationToken cancellationToken = default)

Asynchronously creates a GenAiCacheServiceClient using the default credentials, endpoint and settings. To specify custom credentials or other settings, use GenAiCacheServiceClientBuilder.

Parameter
Name Description
cancellationToken CancellationToken

The CancellationToken to use while creating the client.

Returns
Type Description
TaskGenAiCacheServiceClient

The task representing the created GenAiCacheServiceClient.

CreateCachedContent(LocationName, CachedContent, CallSettings)

public virtual CachedContent CreateCachedContent(LocationName parent, CachedContent cachedContent, CallSettings callSettings = null)

Creates cached content, this call will initialize the cached content in the data storage, and users need to pay for the cache data storage.

Parameters
Name Description
parent LocationName

Required. The parent resource where the cached content will be created

cachedContent CachedContent

Required. The cached content to create

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CachedContent

The RPC response.

Example
// 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);

CreateCachedContent(CreateCachedContentRequest, CallSettings)

public virtual CachedContent CreateCachedContent(CreateCachedContentRequest request, CallSettings callSettings = null)

Creates cached content, this call will initialize the cached content in the data storage, and users need to pay for the cache data storage.

Parameters
Name Description
request CreateCachedContentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CachedContent

The RPC response.

Example
// 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);

CreateCachedContent(string, CachedContent, CallSettings)

public virtual CachedContent CreateCachedContent(string parent, CachedContent cachedContent, CallSettings callSettings = null)

Creates cached content, this call will initialize the cached content in the data storage, and users need to pay for the cache data storage.

Parameters
Name Description
parent string

Required. The parent resource where the cached content will be created

cachedContent CachedContent

Required. The cached content to create

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CachedContent

The RPC response.

Example
// 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);

CreateCachedContentAsync(LocationName, CachedContent, CallSettings)

public virtual Task<CachedContent> CreateCachedContentAsync(LocationName parent, CachedContent cachedContent, CallSettings callSettings = null)

Creates cached content, this call will initialize the cached content in the data storage, and users need to pay for the cache data storage.

Parameters
Name Description
parent LocationName

Required. The parent resource where the cached content will be created

cachedContent CachedContent

Required. The cached content to create

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCachedContent

A Task containing the RPC response.

Example
// 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);

CreateCachedContentAsync(LocationName, CachedContent, CancellationToken)

public virtual Task<CachedContent> CreateCachedContentAsync(LocationName parent, CachedContent cachedContent, CancellationToken cancellationToken)

Creates cached content, this call will initialize the cached content in the data storage, and users need to pay for the cache data storage.

Parameters
Name Description
parent LocationName

Required. The parent resource where the cached content will be created

cachedContent CachedContent

Required. The cached content to create

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCachedContent

A Task containing the RPC response.

Example
// 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);

CreateCachedContentAsync(CreateCachedContentRequest, CallSettings)

public virtual Task<CachedContent> CreateCachedContentAsync(CreateCachedContentRequest request, CallSettings callSettings = null)

Creates cached content, this call will initialize the cached content in the data storage, and users need to pay for the cache data storage.

Parameters
Name Description
request CreateCachedContentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCachedContent

A Task containing the RPC response.

Example
// 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);

CreateCachedContentAsync(CreateCachedContentRequest, CancellationToken)

public virtual Task<CachedContent> CreateCachedContentAsync(CreateCachedContentRequest request, CancellationToken cancellationToken)

Creates cached content, this call will initialize the cached content in the data storage, and users need to pay for the cache data storage.

Parameters
Name Description
request CreateCachedContentRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCachedContent

A Task containing the RPC response.

Example
// 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);

CreateCachedContentAsync(string, CachedContent, CallSettings)

public virtual Task<CachedContent> CreateCachedContentAsync(string parent, CachedContent cachedContent, CallSettings callSettings = null)

Creates cached content, this call will initialize the cached content in the data storage, and users need to pay for the cache data storage.

Parameters
Name Description
parent string

Required. The parent resource where the cached content will be created

cachedContent CachedContent

Required. The cached content to create

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCachedContent

A Task containing the RPC response.

Example
// 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);

CreateCachedContentAsync(string, CachedContent, CancellationToken)

public virtual Task<CachedContent> CreateCachedContentAsync(string parent, CachedContent cachedContent, CancellationToken cancellationToken)

Creates cached content, this call will initialize the cached content in the data storage, and users need to pay for the cache data storage.

Parameters
Name Description
parent string

Required. The parent resource where the cached content will be created

cachedContent CachedContent

Required. The cached content to create

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCachedContent

A Task containing the RPC response.

Example
// 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);

DeleteCachedContent(CachedContentName, CallSettings)

public virtual void DeleteCachedContent(CachedContentName name, CallSettings callSettings = null)

Deletes cached content

Parameters
Name Description
name CachedContentName

Required. The resource name referring to the cached content

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.Create();
// Initialize request argument(s)
CachedContentName name = CachedContentName.FromProjectLocationCachedContent("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]");
// Make the request
genAiCacheServiceClient.DeleteCachedContent(name);

DeleteCachedContent(DeleteCachedContentRequest, CallSettings)

public virtual void DeleteCachedContent(DeleteCachedContentRequest request, CallSettings callSettings = null)

Deletes cached content

Parameters
Name Description
request DeleteCachedContentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.Create();
// Initialize request argument(s)
DeleteCachedContentRequest request = new DeleteCachedContentRequest
{
    CachedContentName = CachedContentName.FromProjectLocationCachedContent("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]"),
};
// Make the request
genAiCacheServiceClient.DeleteCachedContent(request);

DeleteCachedContent(string, CallSettings)

public virtual void DeleteCachedContent(string name, CallSettings callSettings = null)

Deletes cached content

Parameters
Name Description
name string

Required. The resource name referring to the cached content

callSettings CallSettings

If not null, applies overrides to this RPC call.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/cachedContents/[CACHED_CONTENT]";
// Make the request
genAiCacheServiceClient.DeleteCachedContent(name);

DeleteCachedContentAsync(CachedContentName, CallSettings)

public virtual Task DeleteCachedContentAsync(CachedContentName name, CallSettings callSettings = null)

Deletes cached content

Parameters
Name Description
name CachedContentName

Required. The resource name referring to the cached content

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
CachedContentName name = CachedContentName.FromProjectLocationCachedContent("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]");
// Make the request
await genAiCacheServiceClient.DeleteCachedContentAsync(name);

DeleteCachedContentAsync(CachedContentName, CancellationToken)

public virtual Task DeleteCachedContentAsync(CachedContentName name, CancellationToken cancellationToken)

Deletes cached content

Parameters
Name Description
name CachedContentName

Required. The resource name referring to the cached content

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
CachedContentName name = CachedContentName.FromProjectLocationCachedContent("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]");
// Make the request
await genAiCacheServiceClient.DeleteCachedContentAsync(name);

DeleteCachedContentAsync(DeleteCachedContentRequest, CallSettings)

public virtual Task DeleteCachedContentAsync(DeleteCachedContentRequest request, CallSettings callSettings = null)

Deletes cached content

Parameters
Name Description
request DeleteCachedContentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// 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);

DeleteCachedContentAsync(DeleteCachedContentRequest, CancellationToken)

public virtual Task DeleteCachedContentAsync(DeleteCachedContentRequest request, CancellationToken cancellationToken)

Deletes cached content

Parameters
Name Description
request DeleteCachedContentRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// 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);

DeleteCachedContentAsync(string, CallSettings)

public virtual Task DeleteCachedContentAsync(string name, CallSettings callSettings = null)

Deletes cached content

Parameters
Name Description
name string

Required. The resource name referring to the cached content

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// 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);

DeleteCachedContentAsync(string, CancellationToken)

public virtual Task DeleteCachedContentAsync(string name, CancellationToken cancellationToken)

Deletes cached content

Parameters
Name Description
name string

Required. The resource name referring to the cached content

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
Task

A Task containing the RPC response.

Example
// 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);

GetCachedContent(CachedContentName, CallSettings)

public virtual CachedContent GetCachedContent(CachedContentName name, CallSettings callSettings = null)

Gets cached content configurations

Parameters
Name Description
name CachedContentName

Required. The resource name referring to the cached content

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CachedContent

The RPC response.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.Create();
// Initialize request argument(s)
CachedContentName name = CachedContentName.FromProjectLocationCachedContent("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]");
// Make the request
CachedContent response = genAiCacheServiceClient.GetCachedContent(name);

GetCachedContent(GetCachedContentRequest, CallSettings)

public virtual CachedContent GetCachedContent(GetCachedContentRequest request, CallSettings callSettings = null)

Gets cached content configurations

Parameters
Name Description
request GetCachedContentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CachedContent

The RPC response.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.Create();
// Initialize request argument(s)
GetCachedContentRequest request = new GetCachedContentRequest
{
    CachedContentName = CachedContentName.FromProjectLocationCachedContent("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]"),
};
// Make the request
CachedContent response = genAiCacheServiceClient.GetCachedContent(request);

GetCachedContent(string, CallSettings)

public virtual CachedContent GetCachedContent(string name, CallSettings callSettings = null)

Gets cached content configurations

Parameters
Name Description
name string

Required. The resource name referring to the cached content

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CachedContent

The RPC response.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.Create();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/cachedContents/[CACHED_CONTENT]";
// Make the request
CachedContent response = genAiCacheServiceClient.GetCachedContent(name);

GetCachedContentAsync(CachedContentName, CallSettings)

public virtual Task<CachedContent> GetCachedContentAsync(CachedContentName name, CallSettings callSettings = null)

Gets cached content configurations

Parameters
Name Description
name CachedContentName

Required. The resource name referring to the cached content

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCachedContent

A Task containing the RPC response.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
CachedContentName name = CachedContentName.FromProjectLocationCachedContent("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]");
// Make the request
CachedContent response = await genAiCacheServiceClient.GetCachedContentAsync(name);

GetCachedContentAsync(CachedContentName, CancellationToken)

public virtual Task<CachedContent> GetCachedContentAsync(CachedContentName name, CancellationToken cancellationToken)

Gets cached content configurations

Parameters
Name Description
name CachedContentName

Required. The resource name referring to the cached content

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCachedContent

A Task containing the RPC response.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
CachedContentName name = CachedContentName.FromProjectLocationCachedContent("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]");
// Make the request
CachedContent response = await genAiCacheServiceClient.GetCachedContentAsync(name);

GetCachedContentAsync(GetCachedContentRequest, CallSettings)

public virtual Task<CachedContent> GetCachedContentAsync(GetCachedContentRequest request, CallSettings callSettings = null)

Gets cached content configurations

Parameters
Name Description
request GetCachedContentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCachedContent

A Task containing the RPC response.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
GetCachedContentRequest request = new GetCachedContentRequest
{
    CachedContentName = CachedContentName.FromProjectLocationCachedContent("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]"),
};
// Make the request
CachedContent response = await genAiCacheServiceClient.GetCachedContentAsync(request);

GetCachedContentAsync(GetCachedContentRequest, CancellationToken)

public virtual Task<CachedContent> GetCachedContentAsync(GetCachedContentRequest request, CancellationToken cancellationToken)

Gets cached content configurations

Parameters
Name Description
request GetCachedContentRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCachedContent

A Task containing the RPC response.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
GetCachedContentRequest request = new GetCachedContentRequest
{
    CachedContentName = CachedContentName.FromProjectLocationCachedContent("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]"),
};
// Make the request
CachedContent response = await genAiCacheServiceClient.GetCachedContentAsync(request);

GetCachedContentAsync(string, CallSettings)

public virtual Task<CachedContent> GetCachedContentAsync(string name, CallSettings callSettings = null)

Gets cached content configurations

Parameters
Name Description
name string

Required. The resource name referring to the cached content

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCachedContent

A Task containing the RPC response.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/cachedContents/[CACHED_CONTENT]";
// Make the request
CachedContent response = await genAiCacheServiceClient.GetCachedContentAsync(name);

GetCachedContentAsync(string, CancellationToken)

public virtual Task<CachedContent> GetCachedContentAsync(string name, CancellationToken cancellationToken)

Gets cached content configurations

Parameters
Name Description
name string

Required. The resource name referring to the cached content

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCachedContent

A Task containing the RPC response.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
string name = "projects/[PROJECT]/locations/[LOCATION]/cachedContents/[CACHED_CONTENT]";
// Make the request
CachedContent response = await genAiCacheServiceClient.GetCachedContentAsync(name);

ListCachedContents(LocationName, string, int?, CallSettings)

public virtual PagedEnumerable<ListCachedContentsResponse, CachedContent> ListCachedContents(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists cached contents in a project

Parameters
Name Description
parent LocationName

Required. The parent, which owns this collection of cached contents.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListCachedContentsResponseCachedContent

A pageable sequence of CachedContent resources.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.Create();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedEnumerable<ListCachedContentsResponse, CachedContent> response = genAiCacheServiceClient.ListCachedContents(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (CachedContent item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCachedContentsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CachedContent item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CachedContent> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CachedContent item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCachedContents(ListCachedContentsRequest, CallSettings)

public virtual PagedEnumerable<ListCachedContentsResponse, CachedContent> ListCachedContents(ListCachedContentsRequest request, CallSettings callSettings = null)

Lists cached contents in a project

Parameters
Name Description
request ListCachedContentsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListCachedContentsResponseCachedContent

A pageable sequence of CachedContent resources.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.Create();
// Initialize request argument(s)
ListCachedContentsRequest request = new ListCachedContentsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
};
// Make the request
PagedEnumerable<ListCachedContentsResponse, CachedContent> response = genAiCacheServiceClient.ListCachedContents(request);

// Iterate over all response items, lazily performing RPCs as required
foreach (CachedContent item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCachedContentsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CachedContent item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CachedContent> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CachedContent item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCachedContents(string, string, int?, CallSettings)

public virtual PagedEnumerable<ListCachedContentsResponse, CachedContent> ListCachedContents(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists cached contents in a project

Parameters
Name Description
parent string

Required. The parent, which owns this collection of cached contents.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedEnumerableListCachedContentsResponseCachedContent

A pageable sequence of CachedContent resources.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.Create();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedEnumerable<ListCachedContentsResponse, CachedContent> response = genAiCacheServiceClient.ListCachedContents(parent);

// Iterate over all response items, lazily performing RPCs as required
foreach (CachedContent item in response)
{
    // Do something with each item
    Console.WriteLine(item);
}

// Or iterate over pages (of server-defined size), performing one RPC per page
foreach (ListCachedContentsResponse page in response.AsRawResponses())
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CachedContent item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
}

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CachedContent> singlePage = response.ReadPage(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CachedContent item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCachedContentsAsync(LocationName, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListCachedContentsResponse, CachedContent> ListCachedContentsAsync(LocationName parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists cached contents in a project

Parameters
Name Description
parent LocationName

Required. The parent, which owns this collection of cached contents.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListCachedContentsResponseCachedContent

A pageable asynchronous sequence of CachedContent resources.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
LocationName parent = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]");
// Make the request
PagedAsyncEnumerable<ListCachedContentsResponse, CachedContent> response = genAiCacheServiceClient.ListCachedContentsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((CachedContent item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCachedContentsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CachedContent item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CachedContent> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CachedContent item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCachedContentsAsync(ListCachedContentsRequest, CallSettings)

public virtual PagedAsyncEnumerable<ListCachedContentsResponse, CachedContent> ListCachedContentsAsync(ListCachedContentsRequest request, CallSettings callSettings = null)

Lists cached contents in a project

Parameters
Name Description
request ListCachedContentsRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListCachedContentsResponseCachedContent

A pageable asynchronous sequence of CachedContent resources.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
ListCachedContentsRequest request = new ListCachedContentsRequest
{
    ParentAsLocationName = LocationName.FromProjectLocation("[PROJECT]", "[LOCATION]"),
};
// Make the request
PagedAsyncEnumerable<ListCachedContentsResponse, CachedContent> response = genAiCacheServiceClient.ListCachedContentsAsync(request);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((CachedContent item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCachedContentsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CachedContent item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CachedContent> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CachedContent item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ListCachedContentsAsync(string, string, int?, CallSettings)

public virtual PagedAsyncEnumerable<ListCachedContentsResponse, CachedContent> ListCachedContentsAsync(string parent, string pageToken = null, int? pageSize = null, CallSettings callSettings = null)

Lists cached contents in a project

Parameters
Name Description
parent string

Required. The parent, which owns this collection of cached contents.

pageToken string

The token returned from the previous request. A value of null or an empty string retrieves the first page.

pageSize int

The size of page to request. The response will not be larger than this, but may be smaller. A value of null or 0 uses a server-defined page size.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
PagedAsyncEnumerableListCachedContentsResponseCachedContent

A pageable asynchronous sequence of CachedContent resources.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
string parent = "projects/[PROJECT]/locations/[LOCATION]";
// Make the request
PagedAsyncEnumerable<ListCachedContentsResponse, CachedContent> response = genAiCacheServiceClient.ListCachedContentsAsync(parent);

// Iterate over all response items, lazily performing RPCs as required
await response.ForEachAsync((CachedContent item) =>
{
    // Do something with each item
    Console.WriteLine(item);
});

// Or iterate over pages (of server-defined size), performing one RPC per page
await response.AsRawResponses().ForEachAsync((ListCachedContentsResponse page) =>
{
    // Do something with each page of items
    Console.WriteLine("A page of results:");
    foreach (CachedContent item in page)
    {
        // Do something with each item
        Console.WriteLine(item);
    }
});

// Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required
int pageSize = 10;
Page<CachedContent> singlePage = await response.ReadPageAsync(pageSize);
// Do something with the page of items
Console.WriteLine($"A page of {pageSize} results (unless it's the final page):");
foreach (CachedContent item in singlePage)
{
    // Do something with each item
    Console.WriteLine(item);
}
// Store the pageToken, for when the next page is required.
string nextPageToken = singlePage.NextPageToken;

ShutdownDefaultChannelsAsync()

public static Task ShutdownDefaultChannelsAsync()

Shuts down any channels automatically created by Create() and CreateAsync(CancellationToken). Channels which weren't automatically created are not affected.

Returns
Type Description
Task

A task representing the asynchronous shutdown operation.

Remarks

After calling this method, further calls to Create() and CreateAsync(CancellationToken) will create new channels, which could in turn be shut down by another call to this method.

UpdateCachedContent(CachedContent, FieldMask, CallSettings)

public virtual CachedContent UpdateCachedContent(CachedContent cachedContent, FieldMask updateMask, CallSettings callSettings = null)

Updates cached content configurations

Parameters
Name Description
cachedContent CachedContent

Required. The cached content to update

updateMask FieldMask

Required. The list of fields to update.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CachedContent

The RPC response.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.Create();
// Initialize request argument(s)
CachedContent cachedContent = new CachedContent();
FieldMask updateMask = new FieldMask();
// Make the request
CachedContent response = genAiCacheServiceClient.UpdateCachedContent(cachedContent, updateMask);

UpdateCachedContent(UpdateCachedContentRequest, CallSettings)

public virtual CachedContent UpdateCachedContent(UpdateCachedContentRequest request, CallSettings callSettings = null)

Updates cached content configurations

Parameters
Name Description
request UpdateCachedContentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
CachedContent

The RPC response.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.Create();
// Initialize request argument(s)
UpdateCachedContentRequest request = new UpdateCachedContentRequest
{
    CachedContent = new CachedContent(),
    UpdateMask = new FieldMask(),
};
// Make the request
CachedContent response = genAiCacheServiceClient.UpdateCachedContent(request);

UpdateCachedContentAsync(CachedContent, FieldMask, CallSettings)

public virtual Task<CachedContent> UpdateCachedContentAsync(CachedContent cachedContent, FieldMask updateMask, CallSettings callSettings = null)

Updates cached content configurations

Parameters
Name Description
cachedContent CachedContent

Required. The cached content to update

updateMask FieldMask

Required. The list of fields to update.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCachedContent

A Task containing the RPC response.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
CachedContent cachedContent = new CachedContent();
FieldMask updateMask = new FieldMask();
// Make the request
CachedContent response = await genAiCacheServiceClient.UpdateCachedContentAsync(cachedContent, updateMask);

UpdateCachedContentAsync(CachedContent, FieldMask, CancellationToken)

public virtual Task<CachedContent> UpdateCachedContentAsync(CachedContent cachedContent, FieldMask updateMask, CancellationToken cancellationToken)

Updates cached content configurations

Parameters
Name Description
cachedContent CachedContent

Required. The cached content to update

updateMask FieldMask

Required. The list of fields to update.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCachedContent

A Task containing the RPC response.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
CachedContent cachedContent = new CachedContent();
FieldMask updateMask = new FieldMask();
// Make the request
CachedContent response = await genAiCacheServiceClient.UpdateCachedContentAsync(cachedContent, updateMask);

UpdateCachedContentAsync(UpdateCachedContentRequest, CallSettings)

public virtual Task<CachedContent> UpdateCachedContentAsync(UpdateCachedContentRequest request, CallSettings callSettings = null)

Updates cached content configurations

Parameters
Name Description
request UpdateCachedContentRequest

The request object containing all of the parameters for the API call.

callSettings CallSettings

If not null, applies overrides to this RPC call.

Returns
Type Description
TaskCachedContent

A Task containing the RPC response.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateCachedContentRequest request = new UpdateCachedContentRequest
{
    CachedContent = new CachedContent(),
    UpdateMask = new FieldMask(),
};
// Make the request
CachedContent response = await genAiCacheServiceClient.UpdateCachedContentAsync(request);

UpdateCachedContentAsync(UpdateCachedContentRequest, CancellationToken)

public virtual Task<CachedContent> UpdateCachedContentAsync(UpdateCachedContentRequest request, CancellationToken cancellationToken)

Updates cached content configurations

Parameters
Name Description
request UpdateCachedContentRequest

The request object containing all of the parameters for the API call.

cancellationToken CancellationToken

A CancellationToken to use for this RPC.

Returns
Type Description
TaskCachedContent

A Task containing the RPC response.

Example
// Create client
GenAiCacheServiceClient genAiCacheServiceClient = await GenAiCacheServiceClient.CreateAsync();
// Initialize request argument(s)
UpdateCachedContentRequest request = new UpdateCachedContentRequest
{
    CachedContent = new CachedContent(),
    UpdateMask = new FieldMask(),
};
// Make the request
CachedContent response = await genAiCacheServiceClient.UpdateCachedContentAsync(request);