google-cloud-pubsub-v1 0.23.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2676c63bd1f4b22121c0b55f3715e3d5292bf260fc59193c650c6c1aad2853fe
4
- data.tar.gz: df1936d7a3a4d8072432164122eaf5d7f84e1acdb1ede4504b5763302437bc4f
3
+ metadata.gz: 3e4470b53901c05a76316bd9212a064ab754b57cf6e0adf02c4747874eb22a5c
4
+ data.tar.gz: e2505dd7f33e97e1a9fed9d4fd9ad0231811987d2931bc3c69a8891812dd9d4b
5
5
  SHA512:
6
- metadata.gz: e646287c9b110c21fba523850b9f082fe71cec7793014080d78ce1fdadf94bed460efba9ce57d542ed1d8f5e96ca2043391f518d61803653c87a19d85322702c
7
- data.tar.gz: 29739402e7bc85b3cb9588f574f9655ad8b9326203bfbd6d03fec92f2dd23e818b6f5d91c6382fb8400b7b3bfe1af907e6e4f5d991c746bef1d8f130adb0015c
6
+ metadata.gz: cb8151ea833daea5adec419088a01d43fc2ddb46c030acd1087e159e94ee524628f79843f4da8b4cdca3a5c41a3cc30abc8e3429847ff469ea6ddbe4f4bd4494
7
+ data.tar.gz: d206ab6e2da715ca3f43561629eabab26420b9e1b1bb8803665bd4f975551e3a4f3db79e24aee68c1d8892ef01859f51d38f69fd344eea48843f7746cb5f7e32
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/pubsub)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
48
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
52
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
-
54
- Configuring a Ruby stdlib logger:
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ You can customize logging by modifying the `logger` configuration when
72
+ constructing a client object. For example:
55
73
 
56
74
  ```ruby
75
+ require "google/cloud/pubsub/v1"
57
76
  require "logger"
58
77
 
59
- module MyLogger
60
- LOGGER = Logger.new $stderr, level: Logger::WARN
61
- def logger
62
- LOGGER
63
- end
64
- end
65
-
66
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
67
- module GRPC
68
- extend MyLogger
78
+ client = ::Google::Cloud::PubSub::V1::SchemaService::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
69
80
  end
70
81
  ```
71
82
 
72
-
73
83
  ## Google Cloud Samples
74
84
 
75
85
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
@@ -32,6 +32,9 @@ module Google
32
32
  # messages to a topic.
33
33
  #
34
34
  class Client
35
+ # @private
36
+ API_VERSION = ""
37
+
35
38
  # @private
36
39
  DEFAULT_ENDPOINT_TEMPLATE = "pubsub.$UNIVERSE_DOMAIN$"
37
40
 
@@ -201,14 +204,26 @@ module Google
201
204
  universe_domain: @config.universe_domain,
202
205
  channel_args: @config.channel_args,
203
206
  interceptors: @config.interceptors,
204
- channel_pool_config: @config.channel_pool
207
+ channel_pool_config: @config.channel_pool,
208
+ logger: @config.logger
205
209
  )
206
210
 
211
+ @publisher_stub.stub_logger&.info do |entry|
212
+ entry.set_system_name
213
+ entry.set_service
214
+ entry.message = "Created client for #{entry.service}"
215
+ entry.set_credentials_fields credentials
216
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
217
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
218
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
219
+ end
220
+
207
221
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
208
222
  config.credentials = credentials
209
223
  config.quota_project = @quota_project_id
210
224
  config.endpoint = @publisher_stub.endpoint
211
225
  config.universe_domain = @publisher_stub.universe_domain
226
+ config.logger = @publisher_stub.logger if config.respond_to? :logger=
212
227
  end
213
228
  end
214
229
 
@@ -219,6 +234,15 @@ module Google
219
234
  #
220
235
  attr_reader :iam_policy_client
221
236
 
