google-cloud-translate-v3 1.2.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: 904537804b16ebfe6a376ac9aaa53ba8ba8fe7b307dc51d258355929d81246a3
4
- data.tar.gz: 8590700ba937267546a0b94b178976950b03435d087d918a9b2fd7abefb4ced9
3
+ metadata.gz: b9ad858f136353af7439d0ac27266a05e039268470c72699aae3499c09869fb2
4
+ data.tar.gz: ea21cb978196136f1e9541d39ab0384f17036af54a107aa6d8ab75e1440bc396
5
5
  SHA512:
6
- metadata.gz: 38e2d7fc1d8982fea29575f21ec7d44d3f9b36cf70fc550e0537d1da5112684f1e53eb7e5840b5a9234394ab58c548939d0b991dd2887fc6bafb95daba60993b
7
- data.tar.gz: 6bbac514506c2ce9168f8cd64621cbceaa2c185f5395425e0aa20ce347df6db2e27189047f5927774aeef88eb896b369d54d2dcb536b4597d2c27f24088a1c42
6
+ metadata.gz: 86bc88c3e3723ff6b1c30cccb0e45e4ed23db786276b02bb74f9b26abc653b0c254d2a77d1be236f5046100c96e40fbf96619ef9a5a8cf2257505f8d4f3fc118
7
+ data.tar.gz: 92c238711337d5abd9eca186fc7d969ac437d277d9af3c681190de97024293085e611847a98b3f2d6fff4230ff638841c10c4d3b7dd224d17616984ec0905af5
data/README.md CHANGED
@@ -43,40 +43,50 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/translate)
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/translate/v3"
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::Translate::V3::TranslationService::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).
76
86
 
77
87
  ## Supported Ruby Versions
78
88
 
79
- This library is supported on Ruby 2.7+.
89
+ This library is supported on Ruby 3.0+.
80
90
 
81
91
  Google provides official support for Ruby versions that are actively supported
82
92
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -198,14 +198,26 @@ module Google
198
198
  universe_domain: @config.universe_domain,
199
199
  channel_args: @config.channel_args,
200
200
  interceptors: @config.interceptors,
201
- channel_pool_config: @config.channel_pool
201
+ channel_pool_config: @config.channel_pool,
202
+ logger: @config.logger
202
203
  )
203
204
 
205
+ @translation_service_stub.stub_logger&.info do |entry|
206
+ entry.set_system_name
207
+ entry.set_service
208
+ entry.message = "Created client for #{entry.service}"
209
+ entry.set_credentials_fields credentials
210
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
211
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
212
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
213
+ end
214
+
204
215
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
205
216
  config.credentials = credentials
206
217
  config.quota_project = @quota_project_id
207
218
  config.endpoint = @translation_service_stub.endpoint
208
219
  config.universe_domain = @translation_service_stub.universe_domain
220
+ config.logger = @translation_service_stub.logger if config.respond_to? :logger=
209
221
  end
210
222
 
211
223
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Client.new do |config|
@@ -213,6 +225,7 @@ module Google
213
225
  config.quota_project = @quota_project_id
214
226
  config.endpoint = @translation_service_stub.endpoint
215
227
  config.universe_domain = @translation_service_stub.universe_domain
228
+ config.logger = @translation_service_stub.logger if config.respond_to? :logger=
216
229
  end
217
230
  end
218
231
 
@@ -237,6 +250,15 @@ module Google
237
250
  #
238
251
  attr_reader :iam_policy_client
239
252
 
253
+ ##
254
+ # The logger used for request/response debug logging.
255
+ #
256
+ # @return [Logger]
257
+ #
258
+ def logger
259
+ @translation_service_stub.logger
260
+ end
261
+
240
262
  # Service calls
241
263
 
242
264
  ##
@@ -383,7 +405,6 @@ module Google
383
405
 
384
406
  @translation_service_stub.call_rpc :translate_text, request, options: options do |response, operation|
