google-cloud-vision-v1p4beta1 0.8.1 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,7 +30,8 @@ module Google
30
30
  # including transcoding, making the REST call, and deserialing the response.
31
31
  #
32
32
  class ServiceStub
33
- def initialize endpoint:, endpoint_template:, universe_domain:, credentials:
33
+ # @private
34
+ def initialize endpoint:, endpoint_template:, universe_domain:, credentials:, logger:
34
35
  # These require statements are intentionally placed here to initialize
35
36
  # the REST modules only when it's required.
36
37
  require "gapic/rest"
@@ -40,7 +41,9 @@ module Google
40
41
  universe_domain: universe_domain,
41
42
  credentials: credentials,
42
43
  numeric_enums: true,
43
- raise_faraday_errors: false
44
+ service_name: self.class,
45
+ raise_faraday_errors: false,
46
+ logger: logger
44
47
  end
45
48
 
46
49
  ##
@@ -61,6 +64,15 @@ module Google
61
64
  @client_stub.endpoint
62
65
  end
63
66
 
67
+ ##
68
+ # The logger used for request/response debug logging.
69
+ #
70
+ # @return [Logger]
71
+ #
72
+ def logger stub: false
73
+ stub ? @client_stub.stub_logger : @client_stub.logger
74
+ end
75
+
64
76
  ##
65
77
  # Baseline implementation for the batch_annotate_images REST call
66
78
  #
@@ -87,16 +99,18 @@ module Google
87
99
 
88
100
  response = @client_stub.make_http_request(
89
101
  verb,
90
- uri: uri,
91
- body: body || "",
92
- params: query_string_params,
102
+ uri: uri,
103
+ body: body || "",
104
+ params: query_string_params,
105
+ method_name: "batch_annotate_images",
93
106
  options: options
94
107
  )
95
108
  operation = ::Gapic::Rest::TransportOperation.new response
96
109
  result = ::Google::Cloud::Vision::V1p4beta1::BatchAnnotateImagesResponse.decode_json response.body, ignore_unknown_fields: true
97
-
98
- yield result, operation if block_given?
99
- result
110
+ catch :response do
111
+ yield result, operation if block_given?
112
+ result
113
+ end
100
114
  end
101
115
 
102
116
  ##
@@ -125,16 +139,18 @@ module Google
125
139
 
126
140
  response = @client_stub.make_http_request(
127
141
  verb,
128
- uri: uri,
129
- body: body || "",
130
- params: query_string_params,
142
+ uri: uri,
143
+ body: body || "",
144
+ params: query_string_params,
145
+ method_name: "batch_annotate_files",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Cloud::Vision::V1p4beta1::BatchAnnotateFilesResponse.decode_json response.body, ignore_unknown_fields: true
135
-
136
- yield result, operation if block_given?
137
- result
150
+ catch :response do
151
+ yield result, operation if block_given?
152
+ result
153
+ end
138
154
  end
139
155
 
140
156
  ##
@@ -163,16 +179,18 @@ module Google
163
179
 
164
180
  response = @client_stub.make_http_request(
165
181
  verb,
166
- uri: uri,
167
- body: body || "",
168
- params: query_string_params,
182
+ uri: uri,
183
+ body: body || "",
184
+ params: query_string_params,
185
+ method_name: "async_batch_annotate_images",
169
186
  options: options
170
187
  )
171
188
  operation = ::Gapic::Rest::TransportOperation.new response
172
189
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
173
-
174
- yield result, operation if block_given?
175
- result
190
+ catch :response do
191
+ yield result, operation if block_given?
192
+ result
193
+ end
176
194
  end
177
195
 
178
196
  ##
@@ -201,16 +219,18 @@ module Google
201
219
 
202
220
  response = @client_stub.make_http_request(
203
221
  verb,
204
- uri: uri,
205
- body: body || "",
206
- params: query_string_params,
222
+ uri: uri,
223
+ body: body || "",
224
+ params: query_string_params,
225
+ method_name: "async_batch_annotate_files",
207
226
  options: options
208
227
  )
209
228
  operation = ::Gapic::Rest::TransportOperation.new response
210
229
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
211
-
212
- yield result, operation if block_given?
213
- result
230
+ catch :response do
231
+ yield result, operation if block_given?
232
+ result
233
+ end
214
234
  end
215
235
 
216
236
  ##
@@ -271,8 +271,19 @@ module Google
271
271
  universe_domain: @config.universe_domain,
272
272
  channel_args: @config.channel_args,
273
273
  interceptors: @config.interceptors,
274
- channel_pool_config: @config.channel_pool
274
+ channel_pool_config: @config.channel_pool,
275
+ logger: @config.logger
275
276
  )