237
+ ##
238
+ # The logger used for request/response debug logging.
239
+ #
240
+ # @return [Logger]
241
+ #
242
+ def logger
243
+ @publisher_stub.logger
244
+ end
245
+
222
246
  # Service calls
223
247
 
224
248
  ##
@@ -311,10 +335,11 @@ module Google
311
335
  # Customize the options with defaults
312
336
  metadata = @config.rpcs.create_topic.metadata.to_h
313
337
 
314
- # Set x-goog-api-client and x-goog-user-project headers
338
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
315
339
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
316
340
  lib_name: @config.lib_name, lib_version: @config.lib_version,
317
341
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
342
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
318
343
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
319
344
 
320
345
  header_params = {}
@@ -335,7 +360,6 @@ module Google
335
360
 
336
361
  @publisher_stub.call_rpc :create_topic, request, options: options do |response, operation|
337
362
  yield response, operation if block_given?
338
- return response
339
363
  end
340
364
  rescue ::GRPC::BadStatus => e
341
365
  raise ::Google::Cloud::Error.from_error(e)
@@ -403,10 +427,11 @@ module Google
403
427
  # Customize the options with defaults
404
428
  metadata = @config.rpcs.update_topic.metadata.to_h
405
429
 
406
- # Set x-goog-api-client and x-goog-user-project headers
430
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
407
431
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
408
432
  lib_name: @config.lib_name, lib_version: @config.lib_version,
409
433
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
434
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
410
435
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
411
436
 
412
437
  header_params = {}
@@ -427,7 +452,6 @@ module Google
427
452
 
428
453
  @publisher_stub.call_rpc :update_topic, request, options: options do |response, operation|
429
454
  yield response, operation if block_given?
430
- return response
431
455
  end
432
456
  rescue ::GRPC::BadStatus => e
433
457
  raise ::Google::Cloud::Error.from_error(e)
@@ -492,10 +516,11 @@ module Google
492
516
  # Customize the options with defaults
493
517
  metadata = @config.rpcs.publish.metadata.to_h
494
518
 
495
- # Set x-goog-api-client and x-goog-user-project headers
519
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
496
520
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
497
521
  lib_name: @config.lib_name, lib_version: @config.lib_version,
498
522
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
523
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
499
524
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
500
525
 
501
526
  header_params = {}
@@ -516,7 +541,6 @@ module Google
516
541
 
517
542
  @publisher_stub.call_rpc :publish, request, options: options do |response, operation|
518
543
  yield response, operation if block_given?
519
- return response
520
544
  end
521
545
  rescue ::GRPC::BadStatus => e
522
546
  raise ::Google::Cloud::Error.from_error(e)
@@ -578,10 +602,11 @@ module Google
578
602
  # Customize the options with defaults
579
603
  metadata = @config.rpcs.get_topic.metadata.to_h
580
604
 
581
- # Set x-goog-api-client and x-goog-user-project headers
605
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
582
606
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
583
607
  lib_name: @config.lib_name, lib_version: @config.lib_version,
584
608
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
609
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
585
610
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
586
611
 
587
612
  header_params = {}
@@ -602,7 +627,6 @@ module Google
602
627
 
603
628
  @publisher_stub.call_rpc :get_topic, request, options: options do |response, operation|
604
629
  yield response, operation if block_given?
605
- return response
606
630
  end
607
631
  rescue ::GRPC::BadStatus => e
608
632
  raise ::Google::Cloud::Error.from_error(e)
@@ -674,10 +698,11 @@ module Google
674
698
  # Customize the options with defaults
675
699
  metadata = @config.rpcs.list_topics.metadata.to_h
676
700
 
677
- # Set x-goog-api-client and x-goog-user-project headers
701
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
678
702
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
679
703
  lib_name: @config.lib_name, lib_version: @config.lib_version,
680
704
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
705
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
681
706
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
682
707
 
683
708
  header_params = {}
@@ -699,7 +724,7 @@ module Google
699
724
  @publisher_stub.call_rpc :list_topics, request, options: options do |response, operation|
