Class: Google::Cloud::Redis::V1beta1::CloudRedis::Rest::Client

Inherits:
Object
  • Object
show all
Includes:
Paths
Defined in:
lib/google/cloud/redis/v1beta1/cloud_redis/rest/client.rb

Overview

REST client for the CloudRedis service.

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

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

Defined Under Namespace

Classes: Configuration

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Paths

#instance_path, #location_path

Constructor Details

#initialize {|config| ... } ⇒ Client

Create a new CloudRedis REST client object.

Examples:


# Create a client using the default configuration
client = ::Google::Cloud::Redis::V1beta1::CloudRedis::Rest::Client.new

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

Yields:

  • (config)

    Configure the CloudRedis client.

Yield Parameters:



157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/google/cloud/redis/v1beta1/cloud_redis/rest/client.rb', line 157

def initialize
  # Create the configuration object
  @config = Configuration.new Client.configure

  # Yield the configuration if needed
  yield @config if block_given?

  # Create credentials
  credentials = @config.credentials
  # Use self-signed JWT if the endpoint is unchanged from default,
  # but only if the default endpoint does not have a region prefix.
  enable_self_signed_jwt = @config.endpoint.nil? ||
                           (@config.endpoint == Configuration::DEFAULT_ENDPOINT &&
                           !@config.endpoint.split(".").first.include?("-"))
  credentials ||= Credentials.default scope: @config.scope,
                                      enable_self_signed_jwt: enable_self_signed_jwt
  if credentials.is_a?(::String) || credentials.is_a?(::Hash)
    credentials = Credentials.new credentials, scope: @config.scope
  end

  @quota_project_id = @config.quota_project
  @quota_project_id ||= credentials.quota_project_id if credentials.respond_to? :quota_project_id

  @operations_client = ::Google::Cloud::Redis::V1beta1::CloudRedis::Rest::Operations.new do |config|
    config.credentials = credentials
    config.quota_project = @quota_project_id
    config.endpoint = @config.endpoint
    config.universe_domain = @config.universe_domain
  end

  @cloud_redis_stub = ::Google::Cloud::Redis::V1beta1::CloudRedis::Rest::ServiceStub.new(
    endpoint: @config.endpoint,
    endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
    universe_domain: @config.universe_domain,
    credentials: credentials
  )
end

Instance Attribute Details

#operations_client::Google::Cloud::Redis::V1beta1::CloudRedis::Rest::Operations (readonly)

Get the associated client for long-running operations.



200
201
202
# File 'lib/google/cloud/redis/v1beta1/cloud_redis/rest/client.rb', line 200

def operations_client
  @operations_client
end

Class Method Details

.configure {|config| ... } ⇒ Client::Configuration

Configure the CloudRedis Client class.

See Configuration for a description of the configuration fields.

Examples:


# Modify the configuration for all CloudRedis clients
::Google::Cloud::Redis::V1beta1::CloudRedis::Rest::Client.configure do |config|
  config.timeout = 10.0
end

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/google/cloud/redis/v1beta1/cloud_redis/rest/client.rb', line 75

def self.configure
  @configure ||= begin
    namespace = ["Google", "Cloud", "Redis", "V1beta1"]
    parent_config = while namespace.any?
                      parent_name = namespace.join "::"
                      parent_const = const_get parent_name
                      break parent_const.configure if parent_const.respond_to? :configure
                      namespace.pop
                    end
    default_config = Client::Configuration.new parent_config

    default_config.rpcs.list_instances.timeout = 600.0

    default_config.rpcs.get_instance.timeout = 600.0

    default_config.rpcs.get_instance_auth_string.timeout = 600.0

    default_config.rpcs.create_instance.timeout = 600.0

    default_config.rpcs.update_instance.timeout = 600.0

    default_config.rpcs.upgrade_instance.timeout = 600.0

    default_config.rpcs.import_instance.timeout = 600.0

    default_config.rpcs.export_instance.timeout = 600.0

    default_config.rpcs.failover_instance.timeout = 600.0

    default_config.rpcs.delete_instance.timeout = 600.0

    default_config
  end
  yield @configure if block_given?
  @configure
end

Instance Method Details

#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 configure.

See Configuration for a description of the configuration fields.

Yields:

  • (config)

    Configure the Client client.

Yield Parameters:

Returns:



127
128
129
130
# File 'lib/google/cloud/redis/v1beta1/cloud_redis/rest/client.rb', line 127

def configure
  yield @config if block_given?
  @config
end

#create_instance(request, options = nil) ⇒ ::Gapic::Operation #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. The 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.

Examples:

Basic example

require "google/cloud/redis/v1beta1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1beta1::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

Overloads:

  • #create_instance(request, options = nil) ⇒ ::Gapic::Operation

    Pass arguments to create_instance via a request object, either of type Google::Cloud::Redis::V1beta1::CreateInstanceRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Redis::V1beta1::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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) (defaults to: nil)

      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) (defaults to: nil)

      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, ::Hash) (defaults to: nil)

      Required. A Redis [Instance] resource

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.



