@Generated(value="by gapic-generator-java") public class CloudRedisClient extends Object implements com.google.api.gax.core.BackgroundResource
Google Cloud Memorystore for Redis v1
The `redis.googleapis.com` service implements the Google Cloud Memorystore for Redis API and defines the following resource model for managing Redis instances:
Note that location_id must be referring to a GCP `region`; for example:
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:
// 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
Instance response = cloudRedisClient.getInstance(name);
}
Note: close() needs to be called on the CloudRedisClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().
| Method | Description | Method Variants |
|---|---|---|
ListInstances |
Lists all Redis instances owned by a project in either the specified location (region) or all locations. The location should have the following format:
If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetInstance |
Gets the details of a specific Redis instance. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetInstanceAuthString |
Gets the AUTH string for a Redis instance. If AUTH is not enabled for the instance the response will be empty. This information is not included in the details returned to GetInstance. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
CreateInstance |
Creates a Redis instance based on the specified tier and memory size. By default, the instance is accessible from the project's [default network](https://cloud.google.com/vpc/docs/vpc). The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis instance will be fully functional. Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpdateInstance |
Updates the metadata and configuration of a specific Redis instance. Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
UpgradeInstance |
Upgrades Redis instance to the newer Redis version specified in the request. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ImportInstance |
Import a Redis RDB snapshot file from Cloud Storage into a Redis instance. Redis may stop serving during this operation. Instance state will be IMPORTING for entire operation. When complete, the instance will contain only data from the imported file. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
ExportInstance |
Export Redis instance data into a Redis RDB format file in Cloud Storage. Redis will continue serving during this operation. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
FailoverInstance |
Initiates a failover of the primary node to current replica node for a specific STANDARD tier Cloud Memorystore for Redis instance. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
DeleteInstance |
Deletes a specific Redis instance. Instance stops serving and data is deleted. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
RescheduleMaintenance |
Reschedule maintenance for a given instance in a given project and location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Methods that return long-running operations have "Async" method variants that return `OperationFuture`, which is used to track polling of the service.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
GetLocation |
Gets information about a location. |
Request object method variants only take one parameter, a request object, which must be constructed before the call.
Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.
|
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 CloudRedisSettings to create(). For example:
To customize credentials:
// 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
CloudRedisSettings cloudRedisSettings =
CloudRedisSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
CloudRedisClient cloudRedisClient = CloudRedisClient.create(cloudRedisSettings);
To customize the endpoint:
// 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
CloudRedisSettings cloudRedisSettings =
CloudRedisSettings.newBuilder().setEndpoint(myEndpoint).build();
CloudRedisClient cloudRedisClient = CloudRedisClient.create(cloudRedisSettings);
To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over the wire:
// 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
CloudRedisSettings cloudRedisSettings = CloudRedisSettings.newHttpJsonBuilder().build();
CloudRedisClient cloudRedisClient = CloudRedisClient.create(cloudRedisSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
| Modifier and Type | Class and Description |
|---|---|
static class |
CloudRedisClient.ListInstancesFixedSizeCollection |
static class |
CloudRedisClient.ListInstancesPage |
static class |
CloudRedisClient.ListInstancesPagedResponse |
static class |
CloudRedisClient.ListLocationsFixedSizeCollection |
static class |
CloudRedisClient.ListLocationsPage |
static class |
CloudRedisClient.ListLocationsPagedResponse |
| Modifier | Constructor and Description |
|---|---|
protected |
CloudRedisClient(CloudRedisSettings settings)
Constructs an instance of CloudRedisClient, using the given settings.
|
protected |
CloudRedisClient(CloudRedisStub stub) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
awaitTermination(long duration,
TimeUnit unit) |
void |
close() |
static CloudRedisClient |
create()
Constructs an instance of CloudRedisClient with default settings.
|
static CloudRedisClient |
create(CloudRedisSettings settings)
Constructs an instance of CloudRedisClient, using the given settings.
|
static CloudRedisClient |
create(CloudRedisStub stub)
Constructs an instance of CloudRedisClient, using the given stub for making calls.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
createInstanceAsync(CreateInstanceRequest request)
Creates a Redis instance based on the specified tier and memory size.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
createInstanceAsync(LocationName parent,
String instanceId,
Instance instance)
Creates a Redis instance based on the specified tier and memory size.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
createInstanceAsync(String parent,
String instanceId,
Instance instance)
Creates a Redis instance based on the specified tier and memory size.
|
com.google.api.gax.rpc.UnaryCallable<CreateInstanceRequest,com.google.longrunning.Operation> |
createInstanceCallable()
Creates a Redis instance based on the specified tier and memory size.
|
com.google.api.gax.rpc.OperationCallable<CreateInstanceRequest,Instance,OperationMetadata> |
createInstanceOperationCallable()
Creates a Redis instance based on the specified tier and memory size.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deleteInstanceAsync(DeleteInstanceRequest request)
Deletes a specific Redis instance.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deleteInstanceAsync(InstanceName name)
Deletes a specific Redis instance.
|
com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> |
deleteInstanceAsync(String name)
Deletes a specific Redis instance.
|
com.google.api.gax.rpc.UnaryCallable<DeleteInstanceRequest,com.google.longrunning.Operation> |
deleteInstanceCallable()
Deletes a specific Redis instance.
|
com.google.api.gax.rpc.OperationCallable<DeleteInstanceRequest,com.google.protobuf.Empty,OperationMetadata> |
deleteInstanceOperationCallable()
Deletes a specific Redis instance.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
exportInstanceAsync(ExportInstanceRequest request)
Export Redis instance data into a Redis RDB format file in Cloud Storage.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
exportInstanceAsync(String name,
OutputConfig outputConfig)
Export Redis instance data into a Redis RDB format file in Cloud Storage.
|
com.google.api.gax.rpc.UnaryCallable<ExportInstanceRequest,com.google.longrunning.Operation> |
exportInstanceCallable()
Export Redis instance data into a Redis RDB format file in Cloud Storage.
|
com.google.api.gax.rpc.OperationCallable<ExportInstanceRequest,Instance,OperationMetadata> |
exportInstanceOperationCallable()
Export Redis instance data into a Redis RDB format file in Cloud Storage.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
failoverInstanceAsync(FailoverInstanceRequest request)
Initiates a failover of the primary node to current replica node for a specific STANDARD tier
Cloud Memorystore for Redis instance.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
failoverInstanceAsync(InstanceName name,
FailoverInstanceRequest.DataProtectionMode dataProtectionMode)
Initiates a failover of the primary node to current replica node for a specific STANDARD tier
Cloud Memorystore for Redis instance.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
failoverInstanceAsync(String name,
FailoverInstanceRequest.DataProtectionMode dataProtectionMode)
Initiates a failover of the primary node to current replica node for a specific STANDARD tier
Cloud Memorystore for Redis instance.
|
com.google.api.gax.rpc.UnaryCallable<FailoverInstanceRequest,com.google.longrunning.Operation> |
failoverInstanceCallable()
Initiates a failover of the primary node to current replica node for a specific STANDARD tier
Cloud Memorystore for Redis instance.
|
com.google.api.gax.rpc.OperationCallable<FailoverInstanceRequest,Instance,OperationMetadata> |
failoverInstanceOperationCallable()
Initiates a failover of the primary node to current replica node for a specific STANDARD tier
Cloud Memorystore for Redis instance.
|
com.google.api.gax.httpjson.longrunning.OperationsClient |
getHttpJsonOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
Instance |
getInstance(GetInstanceRequest request)
Gets the details of a specific Redis instance.
|
Instance |
getInstance(InstanceName name)
Gets the details of a specific Redis instance.
|
Instance |
getInstance(String name)
Gets the details of a specific Redis instance.
|
InstanceAuthString |
getInstanceAuthString(GetInstanceAuthStringRequest request)
Gets the AUTH string for a Redis instance.
|
InstanceAuthString |
getInstanceAuthString(InstanceName name)
Gets the AUTH string for a Redis instance.
|
InstanceAuthString |
getInstanceAuthString(String name)
Gets the AUTH string for a Redis instance.
|
com.google.api.gax.rpc.UnaryCallable<GetInstanceAuthStringRequest,InstanceAuthString> |
getInstanceAuthStringCallable()
Gets the AUTH string for a Redis instance.
|
com.google.api.gax.rpc.UnaryCallable<GetInstanceRequest,Instance> |
getInstanceCallable()
Gets the details of a specific Redis instance.
|
com.google.cloud.location.Location |
getLocation(com.google.cloud.location.GetLocationRequest request)
Gets information about a location.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
getLocationCallable()
Gets information about a location.
|
com.google.longrunning.OperationsClient |
getOperationsClient()
Returns the OperationsClient that can be used to query the status of a long-running operation
returned by another API method call.
|
CloudRedisSettings |
getSettings() |
CloudRedisStub |
getStub() |
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
importInstanceAsync(ImportInstanceRequest request)
Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
importInstanceAsync(String name,
InputConfig inputConfig)
Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
|
com.google.api.gax.rpc.UnaryCallable<ImportInstanceRequest,com.google.longrunning.Operation> |
importInstanceCallable()
Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
|
com.google.api.gax.rpc.OperationCallable<ImportInstanceRequest,Instance,OperationMetadata> |
importInstanceOperationCallable()
Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.
|
boolean |
isShutdown() |
boolean |
isTerminated() |
CloudRedisClient.ListInstancesPagedResponse |
listInstances(ListInstancesRequest request)
Lists all Redis instances owned by a project in either the specified location (region) or all
locations.
|
CloudRedisClient.ListInstancesPagedResponse |
listInstances(LocationName parent)
Lists all Redis instances owned by a project in either the specified location (region) or all
locations.
|
CloudRedisClient.ListInstancesPagedResponse |
listInstances(String parent)
Lists all Redis instances owned by a project in either the specified location (region) or all
locations.
|
com.google.api.gax.rpc.UnaryCallable<ListInstancesRequest,ListInstancesResponse> |
listInstancesCallable()
Lists all Redis instances owned by a project in either the specified location (region) or all
locations.
|
com.google.api.gax.rpc.UnaryCallable<ListInstancesRequest,CloudRedisClient.ListInstancesPagedResponse> |
listInstancesPagedCallable()
Lists all Redis instances owned by a project in either the specified location (region) or all
locations.
|
CloudRedisClient.ListLocationsPagedResponse |
listLocations(com.google.cloud.location.ListLocationsRequest request)
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
listLocationsCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,CloudRedisClient.ListLocationsPagedResponse> |
listLocationsPagedCallable()
Lists information about the supported locations for this service.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
rescheduleMaintenanceAsync(InstanceName name,
RescheduleMaintenanceRequest.RescheduleType rescheduleType,
com.google.protobuf.Timestamp scheduleTime)
Reschedule maintenance for a given instance in a given project and location.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
rescheduleMaintenanceAsync(RescheduleMaintenanceRequest request)
Reschedule maintenance for a given instance in a given project and location.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
rescheduleMaintenanceAsync(String name,
RescheduleMaintenanceRequest.RescheduleType rescheduleType,
com.google.protobuf.Timestamp scheduleTime)
Reschedule maintenance for a given instance in a given project and location.
|
com.google.api.gax.rpc.UnaryCallable<RescheduleMaintenanceRequest,com.google.longrunning.Operation> |
rescheduleMaintenanceCallable()
Reschedule maintenance for a given instance in a given project and location.
|
com.google.api.gax.rpc.OperationCallable<RescheduleMaintenanceRequest,Instance,OperationMetadata> |
rescheduleMaintenanceOperationCallable()
Reschedule maintenance for a given instance in a given project and location.
|
void |
shutdown() |
void |
shutdownNow() |
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
updateInstanceAsync(com.google.protobuf.FieldMask updateMask,
Instance instance)
Updates the metadata and configuration of a specific Redis instance.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
updateInstanceAsync(UpdateInstanceRequest request)
Updates the metadata and configuration of a specific Redis instance.
|
com.google.api.gax.rpc.UnaryCallable<UpdateInstanceRequest,com.google.longrunning.Operation> |
updateInstanceCallable()
Updates the metadata and configuration of a specific Redis instance.
|
com.google.api.gax.rpc.OperationCallable<UpdateInstanceRequest,Instance,OperationMetadata> |
updateInstanceOperationCallable()
Updates the metadata and configuration of a specific Redis instance.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
upgradeInstanceAsync(InstanceName name,
String redisVersion)
Upgrades Redis instance to the newer Redis version specified in the request.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
upgradeInstanceAsync(String name,
String redisVersion)
Upgrades Redis instance to the newer Redis version specified in the request.
|
com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> |
upgradeInstanceAsync(UpgradeInstanceRequest request)
Upgrades Redis instance to the newer Redis version specified in the request.
|
com.google.api.gax.rpc.UnaryCallable<UpgradeInstanceRequest,com.google.longrunning.Operation> |
upgradeInstanceCallable()
Upgrades Redis instance to the newer Redis version specified in the request.
|
com.google.api.gax.rpc.OperationCallable<UpgradeInstanceRequest,Instance,OperationMetadata> |
upgradeInstanceOperationCallable()
Upgrades Redis instance to the newer Redis version specified in the request.
|
protected CloudRedisClient(CloudRedisSettings settings) throws IOException
IOExceptionprotected CloudRedisClient(CloudRedisStub stub)
public static final CloudRedisClient create() throws IOException
IOExceptionpublic static final CloudRedisClient create(CloudRedisSettings settings) throws IOException
IOExceptionpublic static final CloudRedisClient create(CloudRedisStub stub)
public final CloudRedisSettings getSettings()
public CloudRedisStub getStub()
public final com.google.longrunning.OperationsClient getOperationsClient()
@BetaApi public final com.google.api.gax.httpjson.longrunning.OperationsClient getHttpJsonOperationsClient()
public final CloudRedisClient.ListInstancesPagedResponse listInstances(LocationName parent)
The location should have the following format:
If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
for (Instance element : cloudRedisClient.listInstances(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The resource name of the instance location using the form:
`projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.com.google.api.gax.rpc.ApiException - if the remote call failspublic final CloudRedisClient.ListInstancesPagedResponse listInstances(String parent)
The location should have the following format:
If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
for (Instance element : cloudRedisClient.listInstances(parent).iterateAll()) {
// doThingsWith(element);
}
}
parent - Required. The resource name of the instance location using the form:
`projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.com.google.api.gax.rpc.ApiException - if the remote call failspublic final CloudRedisClient.ListInstancesPagedResponse listInstances(ListInstancesRequest request)
The location should have the following format:
If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
ListInstancesRequest request =
ListInstancesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Instance element : cloudRedisClient.listInstances(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<ListInstancesRequest,CloudRedisClient.ListInstancesPagedResponse> listInstancesPagedCallable()
The location should have the following format:
If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
ListInstancesRequest request =
ListInstancesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Instance> future =
cloudRedisClient.listInstancesPagedCallable().futureCall(request);
// Do something.
for (Instance element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<ListInstancesRequest,ListInstancesResponse> listInstancesCallable()
The location should have the following format:
If `location_id` is specified as `-` (wildcard), then all regions available to the project are queried, and the results are aggregated.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
ListInstancesRequest request =
ListInstancesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListInstancesResponse response = cloudRedisClient.listInstancesCallable().call(request);
for (Instance element : response.getInstancesList()) {
// doThingsWith(element);
}
String nextPageToken = response.getNextPageToken();
if (!Strings.isNullOrEmpty(nextPageToken)) {
request = request.toBuilder().setPageToken(nextPageToken).build();
} else {
break;
}
}
}
public final Instance getInstance(InstanceName name)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
Instance response = cloudRedisClient.getInstance(name);
}
name - Required. Redis instance resource name using the form:
`projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
refers to a GCP region.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Instance getInstance(String name)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
Instance response = cloudRedisClient.getInstance(name);
}
name - Required. Redis instance resource name using the form:
`projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
refers to a GCP region.com.google.api.gax.rpc.ApiException - if the remote call failspublic final Instance getInstance(GetInstanceRequest request)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
GetInstanceRequest request =
GetInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.build();
Instance response = cloudRedisClient.getInstance(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetInstanceRequest,Instance> getInstanceCallable()
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
GetInstanceRequest request =
GetInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.build();
ApiFuture<Instance> future = cloudRedisClient.getInstanceCallable().futureCall(request);
// Do something.
Instance response = future.get();
}
public final InstanceAuthString getInstanceAuthString(InstanceName name)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
InstanceAuthString response = cloudRedisClient.getInstanceAuthString(name);
}
name - Required. Redis instance resource name using the form:
`projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
refers to a GCP region.com.google.api.gax.rpc.ApiException - if the remote call failspublic final InstanceAuthString getInstanceAuthString(String name)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
InstanceAuthString response = cloudRedisClient.getInstanceAuthString(name);
}
name - Required. Redis instance resource name using the form:
`projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
refers to a GCP region.com.google.api.gax.rpc.ApiException - if the remote call failspublic final InstanceAuthString getInstanceAuthString(GetInstanceAuthStringRequest request)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
GetInstanceAuthStringRequest request =
GetInstanceAuthStringRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.build();
InstanceAuthString response = cloudRedisClient.getInstanceAuthString(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<GetInstanceAuthStringRequest,InstanceAuthString> getInstanceAuthStringCallable()
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
GetInstanceAuthStringRequest request =
GetInstanceAuthStringRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.build();
ApiFuture<InstanceAuthString> future =
cloudRedisClient.getInstanceAuthStringCallable().futureCall(request);
// Do something.
InstanceAuthString response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> createInstanceAsync(LocationName parent, String instanceId, Instance instance)
By default, the instance is accessible from the project's [default network](https://cloud.google.com/vpc/docs/vpc).
The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis instance will be fully functional. Completed longrunning.Operation will contain the new instance object in the response field.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
String instanceId = "instanceId902024336";
Instance instance = Instance.newBuilder().build();
Instance response = cloudRedisClient.createInstanceAsync(parent, instanceId, instance).get();
}
parent - Required. The resource name of the instance location using the form:
`projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.instanceId - Required. The logical name of the Redis instance in the customer project with
the following restrictions:
instance - Required. A Redis [Instance] resourcecom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> createInstanceAsync(String parent, String instanceId, Instance instance)
By default, the instance is accessible from the project's [default network](https://cloud.google.com/vpc/docs/vpc).
The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis instance will be fully functional. Completed longrunning.Operation will contain the new instance object in the response field.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
String instanceId = "instanceId902024336";
Instance instance = Instance.newBuilder().build();
Instance response = cloudRedisClient.createInstanceAsync(parent, instanceId, instance).get();
}
parent - Required. The resource name of the instance location using the form:
`projects/{project_id}/locations/{location_id}` where `location_id` refers to a GCP region.instanceId - Required. The logical name of the Redis instance in the customer project with
the following restrictions:
instance - Required. A Redis [Instance] resourcecom.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> createInstanceAsync(CreateInstanceRequest request)
By default, the instance is accessible from the project's [default network](https://cloud.google.com/vpc/docs/vpc).
The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis instance will be fully functional. Completed longrunning.Operation will contain the new instance object in the response field.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
CreateInstanceRequest request =
CreateInstanceRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setInstanceId("instanceId902024336")
.setInstance(Instance.newBuilder().build())
.build();
Instance response = cloudRedisClient.createInstanceAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<CreateInstanceRequest,Instance,OperationMetadata> createInstanceOperationCallable()
By default, the instance is accessible from the project's [default network](https://cloud.google.com/vpc/docs/vpc).
The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis instance will be fully functional. Completed longrunning.Operation will contain the new instance object in the response field.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
CreateInstanceRequest request =
CreateInstanceRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setInstanceId("instanceId902024336")
.setInstance(Instance.newBuilder().build())
.build();
OperationFuture<Instance, OperationMetadata> future =
cloudRedisClient.createInstanceOperationCallable().futureCall(request);
// Do something.
Instance response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<CreateInstanceRequest,com.google.longrunning.Operation> createInstanceCallable()
By default, the instance is accessible from the project's [default network](https://cloud.google.com/vpc/docs/vpc).
The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis instance will be fully functional. Completed longrunning.Operation will contain the new instance object in the response field.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
CreateInstanceRequest request =
CreateInstanceRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
.setInstanceId("instanceId902024336")
.setInstance(Instance.newBuilder().build())
.build();
ApiFuture<Operation> future = cloudRedisClient.createInstanceCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> updateInstanceAsync(com.google.protobuf.FieldMask updateMask, Instance instance)
Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
FieldMask updateMask = FieldMask.newBuilder().build();
Instance instance = Instance.newBuilder().build();
Instance response = cloudRedisClient.updateInstanceAsync(updateMask, instance).get();
}
updateMask - Required. Mask of fields to update. At least one path must be supplied in
this field. The elements of the repeated paths field may only include these fields from
[Instance][google.cloud.redis.v1.Instance]:
* `displayName` * `labels` * `memorySizeGb` * `redisConfig` * `replica_count`
instance - Required. Update description. Only fields specified in update_mask are updated.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> updateInstanceAsync(UpdateInstanceRequest request)
Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
UpdateInstanceRequest request =
UpdateInstanceRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setInstance(Instance.newBuilder().build())
.build();
Instance response = cloudRedisClient.updateInstanceAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpdateInstanceRequest,Instance,OperationMetadata> updateInstanceOperationCallable()
Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
UpdateInstanceRequest request =
UpdateInstanceRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setInstance(Instance.newBuilder().build())
.build();
OperationFuture<Instance, OperationMetadata> future =
cloudRedisClient.updateInstanceOperationCallable().futureCall(request);
// Do something.
Instance response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UpdateInstanceRequest,com.google.longrunning.Operation> updateInstanceCallable()
Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
UpdateInstanceRequest request =
UpdateInstanceRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setInstance(Instance.newBuilder().build())
.build();
ApiFuture<Operation> future = cloudRedisClient.updateInstanceCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> upgradeInstanceAsync(InstanceName name, String redisVersion)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
String redisVersion = "redisVersion-1972584739";
Instance response = cloudRedisClient.upgradeInstanceAsync(name, redisVersion).get();
}
name - Required. Redis instance resource name using the form:
`projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
refers to a GCP region.redisVersion - Required. Specifies the target version of Redis software to upgrade to.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> upgradeInstanceAsync(String name, String redisVersion)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
String redisVersion = "redisVersion-1972584739";
Instance response = cloudRedisClient.upgradeInstanceAsync(name, redisVersion).get();
}
name - Required. Redis instance resource name using the form:
`projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
refers to a GCP region.redisVersion - Required. Specifies the target version of Redis software to upgrade to.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> upgradeInstanceAsync(UpgradeInstanceRequest request)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
UpgradeInstanceRequest request =
UpgradeInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.setRedisVersion("redisVersion-1972584739")
.build();
Instance response = cloudRedisClient.upgradeInstanceAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<UpgradeInstanceRequest,Instance,OperationMetadata> upgradeInstanceOperationCallable()
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
UpgradeInstanceRequest request =
UpgradeInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.setRedisVersion("redisVersion-1972584739")
.build();
OperationFuture<Instance, OperationMetadata> future =
cloudRedisClient.upgradeInstanceOperationCallable().futureCall(request);
// Do something.
Instance response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<UpgradeInstanceRequest,com.google.longrunning.Operation> upgradeInstanceCallable()
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
UpgradeInstanceRequest request =
UpgradeInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.setRedisVersion("redisVersion-1972584739")
.build();
ApiFuture<Operation> future = cloudRedisClient.upgradeInstanceCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> importInstanceAsync(String name, InputConfig inputConfig)
Redis may stop serving during this operation. Instance state will be IMPORTING for entire operation. When complete, the instance will contain only data from the imported file.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
String name = "name3373707";
InputConfig inputConfig = InputConfig.newBuilder().build();
Instance response = cloudRedisClient.importInstanceAsync(name, inputConfig).get();
}
name - Required. Redis instance resource name using the form:
`projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
refers to a GCP region.inputConfig - Required. Specify data to be imported.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> importInstanceAsync(ImportInstanceRequest request)
Redis may stop serving during this operation. Instance state will be IMPORTING for entire operation. When complete, the instance will contain only data from the imported file.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
ImportInstanceRequest request =
ImportInstanceRequest.newBuilder()
.setName("name3373707")
.setInputConfig(InputConfig.newBuilder().build())
.build();
Instance response = cloudRedisClient.importInstanceAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<ImportInstanceRequest,Instance,OperationMetadata> importInstanceOperationCallable()
Redis may stop serving during this operation. Instance state will be IMPORTING for entire operation. When complete, the instance will contain only data from the imported file.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
ImportInstanceRequest request =
ImportInstanceRequest.newBuilder()
.setName("name3373707")
.setInputConfig(InputConfig.newBuilder().build())
.build();
OperationFuture<Instance, OperationMetadata> future =
cloudRedisClient.importInstanceOperationCallable().futureCall(request);
// Do something.
Instance response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<ImportInstanceRequest,com.google.longrunning.Operation> importInstanceCallable()
Redis may stop serving during this operation. Instance state will be IMPORTING for entire operation. When complete, the instance will contain only data from the imported file.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
ImportInstanceRequest request =
ImportInstanceRequest.newBuilder()
.setName("name3373707")
.setInputConfig(InputConfig.newBuilder().build())
.build();
ApiFuture<Operation> future = cloudRedisClient.importInstanceCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> exportInstanceAsync(String name, OutputConfig outputConfig)
Redis will continue serving during this operation.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
String name = "name3373707";
OutputConfig outputConfig = OutputConfig.newBuilder().build();
Instance response = cloudRedisClient.exportInstanceAsync(name, outputConfig).get();
}
name - Required. Redis instance resource name using the form:
`projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
refers to a GCP region.outputConfig - Required. Specify data to be exported.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> exportInstanceAsync(ExportInstanceRequest request)
Redis will continue serving during this operation.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
ExportInstanceRequest request =
ExportInstanceRequest.newBuilder()
.setName("name3373707")
.setOutputConfig(OutputConfig.newBuilder().build())
.build();
Instance response = cloudRedisClient.exportInstanceAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<ExportInstanceRequest,Instance,OperationMetadata> exportInstanceOperationCallable()
Redis will continue serving during this operation.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
ExportInstanceRequest request =
ExportInstanceRequest.newBuilder()
.setName("name3373707")
.setOutputConfig(OutputConfig.newBuilder().build())
.build();
OperationFuture<Instance, OperationMetadata> future =
cloudRedisClient.exportInstanceOperationCallable().futureCall(request);
// Do something.
Instance response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<ExportInstanceRequest,com.google.longrunning.Operation> exportInstanceCallable()
Redis will continue serving during this operation.
The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
ExportInstanceRequest request =
ExportInstanceRequest.newBuilder()
.setName("name3373707")
.setOutputConfig(OutputConfig.newBuilder().build())
.build();
ApiFuture<Operation> future = cloudRedisClient.exportInstanceCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> failoverInstanceAsync(InstanceName name, FailoverInstanceRequest.DataProtectionMode dataProtectionMode)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
FailoverInstanceRequest.DataProtectionMode dataProtectionMode =
FailoverInstanceRequest.DataProtectionMode.forNumber(0);
Instance response = cloudRedisClient.failoverInstanceAsync(name, dataProtectionMode).get();
}
name - Required. Redis instance resource name using the form:
`projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
refers to a GCP region.dataProtectionMode - Optional. Available data protection modes that the user can choose.
If it's unspecified, data protection mode will be LIMITED_DATA_LOSS by default.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> failoverInstanceAsync(String name, FailoverInstanceRequest.DataProtectionMode dataProtectionMode)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
FailoverInstanceRequest.DataProtectionMode dataProtectionMode =
FailoverInstanceRequest.DataProtectionMode.forNumber(0);
Instance response = cloudRedisClient.failoverInstanceAsync(name, dataProtectionMode).get();
}
name - Required. Redis instance resource name using the form:
`projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
refers to a GCP region.dataProtectionMode - Optional. Available data protection modes that the user can choose.
If it's unspecified, data protection mode will be LIMITED_DATA_LOSS by default.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> failoverInstanceAsync(FailoverInstanceRequest request)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
FailoverInstanceRequest request =
FailoverInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.build();
Instance response = cloudRedisClient.failoverInstanceAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<FailoverInstanceRequest,Instance,OperationMetadata> failoverInstanceOperationCallable()
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
FailoverInstanceRequest request =
FailoverInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.build();
OperationFuture<Instance, OperationMetadata> future =
cloudRedisClient.failoverInstanceOperationCallable().futureCall(request);
// Do something.
Instance response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<FailoverInstanceRequest,com.google.longrunning.Operation> failoverInstanceCallable()
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
FailoverInstanceRequest request =
FailoverInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.build();
ApiFuture<Operation> future = cloudRedisClient.failoverInstanceCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteInstanceAsync(InstanceName name)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
cloudRedisClient.deleteInstanceAsync(name).get();
}
name - Required. Redis instance resource name using the form:
`projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
refers to a GCP region.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteInstanceAsync(String name)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
cloudRedisClient.deleteInstanceAsync(name).get();
}
name - Required. Redis instance resource name using the form:
`projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
refers to a GCP region.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<com.google.protobuf.Empty,OperationMetadata> deleteInstanceAsync(DeleteInstanceRequest request)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
DeleteInstanceRequest request =
DeleteInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.build();
cloudRedisClient.deleteInstanceAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<DeleteInstanceRequest,com.google.protobuf.Empty,OperationMetadata> deleteInstanceOperationCallable()
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
DeleteInstanceRequest request =
DeleteInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.build();
OperationFuture<Empty, OperationMetadata> future =
cloudRedisClient.deleteInstanceOperationCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<DeleteInstanceRequest,com.google.longrunning.Operation> deleteInstanceCallable()
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
DeleteInstanceRequest request =
DeleteInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.build();
ApiFuture<Operation> future = cloudRedisClient.deleteInstanceCallable().futureCall(request);
// Do something.
future.get();
}
public final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> rescheduleMaintenanceAsync(InstanceName name, RescheduleMaintenanceRequest.RescheduleType rescheduleType, com.google.protobuf.Timestamp scheduleTime)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
InstanceName name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]");
RescheduleMaintenanceRequest.RescheduleType rescheduleType =
RescheduleMaintenanceRequest.RescheduleType.forNumber(0);
Timestamp scheduleTime = Timestamp.newBuilder().build();
Instance response =
cloudRedisClient.rescheduleMaintenanceAsync(name, rescheduleType, scheduleTime).get();
}
name - Required. Redis instance resource name using the form:
`projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
refers to a GCP region.rescheduleType - Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time
as well.scheduleTime - Optional. Timestamp when the maintenance shall be rescheduled to if
reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for example `2012-11-15T16:19:00.094Z`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> rescheduleMaintenanceAsync(String name, RescheduleMaintenanceRequest.RescheduleType rescheduleType, com.google.protobuf.Timestamp scheduleTime)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
String name = InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString();
RescheduleMaintenanceRequest.RescheduleType rescheduleType =
RescheduleMaintenanceRequest.RescheduleType.forNumber(0);
Timestamp scheduleTime = Timestamp.newBuilder().build();
Instance response =
cloudRedisClient.rescheduleMaintenanceAsync(name, rescheduleType, scheduleTime).get();
}
name - Required. Redis instance resource name using the form:
`projects/{project_id}/locations/{location_id}/instances/{instance_id}` where `location_id`
refers to a GCP region.rescheduleType - Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time
as well.scheduleTime - Optional. Timestamp when the maintenance shall be rescheduled to if
reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for example `2012-11-15T16:19:00.094Z`.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.longrunning.OperationFuture<Instance,OperationMetadata> rescheduleMaintenanceAsync(RescheduleMaintenanceRequest request)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
RescheduleMaintenanceRequest request =
RescheduleMaintenanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.setScheduleTime(Timestamp.newBuilder().build())
.build();
Instance response = cloudRedisClient.rescheduleMaintenanceAsync(request).get();
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.OperationCallable<RescheduleMaintenanceRequest,Instance,OperationMetadata> rescheduleMaintenanceOperationCallable()
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
RescheduleMaintenanceRequest request =
RescheduleMaintenanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.setScheduleTime(Timestamp.newBuilder().build())
.build();
OperationFuture<Instance, OperationMetadata> future =
cloudRedisClient.rescheduleMaintenanceOperationCallable().futureCall(request);
// Do something.
Instance response = future.get();
}
public final com.google.api.gax.rpc.UnaryCallable<RescheduleMaintenanceRequest,com.google.longrunning.Operation> rescheduleMaintenanceCallable()
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
RescheduleMaintenanceRequest request =
RescheduleMaintenanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]", "[LOCATION]", "[INSTANCE]").toString())
.setScheduleTime(Timestamp.newBuilder().build())
.build();
ApiFuture<Operation> future =
cloudRedisClient.rescheduleMaintenanceCallable().futureCall(request);
// Do something.
Operation response = future.get();
}
public final CloudRedisClient.ListLocationsPagedResponse listLocations(com.google.cloud.location.ListLocationsRequest request)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for (Location element : cloudRedisClient.listLocations(request).iterateAll()) {
// doThingsWith(element);
}
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,CloudRedisClient.ListLocationsPagedResponse> listLocationsPagedCallable()
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location> future =
cloudRedisClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for (Location element : future.get().iterateAll()) {
// doThingsWith(element);
}
}
public final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> listLocationsCallable()
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
ListLocationsRequest request =
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while (true) {
ListLocationsResponse response = cloudRedisClient.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 com.google.cloud.location.Location getLocation(com.google.cloud.location.GetLocationRequest request)
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
Location response = cloudRedisClient.getLocation(request);
}
request - The request object containing all of the parameters for the API call.com.google.api.gax.rpc.ApiException - if the remote call failspublic final com.google.api.gax.rpc.UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> getLocationCallable()
Sample 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 (CloudRedisClient cloudRedisClient = CloudRedisClient.create()) {
GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location> future = cloudRedisClient.getLocationCallable().futureCall(request);
// Do something.
Location response = future.get();
}
public final void close()
close in interface AutoCloseablepublic void shutdown()
shutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isShutdown()
isShutdown in interface com.google.api.gax.core.BackgroundResourcepublic boolean isTerminated()
isTerminated in interface com.google.api.gax.core.BackgroundResourcepublic void shutdownNow()
shutdownNow in interface com.google.api.gax.core.BackgroundResourcepublic boolean awaitTermination(long duration,
TimeUnit unit)
throws InterruptedException
awaitTermination in interface com.google.api.gax.core.BackgroundResourceInterruptedExceptionCopyright © 2024 Google LLC. All rights reserved.