google-cloud-vision-v1p4beta1 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -47,6 +47,9 @@ module Google
47
47
  # `projects/*/locations/*/products/*/referenceImages/*`
48
48
  #
49
49
  class Client
50
+ # @private
51
+ API_VERSION = ""
52
+
50
53
  # @private
51
54
  DEFAULT_ENDPOINT_TEMPLATE = "vision.$UNIVERSE_DOMAIN$"
52
55
 
@@ -268,8 +271,19 @@ module Google
268
271
  universe_domain: @config.universe_domain,
269
272
  channel_args: @config.channel_args,
270
273
  interceptors: @config.interceptors,
271
- channel_pool_config: @config.channel_pool
274
+ channel_pool_config: @config.channel_pool,
275
+ logger: @config.logger
272
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
273
287
  end
274
288
 
275
289
  ##
@@ -279,6 +293,15 @@ module Google
279
293
  #
280
294
  attr_reader :operations_client
281
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
+
282
305
  # Service calls
283
306
 
284
307
  ##
@@ -350,10 +373,11 @@ module Google
350
373
  # Customize the options with defaults
351
374
  metadata = @config.rpcs.create_product_set.metadata.to_h
352
375
 
353
- # Set x-goog-api-client and x-goog-user-project headers
376
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
354
377
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
355
378
  lib_name: @config.lib_name, lib_version: @config.lib_version,
356
379
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
380
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
357
381
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
358
382
 
359
383
  header_params = {}
@@ -374,7 +398,6 @@ module Google
374
398
 
375
399
  @product_search_stub.call_rpc :create_product_set, request, options: options do |response, operation|
376
400
  yield response, operation if block_given?
377
- return response
378
401
  end
379
402
  rescue ::GRPC::BadStatus => e
380
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -450,10 +473,11 @@ module Google
450
473
  # Customize the options with defaults
451
474
  metadata = @config.rpcs.list_product_sets.metadata.to_h
452
475
 
453
- # Set x-goog-api-client and x-goog-user-project headers
476
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
454
477
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
455
478
  lib_name: @config.lib_name, lib_version: @config.lib_version,
456
479
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
480
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
457
481
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
458
482
 
459
483
  header_params = {}
@@ -475,7 +499,7 @@ module Google
475
499
  @product_search_stub.call_rpc :list_product_sets, request, options: options do |response, operation|
476
500
  response = ::Gapic::PagedEnumerable.new @product_search_stub, :list_product_sets, request, response, operation, options
477
501
  yield response, operation if block_given?
478
- return response
502
+ throw :response, response
479
503
  end
480
504
  rescue ::GRPC::BadStatus => e
481
505
  raise ::Google::Cloud::Error.from_error(e)
@@ -543,10 +567,11 @@ module Google
543
567
  # Customize the options with defaults
544
568
  metadata = @config.rpcs.get_product_set.metadata.to_h
545
569
 
546
- # Set x-goog-api-client and x-goog-user-project headers
570
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
547
571
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
548
572
  lib_name: @config.lib_name, lib_version: @config.lib_version,
549
573
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
574
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
550
575
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
551
576
 
552
577
  header_params = {}
@@ -567,7 +592,6 @@ module Google
567
592
 
568
593
  @product_search_stub.call_rpc :get_product_set, request, options: options do |response, operation|
569
594
  yield response, operation if block_given?
570
- return response
571
595
  end
572
596
  rescue ::GRPC::BadStatus => e
573
597
  raise ::Google::Cloud::Error.from_error(e)
@@ -640,10 +664,11 @@ module Google
640
664
  # Customize the options with defaults
641
665
  metadata = @config.rpcs.update_product_set.metadata.to_h
642
666
 
643
- # Set x-goog-api-client and x-goog-user-project headers
667
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
644
668
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
645
669
  lib_name: @config.lib_name, lib_version: @config.lib_version,
646
670
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
671
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
647
672
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
648
673
 
649
674
  header_params = {}
@@ -664,7 +689,6 @@ module Google
664
689
 