385
407
  yield response, operation if block_given?
386
- return response
387
408
  end
388
409
  rescue ::GRPC::BadStatus => e
389
410
  raise ::Google::Cloud::Error.from_error(e)
@@ -483,7 +504,6 @@ module Google
483
504
 
484
505
  @translation_service_stub.call_rpc :romanize_text, request, options: options do |response, operation|
485
506
  yield response, operation if block_given?
486
- return response
487
507
  end
488
508
  rescue ::GRPC::BadStatus => e
489
509
  raise ::Google::Cloud::Error.from_error(e)
@@ -604,7 +624,6 @@ module Google
604
624
 
605
625
  @translation_service_stub.call_rpc :detect_language, request, options: options do |response, operation|
606
626
  yield response, operation if block_given?
607
- return response
608
627
  end
609
628
  rescue ::GRPC::BadStatus => e
610
629
  raise ::Google::Cloud::Error.from_error(e)
@@ -720,7 +739,6 @@ module Google
720
739
 
721
740
  @translation_service_stub.call_rpc :get_supported_languages, request, options: options do |response, operation|
722
741
  yield response, operation if block_given?
723
- return response
724
742
  end
725
743
  rescue ::GRPC::BadStatus => e
726
744
  raise ::Google::Cloud::Error.from_error(e)
@@ -879,7 +897,6 @@ module Google
879
897
 
880
898
  @translation_service_stub.call_rpc :translate_document, request, options: options do |response, operation|
881
899
  yield response, operation if block_given?
882
- return response
883
900
  end
884
901
  rescue ::GRPC::BadStatus => e
885
902
  raise ::Google::Cloud::Error.from_error(e)
@@ -1029,7 +1046,7 @@ module Google
1029
1046
  @translation_service_stub.call_rpc :batch_translate_text, request, options: options do |response, operation|
1030
1047
  response = ::Gapic::Operation.new response, @operations_client, options: options
1031
1048
  yield response, operation if block_given?
1032
- return response
1049
+ throw :response, response
1033
1050
  end
1034
1051
  rescue ::GRPC::BadStatus => e
1035
1052
  raise ::Google::Cloud::Error.from_error(e)
@@ -1194,7 +1211,7 @@ module Google
1194
1211
  @translation_service_stub.call_rpc :batch_translate_document, request, options: options do |response, operation|
1195
1212
  response = ::Gapic::Operation.new response, @operations_client, options: options
1196
1213
  yield response, operation if block_given?
1197
- return response
1214
+ throw :response, response
1198
1215
  end
1199
1216
  rescue ::GRPC::BadStatus => e
1200
1217
  raise ::Google::Cloud::Error.from_error(e)
@@ -1291,7 +1308,7 @@ module Google
1291
1308
  @translation_service_stub.call_rpc :create_glossary, request, options: options do |response, operation|
1292
1309
  response = ::Gapic::Operation.new response, @operations_client, options: options
1293
1310
  yield response, operation if block_given?
1294
- return response
1311
+ throw :response, response
1295
1312
  end
1296
1313
  rescue ::GRPC::BadStatus => e
1297
1314
  raise ::Google::Cloud::Error.from_error(e)
@@ -1389,7 +1406,7 @@ module Google
1389
1406
  @translation_service_stub.call_rpc :update_glossary, request, options: options do |response, operation|
1390
1407
  response = ::Gapic::Operation.new response, @operations_client, options: options
1391
1408
  yield response, operation if block_given?
1392
- return response
1409
+ throw :response, response
1393
1410
  end
1394
1411
  rescue ::GRPC::BadStatus => e
1395
1412
  raise ::Google::Cloud::Error.from_error(e)
@@ -1506,7 +1523,7 @@ module Google
1506
1523
  @translation_service_stub.call_rpc :list_glossaries, request, options: options do |response, operation|
1507
1524
  response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_glossaries, request, response, operation, options
1508
1525
  yield response, operation if block_given?
