google-cloud-vision-v1p3beta1 0.13.1 → 0.15.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::V1p3beta1::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: "async_batch_annotate_files",
131
146
  options: options
132
147
  )
133
148
  operation = ::Gapic::Rest::TransportOperation.new response
134
149
  result = ::Google::Longrunning::Operation.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
  ##
@@ -267,8 +267,19 @@ module Google
267
267
  universe_domain: @config.universe_domain,
268
268
  channel_args: @config.channel_args,
269
269
  interceptors: @config.interceptors,
270
- channel_pool_config: @config.channel_pool
270
+ channel_pool_config: @config.channel_pool,
271
+ logger: @config.logger
271
272
  )
273
+
274
+ @product_search_stub.stub_logger&.info do |entry|
275
+ entry.set_system_name
276
+ entry.set_service
277
+ entry.message = "Created client for #{entry.service}"
278
+ entry.set_credentials_fields credentials
279
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
280
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
281
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
282
+ end
272
283
  end
273
284
 
274
285
  ##
@@ -278,6 +289,15 @@ module Google
278
289
  #
279
290
  attr_reader :operations_client
280
291
 
292
+ ##
293
+ # The logger used for request/response debug logging.
294
+ #
295
+ # @return [Logger]
296
+ #
297
+ def logger
298
+ @product_search_stub.logger
299
+ end
300
+
281
301
  # Service calls
282
302
 
283
303
  ##
@@ -374,7 +394,6 @@ module Google
374
394
 
375
395
  @product_search_stub.call_rpc :create_product_set, request, options: options do |response, operation|
376
396
  yield response, operation if block_given?
377
- return response
378
397
  end
379
398
  rescue ::GRPC::BadStatus => e
380
399
  raise ::Google::Cloud::Error.from_error(e)
@@ -476,7 +495,7 @@ module Google
476
495
  @product_search_stub.call_rpc :list_product_sets, request, options: options do |response, operation|
477
496
  response = ::Gapic::PagedEnumerable.new @product_search_stub, :list_product_sets, request, response, operation, options
478
497
  yield response, operation if block_given?
479
- return response
498
+ throw :response, response
480
499
  end
481
500
  rescue ::GRPC::BadStatus => e
482
501
  raise ::Google::Cloud::Error.from_error(e)
@@ -569,7 +588,6 @@ module Google
569
588
 
570
589
  @product_search_stub.call_rpc :get_product_set, request, options: options do |response, operation|
571
590
  yield response, operation if block_given?
572
- return response
573
591
  end
574
592
  rescue ::GRPC::BadStatus => e
575
593
  raise ::Google::Cloud::Error.from_error(e)
@@ -667,7 +685,6 @@ module Google
667
685
 
668
686
  @product_search_stub.call_rpc :update_product_set, request, options: options do |response, operation|
669
687
  yield response, operation if block_given?
670
- return response
671
688
  end
672
689
  rescue ::GRPC::BadStatus => e
673
690
  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)
@@ -1167,7 +1181,6 @@ module Google
1167
1181
 
1168
1182
  @product_search_stub.call_rpc :update_product, request, options: options do |response, operation|
1169
1183
  yield response, operation if block_given?
1170
- return response
1171
1184
  end
1172
1185
  rescue ::GRPC::BadStatus => e
1173
1186
  raise ::Google::Cloud::Error.from_error(e)
@@ -1264,7 +1277,6 @@ module Google
1264
1277
 
1265
1278
  @product_search_stub.call_rpc :delete_product, request, options: options do |response, operation|
1266
1279
  yield response, operation if block_given?
1267
- return response
1268
1280
  end
1269
1281
  rescue ::GRPC::BadStatus => e
1270
1282
  raise ::Google::Cloud::Error.from_error(e)
@@ -1379,7 +1391,6 @@ module Google
1379
1391
 
1380
1392
  @product_search_stub.call_rpc :create_reference_image, request, options: options do |response, operation|
1381
1393
  yield response, operation if block_given?
1382
- return response
1383
1394
  end
1384
1395
  rescue ::GRPC::BadStatus => e
1385
1396
  raise ::Google::Cloud::Error.from_error(e)
@@ -1479,7 +1490,6 @@ module Google
1479
1490
 
1480
1491
  @product_search_stub.call_rpc :delete_reference_image, request, options: options do |response, operation|
1481
1492
  yield response, operation if block_given?
1482
- return response
1483
1493
  end
1484
1494
  rescue ::GRPC::BadStatus => e
1485
1495
  raise ::Google::Cloud::Error.from_error(e)
@@ -1586,7 +1596,7 @@ module Google
1586
1596
  @product_search_stub.call_rpc :list_reference_images, request, options: options do |response, operation|