665
690
  @product_search_stub.call_rpc :update_product_set, request, options: options do |response, operation|
666
691
  yield response, operation if block_given?
667
- return response
668
692
  end
669
693
  rescue ::GRPC::BadStatus => e
670
694
  raise ::Google::Cloud::Error.from_error(e)
@@ -731,10 +755,11 @@ module Google
731
755
  # Customize the options with defaults
732
756
  metadata = @config.rpcs.delete_product_set.metadata.to_h
733
757
 
734
- # Set x-goog-api-client and x-goog-user-project headers
758
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
735
759
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
736
760
  lib_name: @config.lib_name, lib_version: @config.lib_version,
737
761
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
762
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
738
763
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
739
764
 
740
765
  header_params = {}
@@ -755,7 +780,6 @@ module Google
755
780
 
756
781
  @product_search_stub.call_rpc :delete_product_set, request, options: options do |response, operation|
757
782
  yield response, operation if block_given?
758
- return response
759
783
  end
760
784
  rescue ::GRPC::BadStatus => e
761
785
  raise ::Google::Cloud::Error.from_error(e)
@@ -833,10 +857,11 @@ module Google
833
857
  # Customize the options with defaults
834
858
  metadata = @config.rpcs.create_product.metadata.to_h
835
859
 
836
- # Set x-goog-api-client and x-goog-user-project headers
860
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
837
861
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
838
862
  lib_name: @config.lib_name, lib_version: @config.lib_version,
839
863
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
864
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
840
865
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
841
866
 
842
867
  header_params = {}
@@ -857,7 +882,6 @@ module Google
857
882
 
858
883
  @product_search_stub.call_rpc :create_product, request, options: options do |response, operation|
859
884
  yield response, operation if block_given?
860
- return response
861
885
  end
862
886
  rescue ::GRPC::BadStatus => e
863
887
  raise ::Google::Cloud::Error.from_error(e)
@@ -933,10 +957,11 @@ module Google
933
957
  # Customize the options with defaults
934
958
  metadata = @config.rpcs.list_products.metadata.to_h
935
959
 
936
- # Set x-goog-api-client and x-goog-user-project headers
960
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
937
961
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
938
962
  lib_name: @config.lib_name, lib_version: @config.lib_version,
939
963
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
964
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
940
965
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
941
966
 
942
967
  header_params = {}
@@ -958,7 +983,7 @@ module Google
958
983
  @product_search_stub.call_rpc :list_products, request, options: options do |response, operation|
959
984
  response = ::Gapic::PagedEnumerable.new @product_search_stub, :list_products, request, response, operation, options
960
985
  yield response, operation if block_given?
961
- return response
986
+ throw :response, response
962
987
  end
963
988
  rescue ::GRPC::BadStatus => e
964
989
  raise ::Google::Cloud::Error.from_error(e)
@@ -1026,10 +1051,11 @@ module Google
1026
1051
  # Customize the options with defaults
1027
1052
  metadata = @config.rpcs.get_product.metadata.to_h
1028
1053
 
1029
- # Set x-goog-api-client and x-goog-user-project headers
1054
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1030
1055
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1031
1056
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1032
1057
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
1058
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1033
1059
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1034
1060
 
1035
1061
  header_params = {}
@@ -1050,7 +1076,6 @@ module Google
1050
1076
 
1051
1077
  @product_search_stub.call_rpc :get_product, request, options: options do |response, operation|
1052
1078
  yield response, operation if block_given?
1053
- return response
1054
1079
  end
1055
1080
  rescue ::GRPC::BadStatus => e
1056
1081
  raise ::Google::Cloud::Error.from_error(e)
@@ -1132,10 +1157,11 @@ module Google
1132
1157
  # Customize the options with defaults
1133
1158
  metadata = @config.rpcs.update_product.metadata.to_h
1134
1159
 
1135
- # Set x-goog-api-client and x-goog-user-project headers
1160
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1136
1161
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1137
1162
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1138
1163
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
1164
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1139
1165
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1140
1166
 
1141
1167
  header_params = {}
