GitHub Repository | Product 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().
Method | Description | Method Variants |
---|---|---|
ListClusters | Lists all Redis clusters 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.
|
GetCluster | Gets the details of a specific Redis cluster. |
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.
|
UpdateCluster | 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. |
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.
|
DeleteCluster | Deletes a specific Redis cluster. Cluster 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.
|
CreateCluster | 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. |
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 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.
Static Methods
create()
public static final CloudRedisClusterClient create()
Constructs an instance of CloudRedisClusterClient with default settings.
Returns | |
---|---|
Type | Description |
CloudRedisClusterClient |
Exceptions | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
settings | CloudRedisClusterSettings |
Returns | |
---|---|
Type | Description |
CloudRedisClusterClient |
Exceptions | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
stub | CloudRedisClusterStub |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
settings | CloudRedisClusterSettings |
CloudRedisClusterClient(CloudRedisClusterStub stub)
protected CloudRedisClusterClient(CloudRedisClusterStub stub)
Parameter | |
---|---|
Name | Description |
stub | CloudRedisClusterStub |
Methods
awaitTermination(long duration, TimeUnit unit)
public boolean awaitTermination(long duration, TimeUnit unit)
Parameters | |
---|---|
Name | Description |
duration | long |
unit | TimeUnit |
Returns | |
---|---|
Type | Description |
boolean |
Exceptions | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
request | CreateClusterRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
parent | LocationName Required. The resource name of the cluster location using the form:
|
cluster | Cluster Required. The cluster that is to be created. |
clusterId | String Required. The logical name of the Redis cluster in the customer project with the following restrictions:
|
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
parent | String Required. The resource name of the cluster location using the form:
|
cluster | Cluster Required. The cluster that is to be created. |
clusterId | String Required. The logical name of the Redis cluster in the customer project with the following restrictions:
|
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
name | ClusterName Required. Redis cluster resource name using the form:
|
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
request | DeleteClusterRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
name | String Required. Redis cluster resource name using the form:
|
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
name | ClusterName Required. Redis cluster resource name using the form:
|
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
request | GetClusterRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
name | String Required. Redis cluster resource name using the form:
|
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
request | com.google.cloud.location.GetLocationRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
OperationsClient |
getSettings()
public final CloudRedisClusterSettings getSettings()
Returns | |
---|---|
Type | Description |
CloudRedisClusterSettings |
getStub()
public CloudRedisClusterStub getStub()
Returns | |
---|---|
Type | Description |
CloudRedisClusterStub |
isShutdown()
public boolean isShutdown()
Returns | |
---|---|
Type | Description |
boolean |
isTerminated()
public boolean isTerminated()
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
request | ListClustersRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
parent | LocationName Required. The resource name of the cluster location using the form:
|
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
parent | String Required. The resource name of the cluster location using the form:
|
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
request | com.google.cloud.location.ListLocationsRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
cluster | Cluster Required. Update description. Only fields specified in update_mask are updated. |
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 Cluster: * |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Name | Description |
request | UpdateClusterRequest The request object containing all of the parameters for the API call. |
Returns | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
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 | |
---|---|
Type | Description |
OperationCallable<UpdateClusterRequest,Cluster,Any> |