google-cloud-speech-v1p1beta1 0.21.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 332d5087e76fb2f5d3971ad68c898e2d7f86d14f842ec23ea70e755ff0229d6f
4
- data.tar.gz: da9fd11509921f6b5375decce1aecb4fb2f1a15e2bf34b9340ad7abf03adee64
3
+ metadata.gz: 03d1f81d33348284d0b58c3d55adcd2bf2355a3d4471b0e808b3145528f9cf6e
4
+ data.tar.gz: 2fd66ed27417180c0a80bc58d243bf87d3c181a85eb1f5137940759a1d19fda5
5
5
  SHA512:
6
- metadata.gz: b19c122c3f56a2a20ab9a4d91fe48008e69866991ecd7da90d8cf149b0f809d6a4615b4e73e7dd6504b007f731b45cfdfc28381d23f954ecaa2204deb72d5254
7
- data.tar.gz: ac3b45b146d1d4d435fbcd8904659fa440e21298332fdcb54610e0e2665c18b07c6cd9030f26da3ea3efe304a67758d24a6824cf0339f11d0270717ad4d54ed9
6
+ metadata.gz: 708d1469e32bef3d9e2f2d451c218bc824c8cc486f95c9668825920d1f3921cc9b41322882af9f3e02b028e50142002bd4fef873da1c078ac39fa768cd1a8d31
7
+ data.tar.gz: 50d0403d1647ba0dfa2f03ee519267aca49d9deb63ee55bde3bda6e11873a6e685f6564607f0266b4099d7fb4fc8e9b2a20cc7dd87852a17177fa9a56e7d2fe0
data/README.md CHANGED
@@ -43,33 +43,43 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/speech-to-text)
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/speech/v1p1beta1"
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::Speech::V1p1beta1::Speech::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).
@@ -30,6 +30,9 @@ module Google
30
30
  # Service that implements Google Cloud Speech Adaptation API.
31
31
  #
32
32
  class Client
33
+ # @private
34
+ API_VERSION = ""
35
+
33
36
  # @private
34
37
  DEFAULT_ENDPOINT_TEMPLATE = "speech.$UNIVERSE_DOMAIN$"
35
38
 
@@ -154,8 +157,28 @@ module Google
154
157
  universe_domain: @config.universe_domain,
155
158
  channel_args: @config.channel_args,
156
159
  interceptors: @config.interceptors,
157
- channel_pool_config: @config.channel_pool
160
+ channel_pool_config: @config.channel_pool,
161
+ logger: @config.logger
158
162
  )
163
+
164
+ @adaptation_stub.stub_logger&.info do |entry|
165
+ entry.set_system_name
166
+ entry.set_service
167
+ entry.message = "Created client for #{entry.service}"
168
+ entry.set_credentials_fields credentials
169
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
170
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
171
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
172
+ end
173
+ end
174
+
175
+ ##
176
+ # The logger used for request/response debug logging.
177
+ #
178
+ # @return [Logger]
179
+ #
180
+ def logger
181
+ @adaptation_stub.logger
159
182
  end
160
183
 
161
184
  # Service calls
@@ -234,10 +257,11 @@ module Google
234
257
  # Customize the options with defaults
235
258
  metadata = @config.rpcs.create_phrase_set.metadata.to_h
236
259
 
237
- # Set x-goog-api-client and x-goog-user-project headers
260
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
238
261
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
239
262
  lib_name: @config.lib_name, lib_version: @config.lib_version,
240
263
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
264
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
241
265
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
242
266
 
243
267
  header_params = {}
@@ -258,7 +282,6 @@ module Google
258
282
 
259
283
  @adaptation_stub.call_rpc :create_phrase_set, request, options: options do |response, operation|
260
284
  yield response, operation if block_given?
261
- return response
262
285
  end
263
286
  rescue ::GRPC::BadStatus => e
264
287
  raise ::Google::Cloud::Error.from_error(e)
@@ -327,10 +350,11 @@ module Google
327
350
  # Customize the options with defaults
328
351
  metadata = @config.rpcs.get_phrase_set.metadata.to_h