@@ -1156,7 +1182,6 @@ module Google
1156
1182
 
1157
1183
  @product_search_stub.call_rpc :update_product, request, options: options do |response, operation|
1158
1184
  yield response, operation if block_given?
1159
- return response
1160
1185
  end
1161
1186
  rescue ::GRPC::BadStatus => e
1162
1187
  raise ::Google::Cloud::Error.from_error(e)
@@ -1224,10 +1249,11 @@ module Google
1224
1249
  # Customize the options with defaults
1225
1250
  metadata = @config.rpcs.delete_product.metadata.to_h
1226
1251
 
1227
- # Set x-goog-api-client and x-goog-user-project headers
1252
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1228
1253
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1229
1254
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1230
1255
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
1256
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1231
1257
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1232
1258
 
1233
1259
  header_params = {}
@@ -1248,7 +1274,6 @@ module Google
1248
1274
 
1249
1275
  @product_search_stub.call_rpc :delete_product, request, options: options do |response, operation|
1250
1276
  yield response, operation if block_given?
1251
- return response
1252
1277
  end
1253
1278
  rescue ::GRPC::BadStatus => e
1254
1279
  raise ::Google::Cloud::Error.from_error(e)
@@ -1339,10 +1364,11 @@ module Google
1339
1364
  # Customize the options with defaults
1340
1365
  metadata = @config.rpcs.create_reference_image.metadata.to_h
1341
1366
 
1342
- # Set x-goog-api-client and x-goog-user-project headers
1367
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1343
1368
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1344
1369
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1345
1370
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
1371
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1346
1372
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1347
1373
 
1348
1374
  header_params = {}
@@ -1363,7 +1389,6 @@ module Google
1363
1389
 
1364
1390
  @product_search_stub.call_rpc :create_reference_image, request, options: options do |response, operation|
1365
1391
  yield response, operation if block_given?
1366
- return response
1367
1392
  end
1368
1393
  rescue ::GRPC::BadStatus => e
1369
1394
  raise ::Google::Cloud::Error.from_error(e)
@@ -1434,10 +1459,11 @@ module Google
1434
1459
  # Customize the options with defaults
1435
1460
  metadata = @config.rpcs.delete_reference_image.metadata.to_h
1436
1461
 
1437
- # Set x-goog-api-client and x-goog-user-project headers
1462
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1438
1463
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1439
1464
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1440
1465
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
1466
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1441
1467
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1442
1468
 
1443
1469
  header_params = {}
@@ -1458,7 +1484,6 @@ module Google
1458
1484
 
1459
1485
  @product_search_stub.call_rpc :delete_reference_image, request, options: options do |response, operation|
1460
1486
  yield response, operation if block_given?
1461
- return response
1462
1487
  end
1463
1488
  rescue ::GRPC::BadStatus => e
1464
1489
  raise ::Google::Cloud::Error.from_error(e)
@@ -1539,10 +1564,11 @@ module Google
1539
1564
  # Customize the options with defaults
1540
1565
  metadata = @config.rpcs.list_reference_images.metadata.to_h
1541
1566
 
1542
- # Set x-goog-api-client and x-goog-user-project headers
1567
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1543
1568
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1544
1569
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1545
1570
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
1571
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1546
1572
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1547
1573
 
1548
1574
  header_params = {}
@@ -1564,7 +1590,7 @@ module Google
1564
1590
  @product_search_stub.call_rpc :list_reference_images, request, options: options do |response, operation|
1565
1591
  response = ::Gapic::PagedEnumerable.new @product_search_stub, :list_reference_images, request, response, operation, options
1566
1592
  yield response, operation if block_given?
1567
- return response
1593
+ throw :response, response
1568
1594
  end
1569
1595
  rescue ::GRPC::BadStatus => e
1570
1596
  raise ::Google::Cloud::Error.from_error(e)
@@ -1633,10 +1659,11 @@ module Google
1633
1659
  # Customize the options with defaults
1634
1660
  metadata = @config.rpcs.get_reference_image.metadata.to_h
1635
1661
 
