Google Cloud Memorystore for Redis V1 API - Class Google::Cloud::Redis::V1::CloudRedis::Client (v0.9.0)

Reference documentation and code samples for the Google Cloud Memorystore for Redis V1 API class Google::Cloud::Redis::V1::CloudRedis::Client.

Client for the CloudRedis service.

Configures and manages Cloud Memorystore for Redis instances

Google Cloud Memorystore for Redis v1

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 referring to a GCP region; for example:

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

Inherits

  • Object

Methods

.configure

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

Configure the CloudRedis 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 CloudRedis clients
::Google::Cloud::Redis::V1::CloudRedis::Client.configure do |config|
  config.timeout = 10.0
end

#configure

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

Configure the CloudRedis 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_instance

def create_instance(request, options = nil) -> ::Gapic::Operation
def create_instance(parent: nil, instance_id: nil, instance: nil) -> ::Gapic::Operation

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.

Overloads
def create_instance(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_instance via a request object, either of type Google::Cloud::Redis::V1::CreateInstanceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Redis::V1::CreateInstanceRequest, ::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_instance(parent: nil, instance_id: nil, instance: nil) -> ::Gapic::Operation
Pass arguments to create_instance 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 instance location using the form: projects/{project_id}/locations/{location_id} where location_id refers to a GCP region.
  • instance_id (::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::V1::Instance, ::Hash) — Required. A Redis [Instance] resource
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/redis/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Redis::V1::CloudRedis::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1::CreateInstanceRequest.new

# Call the create_instance method.
result = client.create_instance 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_instance

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

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

Overloads
def delete_instance(request, options = nil) -> ::Gapic::Operation
Pass arguments to delete_instance via a request object, either of type DeleteInstanceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Redis::V1::DeleteInstanceRequest, ::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_instance(name: nil) -> ::Gapic::Operation
Pass arguments to delete_instance 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 instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/redis/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Redis::V1::CloudRedis::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1::DeleteInstanceRequest.new

# Call the delete_instance method.
result = client.delete_instance 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

#export_instance

def export_instance(request, options = nil) -> ::Gapic::Operation
def export_instance(name: nil, output_config: nil) -> ::Gapic::Operation

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.

Overloads
def export_instance(request, options = nil) -> ::Gapic::Operation
Pass arguments to export_instance via a request object, either of type ExportInstanceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Redis::V1::ExportInstanceRequest, ::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 export_instance(name: nil, output_config: nil) -> ::Gapic::Operation
Pass arguments to export_instance 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 instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region.
  • output_config (::Google::Cloud::Redis::V1::OutputConfig, ::Hash) — Required. Specify data to be exported.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/redis/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Redis::V1::CloudRedis::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1::ExportInstanceRequest.new

# Call the export_instance method.
result = client.export_instance 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

#failover_instance

def failover_instance(request, options = nil) -> ::Gapic::Operation
def failover_instance(name: nil, data_protection_mode: nil) -> ::Gapic::Operation

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

Overloads
def failover_instance(request, options = nil) -> ::Gapic::Operation
Pass arguments to failover_instance via a request object, either of type FailoverInstanceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Redis::V1::FailoverInstanceRequest, ::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 failover_instance(name: nil, data_protection_mode: nil) -> ::Gapic::Operation
Pass arguments to failover_instance 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 instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region.
  • data_protection_mode (::Google::Cloud::Redis::V1::FailoverInstanceRequest::DataProtectionMode) — Optional. Available data protection modes that the user can choose. If it's unspecified, data protection mode will be LIMITED_DATA_LOSS by default.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/redis/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Redis::V1::CloudRedis::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1::FailoverInstanceRequest.new

# Call the failover_instance method.
result = client.failover_instance 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_instance

def get_instance(request, options = nil) -> ::Google::Cloud::Redis::V1::Instance
def get_instance(name: nil) -> ::Google::Cloud::Redis::V1::Instance

Gets the details of a specific Redis instance.

Overloads
def get_instance(request, options = nil) -> ::Google::Cloud::Redis::V1::Instance
Pass arguments to get_instance via a request object, either of type GetInstanceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Redis::V1::GetInstanceRequest, ::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_instance(name: nil) -> ::Google::Cloud::Redis::V1::Instance
Pass arguments to get_instance 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 instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/redis/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Redis::V1::CloudRedis::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1::GetInstanceRequest.new

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

# The returned object is of type Google::Cloud::Redis::V1::Instance.
p result

#get_instance_auth_string

def get_instance_auth_string(request, options = nil) -> ::Google::Cloud::Redis::V1::InstanceAuthString
def get_instance_auth_string(name: nil) -> ::Google::Cloud::Redis::V1::InstanceAuthString

Gets the AUTH string for a Redis instance. If AUTH is not enabled for the instance the response will be empty. This information is not included in the details returned to GetInstance.

Overloads
def get_instance_auth_string(request, options = nil) -> ::Google::Cloud::Redis::V1::InstanceAuthString
Pass arguments to get_instance_auth_string via a request object, either of type GetInstanceAuthStringRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Redis::V1::GetInstanceAuthStringRequest, ::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_instance_auth_string(name: nil) -> ::Google::Cloud::Redis::V1::InstanceAuthString
Pass arguments to get_instance_auth_string 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 instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/redis/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Redis::V1::CloudRedis::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1::GetInstanceAuthStringRequest.new

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

# The returned object is of type Google::Cloud::Redis::V1::InstanceAuthString.
p result

#import_instance

def import_instance(request, options = nil) -> ::Gapic::Operation
def import_instance(name: nil, input_config: nil) -> ::Gapic::Operation

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.

Overloads
def import_instance(request, options = nil) -> ::Gapic::Operation
Pass arguments to import_instance via a request object, either of type ImportInstanceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Redis::V1::ImportInstanceRequest, ::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 import_instance(name: nil, input_config: nil) -> ::Gapic::Operation
Pass arguments to import_instance 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 instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region.
  • input_config (::Google::Cloud::Redis::V1::InputConfig, ::Hash) — Required. Specify data to be imported.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/redis/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Redis::V1::CloudRedis::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1::ImportInstanceRequest.new

# Call the import_instance method.
result = client.import_instance 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

#initialize

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

Create a new CloudRedis client object.

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

# Create a client using a custom configuration
client = ::Google::Cloud::Redis::V1::CloudRedis::Client.new do |config|
  config.timeout = 10.0
end

#list_instances

def list_instances(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Redis::V1::Instance>
def list_instances(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Redis::V1::Instance>

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.

Overloads
def list_instances(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Redis::V1::Instance>
Pass arguments to list_instances via a request object, either of type ListInstancesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Redis::V1::ListInstancesRequest, ::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_instances(parent: nil, page_size: nil, page_token: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Redis::V1::Instance>
Pass arguments to list_instances 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 instance 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 instances left to be queried.

  • page_token (::String) — The next_page_token value returned from a previous ListInstances request, if any.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
Returns
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/redis/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Redis::V1::CloudRedis::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1::ListInstancesRequest.new

# Call the list_instances method.
result = client.list_instances 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::V1::Instance.
  p item
end

#operations_client

def operations_client() -> ::Google::Cloud::Redis::V1::CloudRedis::Operations

Get the associated client for long-running operations.

#reschedule_maintenance

def reschedule_maintenance(request, options = nil) -> ::Gapic::Operation
def reschedule_maintenance(name: nil, reschedule_type: nil, schedule_time: nil) -> ::Gapic::Operation

Reschedule maintenance for a given instance in a given project and location.

Overloads
def reschedule_maintenance(request, options = nil) -> ::Gapic::Operation
Pass arguments to reschedule_maintenance via a request object, either of type RescheduleMaintenanceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Redis::V1::RescheduleMaintenanceRequest, ::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 reschedule_maintenance(name: nil, reschedule_type: nil, schedule_time: nil) -> ::Gapic::Operation
Pass arguments to reschedule_maintenance 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 instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region.
  • reschedule_type (::Google::Cloud::Redis::V1::RescheduleMaintenanceRequest::RescheduleType) — Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well.
  • schedule_time (::Google::Protobuf::Timestamp, ::Hash) — Optional. Timestamp when the maintenance shall be rescheduled to if reschedule_type=SPECIFIC_TIME, in RFC 3339 format, for example 2012-11-15T16:19:00.094Z.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/redis/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Redis::V1::CloudRedis::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1::RescheduleMaintenanceRequest.new

# Call the reschedule_maintenance method.
result = client.reschedule_maintenance 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

#update_instance

def update_instance(request, options = nil) -> ::Gapic::Operation
def update_instance(update_mask: nil, instance: nil) -> ::Gapic::Operation

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.

Overloads
def update_instance(request, options = nil) -> ::Gapic::Operation
Pass arguments to update_instance via a request object, either of type UpdateInstanceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Redis::V1::UpdateInstanceRequest, ::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_instance(update_mask: nil, instance: nil) -> ::Gapic::Operation
Pass arguments to update_instance 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 Instance:

    • displayName
    • labels
    • memorySizeGb
    • redisConfig
    • replica_count
  • instance (::Google::Cloud::Redis::V1::Instance, ::Hash) — Required. Update description. Only fields specified in update_mask are updated.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/redis/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Redis::V1::CloudRedis::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1::UpdateInstanceRequest.new

# Call the update_instance method.
result = client.update_instance 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

#upgrade_instance

def upgrade_instance(request, options = nil) -> ::Gapic::Operation
def upgrade_instance(name: nil, redis_version: nil) -> ::Gapic::Operation

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

Overloads
def upgrade_instance(request, options = nil) -> ::Gapic::Operation
Pass arguments to upgrade_instance via a request object, either of type UpgradeInstanceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Redis::V1::UpgradeInstanceRequest, ::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 upgrade_instance(name: nil, redis_version: nil) -> ::Gapic::Operation
Pass arguments to upgrade_instance 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 instance resource name using the form: projects/{project_id}/locations/{location_id}/instances/{instance_id} where location_id refers to a GCP region.
  • redis_version (::String) — Required. Specifies the target version of Redis software to upgrade to.
Yields
  • (response, operation) — Access the result along with the RPC operation
Yield Parameters
  • response (::Gapic::Operation)
  • operation (::GRPC::ActiveCall::Operation)
Returns
  • (::Gapic::Operation)
Raises
  • (::Google::Cloud::Error) — if the RPC is aborted.
Example

Basic example

require "google/cloud/redis/v1"

# Create a client object. The client can be reused for multiple calls.
client = Google::Cloud::Redis::V1::CloudRedis::Client.new

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1::UpgradeInstanceRequest.new

# Call the upgrade_instance method.
result = client.upgrade_instance 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