329
352
 
330
- # Set x-goog-api-client and x-goog-user-project headers
353
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
331
354
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
332
355
  lib_name: @config.lib_name, lib_version: @config.lib_version,
333
356
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
357
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
334
358
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
335
359
 
336
360
  header_params = {}
@@ -351,7 +375,6 @@ module Google
351
375
 
352
376
  @adaptation_stub.call_rpc :get_phrase_set, request, options: options do |response, operation|
353
377
  yield response, operation if block_given?
354
- return response
355
378
  end
356
379
  rescue ::GRPC::BadStatus => e
357
380
  raise ::Google::Cloud::Error.from_error(e)
@@ -435,10 +458,11 @@ module Google
435
458
  # Customize the options with defaults
436
459
  metadata = @config.rpcs.list_phrase_set.metadata.to_h
437
460
 
438
- # Set x-goog-api-client and x-goog-user-project headers
461
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
439
462
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
440
463
  lib_name: @config.lib_name, lib_version: @config.lib_version,
441
464
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
465
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
442
466
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
443
467
 
444
468
  header_params = {}
@@ -460,7 +484,7 @@ module Google
460
484
  @adaptation_stub.call_rpc :list_phrase_set, request, options: options do |response, operation|
461
485
  response = ::Gapic::PagedEnumerable.new @adaptation_stub, :list_phrase_set, request, response, operation, options
462
486
  yield response, operation if block_given?
463
- return response
487
+ throw :response, response
464
488
  end
465
489
  rescue ::GRPC::BadStatus => e
466
490
  raise ::Google::Cloud::Error.from_error(e)
@@ -534,10 +558,11 @@ module Google
534
558
  # Customize the options with defaults
535
559
  metadata = @config.rpcs.update_phrase_set.metadata.to_h
536
560
 
537
- # Set x-goog-api-client and x-goog-user-project headers
561
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
538
562
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
539
563
  lib_name: @config.lib_name, lib_version: @config.lib_version,
540
564
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
565
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
541
566
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
542
567
 
543
568
  header_params = {}
@@ -558,7 +583,6 @@ module Google
558
583
 
559
584
  @adaptation_stub.call_rpc :update_phrase_set, request, options: options do |response, operation|
560
585
  yield response, operation if block_given?
561
- return response
562
586
  end
563
587
  rescue ::GRPC::BadStatus => e
564
588
  raise ::Google::Cloud::Error.from_error(e)
@@ -621,10 +645,11 @@ module Google
621
645
  # Customize the options with defaults
622
646
  metadata = @config.rpcs.delete_phrase_set.metadata.to_h
623
647
 
624
- # Set x-goog-api-client and x-goog-user-project headers
648
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
625
649
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
626
650
  lib_name: @config.lib_name, lib_version: @config.lib_version,
627
651
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
652
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
628
653
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
629
654
 
630
655
  header_params = {}
@@ -645,7 +670,6 @@ module Google
645
670
 
646
671
  @adaptation_stub.call_rpc :delete_phrase_set, request, options: options do |response, operation|
647
672
  yield response, operation if block_given?
648
- return response
649
673
  end
650
674
  rescue ::GRPC::BadStatus => e
651
675
  raise ::Google::Cloud::Error.from_error(e)
@@ -723,10 +747,11 @@ module Google
723
747
  # Customize the options with defaults
724
748
  metadata = @config.rpcs.create_custom_class.metadata.to_h
725
749
 
726
- # Set x-goog-api-client and x-goog-user-project headers
750
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
727
751
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
728
752
  lib_name: @config.lib_name, lib_version: @config.lib_version,
729
753
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
754
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
730
755
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
731
756
 
732
757
  header_params = {}
@@ -747,7 +772,6 @@ module Google
747
772
 
748
773
  @adaptation_stub.call_rpc :create_custom_class, request, options: options do |response, operation|
749
774
  yield response, operation if block_given?
750
- return response
751
775
  end
752
776
  rescue ::GRPC::BadStatus => e
753
777
  raise ::Google::Cloud::Error.from_error(e)
