CloudRedisClient

CloudRedisClient

Configures and manages Cloud Memorystore for Redis instances

Google Cloud Memorystore for Redis v1beta1

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

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

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

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

Constructor

new CloudRedisClient(optionsopt)

Construct an instance of CloudRedisClient.

Parameters:
Name Type Attributes Description
options object <optional>

The configuration object. See the subsequent parameters for more details.

Properties
Name Type Attributes Description
credentials object <optional>

Credentials object.

Properties
Name Type Attributes Description
client_email string <optional>
private_key string <optional>
email string <optional>

Account email address. Required when using a .pem or .p12 keyFilename.

keyFilename string <optional>

Full path to the a .json, .pem, or .p12 key downloaded from the Google Developers Console. If you provide a path to a JSON file, the projectId option below is not necessary. NOTE: .pem and .p12 require you to specify options.email as well.

port number <optional>

The port on which to connect to the remote host.

projectId string <optional>

The project ID from the Google Developer's Console, e.g. 'grape-spaceship-123'. We will also check the environment variable GCLOUD_PROJECT for your project ID. If your app is running in an environment which supports Application Default Credentials, your project ID will be detected automatically.

apiEndpoint string <optional>

The domain name of the API remote host.

Members

(static) apiEndpoint

The DNS address for this API service - same as servicePath(), exists for compatibility reasons.

(static) port

The port for this API service.

(static) scopes

The scopes needed to make gRPC calls for every method defined in this service.

(static) servicePath

The DNS address for this API service.

Methods

(async) checkCreateInstanceProgress(name) → {Promise}

Check the status of the long running operation returned by the createInstance() method.

Parameters:
Name Type Description
name String

The operation name that will be passed.

(async) checkDeleteInstanceProgress(name) → {Promise}

Check the status of the long running operation returned by the deleteInstance() method.

Parameters:
Name Type Description
name String

The operation name that will be passed.

(async) checkExportInstanceProgress(name) → {Promise}

Check the status of the long running operation returned by the exportInstance() method.

Parameters:
Name Type Description
name String

The operation name that will be passed.

(async) checkFailoverInstanceProgress(name) → {Promise}

Check the status of the long running operation returned by the failoverInstance() method.

Parameters:
Name Type Description
name String

The operation name that will be passed.

(async) checkImportInstanceProgress(name) → {Promise}

Check the status of the long running operation returned by the importInstance() method.

Parameters:
Name Type Description
name String

The operation name that will be passed.

(async) checkUpdateInstanceProgress(name) → {Promise}

Check the status of the long running operation returned by the updateInstance() method.

Parameters:
Name Type Description
name String

The operation name that will be passed.

(async) checkUpgradeInstanceProgress(name) → {Promise}

Check the status of the long running operation returned by the upgradeInstance() method.

Parameters:
Name Type Description
name String

The operation name that will be passed.

close()

Terminate the GRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

createInstance(request, optionsopt) → {Promise}

Creates a Redis instance based on the specified tier and memory size.

By default, the instance is accessible from the project's default network.

The creation is executed asynchronously and callers may check the returned operation to track its progress. Once the operation is completed the Redis instance will be fully functional. Completed longrunning.Operation will contain the new instance object in the response field.

The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

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

instanceId string

Required. The logical name of the Redis instance 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-40 characters.
  • Must end with a number or a letter.
  • Must be unique within the customer project / location
instance google.cloud.redis.v1beta1.Instance

Required. A Redis [Instance] resource

options object <optional>

Call options. See CallOptions for more details.

deleteInstance(request, optionsopt) → {Promise}

Deletes a specific Redis instance. Instance stops serving and data is deleted.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. Redis instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region.

options object <optional>

Call options. See CallOptions for more details.

exportInstance(request, optionsopt) → {Promise}

Export Redis instance data into a Redis RDB format file in Cloud Storage.

Redis will continue serving during this operation.

The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. Redis instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region.

outputConfig google.cloud.redis.v1beta1.OutputConfig

Required. Specify data to be exported.

options object <optional>

Call options. See CallOptions for more details.

failoverInstance(request, optionsopt) → {Promise}

Initiates a failover of the master node to current replica node for a specific STANDARD tier Cloud Memorystore for Redis instance.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Attributes Description
name string

Required. Redis instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region.

dataProtectionMode google.cloud.redis.v1beta1.FailoverInstanceRequest.DataProtectionMode <optional>

Optional. Available data protection modes that the user can choose. If it's unspecified, data protection mode will be LIMITED_DATA_LOSS by default.

options object <optional>

Call options. See CallOptions for more details.

getInstance(request, optionsopt) → {Promise}

