google-cloud-apigee_registry-v1 0.8.1 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -321,15 +321,27 @@ module Google
321
321
  endpoint: @config.endpoint,
322
322
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
323
323
  universe_domain: @config.universe_domain,
324
- credentials: credentials
324
+ credentials: credentials,
325
+ logger: @config.logger
325
326
  )
326
327
 
328
+ @registry_stub.logger(stub: true)&.info do |entry|
329
+ entry.set_system_name
330
+ entry.set_service
331
+ entry.message = "Created client for #{entry.service}"
332
+ entry.set_credentials_fields credentials
333
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
334
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
335
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
336
+ end
337
+
327
338
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
328
339
  config.credentials = credentials
329
340
  config.quota_project = @quota_project_id
330
341
  config.endpoint = @registry_stub.endpoint
331
342
  config.universe_domain = @registry_stub.universe_domain
332
343
  config.bindings_override = @config.bindings_override
344
+ config.logger = @registry_stub.logger if config.respond_to? :logger=
333
345
  end
334
346
 
335
347
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
@@ -338,6 +350,7 @@ module Google
338
350
  config.endpoint = @registry_stub.endpoint
339
351
  config.universe_domain = @registry_stub.universe_domain
340
352
  config.bindings_override = @config.bindings_override
353
+ config.logger = @registry_stub.logger if config.respond_to? :logger=
341
354
  end
342
355
  end
343
356
 
@@ -355,6 +368,15 @@ module Google
355
368
  #
356
369
  attr_reader :iam_policy_client
357
370
 
371
+ ##
372
+ # The logger used for request/response debug logging.
373
+ #
374
+ # @return [Logger]
375
+ #
376
+ def logger
377
+ @registry_stub.logger
378
+ end
379
+
358
380
  # Service calls
359
381
 
360
382
  ##
@@ -450,7 +472,7 @@ module Google
450
472
  @registry_stub.list_apis request, options do |result, operation|
451
473
  result = ::Gapic::Rest::PagedEnumerable.new @registry_stub, :list_apis, "apis", request, result, options
452
474
  yield result, operation if block_given?
453
- return result
475
+ throw :response, result
454
476
  end
455
477
  rescue ::Gapic::Rest::Error => e
456
478
  raise ::Google::Cloud::Error.from_error(e)
@@ -530,7 +552,6 @@ module Google
530
552
 
531
553
  @registry_stub.get_api request, options do |result, operation|
532
554
  yield result, operation if block_given?
533
- return result
534
555
  end
535
556
  rescue ::Gapic::Rest::Error => e
536
557
  raise ::Google::Cloud::Error.from_error(e)
@@ -620,7 +641,6 @@ module Google
620
641
 
621
642
  @registry_stub.create_api request, options do |result, operation|
622
643
  yield result, operation if block_given?
623
- return result
624
644
  end
625
645
  rescue ::Gapic::Rest::Error => e
626
646
  raise ::Google::Cloud::Error.from_error(e)
@@ -710,7 +730,6 @@ module Google
710
730
 
711
731
  @registry_stub.update_api request, options do |result, operation|
712
732
  yield result, operation if block_given?
713
- return result
714
733
  end
715
734
  rescue ::Gapic::Rest::Error => e
716
735
  raise ::Google::Cloud::Error.from_error(e)
@@ -794,7 +813,6 @@ module Google
794
813
 
795
814
  @registry_stub.delete_api request, options do |result, operation|
796
815
  yield result, operation if block_given?
797
- return result
798
816
  end
799
817
  rescue ::Gapic::Rest::Error => e
800
818
  raise ::Google::Cloud::Error.from_error(e)
@@ -893,7 +911,7 @@ module Google
893
911
  @registry_stub.list_api_versions request, options do |result, operation|
894
912
  result = ::Gapic::Rest::PagedEnumerable.new @registry_stub, :list_api_versions, "api_versions", request, result, options
895
913
  yield result, operation if block_given?
896
- return result
914
+ throw :response, result
897
915
  end
898
916
  rescue ::Gapic::Rest::Error => e
899
917
  raise ::Google::Cloud::Error.from_error(e)
@@ -973,7 +991,6 @@ module Google
973
991
 
974
992
  @registry_stub.get_api_version request, options do |result, operation|
