lib/google/cloud/memcache/v1beta2/cloud_memcache/client.rb in google-cloud-memcache-v1beta2-0.2.2 vs lib/google/cloud/memcache/v1beta2/cloud_memcache/client.rb in google-cloud-memcache-v1beta2-0.2.3
- old
+ new
@@ -53,18 +53,17 @@
# Configure the CloudMemcache Client class.
#
# See {::Google::Cloud::Memcache::V1beta2::CloudMemcache::Client::Configuration}
# for a description of the configuration fields.
#
- # ## Example
+ # @example
#
- # To modify the configuration for all CloudMemcache clients:
+ # # Modify the configuration for all CloudMemcache clients
+ # ::Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.configure do |config|
+ # config.timeout = 10.0
+ # end
#
- # ::Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.configure do |config|
- # config.timeout = 10.0
- # end
- #
# @yield [config] Configure the Client client.
# @yieldparam config [Client::Configuration]
#
# @return [Client::Configuration]
#
@@ -122,24 +121,20 @@
end
##
# Create a new CloudMemcache client object.
#
- # ## Examples
+ # @example
#
- # To create a new CloudMemcache client with the default
- # configuration:
+ # # Create a client using the default configuration
+ # client = ::Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.new
#
- # client = ::Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.new
+ # # Create a client using a custom configuration
+ # client = ::Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.new do |config|
+ # config.timeout = 10.0
+ # end
#
- # To create a new CloudMemcache client with a custom
- # configuration:
- #
- # client = ::Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.new do |config|
- # config.timeout = 10.0
- # end
- #
# @yield [config] Configure the CloudMemcache client.
# @yieldparam config [Client::Configuration]
#
def initialize
# These require statements are intentionally placed here to initialize
@@ -154,14 +149,13 @@
# Yield the configuration if needed
yield @config if block_given?
# Create credentials
credentials = @config.credentials
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
+ # 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.scope == Client.configure.scope &&
- @config.endpoint == Client.configure.endpoint &&
+ enable_self_signed_jwt = @config.endpoint == Client.configure.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
@@ -262,11 +256,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.list_instances.timeout,
metadata: metadata,
retry_policy: @config.rpcs.list_instances.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_memcache_stub.call_rpc :list_instances, request, options: options do |response, operation|
response = ::Gapic::PagedEnumerable.new @cloud_memcache_stub, :list_instances, request, response, operation, options
yield response, operation if block_given?
@@ -331,11 +327,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.get_instance.timeout,
metadata: metadata,
retry_policy: @config.rpcs.get_instance.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_memcache_stub.call_rpc :get_instance, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -412,11 +410,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.create_instance.timeout,
metadata: metadata,
retry_policy: @config.rpcs.create_instance.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_memcache_stub.call_rpc :create_instance, request, options: options do |response, operation|
response = ::Gapic::Operation.new response, @operations_client, options: options
yield response, operation if block_given?
@@ -483,11 +483,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.update_instance.timeout,
metadata: metadata,
retry_policy: @config.rpcs.update_instance.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_memcache_stub.call_rpc :update_instance, request, options: options do |response, operation|
response = ::Gapic::Operation.new response, @operations_client, options: options
yield response, operation if block_given?
@@ -558,11 +560,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.update_parameters.timeout,
metadata: metadata,
retry_policy: @config.rpcs.update_parameters.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_memcache_stub.call_rpc :update_parameters, request, options: options do |response, operation|
response = ::Gapic::Operation.new response, @operations_client, options: options
yield response, operation if block_given?
@@ -627,11 +631,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.delete_instance.timeout,
metadata: metadata,
retry_policy: @config.rpcs.delete_instance.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_memcache_stub.call_rpc :delete_instance, request, options: options do |response, operation|
response = ::Gapic::Operation.new response, @operations_client, options: options
yield response, operation if block_given?
@@ -702,11 +708,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.apply_parameters.timeout,
metadata: metadata,
retry_policy: @config.rpcs.apply_parameters.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_memcache_stub.call_rpc :apply_parameters, request, options: options do |response, operation|
response = ::Gapic::Operation.new response, @operations_client, options: options
yield response, operation if block_given?
@@ -777,11 +785,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.apply_software_update.timeout,
metadata: metadata,
retry_policy: @config.rpcs.apply_software_update.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_memcache_stub.call_rpc :apply_software_update, request, options: options do |response, operation|
response = ::Gapic::Operation.new response, @operations_client, options: options
yield response, operation if block_given?
@@ -802,25 +812,24 @@
# for a list of RPCs that can be configured independently.
#
# Configuration can be applied globally to all clients, or to a single client
# on construction.
#
- # # Examples
+ # @example
#
- # To modify the global config, setting the timeout for list_instances
- # to 20 seconds, and all remaining timeouts to 10 seconds:
+ # # Modify the global config, setting the timeout for
+ # # list_instances to 20 seconds,
+ # # and all remaining timeouts to 10 seconds.
+ # ::Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.configure do |config|
+ # config.timeout = 10.0
+ # config.rpcs.list_instances.timeout = 20.0
+ # end
#
- # ::Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.configure do |config|
- # config.timeout = 10.0
- # config.rpcs.list_instances.timeout = 20.0
- # end
- #
- # To apply the above configuration only to a new client:
- #
- # client = ::Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.new do |config|
- # config.timeout = 10.0
- # config.rpcs.list_instances.timeout = 20.0
- # end
+ # # Apply the above configuration only to a new client.
+ # client = ::Google::Cloud::Memcache::V1beta2::CloudMemcache::Client.new do |config|
+ # config.timeout = 10.0
+ # config.rpcs.list_instances.timeout = 20.0
+ # end
#
# @!attribute [rw] endpoint
# The hostname or hostname:port of the service endpoint.
# Defaults to `"memcache.googleapis.com"`.
# @return [::String]