1636
- # Set x-goog-api-client and x-goog-user-project headers
1662
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1637
1663
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1638
1664
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1639
1665
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
1666
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1640
1667
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1641
1668
 
1642
1669
  header_params = {}
@@ -1657,7 +1684,6 @@ module Google
1657
1684
 
1658
1685
  @product_search_stub.call_rpc :get_reference_image, request, options: options do |response, operation|
1659
1686
  yield response, operation if block_given?
1660
- return response
1661
1687
  end
1662
1688
  rescue ::GRPC::BadStatus => e
1663
1689
  raise ::Google::Cloud::Error.from_error(e)
@@ -1733,10 +1759,11 @@ module Google
1733
1759
  # Customize the options with defaults
1734
1760
  metadata = @config.rpcs.add_product_to_product_set.metadata.to_h
1735
1761
 
1736
- # Set x-goog-api-client and x-goog-user-project headers
1762
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1737
1763
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1738
1764
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1739
1765
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
1766
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1740
1767
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1741
1768
 
1742
1769
  header_params = {}
@@ -1757,7 +1784,6 @@ module Google
1757
1784
 
1758
1785
  @product_search_stub.call_rpc :add_product_to_product_set, request, options: options do |response, operation|
1759
1786
  yield response, operation if block_given?
1760
- return response
1761
1787
  end
1762
1788
  rescue ::GRPC::BadStatus => e
1763
1789
  raise ::Google::Cloud::Error.from_error(e)
@@ -1827,10 +1853,11 @@ module Google
1827
1853
  # Customize the options with defaults
1828
1854
  metadata = @config.rpcs.remove_product_from_product_set.metadata.to_h
1829
1855
 
1830
- # Set x-goog-api-client and x-goog-user-project headers
1856
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1831
1857
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1832
1858
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1833
1859
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
1860
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1834
1861
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1835
1862
 
1836
1863
  header_params = {}
@@ -1851,7 +1878,6 @@ module Google
1851
1878
 
1852
1879
  @product_search_stub.call_rpc :remove_product_from_product_set, request, options: options do |response, operation|
1853
1880
  yield response, operation if block_given?
1854
- return response
1855
1881
  end
1856
1882
  rescue ::GRPC::BadStatus => e
1857
1883
  raise ::Google::Cloud::Error.from_error(e)
@@ -1929,10 +1955,11 @@ module Google
1929
1955
  # Customize the options with defaults
1930
1956
  metadata = @config.rpcs.list_products_in_product_set.metadata.to_h
1931
1957
 
1932
- # Set x-goog-api-client and x-goog-user-project headers
1958
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
1933
1959
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
1934
1960
  lib_name: @config.lib_name, lib_version: @config.lib_version,
1935
1961
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
1962
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
1936
1963
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1937
1964
 
1938
1965
  header_params = {}
@@ -1954,7 +1981,7 @@ module Google
1954
1981
  @product_search_stub.call_rpc :list_products_in_product_set, request, options: options do |response, operation|
1955
1982
  response = ::Gapic::PagedEnumerable.new @product_search_stub, :list_products_in_product_set, request, response, operation, options
1956
1983
  yield response, operation if block_given?
1957
- return response
1984
+ throw :response, response
1958
1985
  end
1959
1986
  rescue ::GRPC::BadStatus => e
1960
1987
  raise ::Google::Cloud::Error.from_error(e)
@@ -2036,10 +2063,11 @@ module Google
2036
2063
  # Customize the options with defaults
2037
2064
  metadata = @config.rpcs.import_product_sets.metadata.to_h
2038
2065
 
2039
- # Set x-goog-api-client and x-goog-user-project headers
2066
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2040
2067
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2041
2068
  lib_name: @config.lib_name, lib_version: @config.lib_version,
2042
2069
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
2070
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2043
2071
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2044
2072
 
2045
2073
  header_params = {}
@@ -2061,7 +2089,7 @@ module Google
2061
2089
  @product_search_stub.call_rpc :import_product_sets, request, options: options do |response, operation|
2062
2090
  response = ::Gapic::Operation.new response, @operations_client, options: options