543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
# File 'lib/google/cloud/redis/v1beta1/cloud_redis/rest/client.rb', line 543

def create_instance request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::CreateInstanceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.create_instance..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Redis::V1beta1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.create_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.create_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_redis_stub.create_instance request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#delete_instance(request, options = nil) ⇒ ::Gapic::Operation #delete_instance(name: nil) ⇒ ::Gapic::Operation

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

Examples:

Basic example

require "google/cloud/redis/v1beta1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1beta1::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

Overloads:

  • #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::V1beta1::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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).

    Parameters:

    • name (::String) (defaults to: nil)

      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:

  • (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.



1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
# File 'lib/google/cloud/redis/v1beta1/cloud_redis/rest/client.rb', line 1108

def delete_instance request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::DeleteInstanceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.delete_instance..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Redis::V1beta1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.delete_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.delete_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_redis_stub.delete_instance request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#export_instance(request, options = nil) ⇒ ::Gapic::Operation #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.

Examples:

Basic example

require "google/cloud/redis/v1beta1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1beta1::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

Overloads:

  • #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::V1beta1::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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) (defaults to: nil)

      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::V1beta1::OutputConfig, ::Hash) (defaults to: nil)

      Required. Specify data to be exported.

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.



927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
# File 'lib/google/cloud/redis/v1beta1/cloud_redis/rest/client.rb', line 927

def export_instance request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::ExportInstanceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.export_instance..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Redis::V1beta1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.export_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.export_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_redis_stub.export_instance request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#failover_instance(request, options = nil) ⇒ ::Gapic::Operation #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.

Examples:

Basic example

require "google/cloud/redis/v1beta1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1beta1::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

Overloads:

  • #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::V1beta1::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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) (defaults to: nil)

      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::V1beta1::FailoverInstanceRequest::DataProtectionMode) (defaults to: nil)

      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:

  • (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.



1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
# File 'lib/google/cloud/redis/v1beta1/cloud_redis/rest/client.rb', line 1019

def failover_instance request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::FailoverInstanceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.failover_instance..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Redis::V1beta1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.failover_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.failover_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_redis_stub.failover_instance request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_instance(request, options = nil) ⇒ ::Google::Cloud::Redis::V1beta1::Instance #get_instance(name: nil) ⇒ ::Google::Cloud::Redis::V1beta1::Instance

Gets the details of a specific Redis instance.

Examples:

Basic example

require "google/cloud/redis/v1beta1"

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

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

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

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

Overloads:

  • #get_instance(request, options = nil) ⇒ ::Google::Cloud::Redis::V1beta1::Instance

    Pass arguments to get_instance via a request object, either of type GetInstanceRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Redis::V1beta1::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #get_instance(name: nil) ⇒ ::Google::Cloud::Redis::V1beta1::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).

    Parameters:

    • name (::String) (defaults to: nil)

      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:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
# File 'lib/google/cloud/redis/v1beta1/cloud_redis/rest/client.rb', line 352

def get_instance request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::GetInstanceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_instance..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Redis::V1beta1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_redis_stub.get_instance request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#get_instance_auth_string(request, options = nil) ⇒ ::Google::Cloud::Redis::V1beta1::InstanceAuthString #get_instance_auth_string(name: nil) ⇒ ::Google::Cloud::Redis::V1beta1::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.

Examples:

Basic example

require "google/cloud/redis/v1beta1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1beta1::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::V1beta1::InstanceAuthString.
p result

Overloads:

  • #get_instance_auth_string(request, options = nil) ⇒ ::Google::Cloud::Redis::V1beta1::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::V1beta1::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #get_instance_auth_string(name: nil) ⇒ ::Google::Cloud::Redis::V1beta1::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).

    Parameters:

    • name (::String) (defaults to: nil)

      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:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
# File 'lib/google/cloud/redis/v1beta1/cloud_redis/rest/client.rb', line 434

def get_instance_auth_string request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::GetInstanceAuthStringRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.get_instance_auth_string..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Redis::V1beta1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.get_instance_auth_string.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.get_instance_auth_string.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_redis_stub.get_instance_auth_string request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#import_instance(request, options = nil) ⇒ ::Gapic::Operation #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.

Examples:

Basic example

require "google/cloud/redis/v1beta1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1beta1::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

Overloads:

  • #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::V1beta1::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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) (defaults to: nil)

      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::V1beta1::InputConfig, ::Hash) (defaults to: nil)

      Required. Specify data to be imported.

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.



832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
# File 'lib/google/cloud/redis/v1beta1/cloud_redis/rest/client.rb', line 832

def import_instance request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::ImportInstanceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.import_instance..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Redis::V1beta1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.import_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.import_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_redis_stub.import_instance request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#list_instances(request, options = nil) ⇒ ::Google::Cloud::Redis::V1beta1::ListInstancesResponse #list_instances(parent: nil, page_size: nil, page_token: nil) ⇒ ::Google::Cloud::Redis::V1beta1::ListInstancesResponse

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.

