com.google.cloud.aiplatform.v1beta1.GenAiCacheServiceClient Maven / Gradle / Ivy
Show all versions of google-cloud-aiplatform Show documentation
/*
* Copyright 2024 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.
*/
package com.google.cloud.aiplatform.v1beta1;
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.aiplatform.v1beta1.stub.GenAiCacheServiceStub;
import com.google.cloud.aiplatform.v1beta1.stub.GenAiCacheServiceStubSettings;
import com.google.cloud.location.GetLocationRequest;
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.iam.v1.GetIamPolicyRequest;
import com.google.iam.v1.Policy;
import com.google.iam.v1.SetIamPolicyRequest;
import com.google.iam.v1.TestIamPermissionsRequest;
import com.google.iam.v1.TestIamPermissionsResponse;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
import javax.annotation.Generated;
// AUTO-GENERATED DOCUMENTATION AND CLASS.
/**
* Service Description: Service for managing Vertex AI's CachedContent resource.
*
* This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
* CachedContent cachedContent = CachedContent.newBuilder().build();
* CachedContent response = genAiCacheServiceClient.createCachedContent(parent, cachedContent);
* }
* }
*
* Note: close() needs to be called on the GenAiCacheServiceClient object to clean up resources
* such as threads. In the example above, try-with-resources is used, which automatically calls
* close().
*
*
* Methods
*
* Method
* Description
* Method Variants
*
*
* CreateCachedContent
* Creates cached content, this call will initialize the cached content in the data storage, and users need to pay for the cache data storage.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* createCachedContent(CreateCachedContentRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* createCachedContent(LocationName parent, CachedContent cachedContent)
*
createCachedContent(String parent, CachedContent cachedContent)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* createCachedContentCallable()
*
*
*
*
* GetCachedContent
* Gets cached content configurations
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* getCachedContent(GetCachedContentRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* getCachedContent(CachedContentName name)
*
getCachedContent(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* getCachedContentCallable()
*
*
*
*
* UpdateCachedContent
* Updates cached content configurations
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* updateCachedContent(UpdateCachedContentRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* updateCachedContent(CachedContent cachedContent, FieldMask updateMask)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* updateCachedContentCallable()
*
*
*
*
* DeleteCachedContent
* Deletes cached content
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* deleteCachedContent(DeleteCachedContentRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* deleteCachedContent(CachedContentName name)
*
deleteCachedContent(String name)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* deleteCachedContentCallable()
*
*
*
*
* ListCachedContents
* Lists cached contents in a project
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* listCachedContents(ListCachedContentsRequest request)
*
* "Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
*
* listCachedContents(LocationName parent)
*
listCachedContents(String parent)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* listCachedContentsPagedCallable()
*
listCachedContentsCallable()
*
*
*
*
* ListLocations
* Lists information about the supported locations for this service.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* listLocations(ListLocationsRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* listLocationsPagedCallable()
*
listLocationsCallable()
*
*
*
*
* GetLocation
* Gets information about a location.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* getLocation(GetLocationRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* getLocationCallable()
*
*
*
*
* SetIamPolicy
* Sets the access control policy on the specified resource. Replacesany existing policy.
*
Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* setIamPolicy(SetIamPolicyRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* setIamPolicyCallable()
*
*
*
*
* GetIamPolicy
* Gets the access control policy for a resource. Returns an empty policyif the resource exists and does not have a policy set.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* getIamPolicy(GetIamPolicyRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* getIamPolicyCallable()
*
*
*
*
* TestIamPermissions
* Returns permissions that a caller has on the specified resource. If theresource does not exist, this will return an empty set ofpermissions, not a `NOT_FOUND` error.
*
Note: This operation is designed to be used for buildingpermission-aware UIs and command-line tools, not for authorizationchecking. This operation may "fail open" without warning.
*
* Request object method variants only take one parameter, a request object, which must be constructed before the call.
*
* testIamPermissions(TestIamPermissionsRequest request)
*
* Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
*
* testIamPermissionsCallable()
*
*
*
*
*
* See the individual methods for example code.
*
*
Many parameters require resource names to be formatted in a particular way. To assist with
* these names, this class includes a format method for each type of name, and additionally a parse
* method to extract the individual identifiers contained within names that are returned.
*
*
This class can be customized by passing in a custom instance of GenAiCacheServiceSettings to
* create(). For example:
*
*
To customize credentials:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* GenAiCacheServiceSettings genAiCacheServiceSettings =
* GenAiCacheServiceSettings.newBuilder()
* .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
* .build();
* GenAiCacheServiceClient genAiCacheServiceClient =
* GenAiCacheServiceClient.create(genAiCacheServiceSettings);
* }
*
* To customize the endpoint:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* GenAiCacheServiceSettings genAiCacheServiceSettings =
* GenAiCacheServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
* GenAiCacheServiceClient genAiCacheServiceClient =
* GenAiCacheServiceClient.create(genAiCacheServiceSettings);
* }
*
* Please refer to the GitHub repository's samples for more quickstart code snippets.
*/
@BetaApi
@Generated("by gapic-generator-java")
public class GenAiCacheServiceClient implements BackgroundResource {
private final GenAiCacheServiceSettings settings;
private final GenAiCacheServiceStub stub;
/** Constructs an instance of GenAiCacheServiceClient with default settings. */
public static final GenAiCacheServiceClient create() throws IOException {
return create(GenAiCacheServiceSettings.newBuilder().build());
}
/**
* Constructs an instance of GenAiCacheServiceClient, using the given settings. The channels are
* created based on the settings passed in, or defaults for any settings that are not set.
*/
public static final GenAiCacheServiceClient create(GenAiCacheServiceSettings settings)
throws IOException {
return new GenAiCacheServiceClient(settings);
}
/**
* Constructs an instance of GenAiCacheServiceClient, using the given stub for making calls. This
* is for advanced usage - prefer using create(GenAiCacheServiceSettings).
*/
public static final GenAiCacheServiceClient create(GenAiCacheServiceStub stub) {
return new GenAiCacheServiceClient(stub);
}
/**
* Constructs an instance of GenAiCacheServiceClient, using the given settings. This is protected
* so that it is easy to make a subclass, but otherwise, the static factory methods should be
* preferred.
*/
protected GenAiCacheServiceClient(GenAiCacheServiceSettings settings) throws IOException {
this.settings = settings;
this.stub = ((GenAiCacheServiceStubSettings) settings.getStubSettings()).createStub();
}
protected GenAiCacheServiceClient(GenAiCacheServiceStub stub) {
this.settings = null;
this.stub = stub;
}
public final GenAiCacheServiceSettings getSettings() {
return settings;
}
public GenAiCacheServiceStub getStub() {
return stub;
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates cached content, this call will initialize the cached content in the data storage, and
* users need to pay for the cache data storage.
*
*
Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
* CachedContent cachedContent = CachedContent.newBuilder().build();
* CachedContent response = genAiCacheServiceClient.createCachedContent(parent, cachedContent);
* }
* }
*
* @param parent Required. The parent resource where the cached content will be created
* @param cachedContent Required. The cached content to create
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final CachedContent createCachedContent(LocationName parent, CachedContent cachedContent) {
CreateCachedContentRequest request =
CreateCachedContentRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.setCachedContent(cachedContent)
.build();
return createCachedContent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates cached content, this call will initialize the cached content in the data storage, and
* users need to pay for the cache data storage.
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
* CachedContent cachedContent = CachedContent.newBuilder().build();
* CachedContent response = genAiCacheServiceClient.createCachedContent(parent, cachedContent);
* }
* }
*
* @param parent Required. The parent resource where the cached content will be created
* @param cachedContent Required. The cached content to create
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final CachedContent createCachedContent(String parent, CachedContent cachedContent) {
CreateCachedContentRequest request =
CreateCachedContentRequest.newBuilder()
.setParent(parent)
.setCachedContent(cachedContent)
.build();
return createCachedContent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates cached content, this call will initialize the cached content in the data storage, and
* users need to pay for the cache data storage.
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* CreateCachedContentRequest request =
* CreateCachedContentRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setCachedContent(CachedContent.newBuilder().build())
* .build();
* CachedContent response = genAiCacheServiceClient.createCachedContent(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final CachedContent createCachedContent(CreateCachedContentRequest request) {
return createCachedContentCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Creates cached content, this call will initialize the cached content in the data storage, and
* users need to pay for the cache data storage.
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* CreateCachedContentRequest request =
* CreateCachedContentRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setCachedContent(CachedContent.newBuilder().build())
* .build();
* ApiFuture future =
* genAiCacheServiceClient.createCachedContentCallable().futureCall(request);
* // Do something.
* CachedContent response = future.get();
* }
* }
*/
public final UnaryCallable
createCachedContentCallable() {
return stub.createCachedContentCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets cached content configurations
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* CachedContentName name = CachedContentName.of("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]");
* CachedContent response = genAiCacheServiceClient.getCachedContent(name);
* }
* }
*
* @param name Required. The resource name referring to the cached content
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final CachedContent getCachedContent(CachedContentName name) {
GetCachedContentRequest request =
GetCachedContentRequest.newBuilder().setName(name == null ? null : name.toString()).build();
return getCachedContent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets cached content configurations
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* String name = CachedContentName.of("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]").toString();
* CachedContent response = genAiCacheServiceClient.getCachedContent(name);
* }
* }
*
* @param name Required. The resource name referring to the cached content
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final CachedContent getCachedContent(String name) {
GetCachedContentRequest request = GetCachedContentRequest.newBuilder().setName(name).build();
return getCachedContent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets cached content configurations
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* GetCachedContentRequest request =
* GetCachedContentRequest.newBuilder()
* .setName(
* CachedContentName.of("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]").toString())
* .build();
* CachedContent response = genAiCacheServiceClient.getCachedContent(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final CachedContent getCachedContent(GetCachedContentRequest request) {
return getCachedContentCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets cached content configurations
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* GetCachedContentRequest request =
* GetCachedContentRequest.newBuilder()
* .setName(
* CachedContentName.of("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]").toString())
* .build();
* ApiFuture future =
* genAiCacheServiceClient.getCachedContentCallable().futureCall(request);
* // Do something.
* CachedContent response = future.get();
* }
* }
*/
public final UnaryCallable getCachedContentCallable() {
return stub.getCachedContentCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates cached content configurations
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* CachedContent cachedContent = CachedContent.newBuilder().build();
* FieldMask updateMask = FieldMask.newBuilder().build();
* CachedContent response =
* genAiCacheServiceClient.updateCachedContent(cachedContent, updateMask);
* }
* }
*
* @param cachedContent Required. The cached content to update
* @param updateMask Required. The list of fields to update.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final CachedContent updateCachedContent(
CachedContent cachedContent, FieldMask updateMask) {
UpdateCachedContentRequest request =
UpdateCachedContentRequest.newBuilder()
.setCachedContent(cachedContent)
.setUpdateMask(updateMask)
.build();
return updateCachedContent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates cached content configurations
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* UpdateCachedContentRequest request =
* UpdateCachedContentRequest.newBuilder()
* .setCachedContent(CachedContent.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* CachedContent response = genAiCacheServiceClient.updateCachedContent(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final CachedContent updateCachedContent(UpdateCachedContentRequest request) {
return updateCachedContentCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates cached content configurations
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* UpdateCachedContentRequest request =
* UpdateCachedContentRequest.newBuilder()
* .setCachedContent(CachedContent.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* ApiFuture future =
* genAiCacheServiceClient.updateCachedContentCallable().futureCall(request);
* // Do something.
* CachedContent response = future.get();
* }
* }
*/
public final UnaryCallable
updateCachedContentCallable() {
return stub.updateCachedContentCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes cached content
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* CachedContentName name = CachedContentName.of("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]");
* genAiCacheServiceClient.deleteCachedContent(name);
* }
* }
*
* @param name Required. The resource name referring to the cached content
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteCachedContent(CachedContentName name) {
DeleteCachedContentRequest request =
DeleteCachedContentRequest.newBuilder()
.setName(name == null ? null : name.toString())
.build();
deleteCachedContent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes cached content
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* String name = CachedContentName.of("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]").toString();
* genAiCacheServiceClient.deleteCachedContent(name);
* }
* }
*
* @param name Required. The resource name referring to the cached content
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteCachedContent(String name) {
DeleteCachedContentRequest request =
DeleteCachedContentRequest.newBuilder().setName(name).build();
deleteCachedContent(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes cached content
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* DeleteCachedContentRequest request =
* DeleteCachedContentRequest.newBuilder()
* .setName(
* CachedContentName.of("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]").toString())
* .build();
* genAiCacheServiceClient.deleteCachedContent(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final void deleteCachedContent(DeleteCachedContentRequest request) {
deleteCachedContentCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Deletes cached content
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* DeleteCachedContentRequest request =
* DeleteCachedContentRequest.newBuilder()
* .setName(
* CachedContentName.of("[PROJECT]", "[LOCATION]", "[CACHED_CONTENT]").toString())
* .build();
* ApiFuture future =
* genAiCacheServiceClient.deleteCachedContentCallable().futureCall(request);
* // Do something.
* future.get();
* }
* }
*/
public final UnaryCallable deleteCachedContentCallable() {
return stub.deleteCachedContentCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists cached contents in a project
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
* for (CachedContent element :
* genAiCacheServiceClient.listCachedContents(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The parent, which owns this collection of cached contents.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListCachedContentsPagedResponse listCachedContents(LocationName parent) {
ListCachedContentsRequest request =
ListCachedContentsRequest.newBuilder()
.setParent(parent == null ? null : parent.toString())
.build();
return listCachedContents(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists cached contents in a project
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
* for (CachedContent element :
* genAiCacheServiceClient.listCachedContents(parent).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param parent Required. The parent, which owns this collection of cached contents.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListCachedContentsPagedResponse listCachedContents(String parent) {
ListCachedContentsRequest request =
ListCachedContentsRequest.newBuilder().setParent(parent).build();
return listCachedContents(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists cached contents in a project
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* ListCachedContentsRequest request =
* ListCachedContentsRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* for (CachedContent element :
* genAiCacheServiceClient.listCachedContents(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListCachedContentsPagedResponse listCachedContents(
ListCachedContentsRequest request) {
return listCachedContentsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists cached contents in a project
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* ListCachedContentsRequest request =
* ListCachedContentsRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture future =
* genAiCacheServiceClient.listCachedContentsPagedCallable().futureCall(request);
* // Do something.
* for (CachedContent element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listCachedContentsPagedCallable() {
return stub.listCachedContentsPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists cached contents in a project
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* ListCachedContentsRequest request =
* ListCachedContentsRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* while (true) {
* ListCachedContentsResponse response =
* genAiCacheServiceClient.listCachedContentsCallable().call(request);
* for (CachedContent element : response.getCachedContentsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }
*/
public final UnaryCallable
listCachedContentsCallable() {
return stub.listCachedContentsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* ListLocationsRequest request =
* ListLocationsRequest.newBuilder()
* .setName("name3373707")
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* for (Location element : genAiCacheServiceClient.listLocations(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final ListLocationsPagedResponse listLocations(ListLocationsRequest request) {
return listLocationsPagedCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* ListLocationsRequest request =
* ListLocationsRequest.newBuilder()
* .setName("name3373707")
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* ApiFuture future =
* genAiCacheServiceClient.listLocationsPagedCallable().futureCall(request);
* // Do something.
* for (Location element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* }
*/
public final UnaryCallable
listLocationsPagedCallable() {
return stub.listLocationsPagedCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* ListLocationsRequest request =
* ListLocationsRequest.newBuilder()
* .setName("name3373707")
* .setFilter("filter-1274492040")
* .setPageSize(883849137)
* .setPageToken("pageToken873572522")
* .build();
* while (true) {
* ListLocationsResponse response =
* genAiCacheServiceClient.listLocationsCallable().call(request);
* for (Location element : response.getLocationsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* }
*/
public final UnaryCallable listLocationsCallable() {
return stub.listLocationsCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets information about a location.
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
* Location response = genAiCacheServiceClient.getLocation(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Location getLocation(GetLocationRequest request) {
return getLocationCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets information about a location.
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
* ApiFuture future =
* genAiCacheServiceClient.getLocationCallable().futureCall(request);
* // Do something.
* Location response = future.get();
* }
* }
*/
public final UnaryCallable getLocationCallable() {
return stub.getLocationCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Sets the access control policy on the specified resource. Replacesany existing policy.
*
* Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
*
*
Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* SetIamPolicyRequest request =
* SetIamPolicyRequest.newBuilder()
* .setResource(
* EndpointName.ofProjectLocationEndpointName(
* "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
* .toString())
* .setPolicy(Policy.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* Policy response = genAiCacheServiceClient.setIamPolicy(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Policy setIamPolicy(SetIamPolicyRequest request) {
return setIamPolicyCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Sets the access control policy on the specified resource. Replacesany existing policy.
*
* Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`errors.
*
*
Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* SetIamPolicyRequest request =
* SetIamPolicyRequest.newBuilder()
* .setResource(
* EndpointName.ofProjectLocationEndpointName(
* "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
* .toString())
* .setPolicy(Policy.newBuilder().build())
* .setUpdateMask(FieldMask.newBuilder().build())
* .build();
* ApiFuture future = genAiCacheServiceClient.setIamPolicyCallable().futureCall(request);
* // Do something.
* Policy response = future.get();
* }
* }
*/
public final UnaryCallable setIamPolicyCallable() {
return stub.setIamPolicyCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets the access control policy for a resource. Returns an empty policyif the resource exists
* and does not have a policy set.
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* GetIamPolicyRequest request =
* GetIamPolicyRequest.newBuilder()
* .setResource(
* EndpointName.ofProjectLocationEndpointName(
* "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
* .toString())
* .setOptions(GetPolicyOptions.newBuilder().build())
* .build();
* Policy response = genAiCacheServiceClient.getIamPolicy(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final Policy getIamPolicy(GetIamPolicyRequest request) {
return getIamPolicyCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Gets the access control policy for a resource. Returns an empty policyif the resource exists
* and does not have a policy set.
*
* Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* GetIamPolicyRequest request =
* GetIamPolicyRequest.newBuilder()
* .setResource(
* EndpointName.ofProjectLocationEndpointName(
* "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
* .toString())
* .setOptions(GetPolicyOptions.newBuilder().build())
* .build();
* ApiFuture future = genAiCacheServiceClient.getIamPolicyCallable().futureCall(request);
* // Do something.
* Policy response = future.get();
* }
* }
*/
public final UnaryCallable getIamPolicyCallable() {
return stub.getIamPolicyCallable();
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns permissions that a caller has on the specified resource. If theresource does not exist,
* this will return an empty set ofpermissions, not a `NOT_FOUND` error.
*
* Note: This operation is designed to be used for buildingpermission-aware UIs and
* command-line tools, not for authorizationchecking. This operation may "fail open" without
* warning.
*
*
Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* TestIamPermissionsRequest request =
* TestIamPermissionsRequest.newBuilder()
* .setResource(
* EndpointName.ofProjectLocationEndpointName(
* "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
* .toString())
* .addAllPermissions(new ArrayList())
* .build();
* TestIamPermissionsResponse response = genAiCacheServiceClient.testIamPermissions(request);
* }
* }
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final TestIamPermissionsResponse testIamPermissions(TestIamPermissionsRequest request) {
return testIamPermissionsCallable().call(request);
}
// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns permissions that a caller has on the specified resource. If theresource does not exist,
* this will return an empty set ofpermissions, not a `NOT_FOUND` error.
*
* Note: This operation is designed to be used for buildingpermission-aware UIs and
* command-line tools, not for authorizationchecking. This operation may "fail open" without
* warning.
*
*
Sample code:
*
*
{@code
* // 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/java/docs/setup#configure_endpoints_for_the_client_library
* try (GenAiCacheServiceClient genAiCacheServiceClient = GenAiCacheServiceClient.create()) {
* TestIamPermissionsRequest request =
* TestIamPermissionsRequest.newBuilder()
* .setResource(
* EndpointName.ofProjectLocationEndpointName(
* "[PROJECT]", "[LOCATION]", "[ENDPOINT]")
* .toString())
* .addAllPermissions(new ArrayList())
* .build();
* ApiFuture future =
* genAiCacheServiceClient.testIamPermissionsCallable().futureCall(request);
* // Do something.
* TestIamPermissionsResponse response = future.get();
* }
* }
*/
public final UnaryCallable
testIamPermissionsCallable() {
return stub.testIamPermissionsCallable();
}
@Override
public final void close() {
stub.close();
}
@Override
public void shutdown() {
stub.shutdown();
}
@Override
public boolean isShutdown() {
return stub.isShutdown();
}
@Override
public boolean isTerminated() {
return stub.isTerminated();
}
@Override
public void shutdownNow() {
stub.shutdownNow();
}
@Override
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
return stub.awaitTermination(duration, unit);
}
public static class ListCachedContentsPagedResponse
extends AbstractPagedListResponse<
ListCachedContentsRequest,
ListCachedContentsResponse,
CachedContent,
ListCachedContentsPage,
ListCachedContentsFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListCachedContentsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListCachedContentsPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListCachedContentsPagedResponse(ListCachedContentsPage page) {
super(page, ListCachedContentsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListCachedContentsPage
extends AbstractPage<
ListCachedContentsRequest,
ListCachedContentsResponse,
CachedContent,
ListCachedContentsPage> {
private ListCachedContentsPage(
PageContext context,
ListCachedContentsResponse response) {
super(context, response);
}
private static ListCachedContentsPage createEmptyPage() {
return new ListCachedContentsPage(null, null);
}
@Override
protected ListCachedContentsPage createPage(
PageContext context,
ListCachedContentsResponse response) {
return new ListCachedContentsPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListCachedContentsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListCachedContentsRequest,
ListCachedContentsResponse,
CachedContent,
ListCachedContentsPage,
ListCachedContentsFixedSizeCollection> {
private ListCachedContentsFixedSizeCollection(
List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListCachedContentsFixedSizeCollection createEmptyCollection() {
return new ListCachedContentsFixedSizeCollection(null, 0);
}
@Override
protected ListCachedContentsFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListCachedContentsFixedSizeCollection(pages, collectionSize);
}
}
public static class ListLocationsPagedResponse
extends AbstractPagedListResponse<
ListLocationsRequest,
ListLocationsResponse,
Location,
ListLocationsPage,
ListLocationsFixedSizeCollection> {
public static ApiFuture createAsync(
PageContext context,
ApiFuture futureResponse) {
ApiFuture futurePage =
ListLocationsPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
input -> new ListLocationsPagedResponse(input),
MoreExecutors.directExecutor());
}
private ListLocationsPagedResponse(ListLocationsPage page) {
super(page, ListLocationsFixedSizeCollection.createEmptyCollection());
}
}
public static class ListLocationsPage
extends AbstractPage<
ListLocationsRequest, ListLocationsResponse, Location, ListLocationsPage> {
private ListLocationsPage(
PageContext context,
ListLocationsResponse response) {
super(context, response);
}
private static ListLocationsPage createEmptyPage() {
return new ListLocationsPage(null, null);
}
@Override
protected ListLocationsPage createPage(
PageContext context,
ListLocationsResponse response) {
return new ListLocationsPage(context, response);
}
@Override
public ApiFuture createPageAsync(
PageContext context,
ApiFuture futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}
public static class ListLocationsFixedSizeCollection
extends AbstractFixedSizeCollection<
ListLocationsRequest,
ListLocationsResponse,
Location,
ListLocationsPage,
ListLocationsFixedSizeCollection> {
private ListLocationsFixedSizeCollection(List pages, int collectionSize) {
super(pages, collectionSize);
}
private static ListLocationsFixedSizeCollection createEmptyCollection() {
return new ListLocationsFixedSizeCollection(null, 0);
}
@Override
protected ListLocationsFixedSizeCollection createCollection(
List pages, int collectionSize) {
return new ListLocationsFixedSizeCollection(pages, collectionSize);
}
}
}