Class CloudRedisClient (2.73.0)
Stay organized with collections
Save and categorize content based on your preferences.
- 2.81.0 (latest)
- 2.79.0
- 2.78.0
- 2.77.0
- 2.76.0
- 2.75.0
- 2.73.0
- 2.71.0
- 2.70.0
- 2.67.0
- 2.66.0
- 2.65.0
- 2.63.0
- 2.62.0
- 2.61.0
- 2.60.0
- 2.59.0
- 2.58.0
- 2.57.0
- 2.56.0
- 2.55.0
- 2.54.0
- 2.52.0
- 2.51.0
- 2.50.0
- 2.49.0
- 2.48.0
- 2.47.0
- 2.46.0
- 2.45.0
- 2.44.0
- 2.43.0
- 2.42.0
- 2.40.0
- 2.39.0
- 2.38.0
- 2.37.0
- 2.36.0
- 2.35.0
- 2.34.0
- 2.33.0
- 2.32.0
- 2.31.0
- 2.30.0
- 2.27.0
- 2.26.0
- 2.25.0
- 2.24.0
- 2.23.0
- 2.22.0
- 2.21.0
- 2.20.0
- 2.19.0
- 2.18.0
- 2.17.0
- 2.16.0
- 2.15.0
- 2.14.0
- 2.12.0
- 2.11.0
- 2.10.0
- 2.9.0
- 2.8.0
- 2.7.0
- 2.6.5
- 2.5.0
- 2.4.1
- 2.3.0
- 2.2.0
- 2.1.1
Service Description: Configures and manages Cloud Memorystore for Redis instances
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:
- The service works with a collection of cloud projects, named:
/projects/* - Each project has a collection of available locations, named:
/locations/* - Each location has a collection of Redis instances, named:
/instances/* - As such, Redis instances are resources of the form:
/projects/{project_id}/locations/{location_id}/instances/{instance_id}
Note that location_id must be referring to a GCP region; for example:
projects/redpepper-1290/locations/us-central1/instances/my-redis
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
InstanceNamename=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]");
Instanceresponse=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 |
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. 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
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
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
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
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
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
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
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
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
CloudRedisSettingscloudRedisSettings=
CloudRedisSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
CloudRedisClientcloudRedisClient=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
CloudRedisSettingscloudRedisSettings=
CloudRedisSettings.newBuilder().setEndpoint(myEndpoint).build();
CloudRedisClientcloudRedisClient=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
CloudRedisSettingscloudRedisSettings=CloudRedisSettings.newHttpJsonBuilder().build();
CloudRedisClientcloudRedisClient=CloudRedisClient.create(cloudRedisSettings);
Please refer to the GitHub repository's samples for more quickstart code snippets.
Static Methods
create()
publicstaticfinalCloudRedisClientcreate()Constructs an instance of CloudRedisClient with default settings.
| Returns | |
|---|---|
| Type | Description |
CloudRedisClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(CloudRedisSettings settings)
publicstaticfinalCloudRedisClientcreate(CloudRedisSettingssettings)Constructs an instance of CloudRedisClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.
| Parameter | |
|---|---|
| Name | Description |
settings |
CloudRedisSettings |
| Returns | |
|---|---|
| Type | Description |
CloudRedisClient |
|
| Exceptions | |
|---|---|
| Type | Description |
IOException |
|
create(CloudRedisStub stub)
publicstaticfinalCloudRedisClientcreate(CloudRedisStubstub)Constructs an instance of CloudRedisClient, using the given stub for making calls. This is for advanced usage - prefer using create(CloudRedisSettings).
| Parameter | |
|---|---|
| Name | Description |
stub |
CloudRedisStub |
| Returns | |
|---|---|
| Type | Description |
CloudRedisClient |
|
Constructors
CloudRedisClient(CloudRedisSettings settings)
protectedCloudRedisClient(CloudRedisSettingssettings)Constructs an instance of CloudRedisClient, 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.
| Parameter | |
|---|---|
| Name | Description |
settings |
CloudRedisSettings |
CloudRedisClient(CloudRedisStub stub)
protectedCloudRedisClient(CloudRedisStubstub)| Parameter | |
|---|---|
| Name | Description |
stub |
CloudRedisStub |
Methods
awaitTermination(long duration, TimeUnit unit)
publicbooleanawaitTermination(longduration,TimeUnitunit)| Parameters | |
|---|---|
| Name | Description |
duration |
long |
unit |
TimeUnit |
| Returns | |
|---|---|
| Type | Description |
boolean |
|
| Exceptions | |
|---|---|
| Type | Description |
InterruptedException |
|
close()
publicfinalvoidclose()createInstanceAsync(CreateInstanceRequest request)
publicfinalOperationFuture<Instance,OperationMetadata>createInstanceAsync(CreateInstanceRequestrequest)Creates a Redis instance based on the specified tier and memory size.
By default, the instance is accessible from the project's default network.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
CreateInstanceRequestrequest=
CreateInstanceRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setInstanceId("instanceId902024336")
.setInstance(Instance.newBuilder().build())
.build();
Instanceresponse=cloudRedisClient.createInstanceAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
CreateInstanceRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
createInstanceAsync(LocationName parent, String instanceId, Instance instance)
publicfinalOperationFuture<Instance,OperationMetadata>createInstanceAsync(LocationNameparent,StringinstanceId,Instanceinstance)Creates a Redis instance based on the specified tier and memory size.
By default, the instance is accessible from the project's default network.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
LocationNameparent=LocationName.of("[PROJECT]","[LOCATION]");
StringinstanceId="instanceId902024336";
Instanceinstance=Instance.newBuilder().build();
Instanceresponse=cloudRedisClient.createInstanceAsync(parent,instanceId,instance).get();
}
| Parameters | |
|---|---|
| Name | Description |
parent |
LocationName Required. The resource name of the instance location using the form:
|
instanceId |
String Required. The logical name of the Redis instance in the customer project with the following restrictions:
|
instance |
Instance Required. A Redis [Instance] resource |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
createInstanceAsync(String parent, String instanceId, Instance instance)
publicfinalOperationFuture<Instance,OperationMetadata>createInstanceAsync(Stringparent,StringinstanceId,Instanceinstance)Creates a Redis instance based on the specified tier and memory size.
By default, the instance is accessible from the project's default network.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
Stringparent=LocationName.of("[PROJECT]","[LOCATION]").toString();
StringinstanceId="instanceId902024336";
Instanceinstance=Instance.newBuilder().build();
Instanceresponse=cloudRedisClient.createInstanceAsync(parent,instanceId,instance).get();
}
| Parameters | |
|---|---|
| Name | Description |
parent |
String Required. The resource name of the instance location using the form:
|
instanceId |
String Required. The logical name of the Redis instance in the customer project with the following restrictions:
|
instance |
Instance Required. A Redis [Instance] resource |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
createInstanceCallable()
publicfinalUnaryCallable<CreateInstanceRequest,Operation>createInstanceCallable()Creates a Redis instance based on the specified tier and memory size.
By default, the instance is accessible from the project's default network.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
CreateInstanceRequestrequest=
CreateInstanceRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setInstanceId("instanceId902024336")
.setInstance(Instance.newBuilder().build())
.build();
ApiFuture<Operation>future=cloudRedisClient.createInstanceCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<CreateInstanceRequest,Operation> |
|
createInstanceOperationCallable()
publicfinalOperationCallable<CreateInstanceRequest,Instance,OperationMetadata>createInstanceOperationCallable()Creates a Redis instance based on the specified tier and memory size.
By default, the instance is accessible from the project's default network.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
CreateInstanceRequestrequest=
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.
Instanceresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<CreateInstanceRequest,Instance,OperationMetadata> |
|
deleteInstanceAsync(DeleteInstanceRequest request)
publicfinalOperationFuture<Empty,OperationMetadata>deleteInstanceAsync(DeleteInstanceRequestrequest)Deletes a specific Redis instance. Instance stops serving and data is deleted.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
DeleteInstanceRequestrequest=
DeleteInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.build();
cloudRedisClient.deleteInstanceAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
DeleteInstanceRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,OperationMetadata> |
|
deleteInstanceAsync(InstanceName name)
publicfinalOperationFuture<Empty,OperationMetadata>deleteInstanceAsync(InstanceNamename)Deletes a specific Redis instance. Instance stops serving and data is deleted.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
InstanceNamename=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]");
cloudRedisClient.deleteInstanceAsync(name).get();
}
| Parameter | |
|---|---|
| Name | Description |
name |
InstanceName Required. Redis instance resource name using the form:
|
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,OperationMetadata> |
|
deleteInstanceAsync(String name)
publicfinalOperationFuture<Empty,OperationMetadata>deleteInstanceAsync(Stringname)Deletes a specific Redis instance. Instance stops serving and data is deleted.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
Stringname=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString();
cloudRedisClient.deleteInstanceAsync(name).get();
}
| Parameter | |
|---|---|
| Name | Description |
name |
String Required. Redis instance resource name using the form:
|
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Empty,OperationMetadata> |
|
deleteInstanceCallable()
publicfinalUnaryCallable<DeleteInstanceRequest,Operation>deleteInstanceCallable()Deletes a specific Redis instance. Instance stops serving and data is deleted.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
DeleteInstanceRequestrequest=
DeleteInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.build();
ApiFuture<Operation>future=cloudRedisClient.deleteInstanceCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<DeleteInstanceRequest,Operation> |
|
deleteInstanceOperationCallable()
publicfinalOperationCallable<DeleteInstanceRequest,Empty,OperationMetadata>deleteInstanceOperationCallable()Deletes a specific Redis instance. Instance stops serving and data is deleted.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
DeleteInstanceRequestrequest=
DeleteInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.build();
OperationFuture<Empty,OperationMetadata>future=
cloudRedisClient.deleteInstanceOperationCallable().futureCall(request);
// Do something.
future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<DeleteInstanceRequest,Empty,OperationMetadata> |
|
exportInstanceAsync(ExportInstanceRequest request)
publicfinalOperationFuture<Instance,OperationMetadata>exportInstanceAsync(ExportInstanceRequestrequest)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.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
ExportInstanceRequestrequest=
ExportInstanceRequest.newBuilder()
.setName("name3373707")
.setOutputConfig(OutputConfig.newBuilder().build())
.build();
Instanceresponse=cloudRedisClient.exportInstanceAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
ExportInstanceRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
exportInstanceAsync(String name, OutputConfig outputConfig)
publicfinalOperationFuture<Instance,OperationMetadata>exportInstanceAsync(Stringname,OutputConfigoutputConfig)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.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
Stringname="name3373707";
OutputConfigoutputConfig=OutputConfig.newBuilder().build();
Instanceresponse=cloudRedisClient.exportInstanceAsync(name,outputConfig).get();
}
| Parameters | |
|---|---|
| Name | Description |
name |
String Required. Redis instance resource name using the form:
|
outputConfig |
OutputConfig Required. Specify data to be exported. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
exportInstanceCallable()
publicfinalUnaryCallable<ExportInstanceRequest,Operation>exportInstanceCallable()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.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
ExportInstanceRequestrequest=
ExportInstanceRequest.newBuilder()
.setName("name3373707")
.setOutputConfig(OutputConfig.newBuilder().build())
.build();
ApiFuture<Operation>future=cloudRedisClient.exportInstanceCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ExportInstanceRequest,Operation> |
|
exportInstanceOperationCallable()
publicfinalOperationCallable<ExportInstanceRequest,Instance,OperationMetadata>exportInstanceOperationCallable()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.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
ExportInstanceRequestrequest=
ExportInstanceRequest.newBuilder()
.setName("name3373707")
.setOutputConfig(OutputConfig.newBuilder().build())
.build();
OperationFuture<Instance,OperationMetadata>future=
cloudRedisClient.exportInstanceOperationCallable().futureCall(request);
// Do something.
Instanceresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<ExportInstanceRequest,Instance,OperationMetadata> |
|
failoverInstanceAsync(FailoverInstanceRequest request)
publicfinalOperationFuture<Instance,OperationMetadata>failoverInstanceAsync(FailoverInstanceRequestrequest)Initiates a failover of the primary node to current replica node for a specific STANDARD tier Cloud Memorystore for Redis instance.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
FailoverInstanceRequestrequest=
FailoverInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.build();
Instanceresponse=cloudRedisClient.failoverInstanceAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
FailoverInstanceRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
failoverInstanceAsync(InstanceName name, FailoverInstanceRequest.DataProtectionMode dataProtectionMode)
publicfinalOperationFuture<Instance,OperationMetadata>failoverInstanceAsync(InstanceNamename,FailoverInstanceRequest.DataProtectionModedataProtectionMode)Initiates a failover of the primary node to current replica node for a specific STANDARD tier Cloud Memorystore for Redis instance.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
InstanceNamename=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]");
FailoverInstanceRequest.DataProtectionModedataProtectionMode=
FailoverInstanceRequest.DataProtectionMode.forNumber(0);
Instanceresponse=cloudRedisClient.failoverInstanceAsync(name,dataProtectionMode).get();
}
| Parameters | |
|---|---|
| Name | Description |
name |
InstanceName Required. Redis instance resource name using the form:
|
dataProtectionMode |
FailoverInstanceRequest.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. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
failoverInstanceAsync(String name, FailoverInstanceRequest.DataProtectionMode dataProtectionMode)
publicfinalOperationFuture<Instance,OperationMetadata>failoverInstanceAsync(Stringname,FailoverInstanceRequest.DataProtectionModedataProtectionMode)Initiates a failover of the primary node to current replica node for a specific STANDARD tier Cloud Memorystore for Redis instance.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
Stringname=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString();
FailoverInstanceRequest.DataProtectionModedataProtectionMode=
FailoverInstanceRequest.DataProtectionMode.forNumber(0);
Instanceresponse=cloudRedisClient.failoverInstanceAsync(name,dataProtectionMode).get();
}
| Parameters | |
|---|---|
| Name | Description |
name |
String Required. Redis instance resource name using the form:
|
dataProtectionMode |
FailoverInstanceRequest.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. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
failoverInstanceCallable()
publicfinalUnaryCallable<FailoverInstanceRequest,Operation>failoverInstanceCallable()Initiates a failover of the primary node to current replica node for a specific STANDARD tier Cloud Memorystore for Redis instance.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
FailoverInstanceRequestrequest=
FailoverInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.build();
ApiFuture<Operation>future=cloudRedisClient.failoverInstanceCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<FailoverInstanceRequest,Operation> |
|
failoverInstanceOperationCallable()
publicfinalOperationCallable<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.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
FailoverInstanceRequestrequest=
FailoverInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.build();
OperationFuture<Instance,OperationMetadata>future=
cloudRedisClient.failoverInstanceOperationCallable().futureCall(request);
// Do something.
Instanceresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<FailoverInstanceRequest,Instance,OperationMetadata> |
|
getHttpJsonOperationsClient()
publicfinalOperationsClientgetHttpJsonOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
| Returns | |
|---|---|
| Type | Description |
OperationsClient |
|
getInstance(GetInstanceRequest request)
publicfinalInstancegetInstance(GetInstanceRequestrequest)Gets the details of a specific Redis instance.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
GetInstanceRequestrequest=
GetInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.build();
Instanceresponse=cloudRedisClient.getInstance(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetInstanceRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
Instance |
|
getInstance(InstanceName name)
publicfinalInstancegetInstance(InstanceNamename)Gets the details of a specific Redis instance.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
InstanceNamename=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]");
Instanceresponse=cloudRedisClient.getInstance(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
InstanceName Required. Redis instance resource name using the form:
|
| Returns | |
|---|---|
| Type | Description |
Instance |
|
getInstance(String name)
publicfinalInstancegetInstance(Stringname)Gets the details of a specific Redis instance.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
Stringname=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString();
Instanceresponse=cloudRedisClient.getInstance(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
String Required. Redis instance resource name using the form:
|
| Returns | |
|---|---|
| Type | Description |
Instance |
|
getInstanceAuthString(GetInstanceAuthStringRequest request)
publicfinalInstanceAuthStringgetInstanceAuthString(GetInstanceAuthStringRequestrequest)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.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
GetInstanceAuthStringRequestrequest=
GetInstanceAuthStringRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.build();
InstanceAuthStringresponse=cloudRedisClient.getInstanceAuthString(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
GetInstanceAuthStringRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
InstanceAuthString |
|
getInstanceAuthString(InstanceName name)
publicfinalInstanceAuthStringgetInstanceAuthString(InstanceNamename)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.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
InstanceNamename=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]");
InstanceAuthStringresponse=cloudRedisClient.getInstanceAuthString(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
InstanceName Required. Redis instance resource name using the form:
|
| Returns | |
|---|---|
| Type | Description |
InstanceAuthString |
|
getInstanceAuthString(String name)
publicfinalInstanceAuthStringgetInstanceAuthString(Stringname)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.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
Stringname=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString();
InstanceAuthStringresponse=cloudRedisClient.getInstanceAuthString(name);
}
| Parameter | |
|---|---|
| Name | Description |
name |
String Required. Redis instance resource name using the form:
|
| Returns | |
|---|---|
| Type | Description |
InstanceAuthString |
|
getInstanceAuthStringCallable()
publicfinalUnaryCallable<GetInstanceAuthStringRequest,InstanceAuthString>getInstanceAuthStringCallable()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.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
GetInstanceAuthStringRequestrequest=
GetInstanceAuthStringRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.build();
ApiFuture<InstanceAuthString>future=
cloudRedisClient.getInstanceAuthStringCallable().futureCall(request);
// Do something.
InstanceAuthStringresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetInstanceAuthStringRequest,InstanceAuthString> |
|
getInstanceCallable()
publicfinalUnaryCallable<GetInstanceRequest,Instance>getInstanceCallable()Gets the details of a specific Redis instance.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
GetInstanceRequestrequest=
GetInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.build();
ApiFuture<Instance>future=cloudRedisClient.getInstanceCallable().futureCall(request);
// Do something.
Instanceresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<GetInstanceRequest,Instance> |
|
getLocation(GetLocationRequest request)
publicfinalLocationgetLocation(GetLocationRequestrequest)Gets information about a location.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
GetLocationRequestrequest=GetLocationRequest.newBuilder().setName("name3373707").build();
Locationresponse=cloudRedisClient.getLocation(request);
}
| Parameter | |
|---|---|
| Name | Description |
request |
com.google.cloud.location.GetLocationRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
com.google.cloud.location.Location |
|
getLocationCallable()
publicfinalUnaryCallable<GetLocationRequest,Location>getLocationCallable()Gets information about a location.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
GetLocationRequestrequest=GetLocationRequest.newBuilder().setName("name3373707").build();
ApiFuture<Location>future=cloudRedisClient.getLocationCallable().futureCall(request);
// Do something.
Locationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location> |
|
getOperationsClient()
publicfinalOperationsClientgetOperationsClient()Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.
| Returns | |
|---|---|
| Type | Description |
OperationsClient |
|
getSettings()
publicfinalCloudRedisSettingsgetSettings()| Returns | |
|---|---|
| Type | Description |
CloudRedisSettings |
|
getStub()
publicCloudRedisStubgetStub()| Returns | |
|---|---|
| Type | Description |
CloudRedisStub |
|
importInstanceAsync(ImportInstanceRequest request)
publicfinalOperationFuture<Instance,OperationMetadata>importInstanceAsync(ImportInstanceRequestrequest)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.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
ImportInstanceRequestrequest=
ImportInstanceRequest.newBuilder()
.setName("name3373707")
.setInputConfig(InputConfig.newBuilder().build())
.build();
Instanceresponse=cloudRedisClient.importInstanceAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
ImportInstanceRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
importInstanceAsync(String name, InputConfig inputConfig)
publicfinalOperationFuture<Instance,OperationMetadata>importInstanceAsync(Stringname,InputConfiginputConfig)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.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
Stringname="name3373707";
InputConfiginputConfig=InputConfig.newBuilder().build();
Instanceresponse=cloudRedisClient.importInstanceAsync(name,inputConfig).get();
}
| Parameters | |
|---|---|
| Name | Description |
name |
String Required. Redis instance resource name using the form:
|
inputConfig |
InputConfig Required. Specify data to be imported. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
importInstanceCallable()
publicfinalUnaryCallable<ImportInstanceRequest,Operation>importInstanceCallable()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.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
ImportInstanceRequestrequest=
ImportInstanceRequest.newBuilder()
.setName("name3373707")
.setInputConfig(InputConfig.newBuilder().build())
.build();
ApiFuture<Operation>future=cloudRedisClient.importInstanceCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ImportInstanceRequest,Operation> |
|
importInstanceOperationCallable()
publicfinalOperationCallable<ImportInstanceRequest,Instance,OperationMetadata>importInstanceOperationCallable()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.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
ImportInstanceRequestrequest=
ImportInstanceRequest.newBuilder()
.setName("name3373707")
.setInputConfig(InputConfig.newBuilder().build())
.build();
OperationFuture<Instance,OperationMetadata>future=
cloudRedisClient.importInstanceOperationCallable().futureCall(request);
// Do something.
Instanceresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<ImportInstanceRequest,Instance,OperationMetadata> |
|
isShutdown()
publicbooleanisShutdown()| Returns | |
|---|---|
| Type | Description |
boolean |
|
isTerminated()
publicbooleanisTerminated()| Returns | |
|---|---|
| Type | Description |
boolean |
|
listInstances(ListInstancesRequest request)
publicfinalCloudRedisClient.ListInstancesPagedResponselistInstances(ListInstancesRequestrequest)Lists all Redis instances owned by a project in either the specified location (region) or all locations.
The location should have the following format:
projects/{project_id}/locations/{location_id}
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
ListInstancesRequestrequest=
ListInstancesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for(Instanceelement:cloudRedisClient.listInstances(request).iterateAll()){
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
ListInstancesRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
CloudRedisClient.ListInstancesPagedResponse |
|
listInstances(LocationName parent)
publicfinalCloudRedisClient.ListInstancesPagedResponselistInstances(LocationNameparent)Lists all Redis instances owned by a project in either the specified location (region) or all locations.
The location should have the following format:
projects/{project_id}/locations/{location_id}
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
LocationNameparent=LocationName.of("[PROJECT]","[LOCATION]");
for(Instanceelement:cloudRedisClient.listInstances(parent).iterateAll()){
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
LocationName Required. The resource name of the instance location using the form:
|
| Returns | |
|---|---|
| Type | Description |
CloudRedisClient.ListInstancesPagedResponse |
|
listInstances(String parent)
publicfinalCloudRedisClient.ListInstancesPagedResponselistInstances(Stringparent)Lists all Redis instances owned by a project in either the specified location (region) or all locations.
The location should have the following format:
projects/{project_id}/locations/{location_id}
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
Stringparent=LocationName.of("[PROJECT]","[LOCATION]").toString();
for(Instanceelement:cloudRedisClient.listInstances(parent).iterateAll()){
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
parent |
String Required. The resource name of the instance location using the form:
|
| Returns | |
|---|---|
| Type | Description |
CloudRedisClient.ListInstancesPagedResponse |
|
listInstancesCallable()
publicfinalUnaryCallable<ListInstancesRequest,ListInstancesResponse>listInstancesCallable()Lists all Redis instances owned by a project in either the specified location (region) or all locations.
The location should have the following format:
projects/{project_id}/locations/{location_id}
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
ListInstancesRequestrequest=
ListInstancesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while(true){
ListInstancesResponseresponse=cloudRedisClient.listInstancesCallable().call(request);
for(Instanceelement:response.getInstancesList()){
// doThingsWith(element);
}
StringnextPageToken=response.getNextPageToken();
if(!Strings.isNullOrEmpty(nextPageToken)){
request=request.toBuilder().setPageToken(nextPageToken).build();
}else{
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListInstancesRequest,ListInstancesResponse> |
|
listInstancesPagedCallable()
publicfinalUnaryCallable<ListInstancesRequest,CloudRedisClient.ListInstancesPagedResponse>listInstancesPagedCallable()Lists all Redis instances owned by a project in either the specified location (region) or all locations.
The location should have the following format:
projects/{project_id}/locations/{location_id}
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
ListInstancesRequestrequest=
ListInstancesRequest.newBuilder()
.setParent(LocationName.of("[PROJECT]","[LOCATION]").toString())
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Instance>future=
cloudRedisClient.listInstancesPagedCallable().futureCall(request);
// Do something.
for(Instanceelement:future.get().iterateAll()){
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<ListInstancesRequest,ListInstancesPagedResponse> |
|
listLocations(ListLocationsRequest request)
publicfinalCloudRedisClient.ListLocationsPagedResponselistLocations(ListLocationsRequestrequest)Lists information about the supported locations for this service.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
ListLocationsRequestrequest=
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
for(Locationelement:cloudRedisClient.listLocations(request).iterateAll()){
// doThingsWith(element);
}
}
| Parameter | |
|---|---|
| Name | Description |
request |
com.google.cloud.location.ListLocationsRequestThe request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
CloudRedisClient.ListLocationsPagedResponse |
|
listLocationsCallable()
publicfinalUnaryCallable<ListLocationsRequest,ListLocationsResponse>listLocationsCallable()Lists information about the supported locations for this service.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
ListLocationsRequestrequest=
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
while(true){
ListLocationsResponseresponse=cloudRedisClient.listLocationsCallable().call(request);
for(Locationelement:response.getLocationsList()){
// doThingsWith(element);
}
StringnextPageToken=response.getNextPageToken();
if(!Strings.isNullOrEmpty(nextPageToken)){
request=request.toBuilder().setPageToken(nextPageToken).build();
}else{
break;
}
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse> |
|
listLocationsPagedCallable()
publicfinalUnaryCallable<ListLocationsRequest,CloudRedisClient.ListLocationsPagedResponse>listLocationsPagedCallable()Lists information about the supported locations for this service.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
ListLocationsRequestrequest=
ListLocationsRequest.newBuilder()
.setName("name3373707")
.setFilter("filter-1274492040")
.setPageSize(883849137)
.setPageToken("pageToken873572522")
.build();
ApiFuture<Location>future=
cloudRedisClient.listLocationsPagedCallable().futureCall(request);
// Do something.
for(Locationelement:future.get().iterateAll()){
// doThingsWith(element);
}
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse> |
|
rescheduleMaintenanceAsync(InstanceName name, RescheduleMaintenanceRequest.RescheduleType rescheduleType, Timestamp scheduleTime)
publicfinalOperationFuture<Instance,OperationMetadata>rescheduleMaintenanceAsync(InstanceNamename,RescheduleMaintenanceRequest.RescheduleTyperescheduleType,TimestampscheduleTime)Reschedule maintenance for a given instance in a given project and location.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
InstanceNamename=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]");
RescheduleMaintenanceRequest.RescheduleTyperescheduleType=
RescheduleMaintenanceRequest.RescheduleType.forNumber(0);
TimestampscheduleTime=Timestamp.newBuilder().build();
Instanceresponse=
cloudRedisClient.rescheduleMaintenanceAsync(name,rescheduleType,scheduleTime).get();
}
| Parameters | |
|---|---|
| Name | Description |
name |
InstanceName Required. Redis instance resource name using the form:
|
rescheduleType |
RescheduleMaintenanceRequest.RescheduleType Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well. |
scheduleTime |
Timestamp Optional. Timestamp when the maintenance shall be rescheduled to if
reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for example |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
rescheduleMaintenanceAsync(RescheduleMaintenanceRequest request)
publicfinalOperationFuture<Instance,OperationMetadata>rescheduleMaintenanceAsync(RescheduleMaintenanceRequestrequest)Reschedule maintenance for a given instance in a given project and location.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
RescheduleMaintenanceRequestrequest=
RescheduleMaintenanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.setScheduleTime(Timestamp.newBuilder().build())
.build();
Instanceresponse=cloudRedisClient.rescheduleMaintenanceAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
RescheduleMaintenanceRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
rescheduleMaintenanceAsync(String name, RescheduleMaintenanceRequest.RescheduleType rescheduleType, Timestamp scheduleTime)
publicfinalOperationFuture<Instance,OperationMetadata>rescheduleMaintenanceAsync(Stringname,RescheduleMaintenanceRequest.RescheduleTyperescheduleType,TimestampscheduleTime)Reschedule maintenance for a given instance in a given project and location.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
Stringname=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString();
RescheduleMaintenanceRequest.RescheduleTyperescheduleType=
RescheduleMaintenanceRequest.RescheduleType.forNumber(0);
TimestampscheduleTime=Timestamp.newBuilder().build();
Instanceresponse=
cloudRedisClient.rescheduleMaintenanceAsync(name,rescheduleType,scheduleTime).get();
}
| Parameters | |
|---|---|
| Name | Description |
name |
String Required. Redis instance resource name using the form:
|
rescheduleType |
RescheduleMaintenanceRequest.RescheduleType Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well. |
scheduleTime |
Timestamp Optional. Timestamp when the maintenance shall be rescheduled to if
reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for example |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
rescheduleMaintenanceCallable()
publicfinalUnaryCallable<RescheduleMaintenanceRequest,Operation>rescheduleMaintenanceCallable()Reschedule maintenance for a given instance in a given project and location.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
RescheduleMaintenanceRequestrequest=
RescheduleMaintenanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.setScheduleTime(Timestamp.newBuilder().build())
.build();
ApiFuture<Operation>future=
cloudRedisClient.rescheduleMaintenanceCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<RescheduleMaintenanceRequest,Operation> |
|
rescheduleMaintenanceOperationCallable()
publicfinalOperationCallable<RescheduleMaintenanceRequest,Instance,OperationMetadata>rescheduleMaintenanceOperationCallable()Reschedule maintenance for a given instance in a given project and location.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
RescheduleMaintenanceRequestrequest=
RescheduleMaintenanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.setScheduleTime(Timestamp.newBuilder().build())
.build();
OperationFuture<Instance,OperationMetadata>future=
cloudRedisClient.rescheduleMaintenanceOperationCallable().futureCall(request);
// Do something.
Instanceresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<RescheduleMaintenanceRequest,Instance,OperationMetadata> |
|
shutdown()
publicvoidshutdown()shutdownNow()
publicvoidshutdownNow()updateInstanceAsync(UpdateInstanceRequest request)
publicfinalOperationFuture<Instance,OperationMetadata>updateInstanceAsync(UpdateInstanceRequestrequest)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.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
UpdateInstanceRequestrequest=
UpdateInstanceRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setInstance(Instance.newBuilder().build())
.build();
Instanceresponse=cloudRedisClient.updateInstanceAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
UpdateInstanceRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
updateInstanceAsync(FieldMask updateMask, Instance instance)
publicfinalOperationFuture<Instance,OperationMetadata>updateInstanceAsync(FieldMaskupdateMask,Instanceinstance)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.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
FieldMaskupdateMask=FieldMask.newBuilder().build();
Instanceinstance=Instance.newBuilder().build();
Instanceresponse=cloudRedisClient.updateInstanceAsync(updateMask,instance).get();
}
| Parameters | |
|---|---|
| Name | Description |
updateMask |
FieldMask 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: * |
instance |
Instance Required. Update description. Only fields specified in update_mask are updated. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
updateInstanceCallable()
publicfinalUnaryCallable<UpdateInstanceRequest,Operation>updateInstanceCallable()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.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
UpdateInstanceRequestrequest=
UpdateInstanceRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setInstance(Instance.newBuilder().build())
.build();
ApiFuture<Operation>future=cloudRedisClient.updateInstanceCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<UpdateInstanceRequest,Operation> |
|
updateInstanceOperationCallable()
publicfinalOperationCallable<UpdateInstanceRequest,Instance,OperationMetadata>updateInstanceOperationCallable()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.
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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
UpdateInstanceRequestrequest=
UpdateInstanceRequest.newBuilder()
.setUpdateMask(FieldMask.newBuilder().build())
.setInstance(Instance.newBuilder().build())
.build();
OperationFuture<Instance,OperationMetadata>future=
cloudRedisClient.updateInstanceOperationCallable().futureCall(request);
// Do something.
Instanceresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<UpdateInstanceRequest,Instance,OperationMetadata> |
|
upgradeInstanceAsync(InstanceName name, String redisVersion)
publicfinalOperationFuture<Instance,OperationMetadata>upgradeInstanceAsync(InstanceNamename,StringredisVersion)Upgrades Redis instance to the newer Redis version specified in the 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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
InstanceNamename=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]");
StringredisVersion="redisVersion-1972584739";
Instanceresponse=cloudRedisClient.upgradeInstanceAsync(name,redisVersion).get();
}
| Parameters | |
|---|---|
| Name | Description |
name |
InstanceName Required. Redis instance resource name using the form:
|
redisVersion |
String Required. Specifies the target version of Redis software to upgrade to. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
upgradeInstanceAsync(UpgradeInstanceRequest request)
publicfinalOperationFuture<Instance,OperationMetadata>upgradeInstanceAsync(UpgradeInstanceRequestrequest)Upgrades Redis instance to the newer Redis version specified in the 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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
UpgradeInstanceRequestrequest=
UpgradeInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.setRedisVersion("redisVersion-1972584739")
.build();
Instanceresponse=cloudRedisClient.upgradeInstanceAsync(request).get();
}
| Parameter | |
|---|---|
| Name | Description |
request |
UpgradeInstanceRequest The request object containing all of the parameters for the API call. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
upgradeInstanceAsync(String name, String redisVersion)
publicfinalOperationFuture<Instance,OperationMetadata>upgradeInstanceAsync(Stringname,StringredisVersion)Upgrades Redis instance to the newer Redis version specified in the 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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
Stringname=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString();
StringredisVersion="redisVersion-1972584739";
Instanceresponse=cloudRedisClient.upgradeInstanceAsync(name,redisVersion).get();
}
| Parameters | |
|---|---|
| Name | Description |
name |
String Required. Redis instance resource name using the form:
|
redisVersion |
String Required. Specifies the target version of Redis software to upgrade to. |
| Returns | |
|---|---|
| Type | Description |
OperationFuture<Instance,OperationMetadata> |
|
upgradeInstanceCallable()
publicfinalUnaryCallable<UpgradeInstanceRequest,Operation>upgradeInstanceCallable()Upgrades Redis instance to the newer Redis version specified in the 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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
UpgradeInstanceRequestrequest=
UpgradeInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.setRedisVersion("redisVersion-1972584739")
.build();
ApiFuture<Operation>future=cloudRedisClient.upgradeInstanceCallable().futureCall(request);
// Do something.
Operationresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
UnaryCallable<UpgradeInstanceRequest,Operation> |
|
upgradeInstanceOperationCallable()
publicfinalOperationCallable<UpgradeInstanceRequest,Instance,OperationMetadata>upgradeInstanceOperationCallable()Upgrades Redis instance to the newer Redis version specified in the 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(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){
UpgradeInstanceRequestrequest=
UpgradeInstanceRequest.newBuilder()
.setName(InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]").toString())
.setRedisVersion("redisVersion-1972584739")
.build();
OperationFuture<Instance,OperationMetadata>future=
cloudRedisClient.upgradeInstanceOperationCallable().futureCall(request);
// Do something.
Instanceresponse=future.get();
}
| Returns | |
|---|---|
| Type | Description |
OperationCallable<UpgradeInstanceRequest,Instance,OperationMetadata> |
|