1509
- return response
1526
+ throw :response, response
1510
1527
  end
1511
1528
  rescue ::GRPC::BadStatus => e
1512
1529
  raise ::Google::Cloud::Error.from_error(e)
@@ -1593,7 +1610,6 @@ module Google
1593
1610
 
1594
1611
  @translation_service_stub.call_rpc :get_glossary, request, options: options do |response, operation|
1595
1612
  yield response, operation if block_given?
1596
- return response
1597
1613
  end
1598
1614
  rescue ::GRPC::BadStatus => e
1599
1615
  raise ::Google::Cloud::Error.from_error(e)
@@ -1689,7 +1705,7 @@ module Google
1689
1705
  @translation_service_stub.call_rpc :delete_glossary, request, options: options do |response, operation|
1690
1706
  response = ::Gapic::Operation.new response, @operations_client, options: options
1691
1707
  yield response, operation if block_given?
1692
- return response
1708
+ throw :response, response
1693
1709
  end
1694
1710
  rescue ::GRPC::BadStatus => e
1695
1711
  raise ::Google::Cloud::Error.from_error(e)
@@ -1775,7 +1791,6 @@ module Google
1775
1791
 
1776
1792
  @translation_service_stub.call_rpc :get_glossary_entry, request, options: options do |response, operation|
1777
1793
  yield response, operation if block_given?
1778
- return response
1779
1794
  end
1780
1795
  rescue ::GRPC::BadStatus => e
1781
1796
  raise ::Google::Cloud::Error.from_error(e)
@@ -1875,7 +1890,7 @@ module Google
1875
1890
  @translation_service_stub.call_rpc :list_glossary_entries, request, options: options do |response, operation|
1876
1891
  response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_glossary_entries, request, response, operation, options
1877
1892
  yield response, operation if block_given?
1878
- return response
1893
+ throw :response, response
1879
1894
  end
1880
1895
  rescue ::GRPC::BadStatus => e
1881
1896
  raise ::Google::Cloud::Error.from_error(e)
@@ -1963,7 +1978,6 @@ module Google
1963
1978
 
1964
1979
  @translation_service_stub.call_rpc :create_glossary_entry, request, options: options do |response, operation|
1965
1980
  yield response, operation if block_given?
1966
- return response
1967
1981
  end
1968
1982
  rescue ::GRPC::BadStatus => e
1969
1983
  raise ::Google::Cloud::Error.from_error(e)
@@ -2049,7 +2063,6 @@ module Google
2049
2063
 
2050
2064
  @translation_service_stub.call_rpc :update_glossary_entry, request, options: options do |response, operation|
2051
2065
  yield response, operation if block_given?
2052
- return response
2053
2066
  end
2054
2067
  rescue ::GRPC::BadStatus => e
2055
2068
  raise ::Google::Cloud::Error.from_error(e)
@@ -2135,7 +2148,6 @@ module Google
2135
2148
 
2136
2149
  @translation_service_stub.call_rpc :delete_glossary_entry, request, options: options do |response, operation|
2137
2150
  yield response, operation if block_given?
2138
- return response
2139
2151
  end
2140
2152
  rescue ::GRPC::BadStatus => e
2141
2153
  raise ::Google::Cloud::Error.from_error(e)
@@ -2231,7 +2243,7 @@ module Google
2231
2243
  @translation_service_stub.call_rpc :create_dataset, request, options: options do |response, operation|
2232
2244
  response = ::Gapic::Operation.new response, @operations_client, options: options
2233
2245
  yield response, operation if block_given?
2234
- return response
2246
+ throw :response, response
2235
2247
  end
2236
2248
  rescue ::GRPC::BadStatus => e
2237
2249
  raise ::Google::Cloud::Error.from_error(e)
@@ -2317,7 +2329,6 @@ module Google
2317
2329
 
2318
2330
  @translation_service_stub.call_rpc :get_dataset, request, options: options do |response, operation|