2063
2091
  yield response, operation if block_given?
2064
- return response
2092
+ throw :response, response
2065
2093
  end
2066
2094
  rescue ::GRPC::BadStatus => e
2067
2095
  raise ::Google::Cloud::Error.from_error(e)
@@ -2162,10 +2190,11 @@ module Google
2162
2190
  # Customize the options with defaults
2163
2191
  metadata = @config.rpcs.purge_products.metadata.to_h
2164
2192
 
2165
- # Set x-goog-api-client and x-goog-user-project headers
2193
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
2166
2194
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
2167
2195
  lib_name: @config.lib_name, lib_version: @config.lib_version,
2168
2196
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
2197
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
2169
2198
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
2170
2199
 
2171
2200
  header_params = {}
@@ -2187,7 +2216,7 @@ module Google
2187
2216
  @product_search_stub.call_rpc :purge_products, request, options: options do |response, operation|
2188
2217
  response = ::Gapic::Operation.new response, @operations_client, options: options
2189
2218
  yield response, operation if block_given?
2190
- return response
2219
+ throw :response, response
2191
2220
  end
2192
2221
  rescue ::GRPC::BadStatus => e
2193
2222
  raise ::Google::Cloud::Error.from_error(e)
@@ -2276,6 +2305,11 @@ module Google
2276
2305
  # default endpoint URL. The default value of nil uses the environment
2277
2306
  # universe (usually the default "googleapis.com" universe).
2278
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]
2279
2313
  #
2280
2314
  class Configuration
2281
2315
  extend ::Gapic::Config
@@ -2300,6 +2334,7 @@ module Google
2300
2334
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2301
2335
  config_attr :quota_project, nil, ::String, nil
2302
2336
  config_attr :universe_domain, nil, ::String, nil
2337
+ config_attr :logger, :default, ::Logger, nil, :default
2303
2338
 
2304
2339
  # @private
2305
2340
  def initialize parent_config = nil
@@ -26,6 +26,9 @@ module Google
26
26
  module ProductSearch
27
27
  # Service that implements Longrunning Operations API.
28
28
  class Operations
29
+ # @private
30
+ API_VERSION = ""
31
+
29
32
  # @private
30
33
  DEFAULT_ENDPOINT_TEMPLATE = "vision.$UNIVERSE_DOMAIN$"
31
34
 
@@ -121,14 +124,6 @@ module Google
121
124
  # Lists operations that match the specified filter in the request. If the
122
125
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
123
126
  #
124
- # NOTE: the `name` binding allows API services to override the binding
125
- # to use different resource name schemes, such as `users/*/operations`. To
126
- # override the binding, API services can add a binding such as
127
- # `"/v1/{name=users/*}/operations"` to their service configuration.
128
- # For backwards compatibility, the default name includes the operations
129
- # collection id, however overriding users must ensure the name binding
130
- # is the parent resource, without the operations collection id.
131
- #
132
127
  # @overload list_operations(request, options = nil)
133
128
  # Pass arguments to `list_operations` via a request object, either of type
134
129
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -191,10 +186,11 @@ module Google
191
186
  # Customize the options with defaults
192
187
  metadata = @config.rpcs.list_operations.metadata.to_h
193
188
 
194
- # Set x-goog-api-client and x-goog-user-project headers
189
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
195
190
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
196
191
  lib_name: @config.lib_name, lib_version: @config.lib_version,
197
192
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
193
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
198
194
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
199
195
 
200
196
  header_params = {}
@@ -217,7 +213,7 @@ module Google
217
213
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
218
214
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
219
215
  yield response, operation if block_given?
220
- return response
216
+ throw :response, response
221
217
  end
222
218
  rescue ::GRPC::BadStatus => e
223
219
  raise ::Google::Cloud::Error.from_error(e)
@@ -287,10 +283,11 @@ module Google
287
283
  # Customize the options with defaults
288
284
  metadata = @config.rpcs.get_operation.metadata.to_h
289
285
 