@@ -810,10 +834,11 @@ module Google
810
834
  # Customize the options with defaults
811
835
  metadata = @config.rpcs.get_custom_class.metadata.to_h
812
836
 
813
- # Set x-goog-api-client and x-goog-user-project headers
837
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
814
838
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
815
839
  lib_name: @config.lib_name, lib_version: @config.lib_version,
816
840
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
841
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
817
842
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
818
843
 
819
844
  header_params = {}
@@ -834,7 +859,6 @@ module Google
834
859
 
835
860
  @adaptation_stub.call_rpc :get_custom_class, request, options: options do |response, operation|
836
861
  yield response, operation if block_given?
837
- return response
838
862
  end
839
863
  rescue ::GRPC::BadStatus => e
840
864
  raise ::Google::Cloud::Error.from_error(e)
@@ -918,10 +942,11 @@ module Google
918
942
  # Customize the options with defaults
919
943
  metadata = @config.rpcs.list_custom_classes.metadata.to_h
920
944
 
921
- # Set x-goog-api-client and x-goog-user-project headers
945
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
922
946
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
923
947
  lib_name: @config.lib_name, lib_version: @config.lib_version,
924
948
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
949
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
925
950
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
926
951
 
927
952
  header_params = {}
@@ -943,7 +968,7 @@ module Google
943
968
  @adaptation_stub.call_rpc :list_custom_classes, request, options: options do |response, operation|
944
969
  response = ::Gapic::PagedEnumerable.new @adaptation_stub, :list_custom_classes, request, response, operation, options
945
970
  yield response, operation if block_given?
946
- return response
971
+ throw :response, response
947
972
  end
948
973
  rescue ::GRPC::BadStatus => e
949
974
  raise ::Google::Cloud::Error.from_error(e)
@@ -1017,10 +1042,11 @@ module Google
1017
1042
  # Customize the options with defaults
1018
1043
  metadata = @config.rpcs.update_custom_class.metadata.to_h
1019
1044
 
1020
- # Set x-goog-api-client and x-goog-user-project headers
1045
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1021
1046
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1022
1047
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1023
1048
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
1049
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1024
1050
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1025
1051
 
1026
1052
  header_params = {}
@@ -1041,7 +1067,6 @@ module Google
1041
1067
 
1042
1068
  @adaptation_stub.call_rpc :update_custom_class, request, options: options do |response, operation|
1043
1069
  yield response, operation if block_given?
1044
- return response
1045
1070
  end
1046
1071
  rescue ::GRPC::BadStatus => e
1047
1072
  raise ::Google::Cloud::Error.from_error(e)
@@ -1110,10 +1135,11 @@ module Google
1110
1135
  # Customize the options with defaults
1111
1136
  metadata = @config.rpcs.delete_custom_class.metadata.to_h
1112
1137
 
1113
- # Set x-goog-api-client and x-goog-user-project headers
1138
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1114
1139
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1115
1140
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1116
1141
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION
1142
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1117
1143
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1118
1144
 
1119
1145
  header_params = {}
@@ -1134,7 +1160,6 @@ module Google
1134
1160
 
1135
1161
  @adaptation_stub.call_rpc :delete_custom_class, request, options: options do |response, operation|
1136
1162
  yield response, operation if block_given?
1137
- return response
1138
1163
  end
1139
1164
  rescue ::GRPC::BadStatus => e
1140
1165
  raise ::Google::Cloud::Error.from_error(e)
@@ -1223,6 +1248,11 @@ module Google
1223
1248
  # default endpoint URL. The default value of nil uses the environment
1224
1249
  # universe (usually the default "googleapis.com" universe).
1225
1250
  # @return [::String,nil]
1251
+ # @!attribute [rw] logger
1252
+ # A custom logger to use for request/response debug logging, or the value
1253
+ # `:default` (the default) to construct a default logger, or `nil` to
1254
+ # explicitly disable logging.
1255
+ # @return [::Logger,:default,nil]
1226
1256
  #
1227
1257
  class Configuration
1228
1258
  extend ::Gapic::Config