Gets the details of a specific Redis instance.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. Redis instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region.

options object <optional>

Call options. See CallOptions for more details.

getProjectId(callback)

Return the project ID used by this class.

Parameters:
Name Type Description
callback function

the callback to be called with the current project Id.

importInstance(request, optionsopt) → {Promise}

Import a Redis RDB snapshot file from Cloud Storage into a Redis instance.

Redis may stop serving during this operation. Instance state will be IMPORTING for entire operation. When complete, the instance will contain only data from the imported file.

The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. Redis instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region.

inputConfig google.cloud.redis.v1beta1.InputConfig

Required. Specify data to be imported.

options object <optional>

Call options. See CallOptions for more details.

initialize() → {Promise}

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

instancePath(project, location, instance) → {string}

Return a fully-qualified instance resource name string.

Parameters:
Name Type Description
project string
location string
instance string

listInstances(request, optionsopt) → {Promise}

Lists all Redis instances owned by a project in either the specified location (region) or all locations.

The location should have the following format:

  • projects/{project_id}/locations/{location_id}

If location_id is specified as - (wildcard), then all regions available to the project are queried, and the results are aggregated.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

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

pageSize number

The maximum number of items to return.

If not specified, a default value of 1000 will be used by the service. Regardless of the page_size value, the response may include a partial list and a caller should only rely on response's next_page_token to determine if there are more instances left to be queried.

pageToken string

The next_page_token value returned from a previous ListInstances request, if any.

options object <optional>

Call options. See CallOptions for more details.

listInstancesAsync(request, optionsopt) → {Object}

Equivalent to listInstances, but returns an iterable object.

for-await-of syntax is used with the iterable to recursively get response element on-demand.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

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

pageSize number

The maximum number of items to return.

If not specified, a default value of 1000 will be used by the service. Regardless of the page_size value, the response may include a partial list and a caller should only rely on response's next_page_token to determine if there are more instances left to be queried.

pageToken string

The next_page_token value returned from a previous ListInstances request, if any.

options object <optional>

Call options. See CallOptions for more details.

listInstancesStream(request, optionsopt) → {Stream}

Equivalent to listInstances, but returns a NodeJS Stream object.

This fetches the paged responses for listInstances continuously and invokes the callback registered for 'data' event for each element in the responses.

The returned object has 'end' method when no more elements are required.

autoPaginate option will be ignored.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
parent string

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

pageSize number

The maximum number of items to return.

If not specified, a default value of 1000 will be used by the service. Regardless of the page_size value, the response may include a partial list and a caller should only rely on response's next_page_token to determine if there are more instances left to be queried.

pageToken string

The next_page_token value returned from a previous ListInstances request, if any.

options object <optional>

Call options. See CallOptions for more details.

See:

locationPath(project, location) → {string}

Return a fully-qualified location resource name string.

Parameters:
Name Type Description
project string
location string

matchInstanceFromInstanceName(instanceName) → {string}

Parse the instance from Instance resource.

Parameters:
Name Type Description
instanceName string

A fully-qualified path representing Instance resource.

matchLocationFromInstanceName(instanceName) → {string}

Parse the location from Instance resource.

Parameters:
Name Type Description
instanceName string

A fully-qualified path representing Instance resource.

matchLocationFromLocationName(locationName) → {string}

Parse the location from Location resource.

Parameters:
Name Type Description
locationName string

A fully-qualified path representing Location resource.

matchProjectFromInstanceName(instanceName) → {string}

Parse the project from Instance resource.

Parameters:
Name Type Description
instanceName string

A fully-qualified path representing Instance resource.

matchProjectFromLocationName(locationName) → {string}

Parse the project from Location resource.

Parameters:
Name Type Description
locationName string

A fully-qualified path representing Location resource.

updateInstance(request, optionsopt) → {Promise}

Updates the metadata and configuration of a specific Redis instance.

Completed longrunning.Operation will contain the new instance object in the response field. The returned operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
updateMask google.protobuf.FieldMask

Required. Mask of fields to update. At least one path must be supplied in this field. The elements of the repeated paths field may only include these fields from Instance:

  • displayName
  • labels
  • memorySizeGb
  • redisConfig
instance google.cloud.redis.v1beta1.Instance

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

options object <optional>

Call options. See CallOptions for more details.

upgradeInstance(request, optionsopt) → {Promise}

Upgrades Redis instance to the newer Redis version specified in the request.

Parameters:
Name Type Attributes Description
request Object

The request object that will be sent.

Properties
Name Type Description
name string

Required. Redis instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region.

redisVersion string

Required. Specifies the target version of Redis software to upgrade to.

options object <optional>

Call options. See CallOptions for more details.