277
+
278
+ @product_search_stub.stub_logger&.info do |entry|
279
+ entry.set_system_name
280
+ entry.set_service
281
+ entry.message = "Created client for #{entry.service}"
282
+ entry.set_credentials_fields credentials
283
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
284
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
285
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
286
+ end
276
287
  end
277
288
 
278
289
  ##
@@ -282,6 +293,15 @@ module Google
282
293
  #
283
294
  attr_reader :operations_client
284
295
 
296
+ ##
297
+ # The logger used for request/response debug logging.
298
+ #
299
+ # @return [Logger]
300
+ #
301
+ def logger
302
+ @product_search_stub.logger
303
+ end
304
+
285
305
  # Service calls
286
306
 
287
307
  ##
@@ -378,7 +398,6 @@ module Google
378
398
 
379
399
  @product_search_stub.call_rpc :create_product_set, request, options: options do |response, operation|
380
400
  yield response, operation if block_given?
381
- return response
382
401
  end
383
402
  rescue ::GRPC::BadStatus => e
384
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -480,7 +499,7 @@ module Google
480
499
  @product_search_stub.call_rpc :list_product_sets, request, options: options do |response, operation|
481
500
  response = ::Gapic::PagedEnumerable.new @product_search_stub, :list_product_sets, request, response, operation, options
482
501
  yield response, operation if block_given?
483
- return response
502
+ throw :response, response
484
503
  end
485
504
  rescue ::GRPC::BadStatus => e
486
505
  raise ::Google::Cloud::Error.from_error(e)
@@ -573,7 +592,6 @@ module Google
573
592
 
574
593
  @product_search_stub.call_rpc :get_product_set, request, options: options do |response, operation|
575
594
  yield response, operation if block_given?
576
- return response
577
595
  end
578
596
  rescue ::GRPC::BadStatus => e
579
597
  raise ::Google::Cloud::Error.from_error(e)
@@ -671,7 +689,6 @@ module Google
671
689
 
672
690
  @product_search_stub.call_rpc :update_product_set, request, options: options do |response, operation|
673
691
  yield response, operation if block_given?
674
- return response
675
692
  end
676
693
  rescue ::GRPC::BadStatus => e
677
694
  raise ::Google::Cloud::Error.from_error(e)
@@ -763,7 +780,6 @@ module Google
763
780
 
764
781
  @product_search_stub.call_rpc :delete_product_set, request, options: options do |response, operation|
765
782
  yield response, operation if block_given?
766
- return response
767
783
  end
768
784
  rescue ::GRPC::BadStatus => e
769
785
  raise ::Google::Cloud::Error.from_error(e)
@@ -866,7 +882,6 @@ module Google
866
882
 
867
883
  @product_search_stub.call_rpc :create_product, request, options: options do |response, operation|
868
884
  yield response, operation if block_given?
869
- return response
870
885
  end
871
886
  rescue ::GRPC::BadStatus => e
872
887
  raise ::Google::Cloud::Error.from_error(e)
@@ -968,7 +983,7 @@ module Google
968
983
  @product_search_stub.call_rpc :list_products, request, options: options do |response, operation|
969
984
  response = ::Gapic::PagedEnumerable.new @product_search_stub, :list_products, request, response, operation, options
970
985
  yield response, operation if block_given?
971
- return response
986
+ throw :response, response
972
987
  end
973
988
  rescue ::GRPC::BadStatus => e
974
989
  raise ::Google::Cloud::Error.from_error(e)
@@ -1061,7 +1076,6 @@ module Google
1061
1076
 
1062
1077
  @product_search_stub.call_rpc :get_product, request, options: options do |response, operation|
1063
1078
  yield response, operation if block_given?
1064
- return response
1065
1079
  end
1066
1080
  rescue ::GRPC::BadStatus => e