@@ -1247,6 +1277,7 @@ module Google
1247
1277
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1248
1278
  config_attr :quota_project, nil, ::String, nil
1249
1279
  config_attr :universe_domain, nil, ::String, nil
1280
+ config_attr :logger, :default, ::Logger, nil, :default
1250
1281
 
1251
1282
  # @private
1252
1283
  def initialize parent_config = nil
@@ -32,6 +32,9 @@ module Google
32
32
  # Service that implements Google Cloud Speech Adaptation API.
33
33
  #
34
34
  class Client
35
+ # @private
36
+ API_VERSION = ""
37
+
35
38
  # @private
36
39
  DEFAULT_ENDPOINT_TEMPLATE = "speech.$UNIVERSE_DOMAIN$"
37
40
 
@@ -147,8 +150,28 @@ module Google
147
150
  endpoint: @config.endpoint,
148
151
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
149
152
  universe_domain: @config.universe_domain,
150
- credentials: credentials
153
+ credentials: credentials,
154
+ logger: @config.logger
151
155
  )
156
+
157
+ @adaptation_stub.logger(stub: true)&.info do |entry|
158
+ entry.set_system_name
159
+ entry.set_service
160
+ entry.message = "Created client for #{entry.service}"
161
+ entry.set_credentials_fields credentials
162
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
163
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
164
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
165
+ end
166
+ end
167
+
168
+ ##
169
+ # The logger used for request/response debug logging.
170
+ #
171
+ # @return [Logger]
172
+ #
173
+ def logger
174
+ @adaptation_stub.logger
152
175
  end
153
176
 
154
177
  # Service calls
@@ -226,12 +249,13 @@ module Google
226
249
  # Customize the options with defaults
227
250
  call_metadata = @config.rpcs.create_phrase_set.metadata.to_h
228
251
 
229
- # Set x-goog-api-client and x-goog-user-project headers
252
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
230
253
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
231
254
  lib_name: @config.lib_name, lib_version: @config.lib_version,
232
255
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION,
233
256
  transports_version_send: [:rest]
234
257
 
258
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
235
259
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
236
260
 
237
261
  options.apply_defaults timeout: @config.rpcs.create_phrase_set.timeout,
@@ -244,7 +268,6 @@ module Google
244
268
 
245
269
  @adaptation_stub.create_phrase_set request, options do |result, operation|
246
270
  yield result, operation if block_given?
247
- return result
248
271
  end
249
272
  rescue ::Gapic::Rest::Error => e
250
273
  raise ::Google::Cloud::Error.from_error(e)
@@ -312,12 +335,13 @@ module Google
312
335
  # Customize the options with defaults
313
336
  call_metadata = @config.rpcs.get_phrase_set.metadata.to_h
314
337
 
315
- # 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
316
339
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
317
340
  lib_name: @config.lib_name, lib_version: @config.lib_version,
318
341
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION,
319
342
  transports_version_send: [:rest]
320
343
 
344
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
321
345
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
322
346
 
323
347
  options.apply_defaults timeout: @config.rpcs.get_phrase_set.timeout,
@@ -330,7 +354,6 @@ module Google
330
354
 
331
355
  @adaptation_stub.get_phrase_set request, options do |result, operation|
332
356
  yield result, operation if block_given?
333
- return result
334
357
  end
335
358
  rescue ::Gapic::Rest::Error => e
336
359
  raise ::Google::Cloud::Error.from_error(e)
@@ -413,12 +436,13 @@ module Google
413
436
  # Customize the options with defaults
414
437
  call_metadata = @config.rpcs.list_phrase_set.metadata.to_h
415
438
 
416
- # Set x-goog-api-client and x-goog-user-project headers
439
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
417
440
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
418
441
  lib_name: @config.lib_name, lib_version: @config.lib_version,
419
442
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION,
420
443
  transports_version_send: [:rest]
421
444
 
445
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
422
446
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
423
447
 
424
448
  options.apply_defaults timeout: @config.rpcs.list_phrase_set.timeout,