1587
1597
  response = ::Gapic::PagedEnumerable.new @product_search_stub, :list_reference_images, request, response, operation, options
1588
1598
  yield response, operation if block_given?
1589
- return response
1599
+ throw :response, response
1590
1600
  end
1591
1601
  rescue ::GRPC::BadStatus => e
1592
1602
  raise ::Google::Cloud::Error.from_error(e)
@@ -1680,7 +1690,6 @@ module Google
1680
1690
 
1681
1691
  @product_search_stub.call_rpc :get_reference_image, request, options: options do |response, operation|
1682
1692
  yield response, operation if block_given?
1683
- return response
1684
1693
  end
1685
1694
  rescue ::GRPC::BadStatus => e
1686
1695
  raise ::Google::Cloud::Error.from_error(e)
@@ -1781,7 +1790,6 @@ module Google
1781
1790
 
1782
1791
  @product_search_stub.call_rpc :add_product_to_product_set, request, options: options do |response, operation|
1783
1792
  yield response, operation if block_given?
1784
- return response
1785
1793
  end
1786
1794
  rescue ::GRPC::BadStatus => e
1787
1795
  raise ::Google::Cloud::Error.from_error(e)
@@ -1879,7 +1887,6 @@ module Google
1879
1887
 
1880
1888
  @product_search_stub.call_rpc :remove_product_from_product_set, request, options: options do |response, operation|
1881
1889
  yield response, operation if block_given?
1882
- return response
1883
1890
  end
1884
1891
  rescue ::GRPC::BadStatus => e
1885
1892
  raise ::Google::Cloud::Error.from_error(e)
@@ -1983,7 +1990,7 @@ module Google
1983
1990
  @product_search_stub.call_rpc :list_products_in_product_set, request, options: options do |response, operation|
1984
1991
  response = ::Gapic::PagedEnumerable.new @product_search_stub, :list_products_in_product_set, request, response, operation, options
1985
1992
  yield response, operation if block_given?
1986
- return response
1993
+ throw :response, response
1987
1994
  end
1988
1995
  rescue ::GRPC::BadStatus => e
1989
1996
  raise ::Google::Cloud::Error.from_error(e)
@@ -2091,7 +2098,7 @@ module Google
2091
2098
  @product_search_stub.call_rpc :import_product_sets, request, options: options do |response, operation|
2092
2099
  response = ::Gapic::Operation.new response, @operations_client, options: options
2093
2100
  yield response, operation if block_given?
2094
- return response
2101
+ throw :response, response
2095
2102
  end
2096
2103
  rescue ::GRPC::BadStatus => e
2097
2104
  raise ::Google::Cloud::Error.from_error(e)
@@ -2141,6 +2148,13 @@ module Google
2141
2148
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
2142
2149
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
2143
2150
  # * (`nil`) indicating no credentials
2151
+ #
2152
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
2153
+ # external source for authentication to Google Cloud, you must validate it before
2154
+ # providing it to a Google API client library. Providing an unvalidated credential
2155
+ # configuration to Google APIs can compromise the security of your systems and data.
2156
+ # For more information, refer to [Validate credential configurations from external
2157
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
2144
2158
  # @return [::Object]
2145
2159
  # @!attribute [rw] scope
2146
2160
  # The OAuth scopes
@@ -2180,6 +2194,11 @@ module Google
2180
2194
  # default endpoint URL. The default value of nil uses the environment
2181
2195
  # universe (usually the default "googleapis.com" universe).
2182
2196
  # @return [::String,nil]
2197
+ # @!attribute [rw] logger
2198
+ # A custom logger to use for request/response debug logging, or the value
2199
+ # `:default` (the default) to construct a default logger, or `nil` to
2200
+ # explicitly disable logging.
2201
+ # @return [::Logger,:default,nil]
2183
2202
  #
2184
2203
  class Configuration
2185
2204
  extend ::Gapic::Config
@@ -2204,6 +2223,7 @@ module Google
2204
2223
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2205
2224
  config_attr :quota_project, nil, ::String, nil
2206
2225
  config_attr :universe_domain, nil, ::String, nil
2226
+ config_attr :logger, :default, ::Logger, nil, :default
2207
2227
 
2208
2228
  # @private
2209
2229
  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)
@@ -649,6 +640,13 @@ module Google
649
640
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
650
641
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
651
642
  # * (`nil`) indicating no credentials
643
+ #
644
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
645
+ # external source for authentication to Google Cloud, you must validate it before
646
+ # providing it to a Google API client library. Providing an unvalidated credential
647
+ # configuration to Google APIs can compromise the security of your systems and data.
648
+ # For more information, refer to [Validate credential configurations from external
649
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
652
650
  # @return [::Object]