1067
1081
  raise ::Google::Cloud::Error.from_error(e)
@@ -1168,7 +1182,6 @@ module Google
1168
1182
 
1169
1183
  @product_search_stub.call_rpc :update_product, request, options: options do |response, operation|
1170
1184
  yield response, operation if block_given?
1171
- return response
1172
1185
  end
1173
1186
  rescue ::GRPC::BadStatus => e
1174
1187
  raise ::Google::Cloud::Error.from_error(e)
@@ -1261,7 +1274,6 @@ module Google
1261
1274
 
1262
1275
  @product_search_stub.call_rpc :delete_product, request, options: options do |response, operation|
1263
1276
  yield response, operation if block_given?
1264
- return response
1265
1277
  end
1266
1278
  rescue ::GRPC::BadStatus => e
1267
1279
  raise ::Google::Cloud::Error.from_error(e)
@@ -1377,7 +1389,6 @@ module Google
1377
1389
 
1378
1390
  @product_search_stub.call_rpc :create_reference_image, request, options: options do |response, operation|
1379
1391
  yield response, operation if block_given?
1380
- return response
1381
1392
  end
1382
1393
  rescue ::GRPC::BadStatus => e
1383
1394
  raise ::Google::Cloud::Error.from_error(e)
@@ -1473,7 +1484,6 @@ module Google
1473
1484
 
1474
1485
  @product_search_stub.call_rpc :delete_reference_image, request, options: options do |response, operation|
1475
1486
  yield response, operation if block_given?
1476
- return response
1477
1487
  end
1478
1488
  rescue ::GRPC::BadStatus => e
1479
1489
  raise ::Google::Cloud::Error.from_error(e)
@@ -1580,7 +1590,7 @@ module Google
1580
1590
  @product_search_stub.call_rpc :list_reference_images, request, options: options do |response, operation|
1581
1591
  response = ::Gapic::PagedEnumerable.new @product_search_stub, :list_reference_images, request, response, operation, options
1582
1592
  yield response, operation if block_given?
1583
- return response
1593
+ throw :response, response
1584
1594
  end
1585
1595
  rescue ::GRPC::BadStatus => e
1586
1596
  raise ::Google::Cloud::Error.from_error(e)
@@ -1674,7 +1684,6 @@ module Google
1674
1684
 
1675
1685
  @product_search_stub.call_rpc :get_reference_image, request, options: options do |response, operation|
1676
1686
  yield response, operation if block_given?
1677
- return response
1678
1687
  end
1679
1688
  rescue ::GRPC::BadStatus => e
1680
1689
  raise ::Google::Cloud::Error.from_error(e)
@@ -1775,7 +1784,6 @@ module Google
1775
1784
 
1776
1785
  @product_search_stub.call_rpc :add_product_to_product_set, request, options: options do |response, operation|
1777
1786
  yield response, operation if block_given?
1778
- return response
1779
1787
  end
1780
1788
  rescue ::GRPC::BadStatus => e
1781
1789
  raise ::Google::Cloud::Error.from_error(e)
@@ -1870,7 +1878,6 @@ module Google
1870
1878
 
1871
1879
  @product_search_stub.call_rpc :remove_product_from_product_set, request, options: options do |response, operation|
1872
1880
  yield response, operation if block_given?
1873
- return response
1874
1881
  end
1875
1882
  rescue ::GRPC::BadStatus => e
1876
1883
  raise ::Google::Cloud::Error.from_error(e)
@@ -1974,7 +1981,7 @@ module Google
1974
1981
  @product_search_stub.call_rpc :list_products_in_product_set, request, options: options do |response, operation|
1975
1982
  response = ::Gapic::PagedEnumerable.new @product_search_stub, :list_products_in_product_set, request, response, operation, options
1976
1983
  yield response, operation if block_given?
1977
- return response
1984
+ throw :response, response
1978
1985
  end
1979
1986
  rescue ::GRPC::BadStatus => e
1980
1987
  raise ::Google::Cloud::Error.from_error(e)
@@ -2082,7 +2089,7 @@ module Google
2082
2089
  @product_search_stub.call_rpc :import_product_sets, request, options: options do |response, operation|
2083
2090
  response = ::Gapic::Operation.new response, @operations_client, options: options
2084
2091
  yield response, operation if block_given?
