lib/google/cloud/backupdr/v1/backupdr/client.rb in google-cloud-backupdr-v1-0.3.0 vs lib/google/cloud/backupdr/v1/backupdr/client.rb in google-cloud-backupdr-v1-0.4.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 ) + @backup_dr_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 = @backup_dr_stub.endpoint config.universe_domain = @backup_dr_stub.universe_domain + config.logger = @backup_dr_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 = @backup_dr_stub.endpoint config.universe_domain = @backup_dr_stub.universe_domain + config.logger = @backup_dr_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 + @backup_dr_stub.logger + end + # Service calls ## # Lists ManagementServers in a given project and location. # @@ -371,11 +393,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :list_management_servers, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :list_management_servers, 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 @@ -458,11 +480,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :get_management_server, 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 @@ -574,11 +595,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :create_management_server, 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 @@ -682,11 +703,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :delete_management_server, 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 @@ -799,11 +820,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :create_backup_vault, 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 @@ -907,11 +928,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :list_backup_vaults, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :list_backup_vaults, 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 @@ -1014,11 +1035,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :fetch_usable_backup_vaults, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :fetch_usable_backup_vaults, 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 @@ -1104,11 +1125,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :get_backup_vault, 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 @@ -1224,11 +1244,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :update_backup_vault, 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 @backup_dr_stub.call_rpc :delete_backup_vault, 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 @@ -1450,11 +1470,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :list_data_sources, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :list_data_sources, 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 @@ -1537,11 +1557,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :get_data_source, 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 @@ -1653,11 +1672,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :update_data_source, 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 @@ -1761,11 +1780,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :list_backups, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :list_backups, 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 @@ -1851,11 +1870,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :get_backup, 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 @@ -1965,11 +1983,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :update_backup, 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 @@ -2073,11 +2091,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :delete_backup, 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 @@ -2186,11 +2204,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :restore_backup, 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 @@ -2303,11 +2321,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :create_backup_plan, 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 @@ -2391,11 +2409,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :get_backup_plan, 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 @@ -2504,11 +2521,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :list_backup_plans, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :list_backup_plans, 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 @@ -2614,11 +2631,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :delete_backup_plan, 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 @@ -2729,11 +2746,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :create_backup_plan_association, 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 @@ -2816,11 +2833,10 @@ metadata: @config.metadata, retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :get_backup_plan_association, 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 @@ -2919,11 +2935,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :list_backup_plan_associations, request, options: options do |response, operation| response = ::Gapic::PagedEnumerable.new @backup_dr_stub, :list_backup_plan_associations, 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 @@ -3028,11 +3044,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :delete_backup_plan_association, 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 @@ -3139,11 +3155,11 @@ retry_policy: @config.retry_policy @backup_dr_stub.call_rpc :trigger_backup, 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 @@ -3228,10 +3244,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 @@ -3252,9 +3273,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?