Google Cloud Memorystore for Memcached V1 API - Class Google::Cloud::Memcache::V1::CloudMemcache::Rest::Client (v0.9.0)

Reference documentation and code samples for the Google Cloud Memorystore for Memcached V1 API class Google::Cloud::Memcache::V1::CloudMemcache::Rest::Client.

REST client for the CloudMemcache service.

Configures and manages Cloud Memorystore for Memcached instances.

The memcache.googleapis.com service implements the Google Cloud Memorystore for Memcached API and defines the following resource model for managing Memorystore Memcached (also called Memcached below) 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 Memcached instances, named: /instances/*
  • As such, Memcached instances are resources of the form: /projects/{project_id}/locations/{location_id}/instances/{instance_id}

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

  • projects/my-memcached-project/locations/us-central1/instances/my-memcached

Inherits

  • Object

Methods

.configure

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

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

#apply_parameters

def apply_parameters(request, options = nil) -> ::Gapic::Operation
def apply_parameters(name: nil, node_ids: nil, apply_all: nil) -> ::Gapic::Operation

ApplyParameters restarts the set of specified nodes in order to update them to the current set of parameters for the Memcached Instance.

Overloads
def apply_parameters(request, options = nil) -> ::Gapic::Operation
Pass arguments to apply_parameters via a request object, either of type ApplyParametersRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Memcache::V1::ApplyParametersRequest, ::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 apply_parameters(name: nil, node_ids: nil, apply_all: nil) -> ::Gapic::Operation
Pass arguments to apply_parameters 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. Resource name of the Memcached instance for which parameter group updates should be applied.
  • node_ids (::Array<::String>) — Nodes to which the instance-level parameter group is applied.
  • apply_all (::Boolean) — Whether to apply instance-level parameter group to all nodes. If set to true, users are restricted from specifying individual nodes, and ApplyParameters updates all nodes within the instance.
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/memcache/v1"

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

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

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

#configure

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

Configure the CloudMemcache 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 new Instance in a given location.

Overloads
def create_instance(request, options = nil) -> ::Gapic::Operation
Pass arguments to create_instance via a request object, either of type Google::Cloud::Memcache::V1::CreateInstanceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Memcache::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 Memcached instance in the user 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 user project / location.

    If any of the above are not met, the API raises an invalid argument error.

  • instance (::Google::Cloud::Memcache::V1::Instance, ::Hash) — Required. A Memcached Instance
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/memcache/v1"

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

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

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::Memcache::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. Memcached instance resource name in the format: 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.
Example

Basic example

require "google/cloud/memcache/v1"

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

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

#get_instance

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

Gets details of a single Instance.

Overloads
def get_instance(request, options = nil) -> ::Google::Cloud::Memcache::V1::Instance
Pass arguments to get_instance via a request object, either of type GetInstanceRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Memcache::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::Memcache::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. Memcached instance resource name in the format: 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
Raises
  • (::Google::Cloud::Error) — if the REST call is aborted.
Example

Basic example

require "google/cloud/memcache/v1"

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

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

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

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

#initialize

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

Create a new CloudMemcache REST client object.

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

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

#list_instances

def list_instances(request, options = nil) -> ::Google::Cloud::Memcache::V1::ListInstancesResponse
def list_instances(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Google::Cloud::Memcache::V1::ListInstancesResponse

Lists Instances in a given location.

Overloads
def list_instances(request, options = nil) -> ::Google::Cloud::Memcache::V1::ListInstancesResponse
Pass arguments to list_instances via a request object, either of type ListInstancesRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Memcache::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, filter: nil, order_by: nil) -> ::Google::Cloud::Memcache::V1::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) — 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 List request, if any.
  • filter (::String) — List filter. For example, exclude all Memcached instances with name as my-instance by specifying "name != my-instance".
  • order_by (::String) — Sort results. Supported values are "name", "name desc" or "" (unsorted).
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/memcache/v1"

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

# Create a request. To set request fields, pass in keyword arguments.
request = Google::Cloud::Memcache::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::Memcache::V1::Instance.
  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::Memcache::V1::CloudMemcache::Rest::Operations

Get the associated client for long-running operations.

#reschedule_maintenance

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

Reschedules upcoming maintenance event.

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::Memcache::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(instance: 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
  • instance (::String) — Required. Memcache 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::Memcache::V1::RescheduleMaintenanceRequest::RescheduleType) — Required. If reschedule type is SPECIFIC_TIME, must set up schedule_time as well.
  • schedule_time (::Google::Protobuf::Timestamp, ::Hash) — 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.
Example

Basic example

require "google/cloud/memcache/v1"

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

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

#universe_domain

def universe_domain() -> String

The effective universe domain

Returns
  • (String)

#update_instance

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

Updates an existing Instance in a given project and location.

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::Memcache::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
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/memcache/v1"

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

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

#update_parameters

def update_parameters(request, options = nil) -> ::Gapic::Operation
def update_parameters(name: nil, update_mask: nil, parameters: nil) -> ::Gapic::Operation

Updates the defined Memcached parameters for an existing instance. This method only stages the parameters, it must be followed by ApplyParameters to apply the parameters to nodes of the Memcached instance.

Overloads
def update_parameters(request, options = nil) -> ::Gapic::Operation
Pass arguments to update_parameters via a request object, either of type UpdateParametersRequest or an equivalent Hash.
Parameters
  • request (::Google::Cloud::Memcache::V1::UpdateParametersRequest, ::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_parameters(name: nil, update_mask: nil, parameters: nil) -> ::Gapic::Operation
Pass arguments to update_parameters 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
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/memcache/v1"

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

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

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