Class CloudRedisClusterClient (0.3.0)

GitHub RepositoryProduct Reference

Service Description: Configures and manages Cloud Memorystore for Redis clusters

Google Cloud Memorystore for Redis Cluster

The redis.googleapis.com service implements the Google Cloud Memorystore for Redis API and defines the following resource model for managing Redis clusters:

  • 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 clusters, named: /clusters/*
  • As such, Redis clusters are resources of the form: /projects/{project_id}/locations/{location_id}/clusters/{instance_id}

Note that location_id must be a GCP region; for example:

  • projects/redpepper-1290/locations/us-central1/clusters/my-redis

We use API version selector for Flex APIs

  • The versioning strategy is release-based versioning
  • Our backend CLH only deals with the superset version (called v1main)
  • Existing backend for Redis Gen1 and MRR is not touched.
  • More details in go/redis-flex-api-versioning

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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   ClusterName name = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]");
   Cluster response = cloudRedisClusterClient.getCluster(name);
 }
 

Note: close() needs to be called on the CloudRedisClusterClient object to clean up resources such as threads. In the example above, try-with-resources is used, which automatically calls close().

The surface of this class includes several types of Java methods for each of the API's methods:

  1. A "flattened" method. With this type of method, the fields of the request type have been converted into function parameters. It may be the case that not all fields are available as parameters, and not every API method will have a flattened method entry point.
  2. A "request object" method. This type of method only takes one parameter, a request object, which must be constructed before the call. Not every API method will have a request object method.
  3. A "callable" method. This type of method takes no parameters and returns 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 CloudRedisClusterSettings 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
 CloudRedisClusterSettings cloudRedisClusterSettings =
     CloudRedisClusterSettings.newBuilder()
         .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
         .build();
 CloudRedisClusterClient cloudRedisClusterClient =
     CloudRedisClusterClient.create(cloudRedisClusterSettings);
 

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
 CloudRedisClusterSettings cloudRedisClusterSettings =
     CloudRedisClusterSettings.newBuilder().setEndpoint(myEndpoint).build();
 CloudRedisClusterClient cloudRedisClusterClient =
     CloudRedisClusterClient.create(cloudRedisClusterSettings);
 

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
 CloudRedisClusterSettings cloudRedisClusterSettings =
     CloudRedisClusterSettings.newHttpJsonBuilder().build();
 CloudRedisClusterClient cloudRedisClusterClient =
     CloudRedisClusterClient.create(cloudRedisClusterSettings);
 

Please refer to the GitHub repository's samples for more quickstart code snippets.

Inheritance

java.lang.Object > CloudRedisClusterClient

Static Methods

create()

public static final CloudRedisClusterClient create()

Constructs an instance of CloudRedisClusterClient with default settings.

Returns
TypeDescription
CloudRedisClusterClient
Exceptions
TypeDescription
IOException

create(CloudRedisClusterSettings settings)

public static final CloudRedisClusterClient create(CloudRedisClusterSettings settings)

Constructs an instance of CloudRedisClusterClient, using the given settings. The channels are created based on the settings passed in, or defaults for any settings that are not set.

Parameter
NameDescription
settingsCloudRedisClusterSettings
Returns
TypeDescription
CloudRedisClusterClient
Exceptions
TypeDescription
IOException

create(CloudRedisClusterStub stub)

public static final CloudRedisClusterClient create(CloudRedisClusterStub stub)

Constructs an instance of CloudRedisClusterClient, using the given stub for making calls. This is for advanced usage - prefer using create(CloudRedisClusterSettings).

Parameter
NameDescription
stubCloudRedisClusterStub
Returns
TypeDescription
CloudRedisClusterClient

Constructors

CloudRedisClusterClient(CloudRedisClusterSettings settings)

protected CloudRedisClusterClient(CloudRedisClusterSettings settings)

Constructs an instance of CloudRedisClusterClient, 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
NameDescription
settingsCloudRedisClusterSettings

CloudRedisClusterClient(CloudRedisClusterStub stub)

protected CloudRedisClusterClient(CloudRedisClusterStub stub)
Parameter
NameDescription
stubCloudRedisClusterStub

Methods

awaitTermination(long duration, TimeUnit unit)

public boolean awaitTermination(long duration, TimeUnit unit)
Parameters
NameDescription
durationlong
unitTimeUnit
Returns
TypeDescription
boolean
Exceptions
TypeDescription
InterruptedException

close()

public final void close()

createClusterAsync(CreateClusterRequest request)

public final OperationFuture<Cluster,Any> createClusterAsync(CreateClusterRequest request)

Creates a Redis cluster based on the specified properties. The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis cluster will be fully functional. The completed longrunning.Operation will contain the new cluster 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   CreateClusterRequest request =
       CreateClusterRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setClusterId("clusterId561939637")
           .setCluster(Cluster.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Cluster response = cloudRedisClusterClient.createClusterAsync(request).get();
 }
 
Parameter
NameDescription
requestCreateClusterRequest

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

Returns
TypeDescription
OperationFuture<Cluster,Any>

createClusterAsync(LocationName parent, Cluster cluster, String clusterId)

public final OperationFuture<Cluster,Any> createClusterAsync(LocationName parent, Cluster cluster, String clusterId)

Creates a Redis cluster based on the specified properties. The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis cluster will be fully functional. The completed longrunning.Operation will contain the new cluster 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   Cluster cluster = Cluster.newBuilder().build();
   String clusterId = "clusterId561939637";
   Cluster response =
       cloudRedisClusterClient.createClusterAsync(parent, cluster, clusterId).get();
 }
 
Parameters
NameDescription
parentLocationName

Required. The resource name of the cluster location using the form: projects/{project_id}/locations/{location_id} where location_id refers to a GCP region.

clusterCluster

Required. The cluster that is to be created.

clusterIdString

Required. The logical name of the Redis cluster in the customer project with the following restrictions:

  • Must contain only lowercase letters, numbers, and hyphens.
  • Must start with a letter.
  • Must be between 1-63 characters.
  • Must end with a number or a letter.
  • Must be unique within the customer project / location

Returns
TypeDescription
OperationFuture<Cluster,Any>

createClusterAsync(String parent, Cluster cluster, String clusterId)

public final OperationFuture<Cluster,Any> createClusterAsync(String parent, Cluster cluster, String clusterId)

Creates a Redis cluster based on the specified properties. The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis cluster will be fully functional. The completed longrunning.Operation will contain the new cluster 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   Cluster cluster = Cluster.newBuilder().build();
   String clusterId = "clusterId561939637";
   Cluster response =
       cloudRedisClusterClient.createClusterAsync(parent, cluster, clusterId).get();
 }
 
Parameters
NameDescription
parentString

Required. The resource name of the cluster location using the form: projects/{project_id}/locations/{location_id} where location_id refers to a GCP region.

clusterCluster

Required. The cluster that is to be created.

clusterIdString

Required. The logical name of the Redis cluster in the customer project with the following restrictions:

  • Must contain only lowercase letters, numbers, and hyphens.
  • Must start with a letter.
  • Must be between 1-63 characters.
  • Must end with a number or a letter.
  • Must be unique within the customer project / location

Returns
TypeDescription
OperationFuture<Cluster,Any>

createClusterCallable()

public final UnaryCallable<CreateClusterRequest,Operation> createClusterCallable()

Creates a Redis cluster based on the specified properties. The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis cluster will be fully functional. The completed longrunning.Operation will contain the new cluster 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   CreateClusterRequest request =
       CreateClusterRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setClusterId("clusterId561939637")
           .setCluster(Cluster.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       cloudRedisClusterClient.createClusterCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<CreateClusterRequest,Operation>

createClusterOperationCallable()

public final OperationCallable<CreateClusterRequest,Cluster,Any> createClusterOperationCallable()

Creates a Redis cluster based on the specified properties. The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis cluster will be fully functional. The completed longrunning.Operation will contain the new cluster 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   CreateClusterRequest request =
       CreateClusterRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setClusterId("clusterId561939637")
           .setCluster(Cluster.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Cluster, Any> future =
       cloudRedisClusterClient.createClusterOperationCallable().futureCall(request);
   // Do something.
   Cluster response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<CreateClusterRequest,Cluster,Any>

deleteClusterAsync(ClusterName name)

public final OperationFuture<Empty,Any> deleteClusterAsync(ClusterName name)

Deletes a specific Redis cluster. Cluster 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   ClusterName name = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]");
   cloudRedisClusterClient.deleteClusterAsync(name).get();
 }
 
Parameter
NameDescription
nameClusterName

Required. Redis cluster resource name using the form: projects/{project_id}/locations/{location_id}/clusters/{cluster_id} where location_id refers to a GCP region.

Returns
TypeDescription
OperationFuture<Empty,Any>

deleteClusterAsync(DeleteClusterRequest request)

public final OperationFuture<Empty,Any> deleteClusterAsync(DeleteClusterRequest request)

Deletes a specific Redis cluster. Cluster 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   DeleteClusterRequest request =
       DeleteClusterRequest.newBuilder()
           .setName(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setRequestId("requestId693933066")
           .build();
   cloudRedisClusterClient.deleteClusterAsync(request).get();
 }
 
Parameter
NameDescription
requestDeleteClusterRequest

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

Returns
TypeDescription
OperationFuture<Empty,Any>

deleteClusterAsync(String name)

public final OperationFuture<Empty,Any> deleteClusterAsync(String name)

Deletes a specific Redis cluster. Cluster 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   String name = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString();
   cloudRedisClusterClient.deleteClusterAsync(name).get();
 }
 
Parameter
NameDescription
nameString

Required. Redis cluster resource name using the form: projects/{project_id}/locations/{location_id}/clusters/{cluster_id} where location_id refers to a GCP region.

Returns
TypeDescription
OperationFuture<Empty,Any>

deleteClusterCallable()

public final UnaryCallable<DeleteClusterRequest,Operation> deleteClusterCallable()

Deletes a specific Redis cluster. Cluster 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   DeleteClusterRequest request =
       DeleteClusterRequest.newBuilder()
           .setName(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       cloudRedisClusterClient.deleteClusterCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
UnaryCallable<DeleteClusterRequest,Operation>

deleteClusterOperationCallable()

public final OperationCallable<DeleteClusterRequest,Empty,Any> deleteClusterOperationCallable()

Deletes a specific Redis cluster. Cluster 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   DeleteClusterRequest request =
       DeleteClusterRequest.newBuilder()
           .setName(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Empty, Any> future =
       cloudRedisClusterClient.deleteClusterOperationCallable().futureCall(request);
   // Do something.
   future.get();
 }
 
Returns
TypeDescription
OperationCallable<DeleteClusterRequest,Empty,Any>

getCluster(ClusterName name)

public final Cluster getCluster(ClusterName name)

Gets the details of a specific Redis cluster.

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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   ClusterName name = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]");
   Cluster response = cloudRedisClusterClient.getCluster(name);
 }
 
Parameter
NameDescription
nameClusterName

Required. Redis cluster resource name using the form: projects/{project_id}/locations/{location_id}/clusters/{cluster_id} where location_id refers to a GCP region.

Returns
TypeDescription
Cluster

getCluster(GetClusterRequest request)

public final Cluster getCluster(GetClusterRequest request)

Gets the details of a specific Redis cluster.

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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   GetClusterRequest request =
       GetClusterRequest.newBuilder()
           .setName(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .build();
   Cluster response = cloudRedisClusterClient.getCluster(request);
 }
 
Parameter
NameDescription
requestGetClusterRequest

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

Returns
TypeDescription
Cluster

getCluster(String name)

public final Cluster getCluster(String name)

Gets the details of a specific Redis cluster.

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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   String name = ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString();
   Cluster response = cloudRedisClusterClient.getCluster(name);
 }
 
Parameter
NameDescription
nameString

Required. Redis cluster resource name using the form: projects/{project_id}/locations/{location_id}/clusters/{cluster_id} where location_id refers to a GCP region.

Returns
TypeDescription
Cluster

getClusterCallable()

public final UnaryCallable<GetClusterRequest,Cluster> getClusterCallable()

Gets the details of a specific Redis cluster.

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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   GetClusterRequest request =
       GetClusterRequest.newBuilder()
           .setName(ClusterName.of("[PROJECT]", "[LOCATION]", "[CLUSTER]").toString())
           .build();
   ApiFuture<Cluster> future = cloudRedisClusterClient.getClusterCallable().futureCall(request);
   // Do something.
   Cluster response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<GetClusterRequest,Cluster>

getHttpJsonOperationsClient()

public final OperationsClient getHttpJsonOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
TypeDescription
OperationsClient

getLocation(GetLocationRequest request)

public final Location getLocation(GetLocationRequest request)

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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   Location response = cloudRedisClusterClient.getLocation(request);
 }
 
Parameter
NameDescription
requestcom.google.cloud.location.GetLocationRequest

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

Returns
TypeDescription
com.google.cloud.location.Location

getLocationCallable()

public final UnaryCallable<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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   GetLocationRequest request = GetLocationRequest.newBuilder().setName("name3373707").build();
   ApiFuture<Location> future =
       cloudRedisClusterClient.getLocationCallable().futureCall(request);
   // Do something.
   Location response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.GetLocationRequest,com.google.cloud.location.Location>

getOperationsClient()

public final OperationsClient getOperationsClient()

Returns the OperationsClient that can be used to query the status of a long-running operation returned by another API method call.

Returns
TypeDescription
OperationsClient

getSettings()

public final CloudRedisClusterSettings getSettings()
Returns
TypeDescription
CloudRedisClusterSettings

getStub()

public CloudRedisClusterStub getStub()
Returns
TypeDescription
CloudRedisClusterStub

isShutdown()

public boolean isShutdown()
Returns
TypeDescription
boolean

isTerminated()

public boolean isTerminated()
Returns
TypeDescription
boolean

listClusters(ListClustersRequest request)

public final CloudRedisClusterClient.ListClustersPagedResponse listClusters(ListClustersRequest request)

Lists all Redis clusters 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   ListClustersRequest request =
       ListClustersRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Cluster element : cloudRedisClusterClient.listClusters(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestListClustersRequest

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

Returns
TypeDescription
CloudRedisClusterClient.ListClustersPagedResponse

listClusters(LocationName parent)

public final CloudRedisClusterClient.ListClustersPagedResponse listClusters(LocationName parent)

Lists all Redis clusters 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
   for (Cluster element : cloudRedisClusterClient.listClusters(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentLocationName

Required. The resource name of the cluster location using the form: projects/{project_id}/locations/{location_id} where location_id refers to a GCP region.

Returns
TypeDescription
CloudRedisClusterClient.ListClustersPagedResponse

listClusters(String parent)

public final CloudRedisClusterClient.ListClustersPagedResponse listClusters(String parent)

Lists all Redis clusters 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString();
   for (Cluster element : cloudRedisClusterClient.listClusters(parent).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
parentString

Required. The resource name of the cluster location using the form: projects/{project_id}/locations/{location_id} where location_id refers to a GCP region.

Returns
TypeDescription
CloudRedisClusterClient.ListClustersPagedResponse

listClustersCallable()

public final UnaryCallable<ListClustersRequest,ListClustersResponse> listClustersCallable()

Lists all Redis clusters 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   ListClustersRequest request =
       ListClustersRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListClustersResponse response =
         cloudRedisClusterClient.listClustersCallable().call(request);
     for (Cluster element : response.getClustersList()) {
       // doThingsWith(element);
     }
     String nextPageToken = response.getNextPageToken();
     if (!Strings.isNullOrEmpty(nextPageToken)) {
       request = request.toBuilder().setPageToken(nextPageToken).build();
     } else {
       break;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListClustersRequest,ListClustersResponse>

listClustersPagedCallable()

public final UnaryCallable<ListClustersRequest,CloudRedisClusterClient.ListClustersPagedResponse> listClustersPagedCallable()

Lists all Redis clusters 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   ListClustersRequest request =
       ListClustersRequest.newBuilder()
           .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Cluster> future =
       cloudRedisClusterClient.listClustersPagedCallable().futureCall(request);
   // Do something.
   for (Cluster element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<ListClustersRequest,ListClustersPagedResponse>

listLocations(ListLocationsRequest request)

public final CloudRedisClusterClient.ListLocationsPagedResponse listLocations(ListLocationsRequest request)

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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   for (Location element : cloudRedisClusterClient.listLocations(request).iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Parameter
NameDescription
requestcom.google.cloud.location.ListLocationsRequest

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

Returns
TypeDescription
CloudRedisClusterClient.ListLocationsPagedResponse

listLocationsCallable()

public final UnaryCallable<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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   while (true) {
     ListLocationsResponse response =
         cloudRedisClusterClient.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;
     }
   }
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.ListLocationsRequest,com.google.cloud.location.ListLocationsResponse>

listLocationsPagedCallable()

public final UnaryCallable<ListLocationsRequest,CloudRedisClusterClient.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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   ListLocationsRequest request =
       ListLocationsRequest.newBuilder()
           .setName("name3373707")
           .setFilter("filter-1274492040")
           .setPageSize(883849137)
           .setPageToken("pageToken873572522")
           .build();
   ApiFuture<Location> future =
       cloudRedisClusterClient.listLocationsPagedCallable().futureCall(request);
   // Do something.
   for (Location element : future.get().iterateAll()) {
     // doThingsWith(element);
   }
 }
 
Returns
TypeDescription
UnaryCallable<com.google.cloud.location.ListLocationsRequest,ListLocationsPagedResponse>

shutdown()

public void shutdown()

shutdownNow()

public void shutdownNow()

updateClusterAsync(Cluster cluster, FieldMask updateMask)

public final OperationFuture<Cluster,Any> updateClusterAsync(Cluster cluster, FieldMask updateMask)

Updates the metadata and configuration of a specific Redis cluster.

Completed longrunning.Operation will contain the new cluster 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   Cluster cluster = Cluster.newBuilder().build();
   FieldMask updateMask = FieldMask.newBuilder().build();
   Cluster response = cloudRedisClusterClient.updateClusterAsync(cluster, updateMask).get();
 }
 
Parameters
NameDescription
clusterCluster

Required. Update description. Only fields specified in update_mask are updated.

updateMaskFieldMask

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 Cluster:

* size_gb * replica_count

Returns
TypeDescription
OperationFuture<Cluster,Any>

updateClusterAsync(UpdateClusterRequest request)

public final OperationFuture<Cluster,Any> updateClusterAsync(UpdateClusterRequest request)

Updates the metadata and configuration of a specific Redis cluster.

Completed longrunning.Operation will contain the new cluster 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   UpdateClusterRequest request =
       UpdateClusterRequest.newBuilder()
           .setUpdateMask(FieldMask.newBuilder().build())
           .setCluster(Cluster.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   Cluster response = cloudRedisClusterClient.updateClusterAsync(request).get();
 }
 
Parameter
NameDescription
requestUpdateClusterRequest

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

Returns
TypeDescription
OperationFuture<Cluster,Any>

updateClusterCallable()

public final UnaryCallable<UpdateClusterRequest,Operation> updateClusterCallable()

Updates the metadata and configuration of a specific Redis cluster.

Completed longrunning.Operation will contain the new cluster 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   UpdateClusterRequest request =
       UpdateClusterRequest.newBuilder()
           .setUpdateMask(FieldMask.newBuilder().build())
           .setCluster(Cluster.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   ApiFuture<Operation> future =
       cloudRedisClusterClient.updateClusterCallable().futureCall(request);
   // Do something.
   Operation response = future.get();
 }
 
Returns
TypeDescription
UnaryCallable<UpdateClusterRequest,Operation>

updateClusterOperationCallable()

public final OperationCallable<UpdateClusterRequest,Cluster,Any> updateClusterOperationCallable()

Updates the metadata and configuration of a specific Redis cluster.

Completed longrunning.Operation will contain the new cluster 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 (CloudRedisClusterClient cloudRedisClusterClient = CloudRedisClusterClient.create()) {
   UpdateClusterRequest request =
       UpdateClusterRequest.newBuilder()
           .setUpdateMask(FieldMask.newBuilder().build())
           .setCluster(Cluster.newBuilder().build())
           .setRequestId("requestId693933066")
           .build();
   OperationFuture<Cluster, Any> future =
       cloudRedisClusterClient.updateClusterOperationCallable().futureCall(request);
   // Do something.
   Cluster response = future.get();
 }
 
Returns
TypeDescription
OperationCallable<UpdateClusterRequest,Cluster,Any>