2085
- return response
2092
+ throw :response, response
2086
2093
  end
2087
2094
  rescue ::GRPC::BadStatus => e
2088
2095
  raise ::Google::Cloud::Error.from_error(e)
@@ -2209,7 +2216,7 @@ module Google
2209
2216
  @product_search_stub.call_rpc :purge_products, request, options: options do |response, operation|
2210
2217
  response = ::Gapic::Operation.new response, @operations_client, options: options
2211
2218
  yield response, operation if block_given?
2212
- return response
2219
+ throw :response, response
2213
2220
  end
2214
2221
  rescue ::GRPC::BadStatus => e
2215
2222
  raise ::Google::Cloud::Error.from_error(e)
@@ -2298,6 +2305,11 @@ module Google
2298
2305
  # default endpoint URL. The default value of nil uses the environment
2299
2306
  # universe (usually the default "googleapis.com" universe).
2300
2307
  # @return [::String,nil]
2308
+ # @!attribute [rw] logger
2309
+ # A custom logger to use for request/response debug logging, or the value
2310
+ # `:default` (the default) to construct a default logger, or `nil` to
2311
+ # explicitly disable logging.
2312
+ # @return [::Logger,:default,nil]
2301
2313
  #
2302
2314
  class Configuration
2303
2315
  extend ::Gapic::Config
@@ -2322,6 +2334,7 @@ module Google
2322
2334
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2323
2335
  config_attr :quota_project, nil, ::String, nil
2324
2336
  config_attr :universe_domain, nil, ::String, nil
2337
+ config_attr :logger, :default, ::Logger, nil, :default
2325
2338
 
2326
2339
  # @private
2327
2340
  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)
@@ -599,7 +590,7 @@ module Google
599
590
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
600
591
  response = ::Gapic::Operation.new response, @operations_client, options: options
601
592
  yield response, operation if block_given?
602
- return response
593
+ throw :response, response
603
594
  end
604
595
  rescue ::GRPC::BadStatus => e
605
596
  raise ::Google::Cloud::Error.from_error(e)
@@ -688,6 +679,11 @@ module Google
688
679
  # default endpoint URL. The default value of nil uses the environment
689
680
  # universe (usually the default "googleapis.com" universe).
690
681
  # @return [::String,nil]
682
+ # @!attribute [rw] logger
683
+ # A custom logger to use for request/response debug logging, or the value
684
+ # `:default` (the default) to construct a default logger, or `nil` to
685
+ # explicitly disable logging.
686
+ # @return [::Logger,:default,nil]
691
687
  #
692
688
  class Configuration
693
689
  extend ::Gapic::Config
@@ -712,6 +708,7 @@ module Google
712
708
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
713
709
  config_attr :quota_project, nil, ::String, nil
714
710
  config_attr :universe_domain, nil, ::String, nil
711
+ config_attr :logger, :default, ::Logger, nil, :default
715
712
 
716
713
  # @private
717
714
  def initialize parent_config = nil
@@ -264,8 +264,19 @@ module Google
264
264
  endpoint: @config.endpoint,
265
265
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
266
266
  universe_domain: @config.universe_domain,
267
- credentials: credentials
267
+ credentials: credentials,
268
+ logger: @config.logger
268
269
  )
270
+
271
+ @product_search_stub.logger(stub: true)&.info do |entry|
272
+ entry.set_system_name
273
+ entry.set_service
274
+ entry.message = "Created client for #{entry.service}"
275
+ entry.set_credentials_fields credentials
276
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
277
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
278
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
279
+ end
269
280
  end
270
281
 
271
282
  ##
@@ -275,6 +286,15 @@ module Google
275
286
  #
276
287
  attr_reader :operations_client
277
288
 
289
+ ##
290
+ # The logger used for request/response debug logging.
291
+ #
292
+ # @return [Logger]
293
+ #
294
+ def logger
295
+ @product_search_stub.logger
296
+ end
297
+
278
298
  # Service calls
279
299
 
280
300
  ##
@@ -364,7 +384,6 @@ module Google
364
384
 
365
385
  @product_search_stub.create_product_set request, options do |result, operation|
366
386
  yield result, operation if block_given?
367
- return result
368
387
  end
369
388
  rescue ::Gapic::Rest::Error => e