975
993
  yield result, operation if block_given?
976
- return result
977
994
  end
978
995
  rescue ::Gapic::Rest::Error => e
979
996
  raise ::Google::Cloud::Error.from_error(e)
@@ -1063,7 +1080,6 @@ module Google
1063
1080
 
1064
1081
  @registry_stub.create_api_version request, options do |result, operation|
1065
1082
  yield result, operation if block_given?
1066
- return result
1067
1083
  end
1068
1084
  rescue ::Gapic::Rest::Error => e
1069
1085
  raise ::Google::Cloud::Error.from_error(e)
@@ -1153,7 +1169,6 @@ module Google
1153
1169
 
1154
1170
  @registry_stub.update_api_version request, options do |result, operation|
1155
1171
  yield result, operation if block_given?
1156
- return result
1157
1172
  end
1158
1173
  rescue ::Gapic::Rest::Error => e
1159
1174
  raise ::Google::Cloud::Error.from_error(e)
@@ -1237,7 +1252,6 @@ module Google
1237
1252
 
1238
1253
  @registry_stub.delete_api_version request, options do |result, operation|
1239
1254
  yield result, operation if block_given?
1240
- return result
1241
1255
  end
1242
1256
  rescue ::Gapic::Rest::Error => e
1243
1257
  raise ::Google::Cloud::Error.from_error(e)
@@ -1336,7 +1350,7 @@ module Google
1336
1350
  @registry_stub.list_api_specs request, options do |result, operation|
1337
1351
  result = ::Gapic::Rest::PagedEnumerable.new @registry_stub, :list_api_specs, "api_specs", request, result, options
1338
1352
  yield result, operation if block_given?
1339
- return result
1353
+ throw :response, result
1340
1354
  end
1341
1355
  rescue ::Gapic::Rest::Error => e
1342
1356
  raise ::Google::Cloud::Error.from_error(e)
@@ -1416,7 +1430,6 @@ module Google
1416
1430
 
1417
1431
  @registry_stub.get_api_spec request, options do |result, operation|
1418
1432
  yield result, operation if block_given?
1419
- return result
1420
1433
  end
1421
1434
  rescue ::Gapic::Rest::Error => e
1422
1435
  raise ::Google::Cloud::Error.from_error(e)
@@ -1499,7 +1512,6 @@ module Google
1499
1512
 
1500
1513
  @registry_stub.get_api_spec_contents request, options do |result, operation|
1501
1514
  yield result, operation if block_given?
1502
- return result
1503
1515
  end
1504
1516
  rescue ::Gapic::Rest::Error => e
1505
1517
  raise ::Google::Cloud::Error.from_error(e)
@@ -1589,7 +1601,6 @@ module Google
1589
1601
 
1590
1602
  @registry_stub.create_api_spec request, options do |result, operation|
1591
1603
  yield result, operation if block_given?
1592
- return result
1593
1604
  end
1594
1605
  rescue ::Gapic::Rest::Error => e
1595
1606
  raise ::Google::Cloud::Error.from_error(e)
@@ -1679,7 +1690,6 @@ module Google
1679
1690
 
1680
1691
  @registry_stub.update_api_spec request, options do |result, operation|
1681
1692
  yield result, operation if block_given?
1682
- return result
1683
1693
  end
1684
1694
  rescue ::Gapic::Rest::Error => e
1685
1695
  raise ::Google::Cloud::Error.from_error(e)
@@ -1763,7 +1773,6 @@ module Google
1763
1773
 
1764
1774
  @registry_stub.delete_api_spec request, options do |result, operation|
1765
1775
  yield result, operation if block_given?
1766
- return result
1767
1776
  end
1768
1777
  rescue ::Gapic::Rest::Error => e
1769
1778
  raise ::Google::Cloud::Error.from_error(e)
@@ -1845,7 +1854,6 @@ module Google
1845
1854
 
1846
1855
  @registry_stub.tag_api_spec_revision request, options do |result, operation|
1847
1856
  yield result, operation if block_given?
1848
- return result
1849
1857
  end
1850
1858
  rescue ::Gapic::Rest::Error => e
1851
1859
  raise ::Google::Cloud::Error.from_error(e)