653
651
  # @!attribute [rw] scope
654
652
  # The OAuth scopes
@@ -688,6 +686,11 @@ module Google
688
686
  # default endpoint URL. The default value of nil uses the environment
689
687
  # universe (usually the default "googleapis.com" universe).
690
688
  # @return [::String,nil]
689
+ # @!attribute [rw] logger
690
+ # A custom logger to use for request/response debug logging, or the value
691
+ # `:default` (the default) to construct a default logger, or `nil` to
692
+ # explicitly disable logging.
693
+ # @return [::Logger,:default,nil]
691
694
  #
692
695
  class Configuration
693
696
  extend ::Gapic::Config
@@ -712,6 +715,7 @@ module Google
712
715
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
713
716
  config_attr :quota_project, nil, ::String, nil
714
717
  config_attr :universe_domain, nil, ::String, nil
718
+ config_attr :logger, :default, ::Logger, nil, :default
715
719
 
716
720
  # @private
717
721
  def initialize parent_config = nil
@@ -260,8 +260,19 @@ module Google
260
260
  endpoint: @config.endpoint,
261
261
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
262
262
  universe_domain: @config.universe_domain,
263
- credentials: credentials
263
+ credentials: credentials,
264
+ logger: @config.logger
264
265
  )
266
+
267
+ @product_search_stub.logger(stub: true)&.info do |entry|
268
+ entry.set_system_name
269
+ entry.set_service
270
+ entry.message = "Created client for #{entry.service}"
271
+ entry.set_credentials_fields credentials
272
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
273
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
274
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
275
+ end
265
276
  end
266
277
 
267
278
  ##
@@ -271,6 +282,15 @@ module Google
271
282
  #
272
283
  attr_reader :operations_client
273
284
 
285
+ ##
286
+ # The logger used for request/response debug logging.
287
+ #
288
+ # @return [Logger]
289
+ #
290
+ def logger
291
+ @product_search_stub.logger
292
+ end
293
+
274
294
  # Service calls
275
295
 
276
296
  ##
@@ -360,7 +380,6 @@ module Google
360
380
 
361
381
  @product_search_stub.create_product_set request, options do |result, operation|
362
382
  yield result, operation if block_given?
363
- return result
364
383
  end
365
384
  rescue ::Gapic::Rest::Error => e
366
385
  raise ::Google::Cloud::Error.from_error(e)
@@ -455,7 +474,7 @@ module Google
455
474
  @product_search_stub.list_product_sets request, options do |result, operation|
456
475
  result = ::Gapic::Rest::PagedEnumerable.new @product_search_stub, :list_product_sets, "product_sets", request, result, options
457
476
  yield result, operation if block_given?
458
- return result
477
+ throw :response, result
459
478
  end
460
479
  rescue ::Gapic::Rest::Error => e
461
480
  raise ::Google::Cloud::Error.from_error(e)
@@ -541,7 +560,6 @@ module Google
541
560
 
542
561
  @product_search_stub.get_product_set request, options do |result, operation|
543
562
  yield result, operation if block_given?
544
- return result
545
563
  end
546
564
  rescue ::Gapic::Rest::Error => e
547
565
  raise ::Google::Cloud::Error.from_error(e)
@@ -632,7 +650,6 @@ module Google
632
650
 
633
651
  @product_search_stub.update_product_set request, options do |result, operation|
634
652
  yield result, operation if block_given?
635
- return result
636
653
  end
637
654
  rescue ::Gapic::Rest::Error => e
638
655
  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)
@@ -1097,7 +1111,6 @@ module Google
1097
1111
 
1098
1112
  @product_search_stub.update_product request, options do |result, operation|
1099
1113
  yield result, operation if block_given?
1100
- return result
1101
1114
  end
1102
1115
  rescue ::Gapic::Rest::Error => e
1103
1116
  raise ::Google::Cloud::Error.from_error(e)
@@ -1187,7 +1200,6 @@ module Google
1187
1200
 
1188
1201
  @product_search_stub.delete_product request, options do |result, operation|
1189
1202
  yield result, operation if block_given?
1190
- return result
1191
1203
  end
1192
1204
  rescue ::Gapic::Rest::Error => e
1193
1205
  raise ::Google::Cloud::Error.from_error(e)
@@ -1295,7 +1307,6 @@ module Google
1295
1307
 
1296
1308
  @product_search_stub.create_reference_image request, options do |result, operation|
1297
1309
  yield result, operation if block_given?
1298
- return result
1299
1310
  end
1300
1311
  rescue ::Gapic::Rest::Error => e
1301
1312
  raise ::Google::Cloud::Error.from_error(e)
