Google Cloud Memorystore for Redis V1BETA1 API - Class Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client (v0.1.1)

Reference documentation and code samples for the Google Cloud Memorystore for Redis V1BETA1 API class Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.

REST client for the CloudRedisCluster service.

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

Inherits

  • Object

Methods

.configure

def self.configure() { |config| ... } -> Client::Configuration

Configure the CloudRedisCluster Client class.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter
Example
# Modify the configuration for all CloudRedisCluster clients
::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.configure do |config|
  config.timeout = 10.0
end

#configure

def configure() { |config| ... } -> Client::Configuration

Configure the CloudRedisCluster Client instance.

The configuration is set to the derived mode, meaning that values can be changed, but structural changes (adding new fields, etc.) are not allowed. Structural changes should be made on Client.configure.

See Configuration for a description of the configuration fields.

Yields
  • (config) — Configure the Client client.
Yield Parameter

#create_cluster

def create_cluster(request, options = nil) -> ::Gapic::Operation
def create_cluster(parent: nil, cluster_id: nil, cluster: nil, request_id: nil) -> ::Gapic::Operation

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.

Overloads
def create_cluster(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_cluster via a request object, either of type Google::Cloud::Redis::Cluster::V1beta1::CreateClusterRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Redis::Cluster::V1beta1::CreateClusterRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def create_cluster(parent: nil, cluster_id: nil, cluster: nil, request_id: nil) -> ::Gapic::Operation
Pass arguments to create_cluster via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — 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.
  • cluster_id (::String) —

    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
  • cluster (::Google::Cloud::Redis::Cluster::V1beta1::Cluster, ::Hash) — Required. The cluster that is to be created.
  • request_id (::String) — Idempotent request UUID.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/redis/cluster/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::Cluster::V1beta1::CreateClusterRequest.new

# Call the create_cluster method.
result = client.create_cluster request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#delete_cluster

def delete_cluster(request, options = nil) -> ::Gapic::Operation
def delete_cluster(name: nil, request_id: nil) -> ::Gapic::Operation

Deletes a specific Redis cluster. Cluster stops serving and data is deleted.

Overloads
def delete_cluster(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_cluster via a request object, either of type DeleteClusterRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Redis::Cluster::V1beta1::DeleteClusterRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def delete_cluster(name: nil, request_id: nil) -> ::Gapic::Operation
Pass arguments to delete_cluster via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • name (::String) — 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.
  • request_id (::String) — Idempotent request UUID.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/redis/cluster/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::Cluster::V1beta1::DeleteClusterRequest.new

# Call the delete_cluster method.
result = client.delete_cluster request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end

#get_cluster

def get_cluster(request, options = nil) -> ::Google::Cloud::Redis::Cluster::V1beta1::Cluster
def get_cluster(name: nil) -> ::Google::Cloud::Redis::Cluster::V1beta1::Cluster

Gets the details of a specific Redis cluster.

Overloads
def get_cluster(request, options = nil) -> ::Google::Cloud::Redis::Cluster::V1beta1::Cluster
Pass arguments to get_cluster via a request object, either of type GetClusterRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Redis::Cluster::V1beta1::GetClusterRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def get_cluster(name: nil) -> ::Google::Cloud::Redis::Cluster::V1beta1::Cluster
Pass arguments to get_cluster via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — 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.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/redis/cluster/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::Cluster::V1beta1::GetClusterRequest.new

# Call the get_cluster method.
result = client.get_cluster request

# The returned object is of type Google::Cloud::Redis::Cluster::V1beta1::Cluster.
p result

#get_cluster_certificate_authority

def get_cluster_certificate_authority(request, options = nil) -> ::Google::Cloud::Redis::Cluster::V1beta1::CertificateAuthority
def get_cluster_certificate_authority(name: nil) -> ::Google::Cloud::Redis::Cluster::V1beta1::CertificateAuthority

Gets the details of certificate authority information for Redis cluster.

Overloads
def get_cluster_certificate_authority(request, options = nil) -> ::Google::Cloud::Redis::Cluster::V1beta1::CertificateAuthority
Pass arguments to get_cluster_certificate_authority via a request object, either of type GetClusterCertificateAuthorityRequest or an equivalent Hash.
Parameters
def get_cluster_certificate_authority(name: nil) -> ::Google::Cloud::Redis::Cluster::V1beta1::CertificateAuthority
Pass arguments to get_cluster_certificate_authority via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameter
  • name (::String) — Required. Redis cluster certificate authority resource name using the form: projects/{project_id}/locations/{location_id}/clusters/{cluster_id}/certificateAuthority where location_id refers to a GCP region.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/redis/cluster/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::Cluster::V1beta1::GetClusterCertificateAuthorityRequest.new

# Call the get_cluster_certificate_authority method.
result = client.get_cluster_certificate_authority request

# The returned object is of type Google::Cloud::Redis::Cluster::V1beta1::CertificateAuthority.
p result

#initialize

def initialize() { |config| ... } -> Client

Create a new CloudRedisCluster REST client object.

Yields
  • (config) — Configure the CloudRedisCluster client.
Yield Parameter
Returns
  • (Client) — a new instance of Client
Example
# Create a client using the default configuration
client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new

# Create a client using a custom configuration
client = ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new do |config|
  config.timeout = 10.0
end

#list_clusters

def list_clusters(request, options = nil) -> ::Google::Cloud::Redis::Cluster::V1beta1::ListClustersResponse
def list_clusters(parent: nil, page_size: nil, page_token: nil) -> ::Google::Cloud::Redis::Cluster::V1beta1::ListClustersResponse

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.

Overloads
def list_clusters(request, options = nil) -> ::Google::Cloud::Redis::Cluster::V1beta1::ListClustersResponse
Pass arguments to list_clusters via a request object, either of type ListClustersRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Redis::Cluster::V1beta1::ListClustersRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def list_clusters(parent: nil, page_size: nil, page_token: nil) -> ::Google::Cloud::Redis::Cluster::V1beta1::ListClustersResponse
Pass arguments to list_clusters via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • parent (::String) — 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.
  • page_size (::Integer) — 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 clusters left to be queried.

  • page_token (::String) — The next_page_token value returned from a previous [ListClusters][CloudRedis.ListClusters] request, if any.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/redis/cluster/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::Cluster::V1beta1::ListClustersRequest.new

# Call the list_clusters method.
result = client.list_clusters request

# The returned object is of type Gapic::PagedEnumerable. You can iterate
# over elements, and API calls will be issued to fetch pages as needed.
result.each do |item|
  # Each element is of type ::Google::Cloud::Redis::Cluster::V1beta1::Cluster.
  p item
end

#location_client

def location_client() -> Google::Cloud::Location::Locations::Rest::Client

Get the associated client for mix-in of the Locations.

Returns
  • (Google::Cloud::Location::Locations::Rest::Client)

#operations_client

def operations_client() -> ::Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Operations

Get the associated client for long-running operations.

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_cluster

def update_cluster(request, options = nil) -> ::Gapic::Operation
def update_cluster(update_mask: nil, cluster: nil, request_id: nil) -> ::Gapic::Operation

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.

Overloads
def update_cluster(request, options = nil) -> ::Gapic::Operation
Pass arguments to update_cluster via a request object, either of type UpdateClusterRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Redis::Cluster::V1beta1::UpdateClusterRequest, ::Hash) — A request object representing the call parameters. Required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash.
  • options (::Gapic::CallOptions, ::Hash) — Overrides the default settings for this call, e.g, timeout, retries etc. Optional.
def update_cluster(update_mask: nil, cluster: nil, request_id: nil) -> ::Gapic::Operation
Pass arguments to update_cluster via keyword arguments. Note that at least one keyword argument is required. To specify no parameters, or to keep all the default parameter values, pass an empty Hash as a request object (see above).
Parameters
  • update_mask (::Google::Protobuf::FieldMask, ::Hash) —

    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
  • cluster (::Google::Cloud::Redis::Cluster::V1beta1::Cluster, ::Hash) — Required. Update description. Only fields specified in update_mask are updated.
  • request_id (::String) — Idempotent request UUID.
Yields
  • (result, operation) — Access the result along with the TransportOperation object
Yield Parameters
  • result (::Gapic::Operation)
  • operation (::Gapic::Rest::TransportOperation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/redis/cluster/v1beta1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Redis::Cluster::V1beta1::CloudRedisCluster::Rest::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::Cluster::V1beta1::UpdateClusterRequest.new

# Call the update_cluster method.
result = client.update_cluster request

# The returned object is of type Gapic::Operation. You can use it to
# check the status of an operation, cancel it, or wait for results.
# Here is how to wait for a response.
result.wait_until_done! timeout: 60
if result.response?
  p result.response
else
  puts "No response received."
end