370
389
  raise ::Google::Cloud::Error.from_error(e)
@@ -459,7 +478,7 @@ module Google
459
478
  @product_search_stub.list_product_sets request, options do |result, operation|
460
479
  result = ::Gapic::Rest::PagedEnumerable.new @product_search_stub, :list_product_sets, "product_sets", request, result, options
461
480
  yield result, operation if block_given?
462
- return result
481
+ throw :response, result
463
482
  end
464
483
  rescue ::Gapic::Rest::Error => e
465
484
  raise ::Google::Cloud::Error.from_error(e)
@@ -545,7 +564,6 @@ module Google
545
564
 
546
565
  @product_search_stub.get_product_set request, options do |result, operation|
547
566
  yield result, operation if block_given?
548
- return result
549
567
  end
550
568
  rescue ::Gapic::Rest::Error => e
551
569
  raise ::Google::Cloud::Error.from_error(e)
@@ -636,7 +654,6 @@ module Google
636
654
 
637
655
  @product_search_stub.update_product_set request, options do |result, operation|
638
656
  yield result, operation if block_given?
639
- return result
640
657
  end
641
658
  rescue ::Gapic::Rest::Error => e
642
659
  raise ::Google::Cloud::Error.from_error(e)
@@ -721,7 +738,6 @@ module Google
721
738
 
722
739
  @product_search_stub.delete_product_set request, options do |result, operation|
723
740
  yield result, operation if block_given?
724
- return result
725
741
  end
726
742
  rescue ::Gapic::Rest::Error => e
727
743
  raise ::Google::Cloud::Error.from_error(e)
@@ -817,7 +833,6 @@ module Google
817
833
 
818
834
  @product_search_stub.create_product request, options do |result, operation|
819
835
  yield result, operation if block_given?
820
- return result
821
836
  end
822
837
  rescue ::Gapic::Rest::Error => e
823
838
  raise ::Google::Cloud::Error.from_error(e)
@@ -912,7 +927,7 @@ module Google
912
927
  @product_search_stub.list_products request, options do |result, operation|
913
928
  result = ::Gapic::Rest::PagedEnumerable.new @product_search_stub, :list_products, "products", request, result, options
914
929
  yield result, operation if block_given?
915
- return result
930
+ throw :response, result
916
931
  end
917
932
  rescue ::Gapic::Rest::Error => e
918
933
  raise ::Google::Cloud::Error.from_error(e)
@@ -998,7 +1013,6 @@ module Google
998
1013
 
999
1014
  @product_search_stub.get_product request, options do |result, operation|
1000
1015
  yield result, operation if block_given?
1001
- return result
1002
1016
  end
1003
1017
  rescue ::Gapic::Rest::Error => e
1004
1018
  raise ::Google::Cloud::Error.from_error(e)
@@ -1098,7 +1112,6 @@ module Google
1098
1112
 
1099
1113
  @product_search_stub.update_product request, options do |result, operation|
1100
1114
  yield result, operation if block_given?
1101
- return result
1102
1115
  end
1103
1116
  rescue ::Gapic::Rest::Error => e
1104
1117
  raise ::Google::Cloud::Error.from_error(e)
@@ -1184,7 +1197,6 @@ module Google
1184
1197
 
1185
1198
  @product_search_stub.delete_product request, options do |result, operation|
1186
1199
  yield result, operation if block_given?
1187
- return result
1188
1200
  end
1189
1201
  rescue ::Gapic::Rest::Error => e
1190
1202
  raise ::Google::Cloud::Error.from_error(e)
@@ -1293,7 +1305,6 @@ module Google
1293
1305
 
1294
1306
  @product_search_stub.create_reference_image request, options do |result, operation|
1295
1307
  yield result, operation if block_given?
1296
- return result
1297
1308
  end
1298
1309
  rescue ::Gapic::Rest::Error => e
1299
1310
  raise ::Google::Cloud::Error.from_error(e)
@@ -1382,7 +1393,6 @@ module Google
1382
1393
 
1383
1394
  @product_search_stub.delete_reference_image request, options do |result, operation|
1384
1395
  yield result, operation if block_given?
1385
- return result
1386
1396
  end
1387
1397
  rescue ::Gapic::Rest::Error => e