2319
2331
  yield response, operation if block_given?
2320
- return response
2321
2332
  end
2322
2333
  rescue ::GRPC::BadStatus => e
2323
2334
  raise ::Google::Cloud::Error.from_error(e)
@@ -2416,7 +2427,7 @@ module Google
2416
2427
  @translation_service_stub.call_rpc :list_datasets, request, options: options do |response, operation|
2417
2428
  response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_datasets, request, response, operation, options
2418
2429
  yield response, operation if block_given?
2419
- return response
2430
+ throw :response, response
2420
2431
  end
2421
2432
  rescue ::GRPC::BadStatus => e
2422
2433
  raise ::Google::Cloud::Error.from_error(e)
@@ -2510,7 +2521,7 @@ module Google
2510
2521
  @translation_service_stub.call_rpc :delete_dataset, request, options: options do |response, operation|
2511
2522
  response = ::Gapic::Operation.new response, @operations_client, options: options
2512
2523
  yield response, operation if block_given?
2513
- return response
2524
+ throw :response, response
2514
2525
  end
2515
2526
  rescue ::GRPC::BadStatus => e
2516
2527
  raise ::Google::Cloud::Error.from_error(e)
@@ -2599,7 +2610,6 @@ module Google
2599
2610
 
2600
2611
  @translation_service_stub.call_rpc :create_adaptive_mt_dataset, request, options: options do |response, operation|
2601
2612
  yield response, operation if block_given?
2602
- return response
2603
2613
  end
2604
2614
  rescue ::GRPC::BadStatus => e
2605
2615
  raise ::Google::Cloud::Error.from_error(e)
@@ -2687,7 +2697,6 @@ module Google
2687
2697
 
2688
2698
  @translation_service_stub.call_rpc :delete_adaptive_mt_dataset, request, options: options do |response, operation|
2689
2699
  yield response, operation if block_given?
2690
- return response
2691
2700
  end
2692
2701
  rescue ::GRPC::BadStatus => e
2693
2702
  raise ::Google::Cloud::Error.from_error(e)
@@ -2774,7 +2783,6 @@ module Google
2774
2783
 
2775
2784
  @translation_service_stub.call_rpc :get_adaptive_mt_dataset, request, options: options do |response, operation|
2776
2785
  yield response, operation if block_given?
2777
- return response
2778
2786
  end
2779
2787
  rescue ::GRPC::BadStatus => e
2780
2788
  raise ::Google::Cloud::Error.from_error(e)
@@ -2878,7 +2886,7 @@ module Google
2878
2886
  @translation_service_stub.call_rpc :list_adaptive_mt_datasets, request, options: options do |response, operation|
2879
2887
  response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_datasets, request, response, operation, options
2880
2888
  yield response, operation if block_given?
2881
- return response
2889
+ throw :response, response
2882
2890
  end
2883
2891
  rescue ::GRPC::BadStatus => e
2884
2892
  raise ::Google::Cloud::Error.from_error(e)
@@ -2977,7 +2985,6 @@ module Google
2977
2985
 
2978
2986
  @translation_service_stub.call_rpc :adaptive_mt_translate, request, options: options do |response, operation|
2979
2987
  yield response, operation if block_given?
2980
- return response
2981
2988
  end
2982
2989
  rescue ::GRPC::BadStatus => e
2983
2990
  raise ::Google::Cloud::Error.from_error(e)
@@ -3064,7 +3071,6 @@ module Google
3064
3071
 
3065
3072
  @translation_service_stub.call_rpc :get_adaptive_mt_file, request, options: options do |response, operation|
3066
3073
  yield response, operation if block_given?
3067
- return response
3068
3074
  end
3069
3075
  rescue ::GRPC::BadStatus => e
3070
3076
  raise ::Google::Cloud::Error.from_error(e)
@@ -3151,7 +3157,6 @@ module Google
3151
3157
 
