Reference documentation and code samples for the Google Cloud Memorystore for Memcached API class Google::Cloud::Memcache::V1beta2::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.
- (config) — Configure the Client client.
- config (Client::Configuration)
# Modify the configuration for all CloudMemcache clients ::Google::Cloud::Memcache::V1beta2::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.
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::V1beta2::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.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/memcache/v1beta2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Memcache::V1beta2::CloudMemcache::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Memcache::V1beta2::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
#apply_software_update
def apply_software_update(request, options = nil) -> ::Gapic::Operation
def apply_software_update(instance: nil, node_ids: nil, apply_all: nil) -> ::Gapic::Operation
Updates software on the selected nodes of the Instance.
def apply_software_update(request, options = nil) -> ::Gapic::Operation
apply_software_update
via a request object, either of type
ApplySoftwareUpdateRequest or an equivalent Hash.
- request (::Google::Cloud::Memcache::V1beta2::ApplySoftwareUpdateRequest, ::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_software_update(instance: nil, node_ids: nil, apply_all: nil) -> ::Gapic::Operation
apply_software_update
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. Resource name of the Memcached instance for which software update should be applied.
- node_ids (::Array<::String>) — Nodes to which we should apply the update to. Note all the selected nodes are updated in parallel.
- apply_all (::Boolean) — Whether to apply the update to all nodes. If set to true, will explicitly restrict users from specifying any nodes, and apply software update to all nodes (where applicable) within the instance.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/memcache/v1beta2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Memcache::V1beta2::CloudMemcache::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Memcache::V1beta2::ApplySoftwareUpdateRequest.new # Call the apply_software_update method. result = client.apply_software_update 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, resource: 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::V1beta2::CreateInstanceRequest or an equivalent Hash.
- request (::Google::Cloud::Memcache::V1beta2::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, resource: 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.
- resource (::Google::Cloud::Memcache::V1beta2::Instance, ::Hash) — Required. A Memcached [Instance] resource
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/memcache/v1beta2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Memcache::V1beta2::CloudMemcache::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Memcache::V1beta2::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::V1beta2::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
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/memcache/v1beta2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Memcache::V1beta2::CloudMemcache::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Memcache::V1beta2::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::V1beta2::Instance
def get_instance(name: nil) -> ::Google::Cloud::Memcache::V1beta2::Instance
Gets details of a single Instance.
def get_instance(request, options = nil) -> ::Google::Cloud::Memcache::V1beta2::Instance
get_instance
via a request object, either of type
GetInstanceRequest or an equivalent Hash.
- request (::Google::Cloud::Memcache::V1beta2::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::V1beta2::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
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Memcache::V1beta2::Instance)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/memcache/v1beta2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Memcache::V1beta2::CloudMemcache::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Memcache::V1beta2::GetInstanceRequest.new # Call the get_instance method. result = client.get_instance request # The returned object is of type Google::Cloud::Memcache::V1beta2::Instance. p result
#initialize
def initialize() { |config| ... } -> Client
Create a new CloudMemcache REST 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::V1beta2::CloudMemcache::Rest::Client.new # Create a client using a custom configuration client = ::Google::Cloud::Memcache::V1beta2::CloudMemcache::Rest::Client.new do |config| config.timeout = 10.0 end
#list_instances
def list_instances(request, options = nil) -> ::Google::Cloud::Memcache::V1beta2::ListInstancesResponse
def list_instances(parent: nil, page_size: nil, page_token: nil, filter: nil, order_by: nil) -> ::Google::Cloud::Memcache::V1beta2::ListInstancesResponse
Lists Instances in a given location.
def list_instances(request, options = nil) -> ::Google::Cloud::Memcache::V1beta2::ListInstancesResponse
list_instances
via a request object, either of type
ListInstancesRequest or an equivalent Hash.
- request (::Google::Cloud::Memcache::V1beta2::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::V1beta2::ListInstancesResponse
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).
- (result, operation) — Access the result along with the TransportOperation object
- result (::Google::Cloud::Memcache::V1beta2::ListInstancesResponse)
- operation (::Gapic::Rest::TransportOperation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/memcache/v1beta2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Memcache::V1beta2::CloudMemcache::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Memcache::V1beta2::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::V1beta2::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.
- (Google::Cloud::Location::Locations::Rest::Client)
#operations_client
def operations_client() -> ::Google::Cloud::Memcache::V1beta2::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
Performs the apply phase of the RescheduleMaintenance verb.
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::V1beta2::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::V1beta2::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
.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/memcache/v1beta2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Memcache::V1beta2::CloudMemcache::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Memcache::V1beta2::RescheduleMaintenanceRequest.new # Call the reschedule_maintenance method. result = client.reschedule_maintenance request # The returned object is of type Gapic::Operation. You can use it to # check the status of an operation, cancel it, or wait for results. # Here is how to wait for a response. result.wait_until_done! timeout: 60 if result.response? p result.response else puts "No response received." end
#update_instance
def update_instance(request, options = nil) -> ::Gapic::Operation
def update_instance(update_mask: nil, resource: 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::V1beta2::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, resource: 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
-
- resource (::Google::Cloud::Memcache::V1beta2::Instance, ::Hash) — Required. A Memcached [Instance] resource. Only fields specified in update_mask are updated.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/memcache/v1beta2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Memcache::V1beta2::CloudMemcache::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Memcache::V1beta2::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::V1beta2::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::V1beta2::MemcacheParameters, ::Hash) — The parameters to apply to the instance.
- (result, operation) — Access the result along with the TransportOperation object
- result (::Gapic::Operation)
- operation (::Gapic::Rest::TransportOperation)
- (::Gapic::Operation)
- (::Google::Cloud::Error) — if the REST call is aborted.
Basic example
require "google/cloud/memcache/v1beta2" # Create a client object. The client can be reused for multiple calls. client = Google::Cloud::Memcache::V1beta2::CloudMemcache::Rest::Client.new # Create a request. To set request fields, pass in keyword arguments. request = Google::Cloud::Memcache::V1beta2::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