@@ -1388,7 +1399,6 @@ module Google
1388
1399
 
1389
1400
  @product_search_stub.delete_reference_image request, options do |result, operation|
1390
1401
  yield result, operation if block_given?
1391
- return result
1392
1402
  end
1393
1403
  rescue ::Gapic::Rest::Error => e
1394
1404
  raise ::Google::Cloud::Error.from_error(e)
@@ -1488,7 +1498,7 @@ module Google
1488
1498
  @product_search_stub.list_reference_images request, options do |result, operation|
1489
1499
  result = ::Gapic::Rest::PagedEnumerable.new @product_search_stub, :list_reference_images, "reference_images", request, result, options
1490
1500
  yield result, operation if block_given?
1491
- return result
1501
+ throw :response, result
1492
1502
  end
1493
1503
  rescue ::Gapic::Rest::Error => e
1494
1504
  raise ::Google::Cloud::Error.from_error(e)
@@ -1575,7 +1585,6 @@ module Google
1575
1585
 
1576
1586
  @product_search_stub.get_reference_image request, options do |result, operation|
1577
1587
  yield result, operation if block_given?
1578
- return result
1579
1588
  end
1580
1589
  rescue ::Gapic::Rest::Error => e
1581
1590
  raise ::Google::Cloud::Error.from_error(e)
@@ -1669,7 +1678,6 @@ module Google
1669
1678
 
1670
1679
  @product_search_stub.add_product_to_product_set request, options do |result, operation|
1671
1680
  yield result, operation if block_given?
1672
- return result
1673
1681
  end
1674
1682
  rescue ::Gapic::Rest::Error => e
1675
1683
  raise ::Google::Cloud::Error.from_error(e)
@@ -1760,7 +1768,6 @@ module Google
1760
1768
 
1761
1769
  @product_search_stub.remove_product_from_product_set request, options do |result, operation|
1762
1770
  yield result, operation if block_given?
1763
- return result
1764
1771
  end
1765
1772
  rescue ::Gapic::Rest::Error => e
1766
1773
  raise ::Google::Cloud::Error.from_error(e)
@@ -1857,7 +1864,7 @@ module Google
1857
1864
  @product_search_stub.list_products_in_product_set request, options do |result, operation|
1858
1865
  result = ::Gapic::Rest::PagedEnumerable.new @product_search_stub, :list_products_in_product_set, "products", request, result, options
1859
1866
  yield result, operation if block_given?
1860
- return result
1867
+ throw :response, result
1861
1868
  end
1862
1869
  rescue ::Gapic::Rest::Error => e
1863
1870
  raise ::Google::Cloud::Error.from_error(e)
@@ -1958,7 +1965,7 @@ module Google
1958
1965
  @product_search_stub.import_product_sets request, options do |result, operation|
1959
1966
  result = ::Gapic::Operation.new result, @operations_client, options: options
1960
1967
  yield result, operation if block_given?
1961
- return result
1968
+ throw :response, result
1962
1969
  end
1963
1970
  rescue ::Gapic::Rest::Error => e
1964
1971
  raise ::Google::Cloud::Error.from_error(e)
@@ -2006,6 +2013,13 @@ module Google
2006
2013
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
2007
2014
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
2008
2015
  # * (`nil`) indicating no credentials
2016
+ #
2017
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
2018
+ # external source for authentication to Google Cloud, you must validate it before
2019
+ # providing it to a Google API client library. Providing an unvalidated credential
2020
+ # configuration to Google APIs can compromise the security of your systems and data.
2021
+ # For more information, refer to [Validate credential configurations from external
2022
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
2009
2023
  # @return [::Object]
2010
2024
  # @!attribute [rw] scope
2011
2025
  # The OAuth scopes
@@ -2038,6 +2052,11 @@ module Google
2038
2052
  # default endpoint URL. The default value of nil uses the environment
2039
2053
  # universe (usually the default "googleapis.com" universe).
2040
2054
  # @return [::String,nil]
2055
+ # @!attribute [rw] logger
2056
+ # A custom logger to use for request/response debug logging, or the value
2057
+ # `:default` (the default) to construct a default logger, or `nil` to
2058
+ # explicitly disable logging.
2059
+ # @return [::Logger,:default,nil]
2041
2060
  #
2042
2061
  class Configuration
2043
2062
  extend ::Gapic::Config
@@ -2059,6 +2078,7 @@ module Google
2059
2078
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2060
2079
  config_attr :quota_project, nil, ::String, nil
2061
2080
  config_attr :universe_domain, nil, ::String, nil
2081
+ config_attr :logger, :default, ::Logger, nil, :default
2062
2082
 
2063
2083
  # @private
2064
2084
  def initialize parent_config = nil