3152
3158
  @translation_service_stub.call_rpc :delete_adaptive_mt_file, request, options: options do |response, operation|
3153
3159
  yield response, operation if block_given?
3154
- return response
3155
3160
  end
3156
3161
  rescue ::GRPC::BadStatus => e
3157
3162
  raise ::Google::Cloud::Error.from_error(e)
@@ -3181,9 +3186,13 @@ module Google
3181
3186
  # `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`
3182
3187
  # @param file_input_source [::Google::Cloud::Translate::V3::FileInputSource, ::Hash]
3183
3188
  # Inline file source.
3189
+ #
3190
+ # Note: The following fields are mutually exclusive: `file_input_source`, `gcs_input_source`. If a field in that set is populated, all other fields in the set will automatically be cleared.
3184
3191
  # @param gcs_input_source [::Google::Cloud::Translate::V3::GcsInputSource, ::Hash]
3185
3192
  # Google Cloud Storage file source.
3186
3193
  #
3194
+ # Note: The following fields are mutually exclusive: `gcs_input_source`, `file_input_source`. If a field in that set is populated, all other fields in the set will automatically be cleared.
3195
+ #
3187
3196
  # @yield [response, operation] Access the result along with the RPC operation
3188
3197
  # @yieldparam response [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse]
3189
3198
  # @yieldparam operation [::GRPC::ActiveCall::Operation]
@@ -3243,7 +3252,6 @@ module Google
3243
3252
 
3244
3253
  @translation_service_stub.call_rpc :import_adaptive_mt_file, request, options: options do |response, operation|
3245
3254
  yield response, operation if block_given?
3246
- return response
3247
3255
  end
3248
3256
  rescue ::GRPC::BadStatus => e
3249
3257
  raise ::Google::Cloud::Error.from_error(e)
@@ -3344,7 +3352,7 @@ module Google
3344
3352
  @translation_service_stub.call_rpc :list_adaptive_mt_files, request, options: options do |response, operation|
3345
3353
  response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_files, request, response, operation, options
3346
3354
  yield response, operation if block_given?
3347
- return response
3355
+ throw :response, response
3348
3356
  end
3349
3357
  rescue ::GRPC::BadStatus => e
3350
3358
  raise ::Google::Cloud::Error.from_error(e)
@@ -3446,7 +3454,7 @@ module Google
3446
3454
  @translation_service_stub.call_rpc :list_adaptive_mt_sentences, request, options: options do |response, operation|
3447
3455
  response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_sentences, request, response, operation, options
3448
3456
  yield response, operation if block_given?
3449
- return response
3457
+ throw :response, response
3450
3458
  end
3451
3459
  rescue ::GRPC::BadStatus => e
3452
3460
  raise ::Google::Cloud::Error.from_error(e)
@@ -3543,7 +3551,7 @@ module Google
3543
3551
  @translation_service_stub.call_rpc :import_data, request, options: options do |response, operation|
3544
3552
  response = ::Gapic::Operation.new response, @operations_client, options: options
3545
3553
  yield response, operation if block_given?
3546
- return response
3554
+ throw :response, response
3547
3555
  end
3548
3556
  rescue ::GRPC::BadStatus => e
3549
3557
  raise ::Google::Cloud::Error.from_error(e)
@@ -3640,7 +3648,7 @@ module Google
3640
3648
  @translation_service_stub.call_rpc :export_data, request, options: options do |response, operation|
3641
3649
  response = ::Gapic::Operation.new response, @operations_client, options: options
3642
3650
  yield response, operation if block_given?
3643
- return response
3651
+ throw :response, response
3644
3652
  end
3645
3653
  rescue ::GRPC::BadStatus => e
3646
3654
  raise ::Google::Cloud::Error.from_error(e)
@@ -3743,7 +3751,7 @@ module Google
3743
3751
  @translation_service_stub.call_rpc :list_examples, request, options: options do |response, operation|
3744
3752
  response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_examples, request, response, operation, options
