Package com.google.cloud.redis.v1 (2.2.0)

A client to Google Cloud Memorystore for Redis API

The interfaces provided are listed below, along with usage samples.

CloudRedisClient

Service Description: Configures and manages Cloud Memorystore for Redis instances

Google Cloud Memorystore for Redis v1

Theredis.googleapis.com service implements the Google Cloud Memorystore for Redis API and defines the following resource model for managing Redis instances:

  • The service works with a collection of cloud projects, named:/projects/*
  • Each project has a collection of available locations, named:/locations/*
  • Each location has a collection of Redis instances, named:/instances/*
  • As such, Redis instances are resources of the form:/projects/{project_id}/locations/{location_id}/instances/{instance_id}

Note that location_id must be referring to a GCPregion; for example:

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

Sample for CloudRedisClient:

try(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){InstanceNamename=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]");Instanceresponse=cloudRedisClient.getInstance(name);}

Classes

CloudRedisClient

Service Description: Configures and manages Cloud Memorystore for Redis instances

Google Cloud Memorystore for Redis v1

Theredis.googleapis.com service implements the Google Cloud Memorystore for Redis API and defines the following resource model for managing Redis instances:

  • The service works with a collection of cloud projects, named:/projects/*
  • Each project has a collection of available locations, named:/locations/*
  • Each location has a collection of Redis instances, named:/instances/*
  • As such, Redis instances are resources of the form:/projects/{project_id}/locations/{location_id}/instances/{instance_id}

Note that location_id must be referring to a GCPregion; for example:

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

This class provides the ability to make remote calls to the backing service through method calls that map to API methods. Sample code to get started:

try(CloudRedisClientcloudRedisClient=CloudRedisClient.create()){InstanceNamename=InstanceName.of("[PROJECT]","[LOCATION]","[INSTANCE]");Instanceresponse=cloudRedisClient.getInstance(name);}

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

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 CloudRedisSettings to create(). For example:

To customize credentials:

CloudRedisSettingscloudRedisSettings=CloudRedisSettings.newBuilder().setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)).build();CloudRedisClientcloudRedisClient=CloudRedisClient.create(cloudRedisSettings);

To customize the endpoint:

CloudRedisSettingscloudRedisSettings=CloudRedisSettings.newBuilder().setEndpoint(myEndpoint).build();CloudRedisClientcloudRedisClient=CloudRedisClient.create(cloudRedisSettings);

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

CloudRedisClient.ListInstancesFixedSizeCollection

CloudRedisClient.ListInstancesPage

CloudRedisClient.ListInstancesPagedResponse

CloudRedisGrpc

Configures and manages Cloud Memorystore for Redis instances Google Cloud Memorystore for Redis v1 Theredis.googleapis.com service implements the Google Cloud Memorystore for Redis API and defines the following resource model for managing Redis instances:

  • The service works with a collection of cloud projects, named:/projects/*
  • Each project has a collection of available locations, named:/locations/*
  • Each location has a collection of Redis instances, named:/instances/*
  • As such, Redis instances are resources of the form:/projects/{project_id}/locations/{location_id}/instances/{instance_id}Note that location_id must be referring to a GCPregion; for example:
  • projects/redpepper-1290/locations/us-central1/instances/my-redis

CloudRedisGrpc.CloudRedisBlockingStub

Configures and manages Cloud Memorystore for Redis instances Google Cloud Memorystore for Redis v1 Theredis.googleapis.com service implements the Google Cloud Memorystore for Redis API and defines the following resource model for managing Redis instances:

  • The service works with a collection of cloud projects, named:/projects/*
  • Each project has a collection of available locations, named:/locations/*
  • Each location has a collection of Redis instances, named:/instances/*
  • As such, Redis instances are resources of the form:/projects/{project_id}/locations/{location_id}/instances/{instance_id}Note that location_id must be referring to a GCPregion; for example:
  • projects/redpepper-1290/locations/us-central1/instances/my-redis

CloudRedisGrpc.CloudRedisFutureStub

Configures and manages Cloud Memorystore for Redis instances Google Cloud Memorystore for Redis v1 Theredis.googleapis.com service implements the Google Cloud Memorystore for Redis API and defines the following resource model for managing Redis instances:

  • The service works with a collection of cloud projects, named:/projects/*
  • Each project has a collection of available locations, named:/locations/*
  • Each location has a collection of Redis instances, named:/instances/*
  • As such, Redis instances are resources of the form:/projects/{project_id}/locations/{location_id}/instances/{instance_id}Note that location_id must be referring to a GCPregion; for example:
  • projects/redpepper-1290/locations/us-central1/instances/my-redis

CloudRedisGrpc.CloudRedisImplBase

Configures and manages Cloud Memorystore for Redis instances Google Cloud Memorystore for Redis v1 Theredis.googleapis.com service implements the Google Cloud Memorystore for Redis API and defines the following resource model for managing Redis instances:

  • The service works with a collection of cloud projects, named:/projects/*
  • Each project has a collection of available locations, named:/locations/*
  • Each location has a collection of Redis instances, named:/instances/*
  • As such, Redis instances are resources of the form:/projects/{project_id}/locations/{location_id}/instances/{instance_id}Note that location_id must be referring to a GCPregion; for example:
  • projects/redpepper-1290/locations/us-central1/instances/my-redis

CloudRedisGrpc.CloudRedisStub

Configures and manages Cloud Memorystore for Redis instances Google Cloud Memorystore for Redis v1 Theredis.googleapis.com service implements the Google Cloud Memorystore for Redis API and defines the following resource model for managing Redis instances:

  • The service works with a collection of cloud projects, named:/projects/*
  • Each project has a collection of available locations, named:/locations/*
  • Each location has a collection of Redis instances, named:/instances/*
  • As such, Redis instances are resources of the form:/projects/{project_id}/locations/{location_id}/instances/{instance_id}Note that location_id must be referring to a GCPregion; for example:
  • projects/redpepper-1290/locations/us-central1/instances/my-redis

CloudRedisServiceV1Proto

CloudRedisSettings

Settings class to configure an instance ofCloudRedisClient.

The default instance has everything set to sensible defaults:

  • The default service address (redis.googleapis.com) and default port (443) are used.
  • Credentials are acquired automatically through Application Default Credentials.
  • Retries are configured for idempotent methods but not for non-idempotent methods.

The builder of this class is recursive, so contained classes are themselves builders. When build() is called, the tree of builders is called to create the complete settings object.

For example, to set the total timeout of getInstance to 30 seconds:

CloudRedisSettings.BuildercloudRedisSettingsBuilder=CloudRedisSettings.newBuilder();cloudRedisSettingsBuilder.getInstanceSettings().setRetrySettings(cloudRedisSettingsBuilder.getInstanceSettings().getRetrySettings().toBuilder().setTotalTimeout(Duration.ofSeconds(30)).build());CloudRedisSettingscloudRedisSettings=cloudRedisSettingsBuilder.build();

CloudRedisSettings.Builder

Builder for CloudRedisSettings.

CreateInstanceRequest

Request forCreateInstance.

Protobuf typegoogle.cloud.redis.v1.CreateInstanceRequest

CreateInstanceRequest.Builder

Request forCreateInstance.

Protobuf typegoogle.cloud.redis.v1.CreateInstanceRequest

DeleteInstanceRequest

Request forDeleteInstance.

Protobuf typegoogle.cloud.redis.v1.DeleteInstanceRequest

DeleteInstanceRequest.Builder

Request forDeleteInstance.

Protobuf typegoogle.cloud.redis.v1.DeleteInstanceRequest

ExportInstanceRequest

Request forExport.

Protobuf typegoogle.cloud.redis.v1.ExportInstanceRequest

ExportInstanceRequest.Builder

Request forExport.

Protobuf typegoogle.cloud.redis.v1.ExportInstanceRequest

FailoverInstanceRequest

Request forFailover.

Protobuf typegoogle.cloud.redis.v1.FailoverInstanceRequest

FailoverInstanceRequest.Builder

Request forFailover.

Protobuf typegoogle.cloud.redis.v1.FailoverInstanceRequest

GcsDestination

The Cloud Storage location for the output content

Protobuf typegoogle.cloud.redis.v1.GcsDestination

GcsDestination.Builder

The Cloud Storage location for the output content

Protobuf typegoogle.cloud.redis.v1.GcsDestination

GcsSource

The Cloud Storage location for the input content

Protobuf typegoogle.cloud.redis.v1.GcsSource

GcsSource.Builder

The Cloud Storage location for the input content

Protobuf typegoogle.cloud.redis.v1.GcsSource

GetInstanceRequest

Request forGetInstance.

Protobuf typegoogle.cloud.redis.v1.GetInstanceRequest

GetInstanceRequest.Builder

Request forGetInstance.

Protobuf typegoogle.cloud.redis.v1.GetInstanceRequest

ImportInstanceRequest

Request forImport.

Protobuf typegoogle.cloud.redis.v1.ImportInstanceRequest

ImportInstanceRequest.Builder

Request forImport.

Protobuf typegoogle.cloud.redis.v1.ImportInstanceRequest

InputConfig

The input content

Protobuf typegoogle.cloud.redis.v1.InputConfig

InputConfig.Builder

The input content

Protobuf typegoogle.cloud.redis.v1.InputConfig

Instance

A Google Cloud Redis instance.

Protobuf typegoogle.cloud.redis.v1.Instance

Instance.Builder

A Google Cloud Redis instance.

Protobuf typegoogle.cloud.redis.v1.Instance

InstanceName

InstanceName.Builder

Builder for projects/{project}/locations/{location}/instances/{instance}.

ListInstancesRequest

Request forListInstances.

Protobuf typegoogle.cloud.redis.v1.ListInstancesRequest

ListInstancesRequest.Builder

Request forListInstances.

Protobuf typegoogle.cloud.redis.v1.ListInstancesRequest

ListInstancesResponse

Response forListInstances.

Protobuf typegoogle.cloud.redis.v1.ListInstancesResponse

ListInstancesResponse.Builder

Response forListInstances.

Protobuf typegoogle.cloud.redis.v1.ListInstancesResponse

LocationMetadata

This location metadata represents additional configuration options for a given location where a Redis instance may be created. All fields are output only. It is returned as content of thegoogle.cloud.location.Location.metadata field.

Protobuf typegoogle.cloud.redis.v1.LocationMetadata

LocationMetadata.Builder

This location metadata represents additional configuration options for a given location where a Redis instance may be created. All fields are output only. It is returned as content of thegoogle.cloud.location.Location.metadata field.

Protobuf typegoogle.cloud.redis.v1.LocationMetadata

LocationName

LocationName.Builder

Builder for projects/{project}/locations/{location}.

NodeInfo

Node specific properties.

Protobuf typegoogle.cloud.redis.v1.NodeInfo

NodeInfo.Builder

Node specific properties.

Protobuf typegoogle.cloud.redis.v1.NodeInfo

OperationMetadata

Represents the v1 metadata of the long-running operation.

Protobuf typegoogle.cloud.redis.v1.OperationMetadata

OperationMetadata.Builder

Represents the v1 metadata of the long-running operation.

Protobuf typegoogle.cloud.redis.v1.OperationMetadata

OutputConfig

The output content

Protobuf typegoogle.cloud.redis.v1.OutputConfig

OutputConfig.Builder

The output content

Protobuf typegoogle.cloud.redis.v1.OutputConfig

UpdateInstanceRequest

Request forUpdateInstance.

Protobuf typegoogle.cloud.redis.v1.UpdateInstanceRequest

UpdateInstanceRequest.Builder

Request forUpdateInstance.

Protobuf typegoogle.cloud.redis.v1.UpdateInstanceRequest

UpgradeInstanceRequest

Request forUpgradeInstance.

Protobuf typegoogle.cloud.redis.v1.UpgradeInstanceRequest

UpgradeInstanceRequest.Builder

Request forUpgradeInstance.

Protobuf typegoogle.cloud.redis.v1.UpgradeInstanceRequest

ZoneMetadata

Defines specific information for a particular zone. Currently empty and reserved for future use only.

Protobuf typegoogle.cloud.redis.v1.ZoneMetadata

ZoneMetadata.Builder

Defines specific information for a particular zone. Currently empty and reserved for future use only.

Protobuf typegoogle.cloud.redis.v1.ZoneMetadata

Interfaces

CreateInstanceRequestOrBuilder

DeleteInstanceRequestOrBuilder

ExportInstanceRequestOrBuilder

FailoverInstanceRequestOrBuilder

GcsDestinationOrBuilder

GcsSourceOrBuilder

GetInstanceRequestOrBuilder

ImportInstanceRequestOrBuilder

InputConfigOrBuilder

InstanceOrBuilder

ListInstancesRequestOrBuilder

ListInstancesResponseOrBuilder

LocationMetadataOrBuilder

NodeInfoOrBuilder

OperationMetadataOrBuilder

OutputConfigOrBuilder

UpdateInstanceRequestOrBuilder

UpgradeInstanceRequestOrBuilder

ZoneMetadataOrBuilder

Enums

FailoverInstanceRequest.DataProtectionMode

Specifies different modes of operation in relation to the data retention.

Protobuf enumgoogle.cloud.redis.v1.FailoverInstanceRequest.DataProtectionMode

InputConfig.SourceCase

Instance.ConnectMode

Available connection modes.

Protobuf enumgoogle.cloud.redis.v1.Instance.ConnectMode

Instance.ReadReplicasMode

Read replicas mode.

Protobuf enumgoogle.cloud.redis.v1.Instance.ReadReplicasMode

Instance.State

Represents the different states of a Redis instance.

Protobuf enumgoogle.cloud.redis.v1.Instance.State

Instance.Tier

Available service tiers to choose from

Protobuf enumgoogle.cloud.redis.v1.Instance.Tier

OutputConfig.DestinationCase

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-10-30 UTC.