@@ -1935,7 +1943,7 @@ module Google
1935
1943
  @registry_stub.list_api_spec_revisions request, options do |result, operation|
1936
1944
  result = ::Gapic::Rest::PagedEnumerable.new @registry_stub, :list_api_spec_revisions, "api_specs", request, result, options
1937
1945
  yield result, operation if block_given?
1938
- return result
1946
+ throw :response, result
1939
1947
  end
1940
1948
  rescue ::Gapic::Rest::Error => e
1941
1949
  raise ::Google::Cloud::Error.from_error(e)
@@ -2020,7 +2028,6 @@ module Google
2020
2028
 
2021
2029
  @registry_stub.rollback_api_spec request, options do |result, operation|
2022
2030
  yield result, operation if block_given?
2023
- return result
2024
2031
  end
2025
2032
  rescue ::Gapic::Rest::Error => e
2026
2033
  raise ::Google::Cloud::Error.from_error(e)
@@ -2103,7 +2110,6 @@ module Google
2103
2110
 
2104
2111
  @registry_stub.delete_api_spec_revision request, options do |result, operation|
2105
2112
  yield result, operation if block_given?
2106
- return result
2107
2113
  end
2108
2114
  rescue ::Gapic::Rest::Error => e
2109
2115
  raise ::Google::Cloud::Error.from_error(e)
@@ -2202,7 +2208,7 @@ module Google
2202
2208
  @registry_stub.list_api_deployments request, options do |result, operation|
2203
2209
  result = ::Gapic::Rest::PagedEnumerable.new @registry_stub, :list_api_deployments, "api_deployments", request, result, options
2204
2210
  yield result, operation if block_given?
2205
- return result
2211
+ throw :response, result
2206
2212
  end
2207
2213
  rescue ::Gapic::Rest::Error => e
2208
2214
  raise ::Google::Cloud::Error.from_error(e)
@@ -2282,7 +2288,6 @@ module Google
2282
2288
 
2283
2289
  @registry_stub.get_api_deployment request, options do |result, operation|
2284
2290
  yield result, operation if block_given?
2285
- return result
2286
2291
  end
2287
2292
  rescue ::Gapic::Rest::Error => e
2288
2293
  raise ::Google::Cloud::Error.from_error(e)
@@ -2372,7 +2377,6 @@ module Google
2372
2377
 
2373
2378
  @registry_stub.create_api_deployment request, options do |result, operation|
2374
2379
  yield result, operation if block_given?
2375
- return result
2376
2380
  end
2377
2381
  rescue ::Gapic::Rest::Error => e
2378
2382
  raise ::Google::Cloud::Error.from_error(e)
@@ -2462,7 +2466,6 @@ module Google
2462
2466
 
2463
2467
  @registry_stub.update_api_deployment request, options do |result, operation|
2464
2468
  yield result, operation if block_given?
2465
- return result
2466
2469
  end
2467
2470
  rescue ::Gapic::Rest::Error => e
2468
2471
  raise ::Google::Cloud::Error.from_error(e)
@@ -2546,7 +2549,6 @@ module Google
2546
2549
 
2547
2550
  @registry_stub.delete_api_deployment request, options do |result, operation|
2548
2551
  yield result, operation if block_given?
2549
- return result
2550
2552
  end
2551
2553
  rescue ::Gapic::Rest::Error => e
2552
2554
  raise ::Google::Cloud::Error.from_error(e)
@@ -2629,7 +2631,6 @@ module Google
2629
2631
 
2630
2632
  @registry_stub.tag_api_deployment_revision request, options do |result, operation|
2631
2633
  yield result, operation if block_given?
2632
- return result
2633
2634
  end
2634
2635
  rescue ::Gapic::Rest::Error => e
2635
2636
  raise ::Google::Cloud::Error.from_error(e)
@@ -2719,7 +2720,7 @@ module Google
2719
2720
  @registry_stub.list_api_deployment_revisions request, options do |result, operation|
2720
2721
  result = ::Gapic::Rest::PagedEnumerable.new @registry_stub, :list_api_deployment_revisions, "api_deployments", request, result, options
2721
2722
  yield result, operation if block_given?
2722
- return result
2723
+ throw :response, result
2723
2724
  end
2724
2725
  rescue ::Gapic::Rest::Error => e