3745
3753
  yield response, operation if block_given?
3746
- return response
3754
+ throw :response, response
3747
3755
  end
3748
3756
  rescue ::GRPC::BadStatus => e
3749
3757
  raise ::Google::Cloud::Error.from_error(e)
@@ -3840,7 +3848,7 @@ module Google
3840
3848
  @translation_service_stub.call_rpc :create_model, request, options: options do |response, operation|
3841
3849
  response = ::Gapic::Operation.new response, @operations_client, options: options
3842
3850
  yield response, operation if block_given?
3843
- return response
3851
+ throw :response, response
3844
3852
  end
3845
3853
  rescue ::GRPC::BadStatus => e
3846
3854
  raise ::Google::Cloud::Error.from_error(e)
@@ -3943,7 +3951,7 @@ module Google
3943
3951
  @translation_service_stub.call_rpc :list_models, request, options: options do |response, operation|
3944
3952
  response = ::Gapic::PagedEnumerable.new @translation_service_stub, :list_models, request, response, operation, options
3945
3953
  yield response, operation if block_given?
3946
- return response
3954
+ throw :response, response
3947
3955
  end
3948
3956
  rescue ::GRPC::BadStatus => e
3949
3957
  raise ::Google::Cloud::Error.from_error(e)
@@ -4029,7 +4037,6 @@ module Google
4029
4037
 
4030
4038
  @translation_service_stub.call_rpc :get_model, request, options: options do |response, operation|
4031
4039
  yield response, operation if block_given?
4032
- return response
4033
4040
  end
4034
4041
  rescue ::GRPC::BadStatus => e
4035
4042
  raise ::Google::Cloud::Error.from_error(e)
@@ -4123,7 +4130,7 @@ module Google
4123
4130
  @translation_service_stub.call_rpc :delete_model, request, options: options do |response, operation|
4124
4131
  response = ::Gapic::Operation.new response, @operations_client, options: options
4125
4132
  yield response, operation if block_given?
4126
- return response
4133
+ throw :response, response
4127
4134
  end
4128
4135
  rescue ::GRPC::BadStatus => e
4129
4136
  raise ::Google::Cloud::Error.from_error(e)
@@ -4173,6 +4180,13 @@ module Google
4173
4180
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
4174
4181
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
4175
4182
  # * (`nil`) indicating no credentials
4183
+ #
4184
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
4185
+ # external source for authentication to Google Cloud, you must validate it before
4186
+ # providing it to a Google API client library. Providing an unvalidated credential
4187
+ # configuration to Google APIs can compromise the security of your systems and data.
4188
+ # For more information, refer to [Validate credential configurations from external
4189
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
4176
4190
  # @return [::Object]
4177
4191
  # @!attribute [rw] scope
4178
4192
  # The OAuth scopes
@@ -4212,6 +4226,11 @@ module Google
4212
4226
  # default endpoint URL. The default value of nil uses the environment
4213
4227
  # universe (usually the default "googleapis.com" universe).
4214
4228
  # @return [::String,nil]
4229
+ # @!attribute [rw] logger
4230
+ # A custom logger to use for request/response debug logging, or the value
4231
+ # `:default` (the default) to construct a default logger, or `nil` to
4232
+ # explicitly disable logging.
4233
+ # @return [::Logger,:default,nil]
4215
4234
  #
4216
4235
  class Configuration
4217
4236
  extend ::Gapic::Config
@@ -4236,6 +4255,7 @@ module Google
4236
4255
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
4237
4256
  config_attr :quota_project, nil, ::String, nil
4238
4257
  config_attr :universe_domain, nil, ::String, nil
4258
+ config_attr :logger, :default, ::Logger, nil, :default
4239
4259
 
4240
4260
  # @private
4241
4261
  def initialize parent_config = nil
@@ -124,14 +124,6 @@ module Google
124
124
  # Lists operations that match the specified filter in the request. If the
125
125
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
126
126
  #
