lib/google/cloud/workstations/v1/workstations/client.rb in google-cloud-workstations-v1-0.1.3 vs lib/google/cloud/workstations/v1/workstations/client.rb in google-cloud-workstations-v1-0.2.0

- old
+ new

@@ -231,25 +231,38 @@ endpoint: @config.endpoint, endpoint_template: DEFAULT_ENDPOINT_TEMPLATE, universe_domain: @config.universe_domain, channel_args: @config.channel_args, interceptors: @config.interceptors, - channel_pool_config: @config.channel_pool + channel_pool_config: @config.channel_pool, + logger: @config.logger ) + @workstations_stub.stub_logger&.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 + @location_client = Google::Cloud::Location::Locations::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @workstations_stub.endpoint config.universe_domain = @workstations_stub.universe_domain + config.logger = @workstations_stub.logger if config.respond_to? :logger= end @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config| config.credentials = credentials config.quota_project = @quota_project_id config.endpoint = @workstations_stub.endpoint config.universe_domain = @workstations_stub.universe_domain + config.logger = @workstations_stub.logger if config.respond_to? :logger= end end ## # Get the associated client for long-running operations. @@ -270,10 +283,19 @@ # # @return [Google::Iam::V1::IAMPolicy::Client] # attr_reader :iam_policy_client + ## + # The logger used for request/response debug logging. + # + # @return [Logger] + # + def logger + @workstations_stub.logger + end + # Service calls ## # Returns the requested workstation cluster. # @@ -352,11 +374,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @workstations_stub.call_rpc :get_workstation_cluster, request, options: options do |response, operation| yield response, operation if block_given? - return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -448,11 +469,11 @@ retry_policy: @config.retry_policy @workstations_stub.call_rpc :list_workstation_clusters, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @workstations_stub, :list_workstation_clusters, request, response, operation, options yield response, operation if block_given? - return response + throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -549,11 +570,11 @@ retry_policy: @config.retry_policy @workstations_stub.call_rpc :create_workstation_cluster, request, options: options do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: options yield response, operation if block_given? - return response + throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -653,11 +674,11 @@ retry_policy: @config.retry_policy @workstations_stub.call_rpc :update_workstation_cluster, request, options: options do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: options yield response, operation if block_given? - return response + throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -757,11 +778,11 @@ retry_policy: @config.retry_policy @workstations_stub.call_rpc :delete_workstation_cluster, request, options: options do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: options yield response, operation if block_given? - return response + throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -843,11 +864,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @workstations_stub.call_rpc :get_workstation_config, request, options: options do |response, operation| yield response, operation if block_given? - return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -939,11 +959,11 @@ retry_policy: @config.retry_policy @workstations_stub.call_rpc :list_workstation_configs, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @workstations_stub, :list_workstation_configs, request, response, operation, options yield response, operation if block_given? - return response + throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1036,11 +1056,11 @@ retry_policy: @config.retry_policy @workstations_stub.call_rpc :list_usable_workstation_configs, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @workstations_stub, :list_usable_workstation_configs, request, response, operation, options yield response, operation if block_given? - return response + throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1137,11 +1157,11 @@ retry_policy: @config.retry_policy @workstations_stub.call_rpc :create_workstation_config, request, options: options do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: options yield response, operation if block_given? - return response + throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1241,11 +1261,11 @@ retry_policy: @config.retry_policy @workstations_stub.call_rpc :update_workstation_config, request, options: options do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: options yield response, operation if block_given? - return response + throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1345,11 +1365,11 @@ retry_policy: @config.retry_policy @workstations_stub.call_rpc :delete_workstation_config, request, options: options do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: options yield response, operation if block_given? - return response + throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1431,11 +1451,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @workstations_stub.call_rpc :get_workstation, request, options: options do |response, operation| yield response, operation if block_given? - return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1527,11 +1546,11 @@ retry_policy: @config.retry_policy @workstations_stub.call_rpc :list_workstations, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @workstations_stub, :list_workstations, request, response, operation, options yield response, operation if block_given? - return response + throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1624,11 +1643,11 @@ retry_policy: @config.retry_policy @workstations_stub.call_rpc :list_usable_workstations, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @workstations_stub, :list_usable_workstations, request, response, operation, options yield response, operation if block_given? - return response + throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1725,11 +1744,11 @@ retry_policy: @config.retry_policy @workstations_stub.call_rpc :create_workstation, request, options: options do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: options yield response, operation if block_given? - return response + throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1829,11 +1848,11 @@ retry_policy: @config.retry_policy @workstations_stub.call_rpc :update_workstation, request, options: options do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: options yield response, operation if block_given? - return response + throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -1929,11 +1948,11 @@ retry_policy: @config.retry_policy @workstations_stub.call_rpc :delete_workstation, request, options: options do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: options yield response, operation if block_given? - return response + throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -2029,11 +2048,11 @@ retry_policy: @config.retry_policy @workstations_stub.call_rpc :start_workstation, request, options: options do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: options yield response, operation if block_given? - return response + throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -2129,11 +2148,11 @@ retry_policy: @config.retry_policy @workstations_stub.call_rpc :stop_workstation, request, options: options do |response, operation| response = ::Gapic::Operation.new response, @operations_client, options: options yield response, operation if block_given? - return response + throw :response, response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -2226,11 +2245,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @workstations_stub.call_rpc :generate_access_token, request, options: options do |response, operation| yield response, operation if block_given? - return response end rescue ::GRPC::BadStatus => e raise ::Google::Cloud::Error.from_error(e) end @@ -2315,10 +2333,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 @@ -2339,9 +2362,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?