1388
1398
  raise ::Google::Cloud::Error.from_error(e)
@@ -1482,7 +1492,7 @@ module Google
1482
1492
  @product_search_stub.list_reference_images request, options do |result, operation|
1483
1493
  result = ::Gapic::Rest::PagedEnumerable.new @product_search_stub, :list_reference_images, "reference_images", request, result, options
1484
1494
  yield result, operation if block_given?
1485
- return result
1495
+ throw :response, result
1486
1496
  end
1487
1497
  rescue ::Gapic::Rest::Error => e
1488
1498
  raise ::Google::Cloud::Error.from_error(e)
@@ -1569,7 +1579,6 @@ module Google
1569
1579
 
1570
1580
  @product_search_stub.get_reference_image request, options do |result, operation|
1571
1581
  yield result, operation if block_given?
1572
- return result
1573
1582
  end
1574
1583
  rescue ::Gapic::Rest::Error => e
1575
1584
  raise ::Google::Cloud::Error.from_error(e)
@@ -1663,7 +1672,6 @@ module Google
1663
1672
 
1664
1673
  @product_search_stub.add_product_to_product_set request, options do |result, operation|
1665
1674
  yield result, operation if block_given?
1666
- return result
1667
1675
  end
1668
1676
  rescue ::Gapic::Rest::Error => e
1669
1677
  raise ::Google::Cloud::Error.from_error(e)
@@ -1751,7 +1759,6 @@ module Google
1751
1759
 
1752
1760
  @product_search_stub.remove_product_from_product_set request, options do |result, operation|
1753
1761
  yield result, operation if block_given?
1754
- return result
1755
1762
  end
1756
1763
  rescue ::Gapic::Rest::Error => e
1757
1764
  raise ::Google::Cloud::Error.from_error(e)
@@ -1848,7 +1855,7 @@ module Google
1848
1855
  @product_search_stub.list_products_in_product_set request, options do |result, operation|
1849
1856
  result = ::Gapic::Rest::PagedEnumerable.new @product_search_stub, :list_products_in_product_set, "products", request, result, options
1850
1857
  yield result, operation if block_given?
1851
- return result
1858
+ throw :response, result
1852
1859
  end
1853
1860
  rescue ::Gapic::Rest::Error => e
1854
1861
  raise ::Google::Cloud::Error.from_error(e)
@@ -1949,7 +1956,7 @@ module Google
1949
1956
  @product_search_stub.import_product_sets request, options do |result, operation|
1950
1957
  result = ::Gapic::Operation.new result, @operations_client, options: options
1951
1958
  yield result, operation if block_given?
1952
- return result
1959
+ throw :response, result
1953
1960
  end
1954
1961
  rescue ::Gapic::Rest::Error => e
1955
1962
  raise ::Google::Cloud::Error.from_error(e)
@@ -2069,7 +2076,7 @@ module Google
2069
2076
  @product_search_stub.purge_products request, options do |result, operation|
2070
2077
  result = ::Gapic::Operation.new result, @operations_client, options: options
2071
2078
  yield result, operation if block_given?
2072
- return result
2079
+ throw :response, result
2073
2080
  end
2074
2081
  rescue ::Gapic::Rest::Error => e
2075
2082
  raise ::Google::Cloud::Error.from_error(e)
@@ -2149,6 +2156,11 @@ module Google
2149
2156
  # default endpoint URL. The default value of nil uses the environment
2150
2157
  # universe (usually the default "googleapis.com" universe).
2151
2158
  # @return [::String,nil]
2159
+ # @!attribute [rw] logger
2160
+ # A custom logger to use for request/response debug logging, or the value
2161
+ # `:default` (the default) to construct a default logger, or `nil` to
2162
+ # explicitly disable logging.
2163
+ # @return [::Logger,:default,nil]
2152
2164
  #
2153
2165
  class Configuration
2154
2166
  extend ::Gapic::Config
@@ -2170,6 +2182,7 @@ module Google
2170
2182
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2171
2183
  config_attr :quota_project, nil, ::String, nil
2172
2184
  config_attr :universe_domain, nil, ::String, nil
2185
+ config_attr :logger, :default, ::Logger, nil, :default
2173
2186
 
2174
2187
  # @private
2175
2188
  def initialize parent_config = nil