127
- # NOTE: the `name` binding allows API services to override the binding
128
- # to use different resource name schemes, such as `users/*/operations`. To
129
- # override the binding, API services can add a binding such as
130
- # `"/v1/{name=users/*}/operations"` to their service configuration.
131
- # For backwards compatibility, the default name includes the operations
132
- # collection id, however overriding users must ensure the name binding
133
- # is the parent resource, without the operations collection id.
134
- #
135
127
  # @overload list_operations(request, options = nil)
136
128
  # Pass arguments to `list_operations` via a request object, either of type
137
129
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -221,7 +213,7 @@ module Google
221
213
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
222
214
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
223
215
  yield response, operation if block_given?
224
- return response
216
+ throw :response, response
225
217
  end
226
218
  rescue ::GRPC::BadStatus => e
227
219
  raise ::Google::Cloud::Error.from_error(e)
@@ -317,7 +309,7 @@ module Google
317
309
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
318
310
  response = ::Gapic::Operation.new response, @operations_client, options: options
319
311
  yield response, operation if block_given?
320
- return response
312
+ throw :response, response
321
313
  end
322
314
  rescue ::GRPC::BadStatus => e
323
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -406,7 +398,6 @@ module Google
406
398
 
407
399
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
408
400
  yield response, operation if block_given?
409
- return response
410
401
  end
411
402
  rescue ::GRPC::BadStatus => e
412
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -421,8 +412,9 @@ module Google
421
412
  # other methods to check whether the cancellation succeeded or whether the
422
413
  # operation completed despite cancellation. On successful cancellation,
423
414
  # the operation is not deleted; instead, it becomes an operation with
424
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
425
- # corresponding to `Code.CANCELLED`.
415
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
416
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
417
+ # `Code.CANCELLED`.
426
418
  #
427
419
  # @overload cancel_operation(request, options = nil)
428
420
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -501,7 +493,6 @@ module Google
501
493
 
502
494
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
503
495
  yield response, operation if block_given?
504
- return response
505
496
  end
506
497
  rescue ::GRPC::BadStatus => e
507
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -607,7 +598,7 @@ module Google
607
598
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
608
599
  response = ::Gapic::Operation.new response, @operations_client, options: options
609
600
  yield response, operation if block_given?
610
- return response
601
+ throw :response, response
611
602
  end
612
603
  rescue ::GRPC::BadStatus => e
613
604
  raise ::Google::Cloud::Error.from_error(e)
@@ -657,6 +648,13 @@ module Google
657
648
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
658
649
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
659
650
  # * (`nil`) indicating no credentials
651
+ #
652
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
653
+ # external source for authentication to Google Cloud, you must validate it before
654
+ # providing it to a Google API client library. Providing an unvalidated credential
655
+ # configuration to Google APIs can compromise the security of your systems and data.
656
+ # For more information, refer to [Validate credential configurations from external
657
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
660
658
  # @return [::Object]
661
659
  # @!attribute [rw] scope
662
660
  # The OAuth scopes
@@ -696,6 +694,11 @@ module Google
696
694
  # default endpoint URL. The default value of nil uses the environment
697
695
  # universe (usually the default "googleapis.com" universe).
698
696
  # @return [::String,nil]
697
+ # @!attribute [rw] logger
698
+ # A custom logger to use for request/response debug logging, or the value
699
+ # `:default` (the default) to construct a default logger, or `nil` to
700
+ # explicitly disable logging.
701
+ # @return [::Logger,:default,nil]
699
702
  #
700
703
  class Configuration
701
704
  extend ::Gapic::Config
@@ -720,6 +723,7 @@ module Google
720
723
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
721
724
  config_attr :quota_project, nil, ::String, nil
722
725
  config_attr :universe_domain, nil, ::String, nil
726
+ config_attr :logger, :default, ::Logger, nil, :default
723
727
 
724
728
  # @private
725
729
  def initialize parent_config = nil