700
725
  response = ::Gapic::PagedEnumerable.new @publisher_stub, :list_topics, request, response, operation, options
701
726
  yield response, operation if block_given?
702
- return response
727
+ throw :response, response
703
728
  end
704
729
  rescue ::GRPC::BadStatus => e
705
730
  raise ::Google::Cloud::Error.from_error(e)
@@ -767,10 +792,11 @@ module Google
767
792
  # Customize the options with defaults
768
793
  metadata = @config.rpcs.list_topic_subscriptions.metadata.to_h
769
794
 
770
- # Set x-goog-api-client and x-goog-user-project headers
795
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
771
796
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
772
797
  lib_name: @config.lib_name, lib_version: @config.lib_version,
773
798
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
799
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
774
800
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
775
801
 
776
802
  header_params = {}
@@ -791,7 +817,6 @@ module Google
791
817
 
792
818
  @publisher_stub.call_rpc :list_topic_subscriptions, request, options: options do |response, operation|
793
819
  yield response, operation if block_given?
794
- return response
795
820
  end
796
821
  rescue ::GRPC::BadStatus => e
797
822
  raise ::Google::Cloud::Error.from_error(e)
@@ -863,10 +888,11 @@ module Google
863
888
  # Customize the options with defaults
864
889
  metadata = @config.rpcs.list_topic_snapshots.metadata.to_h
865
890
 
866
- # Set x-goog-api-client and x-goog-user-project headers
891
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
867
892
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
868
893
  lib_name: @config.lib_name, lib_version: @config.lib_version,
869
894
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
895
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
870
896
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
871
897
 
872
898
  header_params = {}
@@ -887,7 +913,6 @@ module Google
887
913
 
888
914
  @publisher_stub.call_rpc :list_topic_snapshots, request, options: options do |response, operation|
889
915
  yield response, operation if block_given?
890
- return response
891
916
  end
892
917
  rescue ::GRPC::BadStatus => e
893
918
  raise ::Google::Cloud::Error.from_error(e)
@@ -953,10 +978,11 @@ module Google
953
978
  # Customize the options with defaults
954
979
  metadata = @config.rpcs.delete_topic.metadata.to_h
955
980
 
956
- # Set x-goog-api-client and x-goog-user-project headers
981
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
957
982
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
958
983
  lib_name: @config.lib_name, lib_version: @config.lib_version,
959
984
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
985
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
960
986
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
961
987
 
962
988
  header_params = {}
@@ -977,7 +1003,6 @@ module Google
977
1003
 
978
1004
  @publisher_stub.call_rpc :delete_topic, request, options: options do |response, operation|
979
1005
  yield response, operation if block_given?
980
- return response
981
1006
  end
982
1007
  rescue ::GRPC::BadStatus => e
983
1008
  raise ::Google::Cloud::Error.from_error(e)
@@ -1042,10 +1067,11 @@ module Google
1042
1067
  # Customize the options with defaults
1043
1068
  metadata = @config.rpcs.detach_subscription.metadata.to_h
1044
1069
 
1045
- # Set x-goog-api-client and x-goog-user-project headers
1070
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1046
1071
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1047
1072
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1048
1073
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
1074
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1049
1075
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1050
1076
 
1051
1077
  header_params = {}
@@ -1066,7 +1092,6 @@ module Google
1066
1092
 
1067
1093
  @publisher_stub.call_rpc :detach_subscription, request, options: options do |response, operation|
1068
1094
  yield response, operation if block_given?
1069
- return response
1070
1095
  end
1071
1096
  rescue ::GRPC::BadStatus => e
1072
1097
  raise ::Google::Cloud::Error.from_error(e)
@@ -1155,6 +1180,11 @@ module Google
1155
1180
  # default endpoint URL. The default value of nil uses the environment
1156
1181
  # universe (usually the default "googleapis.com" universe).
1157
1182
  # @return [::String,nil]
