lib/google/cloud/compute/v1/network_endpoint_groups/rest/client.rb in google-cloud-compute-v1-2.14.0 vs lib/google/cloud/compute/v1/network_endpoint_groups/rest/client.rb in google-cloud-compute-v1-2.15.0
- old
+ new
@@ -181,21 +181,41 @@
@network_endpoint_groups_stub = ::Google::Cloud::Compute::V1::NetworkEndpointGroups::Rest::ServiceStub.new(
endpoint: @config.endpoint,
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
universe_domain: @config.universe_domain,
- credentials: credentials
+ credentials: credentials,
+ logger: @config.logger
)
+
+ @network_endpoint_groups_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
+ @network_endpoint_groups_stub.logger
+ end
+
# Service calls
##
# Retrieves the list of network endpoint groups and sorts them by zone. To prevent failure, Google recommends that you set the `returnPartialSuccess` parameter to `true`.
#
@@ -282,11 +302,11 @@
retry_policy: @config.retry_policy
@network_endpoint_groups_stub.aggregated_list request, options do |result, operation|
result = ::Gapic::Rest::PagedEnumerable.new @network_endpoint_groups_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
@@ -378,11 +398,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
@@ -472,11 +492,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
@@ -568,11 +588,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
@@ -651,11 +671,10 @@
metadata: @config.metadata,
retry_policy: @config.retry_policy
@network_endpoint_groups_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
@@ -745,11 +764,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
@@ -837,11 +856,11 @@
retry_policy: @config.retry_policy
@network_endpoint_groups_stub.list request, options do |result, operation|
result = ::Gapic::Rest::PagedEnumerable.new @network_endpoint_groups_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
@@ -933,11 +952,11 @@
retry_policy: @config.retry_policy
@network_endpoint_groups_stub.list_network_endpoints request, options do |result, operation|
result = ::Gapic::Rest::PagedEnumerable.new @network_endpoint_groups_stub, :list_network_endpoints, "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
@@ -1018,11 +1037,10 @@
metadata: @config.metadata,
retry_policy: @config.retry_policy
@network_endpoint_groups_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
@@ -1098,10 +1116,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
@@ -1119,9 +1142,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?