290
- # Set x-goog-api-client and x-goog-user-project headers
286
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
291
287
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
292
288
  lib_name: @config.lib_name, lib_version: @config.lib_version,
293
289
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
290
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
294
291
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
295
292
 
296
293
  header_params = {}
@@ -312,7 +309,7 @@ module Google
312
309
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
313
310
  response = ::Gapic::Operation.new response, @operations_client, options: options
314
311
  yield response, operation if block_given?
315
- return response
312
+ throw :response, response
316
313
  end
317
314
  rescue ::GRPC::BadStatus => e
318
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -376,10 +373,11 @@ module Google
376
373
  # Customize the options with defaults
377
374
  metadata = @config.rpcs.delete_operation.metadata.to_h
378
375
 
379
- # Set x-goog-api-client and x-goog-user-project headers
376
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
380
377
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
381
378
  lib_name: @config.lib_name, lib_version: @config.lib_version,
382
379
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
380
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
383
381
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
384
382
 
385
383
  header_params = {}
@@ -400,7 +398,6 @@ module Google
400
398
 
401
399
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
402
400
  yield response, operation if block_given?
403
- return response
404
401
  end
405
402
  rescue ::GRPC::BadStatus => e
406
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -415,8 +412,9 @@ module Google
415
412
  # other methods to check whether the cancellation succeeded or whether the
416
413
  # operation completed despite cancellation. On successful cancellation,
417
414
  # the operation is not deleted; instead, it becomes an operation with
418
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
419
- # 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`.
420
418
  #
421
419
  # @overload cancel_operation(request, options = nil)
422
420
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -470,10 +468,11 @@ module Google
470
468
  # Customize the options with defaults
471
469
  metadata = @config.rpcs.cancel_operation.metadata.to_h
472
470
 
473
- # Set x-goog-api-client and x-goog-user-project headers
471
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
474
472
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
475
473
  lib_name: @config.lib_name, lib_version: @config.lib_version,
476
474
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
475
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
477
476
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
478
477
 
479
478
  header_params = {}
@@ -494,7 +493,6 @@ module Google
494
493
 
495
494
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
496
495
  yield response, operation if block_given?
497
- return response
498
496
  end
499
497
  rescue ::GRPC::BadStatus => e
500
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -574,10 +572,11 @@ module Google
574
572
  # Customize the options with defaults
575
573
  metadata = @config.rpcs.wait_operation.metadata.to_h
576
574
 
577
- # Set x-goog-api-client and x-goog-user-project headers
575
+ # Set x-goog-api-client, x-goog-user-project and x-goog-api-version headers
578
576
  metadata[:"x-goog-api-client"] ||= ::Gapic::Headers.x_goog_api_client \
579
577
  lib_name: @config.lib_name, lib_version: @config.lib_version,
580
578
  gapic_version: ::Google::Cloud::Vision::V1p4beta1::VERSION
579
+ metadata[:"x-goog-api-version"] = API_VERSION unless API_VERSION.empty?
581
580
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
582
581
 
583
582
  options.apply_defaults timeout: @config.rpcs.wait_operation.timeout,
@@ -591,7 +590,7 @@ module Google
591
590
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
592
591
  response = ::Gapic::Operation.new response, @operations_client, options: options
593
592
  yield response, operation if block_given?
594
- return response
593
+ throw :response, response
595
594
  end
596
595
  rescue ::GRPC::BadStatus => e
597
596
  raise ::Google::Cloud::Error.from_error(e)
@@ -680,6 +679,11 @@ module Google
680
679
  # default endpoint URL. The default value of nil uses the environment
681
680
  # universe (usually the default "googleapis.com" universe).
682
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]
683
687
  #
684
688
  class Configuration
685
689
  extend ::Gapic::Config
@@ -704,6 +708,7 @@ module Google
704
708
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
705
709
  config_attr :quota_project, nil, ::String, nil
706
710
  config_attr :universe_domain, nil, ::String, nil
711
+ config_attr :logger, :default, ::Logger, nil, :default
707
712
 
708
713
  # @private
709
714
  def initialize parent_config = nil