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

- old
+ new

@@ -191,21 +191,41 @@ @projects_stub = ::Google::Cloud::Compute::V1::Projects::Rest::ServiceStub.new( endpoint: @config.endpoint, endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, universe_domain: @config.universe_domain, - credentials: credentials + credentials: credentials, + logger: @config.logger ) + + @projects_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 GlobalOperations. # # @return [::Google::Cloud::Compute::V1::GlobalOperations::Rest::Client] # attr_reader :global_operations + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @projects_stub.logger + end + # Service calls ## # Disable this project as a shared VPC host project. # @@ -287,11 +307,11 @@ "project" => request.project }, 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 @@ -378,11 +398,11 @@ "project" => request.project }, 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 @@ -467,11 +487,11 @@ "project" => request.project }, 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 @@ -558,11 +578,11 @@ "project" => request.project }, 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 @@ -637,11 +657,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @projects_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 @@ -716,11 +735,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @projects_stub.get_xpn_host 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 @@ -806,11 +824,11 @@ retry_policy: @config.retry_policy @projects_stub.get_xpn_resources request, options do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @projects_stub, :get_xpn_resources, "resources", 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 @@ -898,11 +916,11 @@ retry_policy: @config.retry_policy @projects_stub.list_xpn_hosts request, options do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @projects_stub, :list_xpn_hosts, "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 @@ -989,11 +1007,11 @@ "project" => request.project }, 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 @@ -1080,11 +1098,11 @@ "project" => request.project }, 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 @@ -1171,11 +1189,11 @@ "project" => request.project }, 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 @@ -1262,11 +1280,11 @@ "project" => request.project }, 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 @@ -1353,11 +1371,11 @@ "project" => request.project }, 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 @@ -1444,11 +1462,11 @@ "project" => request.project }, 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 @@ -1524,10 +1542,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 @@ -1545,9 +1568,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?