@@ -432,7 +456,7 @@ module Google
432
456
  @adaptation_stub.list_phrase_set request, options do |result, operation|
433
457
  result = ::Gapic::Rest::PagedEnumerable.new @adaptation_stub, :list_phrase_set, "phrase_sets", request, result, options
434
458
  yield result, operation if block_given?
435
- return result
459
+ throw :response, result
436
460
  end
437
461
  rescue ::Gapic::Rest::Error => e
438
462
  raise ::Google::Cloud::Error.from_error(e)
@@ -505,12 +529,13 @@ module Google
505
529
  # Customize the options with defaults
506
530
  call_metadata = @config.rpcs.update_phrase_set.metadata.to_h
507
531
 
508
- # Set x-goog-api-client and x-goog-user-project headers
532
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
509
533
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
510
534
  lib_name: @config.lib_name, lib_version: @config.lib_version,
511
535
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION,
512
536
  transports_version_send: [:rest]
513
537
 
538
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
514
539
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
515
540
 
516
541
  options.apply_defaults timeout: @config.rpcs.update_phrase_set.timeout,
@@ -523,7 +548,6 @@ module Google
523
548
 
524
549
  @adaptation_stub.update_phrase_set request, options do |result, operation|
525
550
  yield result, operation if block_given?
526
- return result
527
551
  end
528
552
  rescue ::Gapic::Rest::Error => e
529
553
  raise ::Google::Cloud::Error.from_error(e)
@@ -585,12 +609,13 @@ module Google
585
609
  # Customize the options with defaults
586
610
  call_metadata = @config.rpcs.delete_phrase_set.metadata.to_h
587
611
 
588
- # Set x-goog-api-client and x-goog-user-project headers
612
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
589
613
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
590
614
  lib_name: @config.lib_name, lib_version: @config.lib_version,
591
615
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION,
592
616
  transports_version_send: [:rest]
593
617
 
618
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
594
619
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
595
620
 
596
621
  options.apply_defaults timeout: @config.rpcs.delete_phrase_set.timeout,
@@ -603,7 +628,6 @@ module Google
603
628
 
604
629
  @adaptation_stub.delete_phrase_set request, options do |result, operation|
605
630
  yield result, operation if block_given?
606
- return result
607
631
  end
608
632
  rescue ::Gapic::Rest::Error => e
609
633
  raise ::Google::Cloud::Error.from_error(e)
@@ -680,12 +704,13 @@ module Google
680
704
  # Customize the options with defaults
681
705
  call_metadata = @config.rpcs.create_custom_class.metadata.to_h
682
706
 
683
- # Set x-goog-api-client and x-goog-user-project headers
707
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
684
708
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
685
709
  lib_name: @config.lib_name, lib_version: @config.lib_version,
686
710
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION,
687
711
  transports_version_send: [:rest]
688
712
 
713
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
689
714
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
690
715
 
691
716
  options.apply_defaults timeout: @config.rpcs.create_custom_class.timeout,
@@ -698,7 +723,6 @@ module Google
698
723
 
699
724
  @adaptation_stub.create_custom_class request, options do |result, operation|
700
725
  yield result, operation if block_given?
701
- return result
702
726
  end
703
727
  rescue ::Gapic::Rest::Error => e
704
728
  raise ::Google::Cloud::Error.from_error(e)
@@ -760,12 +784,13 @@ module Google
760
784
  # Customize the options with defaults
761
785
  call_metadata = @config.rpcs.get_custom_class.metadata.to_h
762
786
 
763
- # Set x-goog-api-client and x-goog-user-project headers
787
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
764
788
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
765
789
  lib_name: @config.lib_name, lib_version: @config.lib_version,
766
790
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION,
767
791
  transports_version_send: [:rest]
768
792
 
793
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
769
794
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
770
795
 
771
796
  options.apply_defaults timeout: @config.rpcs.get_custom_class.timeout,
@@ -778,7 +803,6 @@ module Google
778
803
 
779
804
  @adaptation_stub.get_custom_class request, options do |result, operation|
780
805
  yield result, operation if block_given?
781
- return result
782
806
  end
