lib/google/cloud/datastream/v1alpha1/datastream/rest/client.rb in google-cloud-datastream-v1alpha1-0.7.1 vs lib/google/cloud/datastream/v1alpha1/datastream/rest/client.rb in google-cloud-datastream-v1alpha1-0.8.0

- old
+ new

@@ -180,21 +180,41 @@ @datastream_stub = ::Google::Cloud::Datastream::V1alpha1::Datastream::Rest::ServiceStub.new( endpoint: @config.endpoint, endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, universe_domain: @config.universe_domain, - credentials: credentials + credentials: credentials, + logger: @config.logger ) + + @datastream_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. # # @return [::Google::Cloud::Datastream::V1alpha1::Datastream::Rest::Operations] # attr_reader :operations_client + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @datastream_stub.logger + end + # Service calls ## # Use this method to list connection profiles created in a project and # location. @@ -285,11 +305,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @datastream_stub.list_connection_profiles 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 @@ -364,11 +383,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @datastream_stub.get_connection_profile 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 @@ -469,11 +487,11 @@ retry_policy: @config.retry_policy @datastream_stub.create_connection_profile request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: 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 @@ -576,11 +594,11 @@ retry_policy: @config.retry_policy @datastream_stub.update_connection_profile request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: 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 @@ -677,11 +695,11 @@ retry_policy: @config.retry_policy @datastream_stub.delete_connection_profile request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: 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 @@ -773,11 +791,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @datastream_stub.discover_connection_profile 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 @@ -870,11 +887,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @datastream_stub.list_streams 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 +965,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @datastream_stub.get_stream 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 @@ -1059,11 +1074,11 @@ retry_policy: @config.retry_policy @datastream_stub.create_stream request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: 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 @@ -1171,11 +1186,11 @@ retry_policy: @config.retry_policy @datastream_stub.update_stream request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: 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 @@ -1272,11 +1287,11 @@ retry_policy: @config.retry_policy @datastream_stub.delete_stream request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: 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 @@ -1359,11 +1374,11 @@ retry_policy: @config.retry_policy @datastream_stub.fetch_errors request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: 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 @@ -1447,11 +1462,11 @@ retry_policy: @config.retry_policy @datastream_stub.fetch_static_ips request, options do |result, operation| result = ::Gapic::Rest::PagedEnumerable.new @datastream_stub, :fetch_static_ips, "static_ips", 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 @@ -1552,11 +1567,11 @@ retry_policy: @config.retry_policy @datastream_stub.create_private_connection request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: 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 @@ -1631,11 +1646,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @datastream_stub.get_private_connection 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 @@ -1731,11 +1745,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @datastream_stub.list_private_connections 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 @@ -1835,11 +1848,11 @@ retry_policy: @config.retry_policy @datastream_stub.delete_private_connection request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: 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 @@ -1941,11 +1954,11 @@ retry_policy: @config.retry_policy @datastream_stub.create_route request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: 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 @@ -2020,11 +2033,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @datastream_stub.get_route 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 @@ -2120,11 +2132,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @datastream_stub.list_routes 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 @@ -2221,11 +2232,11 @@ retry_policy: @config.retry_policy @datastream_stub.delete_route request, options do |result, operation| result = ::Gapic::Operation.new result, @operations_client, options: 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 @@ -2301,10 +2312,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 @@ -2322,9 +2338,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?