lib/google/cloud/compute/v1/region_disks/rest/client.rb in google-cloud-compute-v1-2.14.0 vs lib/google/cloud/compute/v1/region_disks/rest/client.rb in google-cloud-compute-v1-2.15.0

- old
+ new

@@ -197,21 +197,41 @@ @region_disks_stub = ::Google::Cloud::Compute::V1::RegionDisks::Rest::ServiceStub.new( endpoint: @config.endpoint, endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, universe_domain: @config.universe_domain, - credentials: credentials + credentials: credentials, + logger: @config.logger ) + + @region_disks_stub.logger(stub: true)&.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 end ## # Get the associated client for long-running operations via RegionOperations. # # @return [::Google::Cloud::Compute::V1::RegionOperations::Rest::Client] # attr_reader :region_operations + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @region_disks_stub.logger + end + # Service calls ## # Adds existing resource policies to a regional disk. You can only add one policy which will be applied to this disk for scheduling snapshot creation. # @@ -300,11 +320,11 @@ "region" => request.region }, options: options ) yield result, response if block_given? - return result + throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end @@ -394,11 +414,11 @@ "region" => request.region }, options: options ) yield result, response if block_given? - return result + throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end @@ -490,11 +510,11 @@ "region" => request.region }, options: options ) yield result, response if block_given? - return result + throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end @@ -584,11 +604,11 @@ "region" => request.region }, options: options ) yield result, response if block_given? - return result + throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end @@ -667,11 +687,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @region_disks_stub.get request, options do |result, operation| yield result, operation if block_given? - return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end @@ -752,11 +771,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @region_disks_stub.get_iam_policy request, options do |result, operation| yield result, operation if block_given? - return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end @@ -848,11 +866,11 @@ "region" => request.region }, options: options ) yield result, response if block_given? - return result + throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end @@ -940,11 +958,11 @@ retry_policy: @config.retry_policy @region_disks_stub.list request, options do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @region_disks_stub, :list, "items", request, result, options yield result, operation if block_given? - return result + throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end @@ -1036,11 +1054,11 @@ "region" => request.region }, options: options ) yield result, response if block_given? - return result + throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end @@ -1132,11 +1150,11 @@ "region" => request.region }, options: options ) yield result, response if block_given? - return result + throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end @@ -1217,11 +1235,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @region_disks_stub.set_iam_policy request, options do |result, operation| yield result, operation if block_given? - return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end @@ -1313,11 +1330,11 @@ "region" => request.region }, options: options ) yield result, response if block_given? - return result + throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end @@ -1409,11 +1426,11 @@ "region" => request.region }, options: options ) yield result, response if block_given? - return result + throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end @@ -1503,11 +1520,11 @@ "region" => request.region }, options: options ) yield result, response if block_given? - return result + throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end @@ -1597,11 +1614,11 @@ "region" => request.region }, options: options ) yield result, response if block_given? - return result + throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end @@ -1682,11 +1699,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @region_disks_stub.test_iam_permissions request, options do |result, operation| yield result, operation if block_given? - return result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end @@ -1781,11 +1797,11 @@ "region" => request.region }, options: options ) yield result, response if block_given? - return result + throw :response, result end rescue ::Gapic::Rest::Error => e raise ::Google::Cloud::Error.from_error(e) end @@ -1861,10 +1877,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 @@ -1882,9 +1903,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?