783
807
  rescue ::Gapic::Rest::Error => e
784
808
  raise ::Google::Cloud::Error.from_error(e)
@@ -861,12 +885,13 @@ module Google
861
885
  # Customize the options with defaults
862
886
  call_metadata = @config.rpcs.list_custom_classes.metadata.to_h
863
887
 
864
- # Set x-goog-api-client and x-goog-user-project headers
888
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
865
889
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
866
890
  lib_name: @config.lib_name, lib_version: @config.lib_version,
867
891
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION,
868
892
  transports_version_send: [:rest]
869
893
 
894
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
870
895
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
871
896
 
872
897
  options.apply_defaults timeout: @config.rpcs.list_custom_classes.timeout,
@@ -880,7 +905,7 @@ module Google
880
905
  @adaptation_stub.list_custom_classes request, options do |result, operation|
881
906
  result = ::Gapic::Rest::PagedEnumerable.new @adaptation_stub, :list_custom_classes, "custom_classes", request, result, options
882
907
  yield result, operation if block_given?
883
- return result
908
+ throw :response, result
884
909
  end
885
910
  rescue ::Gapic::Rest::Error => e
886
911
  raise ::Google::Cloud::Error.from_error(e)
@@ -953,12 +978,13 @@ module Google
953
978
  # Customize the options with defaults
954
979
  call_metadata = @config.rpcs.update_custom_class.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
  call_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::Speech::V1p1beta1::VERSION,
960
985
  transports_version_send: [:rest]
961
986
 
987
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
962
988
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
963
989
 
964
990
  options.apply_defaults timeout: @config.rpcs.update_custom_class.timeout,
@@ -971,7 +997,6 @@ module Google
971
997
 
972
998
  @adaptation_stub.update_custom_class request, options do |result, operation|
973
999
  yield result, operation if block_given?
974
- return result
975
1000
  end
976
1001
  rescue ::Gapic::Rest::Error => e
977
1002
  raise ::Google::Cloud::Error.from_error(e)
@@ -1039,12 +1064,13 @@ module Google
1039
1064
  # Customize the options with defaults
1040
1065
  call_metadata = @config.rpcs.delete_custom_class.metadata.to_h
1041
1066
 
1042
- # Set x-goog-api-client and x-goog-user-project headers
1067
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1043
1068
  call_metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1044
1069
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1045
1070
  gapic_version: ::Google::Cloud::Speech::V1p1beta1::VERSION,
1046
1071
  transports_version_send: [:rest]
1047
1072
 
1073
+ call_metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1048
1074
  call_metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1049
1075
 
1050
1076
  options.apply_defaults timeout: @config.rpcs.delete_custom_class.timeout,
@@ -1057,7 +1083,6 @@ module Google
1057
1083
 
1058
1084
  @adaptation_stub.delete_custom_class request, options do |result, operation|
1059
1085
  yield result, operation if block_given?
1060
- return result
1061
1086
  end
1062
1087
  rescue ::Gapic::Rest::Error => e
1063
1088
  raise ::Google::Cloud::Error.from_error(e)
@@ -1137,6 +1162,11 @@ module Google
1137
1162
  # default endpoint URL. The default value of nil uses the environment
1138
1163
  # universe (usually the default "googleapis.com" universe).
1139
1164
  # @return [::String,nil]
1165
+ # @!attribute [rw] logger
1166
+ # A custom logger to use for request/response debug logging, or the value
1167
+ # `:default` (the default) to construct a default logger, or `nil` to
1168
+ # explicitly disable logging.
1169
+ # @return [::Logger,:default,nil]
1140
1170
  #
1141
1171
  class Configuration
1142
1172
  extend ::Gapic::Config
@@ -1158,6 +1188,7 @@ module Google
1158
1188
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1159
1189
  config_attr :quota_project, nil, ::String, nil
1160
1190
  config_attr :universe_domain, nil, ::String, nil
1191
+ config_attr :logger, :default, ::Logger, nil, :default
1161
1192
 
1162
1193
  # @private
1163
1194
  def initialize parent_config = nil