1183
+ # @!attribute [rw] logger
1184
+ # A custom logger to use for request/response debug logging, or the value
1185
+ # `:default` (the default) to construct a default logger, or `nil` to
1186
+ # explicitly disable logging.
1187
+ # @return [::Logger,:default,nil]
1158
1188
  #
1159
1189
  class Configuration
1160
1190
  extend ::Gapic::Config
@@ -1179,6 +1209,7 @@ module Google
1179
1209
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1180
1210
  config_attr :quota_project, nil, ::String, nil
1181
1211
  config_attr :universe_domain, nil, ::String, nil
1212
+ config_attr :logger, :default, ::Logger, nil, :default
1182
1213
 
1183
1214
  # @private
1184
1215
  def initialize parent_config = nil
@@ -31,6 +31,9 @@ module Google
31
31
  # Service for doing schema-related operations.
32
32
  #
33
33
  class Client
34
+ # @private
35
+ API_VERSION = ""
36
+
34
37
  # @private
35
38
  DEFAULT_ENDPOINT_TEMPLATE = "pubsub.$UNIVERSE_DOMAIN$"
36
39
 
@@ -205,14 +208,26 @@ module Google
205
208
  universe_domain: @config.universe_domain,
206
209
  channel_args: @config.channel_args,
207
210
  interceptors: @config.interceptors,
208
- channel_pool_config: @config.channel_pool
211
+ channel_pool_config: @config.channel_pool,
212
+ logger: @config.logger
209
213
  )
210
214
 
215
+ @schema_service_stub.stub_logger&.info do |entry|
216
+ entry.set_system_name
217
+ entry.set_service
218
+ entry.message = "Created client for #{entry.service}"
219
+ entry.set_credentials_fields credentials
220
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
221
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
222
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
223
+ end
224
+
211
225
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
212
226
  config.credentials = credentials
213
227
  config.quota_project = @quota_project_id
214
228
  config.endpoint = @schema_service_stub.endpoint
215
229
  config.universe_domain = @schema_service_stub.universe_domain
230
+ config.logger = @schema_service_stub.logger if config.respond_to? :logger=
216
231
  end
217
232
  end
218
233
 
@@ -223,6 +238,15 @@ module Google
223
238
  #
224
239
  attr_reader :iam_policy_client
225
240
 
241
+ ##
242
+ # The logger used for request/response debug logging.
243
+ #
244
+ # @return [Logger]
245
+ #
246
+ def logger
247
+ @schema_service_stub.logger
248
+ end
249
+
226
250
  # Service calls
227
251
 
228
252
  ##
@@ -293,10 +317,11 @@ module Google
293
317
  # Customize the options with defaults
294
318
  metadata = @config.rpcs.create_schema.metadata.to_h
295
319
 
296
- # Set x-goog-api-client and x-goog-user-project headers
320
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
297
321
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
298
322
  lib_name: @config.lib_name, lib_version: @config.lib_version,
299
323
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
324
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
300
325
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
301
326
 
302
327
  header_params = {}
@@ -317,7 +342,6 @@ module Google
317
342
 
318
343
  @schema_service_stub.call_rpc :create_schema, request, options: options do |response, operation|
319
344
  yield response, operation if block_given?
320
- return response
321
345
  end
322
346
  rescue ::GRPC::BadStatus => e
323
347
  raise ::Google::Cloud::Error.from_error(e)
@@ -382,10 +406,11 @@ module Google
382
406
  # Customize the options with defaults
383
407
  metadata = @config.rpcs.get_schema.metadata.to_h
384
408
 
385
- # Set x-goog-api-client and x-goog-user-project headers
409
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
386
410
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
387
411
  lib_name: @config.lib_name, lib_version: @config.lib_version,
388
412
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
413
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
389
414
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
390
415
 
391
416
  header_params = {}
@@ -406,7 +431,6 @@ module Google
406
431
 
407
432
  @schema_service_stub.call_rpc :get_schema, request, options: options do |response, operation|
408
433
  yield response, operation if block_given?
409
- return response
410
434
  end
411
435
  rescue ::GRPC::BadStatus => e