Examples:

Basic example

require "google/cloud/redis/v1beta1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1beta1::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::V1beta1::Instance.
  p item
end

Overloads:

  • #list_instances(request, options = nil) ⇒ ::Google::Cloud::Redis::V1beta1::ListInstancesResponse

    Pass arguments to list_instances via a request object, either of type ListInstancesRequest or an equivalent Hash.

    Parameters:

    • request (::Google::Cloud::Redis::V1beta1::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #list_instances(parent: nil, page_size: nil, page_token: nil) ⇒ ::Google::Cloud::Redis::V1beta1::ListInstancesResponse

    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) (defaults to: nil)

      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) (defaults to: nil)

      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) (defaults to: nil)

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

Yields:

  • (result, operation)

    Access the result along with the TransportOperation object

Yield Parameters:

Returns:

Raises:

  • (::Google::Cloud::Error)

    if the REST call is aborted.



272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/google/cloud/redis/v1beta1/cloud_redis/rest/client.rb', line 272

def list_instances request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::ListInstancesRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.list_instances..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Redis::V1beta1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.list_instances.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.list_instances.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_redis_stub.list_instances request, options do |result, operation|
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#reschedule_maintenance(request, options = nil) ⇒ ::Gapic::Operation #reschedule_maintenance(name: nil, reschedule_type: nil, schedule_time: nil) ⇒ ::Gapic::Operation

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

Examples:

Basic example

require "google/cloud/redis/v1beta1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1beta1::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

Overloads:

  • #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::V1beta1::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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) (defaults to: nil)

      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::V1beta1::RescheduleMaintenanceRequest::RescheduleType) (defaults to: nil)

      Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well.

    • schedule_time (::Google::Protobuf::Timestamp, ::Hash) (defaults to: nil)

      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:

  • (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.



1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
# File 'lib/google/cloud/redis/v1beta1/cloud_redis/rest/client.rb', line 1203

def reschedule_maintenance request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::RescheduleMaintenanceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.reschedule_maintenance..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Redis::V1beta1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.reschedule_maintenance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.reschedule_maintenance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_redis_stub.reschedule_maintenance request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#universe_domainString

The effective universe domain

Returns:

  • (String)


137
138
139
# File 'lib/google/cloud/redis/v1beta1/cloud_redis/rest/client.rb', line 137

def universe_domain
  @cloud_redis_stub.universe_domain
end

#update_instance(request, options = nil) ⇒ ::Gapic::Operation #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.

Examples:

Basic example

require "google/cloud/redis/v1beta1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1beta1::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

Overloads:

  • #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::V1beta1::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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) (defaults to: nil)

      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::V1beta1::Instance, ::Hash) (defaults to: nil)

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

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.



644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
# File 'lib/google/cloud/redis/v1beta1/cloud_redis/rest/client.rb', line 644

def update_instance request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::UpdateInstanceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.update_instance..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Redis::V1beta1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.update_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.update_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_redis_stub.update_instance request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end

#upgrade_instance(request, options = nil) ⇒ ::Gapic::Operation #upgrade_instance(name: nil, redis_version: nil) ⇒ ::Gapic::Operation

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

Examples:

Basic example

require "google/cloud/redis/v1beta1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Redis::V1beta1::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

Overloads:

  • #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::V1beta1::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) (defaults to: nil)

      Overrides the default settings for this call, e.g, timeout, retries etc. Optional.

  • #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) (defaults to: nil)

      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) (defaults to: nil)

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

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.



735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
# File 'lib/google/cloud/redis/v1beta1/cloud_redis/rest/client.rb', line 735

def upgrade_instance request, options = nil
  raise ::ArgumentError, "request must be provided" if request.nil?

  request = ::Gapic::Protobuf.coerce request, to: ::Google::Cloud::Redis::V1beta1::UpgradeInstanceRequest

  # Converts hash and nil to an options object
  options = ::Gapic::CallOptions.new(**options.to_h) if options.respond_to? :to_h

  # Customize the options with defaults
   = @config.rpcs.upgrade_instance..to_h

  # Set x-goog-api-client and x-goog-user-project headers
  [:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
    lib_name: @config.lib_name, lib_version: @config.lib_version,
    gapic_version: ::Google::Cloud::Redis::V1beta1::VERSION,
    transports_version_send: [:rest]

  [:"x-goog-user-project"] = @quota_project_id if @quota_project_id

  options.apply_defaults timeout:      @config.rpcs.upgrade_instance.timeout,
                         metadata:     ,
                         retry_policy: @config.rpcs.upgrade_instance.retry_policy

  options.apply_defaults timeout:      @config.timeout,
                         metadata:     @config.,
                         retry_policy: @config.retry_policy

  @cloud_redis_stub.upgrade_instance request, options do |result, operation|
    result = ::Gapic::Operation.new result, @operations_client, options: options
    yield result, operation if block_given?
    return result
  end
rescue ::Gapic::Rest::Error => e
  raise ::Google::Cloud::Error.from_error(e)
end