lib/google/cloud/compute/v1/disks/rest/client.rb in google-cloud-compute-v1-2.14.0 vs lib/google/cloud/compute/v1/disks/rest/client.rb in google-cloud-compute-v1-2.15.0
- old
+ new
@@ -202,21 +202,41 @@
@disks_stub = ::Google::Cloud::Compute::V1::Disks::Rest::ServiceStub.new(
endpoint: @config.endpoint,
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
universe_domain: @config.universe_domain,
- credentials: credentials
+ credentials: credentials,
+ logger: @config.logger
)
+
+ @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 ZoneOperations.
#
# @return [::Google::Cloud::Compute::V1::ZoneOperations::Rest::Client]
#
attr_reader :zone_operations
+ ##
+ # The logger used for request/response debug logging.
+ #
+ # @return [Logger]
+ #
+ def logger
+ @disks_stub.logger
+ end
+
# Service calls
##
# Adds existing resource policies to a disk. You can only add one policy which will be applied to this disk for scheduling snapshot creation.
#
@@ -305,11 +325,11 @@
"zone" => request.zone
},
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
@@ -399,11 +419,11 @@
retry_policy: @config.retry_policy
@disks_stub.aggregated_list request, options do |result, operation|
result = ::Gapic::Rest::PagedEnumerable.new @disks_stub, :aggregated_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
@@ -493,11 +513,11 @@
"zone" => request.zone
},
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
@@ -591,11 +611,11 @@
"zone" => request.zone
},
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
@@ -685,11 +705,11 @@
"zone" => request.zone
},
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
@@ -768,11 +788,10 @@
metadata: @config.metadata,
retry_policy: @config.retry_policy
@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
@@ -853,11 +872,10 @@
metadata: @config.metadata,
retry_policy: @config.retry_policy
@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
@@ -949,11 +967,11 @@
"zone" => request.zone
},
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
@@ -1041,11 +1059,11 @@
retry_policy: @config.retry_policy
@disks_stub.list request, options do |result, operation|
result = ::Gapic::Rest::PagedEnumerable.new @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
@@ -1137,11 +1155,11 @@
"zone" => request.zone
},
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
@@ -1233,11 +1251,11 @@
"zone" => request.zone
},
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
@@ -1318,11 +1336,10 @@
metadata: @config.metadata,
retry_policy: @config.retry_policy
@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
@@ -1414,11 +1431,11 @@
"zone" => request.zone
},
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
@@ -1510,11 +1527,11 @@
"zone" => request.zone
},
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
@@ -1604,11 +1621,11 @@
"zone" => request.zone
},
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
@@ -1698,11 +1715,11 @@
"zone" => request.zone
},
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
@@ -1783,11 +1800,10 @@
metadata: @config.metadata,
retry_policy: @config.retry_policy
@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
@@ -1882,11 +1898,11 @@
"zone" => request.zone
},
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
@@ -1962,10 +1978,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
@@ -1983,9 +2004,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?