412
436
  raise ::Google::Cloud::Error.from_error(e)
@@ -482,10 +506,11 @@ module Google
482
506
  # Customize the options with defaults
483
507
  metadata = @config.rpcs.list_schemas.metadata.to_h
484
508
 
485
- # Set x-goog-api-client and x-goog-user-project headers
509
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
486
510
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
487
511
  lib_name: @config.lib_name, lib_version: @config.lib_version,
488
512
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
513
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
489
514
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
490
515
 
491
516
  header_params = {}
@@ -507,7 +532,7 @@ module Google
507
532
  @schema_service_stub.call_rpc :list_schemas, request, options: options do |response, operation|
508
533
  response = ::Gapic::PagedEnumerable.new @schema_service_stub, :list_schemas, request, response, operation, options
509
534
  yield response, operation if block_given?
510
- return response
535
+ throw :response, response
511
536
  end
512
537
  rescue ::GRPC::BadStatus => e
513
538
  raise ::Google::Cloud::Error.from_error(e)
@@ -581,10 +606,11 @@ module Google
581
606
  # Customize the options with defaults
582
607
  metadata = @config.rpcs.list_schema_revisions.metadata.to_h
583
608
 
584
- # Set x-goog-api-client and x-goog-user-project headers
609
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
585
610
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
586
611
  lib_name: @config.lib_name, lib_version: @config.lib_version,
587
612
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
613
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
588
614
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
589
615
 
590
616
  header_params = {}
@@ -606,7 +632,7 @@ module Google
606
632
  @schema_service_stub.call_rpc :list_schema_revisions, request, options: options do |response, operation|
607
633
  response = ::Gapic::PagedEnumerable.new @schema_service_stub, :list_schema_revisions, request, response, operation, options
608
634
  yield response, operation if block_given?
609
- return response
635
+ throw :response, response
610
636
  end
611
637
  rescue ::GRPC::BadStatus => e
612
638
  raise ::Google::Cloud::Error.from_error(e)
@@ -670,10 +696,11 @@ module Google
670
696
  # Customize the options with defaults
671
697
  metadata = @config.rpcs.commit_schema.metadata.to_h
672
698
 
673
- # Set x-goog-api-client and x-goog-user-project headers
699
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
674
700
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
675
701
  lib_name: @config.lib_name, lib_version: @config.lib_version,
676
702
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
703
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
677
704
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
678
705
 
679
706
  header_params = {}
@@ -694,7 +721,6 @@ module Google
694
721
 
695
722
  @schema_service_stub.call_rpc :commit_schema, request, options: options do |response, operation|
696
723
  yield response, operation if block_given?
697
- return response
698
724
  end
699
725
  rescue ::GRPC::BadStatus => e
700
726
  raise ::Google::Cloud::Error.from_error(e)
@@ -760,10 +786,11 @@ module Google
760
786
  # Customize the options with defaults
761
787
  metadata = @config.rpcs.rollback_schema.metadata.to_h
762
788
 
763
- # Set x-goog-api-client and x-goog-user-project headers
789
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
764
790
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
765
791
  lib_name: @config.lib_name, lib_version: @config.lib_version,
766
792
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
793
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
767
794
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
768
795
 
769
796
  header_params = {}
@@ -784,7 +811,6 @@ module Google
784
811
 
785
812
  @schema_service_stub.call_rpc :rollback_schema, request, options: options do |response, operation|
786
813
  yield response, operation if block_given?
787
- return response
788
814
  end
789
815
  rescue ::GRPC::BadStatus => e
790
816
  raise ::Google::Cloud::Error.from_error(e)
@@ -852,10 +878,11 @@ module Google
852
878
  # Customize the options with defaults
853
879
  metadata = @config.rpcs.delete_schema_revision.metadata.to_h
854
880
 
855
- # Set x-goog-api-client and x-goog-user-project headers
881
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
856
882
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
857
883
  lib_name: @config.lib_name, lib_version: @config.lib_version,
