lib/google/cloud/tasks/v2/cloud_tasks/client.rb in google-cloud-tasks-v2-0.4.2 vs lib/google/cloud/tasks/v2/cloud_tasks/client.rb in google-cloud-tasks-v2-0.4.3
- old
+ new
@@ -40,18 +40,17 @@
# Configure the CloudTasks Client class.
#
# See {::Google::Cloud::Tasks::V2::CloudTasks::Client::Configuration}
# for a description of the configuration fields.
#
- # ## Example
+ # @example
#
- # To modify the configuration for all CloudTasks clients:
+ # # Modify the configuration for all CloudTasks clients
+ # ::Google::Cloud::Tasks::V2::CloudTasks::Client.configure do |config|
+ # config.timeout = 10.0
+ # end
#
- # ::Google::Cloud::Tasks::V2::CloudTasks::Client.configure do |config|
- # config.timeout = 10.0
- # end
- #
# @yield [config] Configure the Client client.
# @yieldparam config [Client::Configuration]
#
# @return [Client::Configuration]
#
@@ -149,24 +148,20 @@
end
##
# Create a new CloudTasks client object.
#
- # ## Examples
+ # @example
#
- # To create a new CloudTasks client with the default
- # configuration:
+ # # Create a client using the default configuration
+ # client = ::Google::Cloud::Tasks::V2::CloudTasks::Client.new
#
- # client = ::Google::Cloud::Tasks::V2::CloudTasks::Client.new
+ # # Create a client using a custom configuration
+ # client = ::Google::Cloud::Tasks::V2::CloudTasks::Client.new do |config|
+ # config.timeout = 10.0
+ # end
#
- # To create a new CloudTasks client with a custom
- # configuration:
- #
- # client = ::Google::Cloud::Tasks::V2::CloudTasks::Client.new do |config|
- # config.timeout = 10.0
- # end
- #
# @yield [config] Configure the CloudTasks client.
# @yieldparam config [Client::Configuration]
#
def initialize
# These require statements are intentionally placed here to initialize
@@ -181,14 +176,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
@@ -292,11 +286,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.list_queues.timeout,
metadata: metadata,
retry_policy: @config.rpcs.list_queues.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_tasks_stub.call_rpc :list_queues, request, options: options do |response, operation|
response = ::Gapic::PagedEnumerable.new @cloud_tasks_stub, :list_queues, request, response, operation, options
yield response, operation if block_given?
@@ -360,11 +356,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.get_queue.timeout,
metadata: metadata,
retry_policy: @config.rpcs.get_queue.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_tasks_stub.call_rpc :get_queue, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -446,11 +444,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.create_queue.timeout,
metadata: metadata,
retry_policy: @config.rpcs.create_queue.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_tasks_stub.call_rpc :create_queue, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -536,11 +536,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.update_queue.timeout,
metadata: metadata,
retry_policy: @config.rpcs.update_queue.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_tasks_stub.call_rpc :update_queue, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -615,11 +617,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.delete_queue.timeout,
metadata: metadata,
retry_policy: @config.rpcs.delete_queue.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_tasks_stub.call_rpc :delete_queue, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -687,11 +691,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.purge_queue.timeout,
metadata: metadata,
retry_policy: @config.rpcs.purge_queue.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_tasks_stub.call_rpc :purge_queue, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -760,11 +766,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.pause_queue.timeout,
metadata: metadata,
retry_policy: @config.rpcs.pause_queue.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_tasks_stub.call_rpc :pause_queue, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -839,11 +847,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.resume_queue.timeout,
metadata: metadata,
retry_policy: @config.rpcs.resume_queue.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_tasks_stub.call_rpc :resume_queue, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -917,11 +927,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
metadata: metadata,
retry_policy: @config.rpcs.get_iam_policy.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_tasks_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -999,11 +1011,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
metadata: metadata,
retry_policy: @config.rpcs.set_iam_policy.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_tasks_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -1077,11 +1091,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
metadata: metadata,
retry_policy: @config.rpcs.test_iam_permissions.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_tasks_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -1184,11 +1200,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.list_tasks.timeout,
metadata: metadata,
retry_policy: @config.rpcs.list_tasks.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_tasks_stub.call_rpc :list_tasks, request, options: options do |response, operation|
response = ::Gapic::PagedEnumerable.new @cloud_tasks_stub, :list_tasks, request, response, operation, options
yield response, operation if block_given?
@@ -1265,11 +1283,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.get_task.timeout,
metadata: metadata,
retry_policy: @config.rpcs.get_task.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_tasks_stub.call_rpc :get_task, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -1385,11 +1405,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.create_task.timeout,
metadata: metadata,
retry_policy: @config.rpcs.create_task.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_tasks_stub.call_rpc :create_task, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -1456,11 +1478,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.delete_task.timeout,
metadata: metadata,
retry_policy: @config.rpcs.delete_task.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_tasks_stub.call_rpc :delete_task, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -1559,11 +1583,13 @@
metadata[:"x-goog-request-params"] ||= request_params_header
options.apply_defaults timeout: @config.rpcs.run_task.timeout,
metadata: metadata,
retry_policy: @config.rpcs.run_task.retry_policy
- options.apply_defaults metadata: @config.metadata,
+
+ options.apply_defaults timeout: @config.timeout,
+ metadata: @config.metadata,
retry_policy: @config.retry_policy
@cloud_tasks_stub.call_rpc :run_task, request, options: options do |response, operation|
yield response, operation if block_given?
return response
@@ -1583,25 +1609,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_queues
- # to 20 seconds, and all remaining timeouts to 10 seconds:
+ # # Modify the global config, setting the timeout for
+ # # list_queues to 20 seconds,
+ # # and all remaining timeouts to 10 seconds.
+ # ::Google::Cloud::Tasks::V2::CloudTasks::Client.configure do |config|
+ # config.timeout = 10.0
+ # config.rpcs.list_queues.timeout = 20.0
+ # end
#
- # ::Google::Cloud::Tasks::V2::CloudTasks::Client.configure do |config|
- # config.timeout = 10.0
- # config.rpcs.list_queues.timeout = 20.0
- # end
- #
- # To apply the above configuration only to a new client:
- #
- # client = ::Google::Cloud::Tasks::V2::CloudTasks::Client.new do |config|
- # config.timeout = 10.0
- # config.rpcs.list_queues.timeout = 20.0
- # end
+ # # Apply the above configuration only to a new client.
+ # client = ::Google::Cloud::Tasks::V2::CloudTasks::Client.new do |config|
+ # config.timeout = 10.0
+ # config.rpcs.list_queues.timeout = 20.0
+ # end
#
# @!attribute [rw] endpoint
# The hostname or hostname:port of the service endpoint.
# Defaults to `"cloudtasks.googleapis.com"`.
# @return [::String]