Reference documentation and code samples for the Google Cloud Memorystore for Memcached V1 API class Google::Cloud::Memcache::V1::CloudMemcache::Client.
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.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all CloudMemcache clients ::Google::Cloud::Memcache::V1::CloudMemcache::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.
def apply_parameters(request, options = nil) -> ::Gapic::Operation
apply_parameters
via a request object, either of type
ApplyParametersRequest or an equivalent Hash.
- 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
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).
- 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.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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::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.
- (config) — Configure the Client client.
- config (Client::Configuration)
#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.
def create_instance(request, options = nil) -> ::Gapic::Operation
create_instance
via a request object, either of type
Google::Cloud::Memcache::V1::CreateInstanceRequest or an equivalent Hash.
- 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
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).
-
parent (::String) — Required. The resource name of the instance location using the form:
projects/{project_id}/locations/{location_id}
wherelocation_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
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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::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.
def delete_instance(request, options = nil) -> ::Gapic::Operation
delete_instance
via a request object, either of type
DeleteInstanceRequest or an equivalent Hash.
- 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
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).
-
name (::String) — Required. Memcached instance resource name in the format:
projects/{project_id}/locations/{location_id}/instances/{instance_id}
wherelocation_id
refers to a GCP region
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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::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.
def get_instance(request, options = nil) -> ::Google::Cloud::Memcache::V1::Instance
get_instance
via a request object, either of type
GetInstanceRequest or an equivalent Hash.
- 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
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).
-
name (::String) — Required. Memcached instance resource name in the format:
projects/{project_id}/locations/{location_id}/instances/{instance_id}
wherelocation_id
refers to a GCP region
- (response, operation) — Access the result along with the RPC operation
- response (::Google::Cloud::Memcache::V1::Instance)
- operation (::GRPC::ActiveCall::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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::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 client object.
- (config) — Configure the CloudMemcache client.
- config (Client::Configuration)
- (Client) — a new instance of Client
# Create a client using the default configuration client = ::Google::Cloud::Memcache::V1::CloudMemcache::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Memcache::V1::CloudMemcache::Client.new do |config| config.timeout = 10.0 end
#list_instances
def list_instances(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Memcache::V1::Instance>
def list_instances(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Memcache::V1::Instance>
Lists Instances in a given location.
def list_instances(request, options = nil) -> ::Gapic::PagedEnumerable<::Google::Cloud::Memcache::V1::Instance>
list_instances
via a request object, either of type
ListInstancesRequest or an equivalent Hash.
- 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) -> ::Gapic::PagedEnumerable<::Google::Cloud::Memcache::V1::Instance>
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).
-
parent (::String) — Required. The resource name of the instance location using the form:
projects/{project_id}/locations/{location_id}
wherelocation_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'snext_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).
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::PagedEnumerable<::Google::Cloud::Memcache::V1::Instance>)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::PagedEnumerable<::Google::Cloud::Memcache::V1::Instance>)
- (::Google::Cloud::Error) — if the RPC is aborted.
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::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::Client
Get the associated client for mix-in of the Locations.
- (Google::Cloud::Location::Locations::Client)
#logger
def logger() -> Logger
The logger used for request/response debug logging.
- (Logger)
#operations_client
def operations_client() -> ::Google::Cloud::Memcache::V1::CloudMemcache::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.
def reschedule_maintenance(request, options = nil) -> ::Gapic::Operation
reschedule_maintenance
via a request object, either of type
RescheduleMaintenanceRequest or an equivalent Hash.
- 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
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).
-
instance (::String) — Required. Memcache instance resource name using the form:
projects/{project_id}/locations/{location_id}/instances/{instance_id}
wherelocation_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
.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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::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
- (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.
def update_instance(request, options = nil) -> ::Gapic::Operation
update_instance
via a request object, either of type
UpdateInstanceRequest or an equivalent Hash.
- 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
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).
-
update_mask (::Google::Protobuf::FieldMask, ::Hash) —
Required. Mask of fields to update.
-
displayName
-
- instance (::Google::Cloud::Memcache::V1::Instance, ::Hash) — Required. A Memcached Instance. Only fields specified in update_mask are updated.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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::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.
def update_parameters(request, options = nil) -> ::Gapic::Operation
update_parameters
via a request object, either of type
UpdateParametersRequest or an equivalent Hash.
- 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
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).
- name (::String) — Required. Resource name of the Memcached instance for which the parameters should be updated.
- update_mask (::Google::Protobuf::FieldMask, ::Hash) — Required. Mask of fields to update.
- parameters (::Google::Cloud::Memcache::V1::MemcacheParameters, ::Hash) — The parameters to apply to the instance.
- (response, operation) — Access the result along with the RPC operation
- response (::Gapic::Operation)
- operation (::GRPC::ActiveCall::Operation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the RPC is aborted.
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::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