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 +4 -4
- data/README.md +31 -21
- data/lib/google/cloud/translate/v3/translation_service/client.rb +59 -39
- data/lib/google/cloud/translate/v3/translation_service/operations.rb +19 -15
- data/lib/google/cloud/translate/v3/translation_service/rest/client.rb +59 -39
- data/lib/google/cloud/translate/v3/translation_service/rest/operations.rb +59 -45
- data/lib/google/cloud/translate/v3/translation_service/rest/service_stub.rb +318 -230
- data/lib/google/cloud/translate/v3/version.rb +1 -1
- data/proto_docs/google/api/client.rb +19 -0
- data/proto_docs/google/cloud/translate/v3/adaptive_mt.rb +4 -0
- data/proto_docs/google/cloud/translate/v3/common.rb +4 -0
- data/proto_docs/google/cloud/translate/v3/translation_service.rb +8 -0
- data/proto_docs/google/longrunning/operations.rb +23 -14
- metadata +6 -9
@@ -191,15 +191,27 @@ module Google
|
|
191
191
|
endpoint: @config.endpoint,
|
192
192
|
endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
|
193
193
|
universe_domain: @config.universe_domain,
|
194
|
-
credentials: credentials
|
194
|
+
credentials: credentials,
|
195
|
+
logger: @config.logger
|
195
196
|
)
|
196
197
|
|
198
|
+
@translation_service_stub.logger(stub: true)&.info do |entry|
|
199
|
+
entry.set_system_name
|
200
|
+
entry.set_service
|
201
|
+
entry.message = "Created client for #{entry.service}"
|
202
|
+
entry.set_credentials_fields credentials
|
203
|
+
entry.set "customEndpoint", @config.endpoint if @config.endpoint
|
204
|
+
entry.set "defaultTimeout", @config.timeout if @config.timeout
|
205
|
+
entry.set "quotaProject", @quota_project_id if @quota_project_id
|
206
|
+
end
|
207
|
+
|
197
208
|
@location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
|
198
209
|
config.credentials = credentials
|
199
210
|
config.quota_project = @quota_project_id
|
200
211
|
config.endpoint = @translation_service_stub.endpoint
|
201
212
|
config.universe_domain = @translation_service_stub.universe_domain
|
202
213
|
config.bindings_override = @config.bindings_override
|
214
|
+
config.logger = @translation_service_stub.logger if config.respond_to? :logger=
|
203
215
|
end
|
204
216
|
|
205
217
|
@iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
|
@@ -207,6 +219,7 @@ module Google
|
|
207
219
|
config.quota_project = @quota_project_id
|
208
220
|
config.endpoint = @translation_service_stub.endpoint
|
209
221
|
config.universe_domain = @translation_service_stub.universe_domain
|
222
|
+
config.logger = @translation_service_stub.logger if config.respond_to? :logger=
|
210
223
|
end
|
211
224
|
end
|
212
225
|
|
@@ -231,6 +244,15 @@ module Google
|
|
231
244
|
#
|
232
245
|
attr_reader :iam_policy_client
|
233
246
|
|
247
|
+
##
|
248
|
+
# The logger used for request/response debug logging.
|
249
|
+
#
|
250
|
+
# @return [Logger]
|
251
|
+
#
|
252
|
+
def logger
|
253
|
+
@translation_service_stub.logger
|
254
|
+
end
|
255
|
+
|
234
256
|
# Service calls
|
235
257
|
|
236
258
|
##
|
@@ -370,7 +392,6 @@ module Google
|
|
370
392
|
|
371
393
|
@translation_service_stub.translate_text request, options do |result, operation|
|
372
394
|
yield result, operation if block_given?
|
373
|
-
return result
|
374
395
|
end
|
375
396
|
rescue ::Gapic::Rest::Error => e
|
376
397
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -463,7 +484,6 @@ module Google
|
|
463
484
|
|
464
485
|
@translation_service_stub.romanize_text request, options do |result, operation|
|
465
486
|
yield result, operation if block_given?
|
466
|
-
return result
|
467
487
|
end
|
468
488
|
rescue ::Gapic::Rest::Error => e
|
469
489
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -577,7 +597,6 @@ module Google
|
|
577
597
|
|
578
598
|
@translation_service_stub.detect_language request, options do |result, operation|
|
579
599
|
yield result, operation if block_given?
|
580
|
-
return result
|
581
600
|
end
|
582
601
|
rescue ::Gapic::Rest::Error => e
|
583
602
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -686,7 +705,6 @@ module Google
|
|
686
705
|
|
687
706
|
@translation_service_stub.get_supported_languages request, options do |result, operation|
|
688
707
|
yield result, operation if block_given?
|
689
|
-
return result
|
690
708
|
end
|
691
709
|
rescue ::Gapic::Rest::Error => e
|
692
710
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -838,7 +856,6 @@ module Google
|
|
838
856
|
|
839
857
|
@translation_service_stub.translate_document request, options do |result, operation|
|
840
858
|
yield result, operation if block_given?
|
841
|
-
return result
|
842
859
|
end
|
843
860
|
rescue ::Gapic::Rest::Error => e
|
844
861
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -981,7 +998,7 @@ module Google
|
|
981
998
|
@translation_service_stub.batch_translate_text request, options do |result, operation|
|
982
999
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
983
1000
|
yield result, operation if block_given?
|
984
|
-
|
1001
|
+
throw :response, result
|
985
1002
|
end
|
986
1003
|
rescue ::Gapic::Rest::Error => e
|
987
1004
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1139,7 +1156,7 @@ module Google
|
|
1139
1156
|
@translation_service_stub.batch_translate_document request, options do |result, operation|
|
1140
1157
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1141
1158
|
yield result, operation if block_given?
|
1142
|
-
|
1159
|
+
throw :response, result
|
1143
1160
|
end
|
1144
1161
|
rescue ::Gapic::Rest::Error => e
|
1145
1162
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1229,7 +1246,7 @@ module Google
|
|
1229
1246
|
@translation_service_stub.create_glossary request, options do |result, operation|
|
1230
1247
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1231
1248
|
yield result, operation if block_given?
|
1232
|
-
|
1249
|
+
throw :response, result
|
1233
1250
|
end
|
1234
1251
|
rescue ::Gapic::Rest::Error => e
|
1235
1252
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1320,7 +1337,7 @@ module Google
|
|
1320
1337
|
@translation_service_stub.update_glossary request, options do |result, operation|
|
1321
1338
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1322
1339
|
yield result, operation if block_given?
|
1323
|
-
|
1340
|
+
throw :response, result
|
1324
1341
|
end
|
1325
1342
|
rescue ::Gapic::Rest::Error => e
|
1326
1343
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1430,7 +1447,7 @@ module Google
|
|
1430
1447
|
@translation_service_stub.list_glossaries request, options do |result, operation|
|
1431
1448
|
result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_glossaries, "glossaries", request, result, options
|
1432
1449
|
yield result, operation if block_given?
|
1433
|
-
|
1450
|
+
throw :response, result
|
1434
1451
|
end
|
1435
1452
|
rescue ::Gapic::Rest::Error => e
|
1436
1453
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1510,7 +1527,6 @@ module Google
|
|
1510
1527
|
|
1511
1528
|
@translation_service_stub.get_glossary request, options do |result, operation|
|
1512
1529
|
yield result, operation if block_given?
|
1513
|
-
return result
|
1514
1530
|
end
|
1515
1531
|
rescue ::Gapic::Rest::Error => e
|
1516
1532
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1599,7 +1615,7 @@ module Google
|
|
1599
1615
|
@translation_service_stub.delete_glossary request, options do |result, operation|
|
1600
1616
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
1601
1617
|
yield result, operation if block_given?
|
1602
|
-
|
1618
|
+
throw :response, result
|
1603
1619
|
end
|
1604
1620
|
rescue ::Gapic::Rest::Error => e
|
1605
1621
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1678,7 +1694,6 @@ module Google
|
|
1678
1694
|
|
1679
1695
|
@translation_service_stub.get_glossary_entry request, options do |result, operation|
|
1680
1696
|
yield result, operation if block_given?
|
1681
|
-
return result
|
1682
1697
|
end
|
1683
1698
|
rescue ::Gapic::Rest::Error => e
|
1684
1699
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1771,7 +1786,7 @@ module Google
|
|
1771
1786
|
@translation_service_stub.list_glossary_entries request, options do |result, operation|
|
1772
1787
|
result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_glossary_entries, "glossary_entries", request, result, options
|
1773
1788
|
yield result, operation if block_given?
|
1774
|
-
|
1789
|
+
throw :response, result
|
1775
1790
|
end
|
1776
1791
|
rescue ::Gapic::Rest::Error => e
|
1777
1792
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1852,7 +1867,6 @@ module Google
|
|
1852
1867
|
|
1853
1868
|
@translation_service_stub.create_glossary_entry request, options do |result, operation|
|
1854
1869
|
yield result, operation if block_given?
|
1855
|
-
return result
|
1856
1870
|
end
|
1857
1871
|
rescue ::Gapic::Rest::Error => e
|
1858
1872
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -1931,7 +1945,6 @@ module Google
|
|
1931
1945
|
|
1932
1946
|
@translation_service_stub.update_glossary_entry request, options do |result, operation|
|
1933
1947
|
yield result, operation if block_given?
|
1934
|
-
return result
|
1935
1948
|
end
|
1936
1949
|
rescue ::Gapic::Rest::Error => e
|
1937
1950
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2010,7 +2023,6 @@ module Google
|
|
2010
2023
|
|
2011
2024
|
@translation_service_stub.delete_glossary_entry request, options do |result, operation|
|
2012
2025
|
yield result, operation if block_given?
|
2013
|
-
return result
|
2014
2026
|
end
|
2015
2027
|
rescue ::Gapic::Rest::Error => e
|
2016
2028
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2099,7 +2111,7 @@ module Google
|
|
2099
2111
|
@translation_service_stub.create_dataset request, options do |result, operation|
|
2100
2112
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
2101
2113
|
yield result, operation if block_given?
|
2102
|
-
|
2114
|
+
throw :response, result
|
2103
2115
|
end
|
2104
2116
|
rescue ::Gapic::Rest::Error => e
|
2105
2117
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2178,7 +2190,6 @@ module Google
|
|
2178
2190
|
|
2179
2191
|
@translation_service_stub.get_dataset request, options do |result, operation|
|
2180
2192
|
yield result, operation if block_given?
|
2181
|
-
return result
|
2182
2193
|
end
|
2183
2194
|
rescue ::Gapic::Rest::Error => e
|
2184
2195
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2270,7 +2281,7 @@ module Google
|
|
2270
2281
|
@translation_service_stub.list_datasets request, options do |result, operation|
|
2271
2282
|
result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_datasets, "datasets", request, result, options
|
2272
2283
|
yield result, operation if block_given?
|
2273
|
-
|
2284
|
+
throw :response, result
|
2274
2285
|
end
|
2275
2286
|
rescue ::Gapic::Rest::Error => e
|
2276
2287
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2357,7 +2368,7 @@ module Google
|
|
2357
2368
|
@translation_service_stub.delete_dataset request, options do |result, operation|
|
2358
2369
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
2359
2370
|
yield result, operation if block_given?
|
2360
|
-
|
2371
|
+
throw :response, result
|
2361
2372
|
end
|
2362
2373
|
rescue ::Gapic::Rest::Error => e
|
2363
2374
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2439,7 +2450,6 @@ module Google
|
|
2439
2450
|
|
2440
2451
|
@translation_service_stub.create_adaptive_mt_dataset request, options do |result, operation|
|
2441
2452
|
yield result, operation if block_given?
|
2442
|
-
return result
|
2443
2453
|
end
|
2444
2454
|
rescue ::Gapic::Rest::Error => e
|
2445
2455
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2520,7 +2530,6 @@ module Google
|
|
2520
2530
|
|
2521
2531
|
@translation_service_stub.delete_adaptive_mt_dataset request, options do |result, operation|
|
2522
2532
|
yield result, operation if block_given?
|
2523
|
-
return result
|
2524
2533
|
end
|
2525
2534
|
rescue ::Gapic::Rest::Error => e
|
2526
2535
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2600,7 +2609,6 @@ module Google
|
|
2600
2609
|
|
2601
2610
|
@translation_service_stub.get_adaptive_mt_dataset request, options do |result, operation|
|
2602
2611
|
yield result, operation if block_given?
|
2603
|
-
return result
|
2604
2612
|
end
|
2605
2613
|
rescue ::Gapic::Rest::Error => e
|
2606
2614
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2697,7 +2705,7 @@ module Google
|
|
2697
2705
|
@translation_service_stub.list_adaptive_mt_datasets request, options do |result, operation|
|
2698
2706
|
result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_datasets, "adaptive_mt_datasets", request, result, options
|
2699
2707
|
yield result, operation if block_given?
|
2700
|
-
|
2708
|
+
throw :response, result
|
2701
2709
|
end
|
2702
2710
|
rescue ::Gapic::Rest::Error => e
|
2703
2711
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2789,7 +2797,6 @@ module Google
|
|
2789
2797
|
|
2790
2798
|
@translation_service_stub.adaptive_mt_translate request, options do |result, operation|
|
2791
2799
|
yield result, operation if block_given?
|
2792
|
-
return result
|
2793
2800
|
end
|
2794
2801
|
rescue ::Gapic::Rest::Error => e
|
2795
2802
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2869,7 +2876,6 @@ module Google
|
|
2869
2876
|
|
2870
2877
|
@translation_service_stub.get_adaptive_mt_file request, options do |result, operation|
|
2871
2878
|
yield result, operation if block_given?
|
2872
|
-
return result
|
2873
2879
|
end
|
2874
2880
|
rescue ::Gapic::Rest::Error => e
|
2875
2881
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2949,7 +2955,6 @@ module Google
|
|
2949
2955
|
|
2950
2956
|
@translation_service_stub.delete_adaptive_mt_file request, options do |result, operation|
|
2951
2957
|
yield result, operation if block_given?
|
2952
|
-
return result
|
2953
2958
|
end
|
2954
2959
|
rescue ::Gapic::Rest::Error => e
|
2955
2960
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -2979,8 +2984,12 @@ module Google
|
|
2979
2984
|
# `projects/{project-number-or-id}/locations/{location_id}/adaptiveMtDatasets/{dataset}`
|
2980
2985
|
# @param file_input_source [::Google::Cloud::Translate::V3::FileInputSource, ::Hash]
|
2981
2986
|
# Inline file source.
|
2987
|
+
#
|
2988
|
+
# 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.
|
2982
2989
|
# @param gcs_input_source [::Google::Cloud::Translate::V3::GcsInputSource, ::Hash]
|
2983
2990
|
# Google Cloud Storage file source.
|
2991
|
+
#
|
2992
|
+
# 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.
|
2984
2993
|
# @yield [result, operation] Access the result along with the TransportOperation object
|
2985
2994
|
# @yieldparam result [::Google::Cloud::Translate::V3::ImportAdaptiveMtFileResponse]
|
2986
2995
|
# @yieldparam operation [::Gapic::Rest::TransportOperation]
|
@@ -3034,7 +3043,6 @@ module Google
|
|
3034
3043
|
|
3035
3044
|
@translation_service_stub.import_adaptive_mt_file request, options do |result, operation|
|
3036
3045
|
yield result, operation if block_given?
|
3037
|
-
return result
|
3038
3046
|
end
|
3039
3047
|
rescue ::Gapic::Rest::Error => e
|
3040
3048
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -3128,7 +3136,7 @@ module Google
|
|
3128
3136
|
@translation_service_stub.list_adaptive_mt_files request, options do |result, operation|
|
3129
3137
|
result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_files, "adaptive_mt_files", request, result, options
|
3130
3138
|
yield result, operation if block_given?
|
3131
|
-
|
3139
|
+
throw :response, result
|
3132
3140
|
end
|
3133
3141
|
rescue ::Gapic::Rest::Error => e
|
3134
3142
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -3223,7 +3231,7 @@ module Google
|
|
3223
3231
|
@translation_service_stub.list_adaptive_mt_sentences request, options do |result, operation|
|
3224
3232
|
result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_adaptive_mt_sentences, "adaptive_mt_sentences", request, result, options
|
3225
3233
|
yield result, operation if block_given?
|
3226
|
-
|
3234
|
+
throw :response, result
|
3227
3235
|
end
|
3228
3236
|
rescue ::Gapic::Rest::Error => e
|
3229
3237
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -3313,7 +3321,7 @@ module Google
|
|
3313
3321
|
@translation_service_stub.import_data request, options do |result, operation|
|
3314
3322
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
3315
3323
|
yield result, operation if block_given?
|
3316
|
-
|
3324
|
+
throw :response, result
|
3317
3325
|
end
|
3318
3326
|
rescue ::Gapic::Rest::Error => e
|
3319
3327
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -3403,7 +3411,7 @@ module Google
|
|
3403
3411
|
@translation_service_stub.export_data request, options do |result, operation|
|
3404
3412
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
3405
3413
|
yield result, operation if block_given?
|
3406
|
-
|
3414
|
+
throw :response, result
|
3407
3415
|
end
|
3408
3416
|
rescue ::Gapic::Rest::Error => e
|
3409
3417
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -3499,7 +3507,7 @@ module Google
|
|
3499
3507
|
@translation_service_stub.list_examples request, options do |result, operation|
|
3500
3508
|
result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_examples, "examples", request, result, options
|
3501
3509
|
yield result, operation if block_given?
|
3502
|
-
|
3510
|
+
throw :response, result
|
3503
3511
|
end
|
3504
3512
|
rescue ::Gapic::Rest::Error => e
|
3505
3513
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -3589,7 +3597,7 @@ module Google
|
|
3589
3597
|
@translation_service_stub.create_model request, options do |result, operation|
|
3590
3598
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
3591
3599
|
yield result, operation if block_given?
|
3592
|
-
|
3600
|
+
throw :response, result
|
3593
3601
|
end
|
3594
3602
|
rescue ::Gapic::Rest::Error => e
|
3595
3603
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -3685,7 +3693,7 @@ module Google
|
|
3685
3693
|
@translation_service_stub.list_models request, options do |result, operation|
|
3686
3694
|
result = ::Gapic::Rest::PagedEnumerable.new @translation_service_stub, :list_models, "models", request, result, options
|
3687
3695
|
yield result, operation if block_given?
|
3688
|
-
|
3696
|
+
throw :response, result
|
3689
3697
|
end
|
3690
3698
|
rescue ::Gapic::Rest::Error => e
|
3691
3699
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -3764,7 +3772,6 @@ module Google
|
|
3764
3772
|
|
3765
3773
|
@translation_service_stub.get_model request, options do |result, operation|
|
3766
3774
|
yield result, operation if block_given?
|
3767
|
-
return result
|
3768
3775
|
end
|
3769
3776
|
rescue ::Gapic::Rest::Error => e
|
3770
3777
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -3851,7 +3858,7 @@ module Google
|
|
3851
3858
|
@translation_service_stub.delete_model request, options do |result, operation|
|
3852
3859
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
3853
3860
|
yield result, operation if block_given?
|
3854
|
-
|
3861
|
+
throw :response, result
|
3855
3862
|
end
|
3856
3863
|
rescue ::Gapic::Rest::Error => e
|
3857
3864
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -3899,6 +3906,13 @@ module Google
|
|
3899
3906
|
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
3900
3907
|
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
3901
3908
|
# * (`nil`) indicating no credentials
|
3909
|
+
#
|
3910
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
3911
|
+
# external source for authentication to Google Cloud, you must validate it before
|
3912
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
3913
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
3914
|
+
# For more information, refer to [Validate credential configurations from external
|
3915
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
3902
3916
|
# @return [::Object]
|
3903
3917
|
# @!attribute [rw] scope
|
3904
3918
|
# The OAuth scopes
|
@@ -3931,6 +3945,11 @@ module Google
|
|
3931
3945
|
# default endpoint URL. The default value of nil uses the environment
|
3932
3946
|
# universe (usually the default "googleapis.com" universe).
|
3933
3947
|
# @return [::String,nil]
|
3948
|
+
# @!attribute [rw] logger
|
3949
|
+
# A custom logger to use for request/response debug logging, or the value
|
3950
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
3951
|
+
# explicitly disable logging.
|
3952
|
+
# @return [::Logger,:default,nil]
|
3934
3953
|
#
|
3935
3954
|
class Configuration
|
3936
3955
|
extend ::Gapic::Config
|
@@ -3959,6 +3978,7 @@ module Google
|
|
3959
3978
|
# by the host service.
|
3960
3979
|
# @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
|
3961
3980
|
config_attr :bindings_override, {}, ::Hash, nil
|
3981
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
3962
3982
|
|
3963
3983
|
# @private
|
3964
3984
|
def initialize parent_config = nil
|
@@ -115,14 +115,6 @@ module Google
|
|
115
115
|
# Lists operations that match the specified filter in the request. If the
|
116
116
|
# server doesn't support this method, it returns `UNIMPLEMENTED`.
|
117
117
|
#
|
118
|
-
# NOTE: the `name` binding allows API services to override the binding
|
119
|
-
# to use different resource name schemes, such as `users/*/operations`. To
|
120
|
-
# override the binding, API services can add a binding such as
|
121
|
-
# `"/v1/{name=users/*}/operations"` to their service configuration.
|
122
|
-
# For backwards compatibility, the default name includes the operations
|
123
|
-
# collection id, however overriding users must ensure the name binding
|
124
|
-
# is the parent resource, without the operations collection id.
|
125
|
-
#
|
126
118
|
# @overload list_operations(request, options = nil)
|
127
119
|
# Pass arguments to `list_operations` via a request object, either of type
|
128
120
|
# {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
|
@@ -204,7 +196,7 @@ module Google
|
|
204
196
|
@operations_stub.list_operations request, options do |result, operation|
|
205
197
|
result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
|
206
198
|
yield result, operation if block_given?
|
207
|
-
|
199
|
+
throw :response, result
|
208
200
|
end
|
209
201
|
rescue ::Gapic::Rest::Error => e
|
210
202
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -293,7 +285,7 @@ module Google
|
|
293
285
|
@operations_stub.get_operation request, options do |result, operation|
|
294
286
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
295
287
|
yield result, operation if block_given?
|
296
|
-
|
288
|
+
throw :response, result
|
297
289
|
end
|
298
290
|
rescue ::Gapic::Rest::Error => e
|
299
291
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -375,7 +367,6 @@ module Google
|
|
375
367
|
|
376
368
|
@operations_stub.delete_operation request, options do |result, operation|
|
377
369
|
yield result, operation if block_given?
|
378
|
-
return result
|
379
370
|
end
|
380
371
|
rescue ::Gapic::Rest::Error => e
|
381
372
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -390,8 +381,9 @@ module Google
|
|
390
381
|
# other methods to check whether the cancellation succeeded or whether the
|
391
382
|
# operation completed despite cancellation. On successful cancellation,
|
392
383
|
# the operation is not deleted; instead, it becomes an operation with
|
393
|
-
# an {::Google::Longrunning::Operation#error Operation.error} value with a
|
394
|
-
# corresponding to
|
384
|
+
# an {::Google::Longrunning::Operation#error Operation.error} value with a
|
385
|
+
# {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
|
386
|
+
# `Code.CANCELLED`.
|
395
387
|
#
|
396
388
|
# @overload cancel_operation(request, options = nil)
|
397
389
|
# Pass arguments to `cancel_operation` via a request object, either of type
|
@@ -463,7 +455,6 @@ module Google
|
|
463
455
|
|
464
456
|
@operations_stub.cancel_operation request, options do |result, operation|
|
465
457
|
yield result, operation if block_given?
|
466
|
-
return result
|
467
458
|
end
|
468
459
|
rescue ::Gapic::Rest::Error => e
|
469
460
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -562,7 +553,7 @@ module Google
|
|
562
553
|
@operations_stub.wait_operation request, options do |result, operation|
|
563
554
|
result = ::Gapic::Operation.new result, @operations_client, options: options
|
564
555
|
yield result, operation if block_given?
|
565
|
-
|
556
|
+
throw :response, result
|
566
557
|
end
|
567
558
|
rescue ::Gapic::Rest::Error => e
|
568
559
|
raise ::Google::Cloud::Error.from_error(e)
|
@@ -610,6 +601,13 @@ module Google
|
|
610
601
|
# * (`Signet::OAuth2::Client`) A signet oauth2 client object
|
611
602
|
# (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
|
612
603
|
# * (`nil`) indicating no credentials
|
604
|
+
#
|
605
|
+
# Warning: If you accept a credential configuration (JSON file or Hash) from an
|
606
|
+
# external source for authentication to Google Cloud, you must validate it before
|
607
|
+
# providing it to a Google API client library. Providing an unvalidated credential
|
608
|
+
# configuration to Google APIs can compromise the security of your systems and data.
|
609
|
+
# For more information, refer to [Validate credential configurations from external
|
610
|
+
# sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
|
613
611
|
# @return [::Object]
|
614
612
|
# @!attribute [rw] scope
|
615
613
|
# The OAuth scopes
|
@@ -642,6 +640,11 @@ module Google
|
|
642
640
|
# default endpoint URL. The default value of nil uses the environment
|
643
641
|
# universe (usually the default "googleapis.com" universe).
|
644
642
|
# @return [::String,nil]
|
643
|
+
# @!attribute [rw] logger
|
644
|
+
# A custom logger to use for request/response debug logging, or the value
|
645
|
+
# `:default` (the default) to construct a default logger, or `nil` to
|
646
|
+
# explicitly disable logging.
|
647
|
+
# @return [::Logger,:default,nil]
|
645
648
|
#
|
646
649
|
class Configuration
|
647
650
|
extend ::Gapic::Config
|
@@ -663,6 +666,7 @@ module Google
|
|
663
666
|
config_attr :retry_policy, nil, ::Hash, ::Proc, nil
|
664
667
|
config_attr :quota_project, nil, ::String, nil
|
665
668
|
config_attr :universe_domain, nil, ::String, nil
|
669
|
+
config_attr :logger, :default, ::Logger, nil, :default
|
666
670
|
|
667
671
|
# @private
|
668
672
|
def initialize parent_config = nil
|
@@ -789,16 +793,18 @@ module Google
|
|
789
793
|
|
790
794
|
response = @client_stub.make_http_request(
|
791
795
|
verb,
|
792
|
-
uri:
|
793
|
-
body:
|
794
|
-
params:
|
796
|
+
uri: uri,
|
797
|
+
body: body || "",
|
798
|
+
params: query_string_params,
|
799
|
+
method_name: "list_operations",
|
795
800
|
options: options
|
796
801
|
)
|
797
802
|
operation = ::Gapic::Rest::TransportOperation.new response
|
798
803
|
result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
|
799
|
-
|
800
|
-
|
801
|
-
|
804
|
+
catch :response do
|
805
|
+
yield result, operation if block_given?
|
806
|
+
result
|
807
|
+
end
|
802
808
|
end
|
803
809
|
|
804
810
|
##
|
@@ -827,16 +833,18 @@ module Google
|
|
827
833
|
|
828
834
|
response = @client_stub.make_http_request(
|
829
835
|
verb,
|
830
|
-
uri:
|
831
|
-
body:
|
832
|
-
params:
|
836
|
+
uri: uri,
|
837
|
+
body: body || "",
|
838
|
+
params: query_string_params,
|
839
|
+
method_name: "get_operation",
|
833
840
|
options: options
|
834
841
|
)
|
835
842
|
operation = ::Gapic::Rest::TransportOperation.new response
|
836
843
|
result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
|
837
|
-
|
838
|
-
|
839
|
-
|
844
|
+
catch :response do
|
845
|
+
yield result, operation if block_given?
|
846
|
+
result
|
847
|
+
end
|
840
848
|
end
|
841
849
|
|
842
850
|
##
|
@@ -865,16 +873,18 @@ module Google
|
|
865
873
|
|
866
874
|
response = @client_stub.make_http_request(
|
867
875
|
verb,
|
868
|
-
uri:
|
869
|
-
body:
|
870
|
-
params:
|
876
|
+
uri: uri,
|
877
|
+
body: body || "",
|
878
|
+
params: query_string_params,
|
879
|
+
method_name: "delete_operation",
|
871
880
|
options: options
|
872
881
|
)
|
873
882
|
operation = ::Gapic::Rest::TransportOperation.new response
|
874
883
|
result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
|
875
|
-
|
876
|
-
|
877
|
-
|
884
|
+
catch :response do
|
885
|
+
yield result, operation if block_given?
|
886
|
+
result
|
887
|
+
end
|
878
888
|
end
|
879
889
|
|
880
890
|
##
|
@@ -903,16 +913,18 @@ module Google
|
|
903
913
|
|
904
914
|
response = @client_stub.make_http_request(
|
905
915
|
verb,
|
906
|
-
uri:
|
907
|
-
body:
|
908
|
-
params:
|
916
|
+
uri: uri,
|
917
|
+
body: body || "",
|
918
|
+
params: query_string_params,
|
919
|
+
method_name: "cancel_operation",
|
909
920
|
options: options
|
910
921
|
)
|
911
922
|
operation = ::Gapic::Rest::TransportOperation.new response
|
912
923
|
result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
|
913
|
-
|
914
|
-
|
915
|
-
|
924
|
+
catch :response do
|
925
|
+
yield result, operation if block_given?
|
926
|
+
result
|
927
|
+
end
|
916
928
|
end
|
917
929
|
|
918
930
|
##
|
@@ -941,16 +953,18 @@ module Google
|
|
941
953
|
|
942
954
|
response = @client_stub.make_http_request(
|
943
955
|
verb,
|
944
|
-
uri:
|
945
|
-
body:
|
946
|
-
params:
|
956
|
+
uri: uri,
|
957
|
+
body: body || "",
|
958
|
+
params: query_string_params,
|
959
|
+
method_name: "wait_operation",
|
947
960
|
options: options
|
948
961
|
)
|
949
962
|
operation = ::Gapic::Rest::TransportOperation.new response
|
950
963
|
result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
|
951
|
-
|
952
|
-
|
953
|
-
|
964
|
+
catch :response do
|
965
|
+
yield result, operation if block_given?
|
966
|
+
result
|
967
|
+
end
|
954
968
|
end
|
955
969
|
|
956
970
|
##
|