lib/google/cloud/tasks/v2/cloud_tasks/client.rb in google-cloud-tasks-v2-1.0.1 vs lib/google/cloud/tasks/v2/cloud_tasks/client.rb in google-cloud-tasks-v2-1.1.0

- old
+ new

@@ -213,28 +213,49 @@ endpoint: @config.endpoint, endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, universe_domain: @config.universe_domain, channel_args: @config.channel_args, interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool + channel_pool_config: @config.channel_pool, + logger: @config.logger ) + @cloud_tasks_stub.stub_logger&.info do |entry| + entry.set_system_name + entry.set_service + entry.message = "Created client for #{entry.service}" + entry.set_credentials_fields credentials + entry.set "customEndpoint", @config.endpoint if @config.endpoint + entry.set "defaultTimeout", @config.timeout if @config.timeout + entry.set "quotaProject", @quota_project_id if @quota_project_id + end + @location_client = Google::Cloud::Location::Locations::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @cloud_tasks_stub.endpoint config.universe_domain = @cloud_tasks_stub.universe_domain + config.logger = @cloud_tasks_stub.logger if config.respond_to? :logger= end end ## # Get the associated client for mix-in of the Locations. # # @return [Google::Cloud::Location::Locations::Client] # attr_reader :location_client + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @cloud_tasks_stub.logger + end + # Service calls ## # Lists queues. # @@ -351,11 +372,11 @@ 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? - return response + throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -438,11 +459,10 @@ 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 end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -545,11 +565,10 @@ 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 end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -655,11 +674,10 @@ 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 end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -754,11 +772,10 @@ 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 end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -846,11 +863,10 @@ 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 end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -940,11 +956,10 @@ 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 end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1040,11 +1055,10 @@ 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 end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1138,11 +1152,10 @@ 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 end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1246,11 +1259,10 @@ 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 end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1345,11 +1357,10 @@ 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 end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1477,11 +1488,11 @@ 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? - return response + throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1577,11 +1588,10 @@ 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 end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1717,11 +1727,10 @@ 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 end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1808,11 +1817,10 @@ 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 end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1933,11 +1941,10 @@ 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 end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -2022,10 +2029,15 @@ # @!attribute [rw] universe_domain # The universe domain within which to make requests. This determines the # default endpoint URL. The default value of nil uses the environment # universe (usually the default "googleapis.com" universe). # @return [::String,nil] + # @!attribute [rw] logger + # A custom logger to use for request/response debug logging, or the value + # `:default` (the default) to construct a default logger, or `nil` to + # explicitly disable logging. + # @return [::Logger,:default,nil] # class Configuration extend ::Gapic::Config # @private @@ -2046,9 +2058,10 @@ config_attr :timeout, nil, ::Numeric, nil config_attr :metadata, nil, ::Hash, nil config_attr :retry_policy, nil, ::Hash, ::Proc, nil config_attr :quota_project, nil, ::String, nil config_attr :universe_domain, nil, ::String, nil + config_attr :logger, :default, ::Logger, nil, :default # @private def initialize parent_config = nil @parent_config = parent_config unless parent_config.nil?