858
884
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
885
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
859
886
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
860
887
 
861
888
  header_params = {}
@@ -876,7 +903,6 @@ module Google
876
903
 
877
904
  @schema_service_stub.call_rpc :delete_schema_revision, request, options: options do |response, operation|
878
905
  yield response, operation if block_given?
879
- return response
880
906
  end
881
907
  rescue ::GRPC::BadStatus => e
882
908
  raise ::Google::Cloud::Error.from_error(e)
@@ -938,10 +964,11 @@ module Google
938
964
  # Customize the options with defaults
939
965
  metadata = @config.rpcs.delete_schema.metadata.to_h
940
966
 
941
- # Set x-goog-api-client and x-goog-user-project headers
967
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
942
968
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
943
969
  lib_name: @config.lib_name, lib_version: @config.lib_version,
944
970
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
971
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
945
972
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
946
973
 
947
974
  header_params = {}
@@ -962,7 +989,6 @@ module Google
962
989
 
963
990
  @schema_service_stub.call_rpc :delete_schema, request, options: options do |response, operation|
964
991
  yield response, operation if block_given?
965
- return response
966
992
  end
967
993
  rescue ::GRPC::BadStatus => e
968
994
  raise ::Google::Cloud::Error.from_error(e)
@@ -1026,10 +1052,11 @@ module Google
1026
1052
  # Customize the options with defaults
1027
1053
  metadata = @config.rpcs.validate_schema.metadata.to_h
1028
1054
 
1029
- # Set x-goog-api-client and x-goog-user-project headers
1055
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1030
1056
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1031
1057
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1032
1058
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
1059
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1033
1060
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1034
1061
 
1035
1062
  header_params = {}
@@ -1050,7 +1077,6 @@ module Google
1050
1077
 
1051
1078
  @schema_service_stub.call_rpc :validate_schema, request, options: options do |response, operation|
1052
1079
  yield response, operation if block_given?
1053
- return response
1054
1080
  end
1055
1081
  rescue ::GRPC::BadStatus => e
1056
1082
  raise ::Google::Cloud::Error.from_error(e)
@@ -1122,10 +1148,11 @@ module Google
1122
1148
  # Customize the options with defaults
1123
1149
  metadata = @config.rpcs.validate_message.metadata.to_h
1124
1150
 
1125
- # Set x-goog-api-client and x-goog-user-project headers
1151
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1126
1152
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1127
1153
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1128
1154
  gapic_version: ::Google::Cloud::PubSub::V1::VERSION
1155
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1129
1156
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1130
1157
 
1131
1158
  header_params = {}
@@ -1146,7 +1173,6 @@ module Google
1146
1173
 
1147
1174
  @schema_service_stub.call_rpc :validate_message, request, options: options do |response, operation|
1148
1175
  yield response, operation if block_given?
1149
- return response
1150
1176
  end
1151
1177
  rescue ::GRPC::BadStatus => e
1152
1178
  raise ::Google::Cloud::Error.from_error(e)
@@ -1235,6 +1261,11 @@ module Google
1235
1261
  # default endpoint URL. The default value of nil uses the environment
1236
1262
  # universe (usually the default "googleapis.com" universe).
1237
1263
  # @return [::String,nil]
1264
+ # @!attribute [rw] logger
1265
+ # A custom logger to use for request/response debug logging, or the value
1266
+ # `:default` (the default) to construct a default logger, or `nil` to
1267
+ # explicitly disable logging.
1268
+ # @return [::Logger,:default,nil]
1238
1269
  #
1239
1270
  class Configuration
1240
1271
  extend ::Gapic::Config
@@ -1259,6 +1290,7 @@ module Google
1259
1290
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1260
1291
  config_attr :quota_project, nil, ::String, nil
1261
1292
  config_attr :universe_domain, nil, ::String, nil
1293
+ config_attr :logger, :default, ::Logger, nil, :default
1262
1294
 
1263
1295
  # @private
1264
1296
  def initialize parent_config = nil