2725
2726
  raise ::Google::Cloud::Error.from_error(e)
@@ -2804,7 +2805,6 @@ module Google
2804
2805
 
2805
2806
  @registry_stub.rollback_api_deployment request, options do |result, operation|
2806
2807
  yield result, operation if block_given?
2807
- return result
2808
2808
  end
2809
2809
  rescue ::Gapic::Rest::Error => e
2810
2810
  raise ::Google::Cloud::Error.from_error(e)
@@ -2887,7 +2887,6 @@ module Google
2887
2887
 
2888
2888
  @registry_stub.delete_api_deployment_revision request, options do |result, operation|
2889
2889
  yield result, operation if block_given?
2890
- return result
2891
2890
  end
2892
2891
  rescue ::Gapic::Rest::Error => e
2893
2892
  raise ::Google::Cloud::Error.from_error(e)
@@ -2986,7 +2985,7 @@ module Google
2986
2985
  @registry_stub.list_artifacts request, options do |result, operation|
2987
2986
  result = ::Gapic::Rest::PagedEnumerable.new @registry_stub, :list_artifacts, "artifacts", request, result, options
2988
2987
  yield result, operation if block_given?
2989
- return result
2988
+ throw :response, result
2990
2989
  end
2991
2990
  rescue ::Gapic::Rest::Error => e
2992
2991
  raise ::Google::Cloud::Error.from_error(e)
@@ -3066,7 +3065,6 @@ module Google
3066
3065
 
3067
3066
  @registry_stub.get_artifact request, options do |result, operation|
3068
3067
  yield result, operation if block_given?
3069
- return result
3070
3068
  end
3071
3069
  rescue ::Gapic::Rest::Error => e
3072
3070
  raise ::Google::Cloud::Error.from_error(e)
@@ -3149,7 +3147,6 @@ module Google
3149
3147
 
3150
3148
  @registry_stub.get_artifact_contents request, options do |result, operation|
3151
3149
  yield result, operation if block_given?
3152
- return result
3153
3150
  end
3154
3151
  rescue ::Gapic::Rest::Error => e
3155
3152
  raise ::Google::Cloud::Error.from_error(e)
@@ -3239,7 +3236,6 @@ module Google
3239
3236
 
3240
3237
  @registry_stub.create_artifact request, options do |result, operation|
3241
3238
  yield result, operation if block_given?
3242
- return result
3243
3239
  end
3244
3240
  rescue ::Gapic::Rest::Error => e
3245
3241
  raise ::Google::Cloud::Error.from_error(e)
@@ -3321,7 +3317,6 @@ module Google
3321
3317
 
3322
3318
  @registry_stub.replace_artifact request, options do |result, operation|
3323
3319
  yield result, operation if block_given?
3324
- return result
3325
3320
  end
3326
3321
  rescue ::Gapic::Rest::Error => e
3327
3322
  raise ::Google::Cloud::Error.from_error(e)
@@ -3401,7 +3396,6 @@ module Google
3401
3396
 
3402
3397
  @registry_stub.delete_artifact request, options do |result, operation|
3403
3398
  yield result, operation if block_given?
3404
- return result
3405
3399
  end
3406
3400
  rescue ::Gapic::Rest::Error => e
3407
3401
  raise ::Google::Cloud::Error.from_error(e)
@@ -3481,6 +3475,11 @@ module Google
3481
3475
  # default endpoint URL. The default value of nil uses the environment
3482
3476
  # universe (usually the default "googleapis.com" universe).
3483
3477
  # @return [::String,nil]
3478
+ # @!attribute [rw] logger
3479
+ # A custom logger to use for request/response debug logging, or the value
3480
+ # `:default` (the default) to construct a default logger, or `nil` to
3481
+ # explicitly disable logging.
3482
+ # @return [::Logger,:default,nil]
3484
3483
  #
3485
3484
  class Configuration
3486
3485
  extend ::Gapic::Config
@@ -3509,6 +3508,7 @@ module Google
3509
3508
  # by the host service.
3510
3509
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
3511
3510
  config_attr :bindings_override, {}, ::Hash, nil
3511
+ config_attr :logger, :default, ::Logger, nil, :default
3512
3512
 
3513
3513
  # @private
3514
3514
  def initialize parent_config = nil