google-cloud-api_hub-v1 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1bf41a283c08bd0449f6ad1a4a72dc03620810ccd66697f931de51f2a915f33
4
- data.tar.gz: 2794aafbd6bf6356f908e84b4a7a291259735340144465af3933cbe327e57fc1
3
+ metadata.gz: 3f9f5dcd83cc8f97c195ae85c4f0f8312f571567986e431cbb06523e7f63ef0c
4
+ data.tar.gz: 3421bdaabaef64a538dc18ed669f1b26f0702a5b647a914929bcaebcf9ab0c13
5
5
  SHA512:
6
- metadata.gz: e49056bbd0fe3cc1b9dbad2563f770a444e7ab99b7e755af928359c021f2e31f6b75f0b11de641beb1f9ce8f0229ecee0b03c7907cc0ee7f390074da6f2ac531
7
- data.tar.gz: 7b90efd60173df61c8572ade0a417008f4406839b9db193e5dd31232622ce71be294f0fcdf44cc002f7511744b7f3159ad942af7ae81ce45c440fc6c8f29df21
6
+ metadata.gz: 89c2f7433626d064d47daaf5cf6502dcd72700ca460f68aae98d5e14fc0663b4c949169b8b016429938be02281b82ea29b8d704ac6417e3a924284748c29fa6b
7
+ data.tar.gz: 41f971be8e6592c162ca29300969bef3c537eff9b509d4643df6d8e17eab427a8c79a92cd2983702e85bbef8ed76f33e4134a296e6d74c5f585d47b2b78e1611
data/README.md CHANGED
@@ -43,6 +43,42 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/apigee/docs/apihub/what-is-api-hub)
44
44
  for general usage information.
45
45
 
46
+ ## Debug Logging
47
+
48
+ This library comes with opt-in Debug Logging that can help you troubleshoot
49
+ your application's integration with the API. When logging is activated, key
50
+ events such as requests and responses, along with data payloads and metadata
51
+ such as headers and client configuration, are logged to the standard error
52
+ stream.
53
+
54
+ **WARNING:** Client Library Debug Logging includes your data payloads in
55
+ plaintext, which could include sensitive data such as PII for yourself or your
56
+ customers, private keys, or other security data that could be compromising if
57
+ leaked. Always practice good data hygiene with your application logs, and follow
58
+ the principle of least access. Google also recommends that Client Library Debug
59
+ Logging be enabled only temporarily during active debugging, and not used
60
+ permanently in production.
61
+
62
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
63
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
64
+ list of client library gem names. This will select the default logging behavior,
65
+ which writes logs to the standard error stream. On a local workstation, this may
66
+ result in logs appearing on the console. When running on a Google Cloud hosting
67
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
68
+ results in logs appearing alongside your application logs in the
69
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
70
+
71
+ You can customize logging by modifying the `logger` configuration when
72
+ constructing a client object. For example:
73
+
74
+ ```ruby
75
+ require "google/cloud/api_hub/v1"
76
+ require "logger"
77
+
78
+ client = ::Google::Cloud::ApiHub::V1::ApiHub::Rest::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
80
+ end
81
+ ```
46
82
 
47
83
  ## Google Cloud Samples
48
84
 
@@ -272,15 +272,27 @@ module Google
272
272
  endpoint: @config.endpoint,
273
273
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
274
274
  universe_domain: @config.universe_domain,
275
- credentials: credentials
275
+ credentials: credentials,
276
+ logger: @config.logger
276
277
  )
277
278
 
279
+ @api_hub_stub.logger(stub: true)&.info do |entry|
280
+ entry.set_system_name
281
+ entry.set_service
282
+ entry.message = "Created client for #{entry.service}"
283
+ entry.set_credentials_fields credentials
284
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
285
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
286
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
287
+ end
288
+
278
289
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
279
290
  config.credentials = credentials
280
291
  config.quota_project = @quota_project_id
281
292
  config.endpoint = @api_hub_stub.endpoint
282
293
  config.universe_domain = @api_hub_stub.universe_domain
283
294
  config.bindings_override = @config.bindings_override
295
+ config.logger = @api_hub_stub.logger if config.respond_to? :logger=
284
296
  end
285
297
  end
286
298
 
@@ -291,6 +303,15 @@ module Google
291
303
  #
292
304
  attr_reader :location_client
293
305
 
306
+ ##
307
+ # The logger used for request/response debug logging.
308
+ #
309
+ # @return [Logger]
310
+ #
311
+ def logger
312
+ @api_hub_stub.logger
313
+ end
314
+
294
315
  # Service calls
295
316
 
296
317
  ##
@@ -380,7 +401,6 @@ module Google
380
401
 
381
402
  @api_hub_stub.create_api request, options do |result, operation|
382
403
  yield result, operation if block_given?
383
- return result
384
404
  end
385
405
  rescue ::Gapic::Rest::Error => e
386
406
  raise ::Google::Cloud::Error.from_error(e)
@@ -460,7 +480,6 @@ module Google
460
480
 
461
481
  @api_hub_stub.get_api request, options do |result, operation|
462
482
  yield result, operation if block_given?
463
- return result
464
483
  end
465
484
  rescue ::Gapic::Rest::Error => e
466
485
  raise ::Google::Cloud::Error.from_error(e)
@@ -628,7 +647,7 @@ module Google
628
647
  @api_hub_stub.list_apis request, options do |result, operation|
629
648
  result = ::Gapic::Rest::PagedEnumerable.new @api_hub_stub, :list_apis, "apis", request, result, options
630
649
  yield result, operation if block_given?
631
- return result
650
+ throw :response, result
632
651
  end
633
652
  rescue ::Gapic::Rest::Error => e
634
653
  raise ::Google::Cloud::Error.from_error(e)
@@ -731,7 +750,6 @@ module Google
731
750
 
732
751
  @api_hub_stub.update_api request, options do |result, operation|
733
752
  yield result, operation if block_given?
734
- return result
735
753
  end
736
754
  rescue ::Gapic::Rest::Error => e
737
755
  raise ::Google::Cloud::Error.from_error(e)
@@ -815,7 +833,6 @@ module Google
815
833
 
816
834
  @api_hub_stub.delete_api request, options do |result, operation|
817
835
  yield result, operation if block_given?
818
- return result
819
836
  end
820
837
  rescue ::Gapic::Rest::Error => e
821
838
  raise ::Google::Cloud::Error.from_error(e)
@@ -907,7 +924,6 @@ module Google
907
924
 
908
925
  @api_hub_stub.create_version request, options do |result, operation|
909
926
  yield result, operation if block_given?
910
- return result
911
927
  end
912
928
  rescue ::Gapic::Rest::Error => e
913
929
  raise ::Google::Cloud::Error.from_error(e)
@@ -990,7 +1006,6 @@ module Google
990
1006
 
991
1007
  @api_hub_stub.get_version request, options do |result, operation|
992
1008
  yield result, operation if block_given?
993
- return result
994
1009
  end
995
1010
  rescue ::Gapic::Rest::Error => e
996
1011
  raise ::Google::Cloud::Error.from_error(e)
@@ -1146,7 +1161,7 @@ module Google
1146
1161
  @api_hub_stub.list_versions request, options do |result, operation|
1147
1162
  result = ::Gapic::Rest::PagedEnumerable.new @api_hub_stub, :list_versions, "versions", request, result, options
1148
1163
  yield result, operation if block_given?
1149
- return result
1164
+ throw :response, result
1150
1165
  end
1151
1166
  rescue ::Gapic::Rest::Error => e
1152
1167
  raise ::Google::Cloud::Error.from_error(e)
@@ -1245,7 +1260,6 @@ module Google
1245
1260
 
1246
1261
  @api_hub_stub.update_version request, options do |result, operation|
1247
1262
  yield result, operation if block_given?
1248
- return result
1249
1263
  end
1250
1264
  rescue ::Gapic::Rest::Error => e
1251
1265
  raise ::Google::Cloud::Error.from_error(e)
@@ -1330,7 +1344,6 @@ module Google
1330
1344
 
1331
1345
  @api_hub_stub.delete_version request, options do |result, operation|
1332
1346
  yield result, operation if block_given?
1333
- return result
1334
1347
  end
1335
1348
  rescue ::Gapic::Rest::Error => e
1336
1349
  raise ::Google::Cloud::Error.from_error(e)
@@ -1444,7 +1457,6 @@ module Google
1444
1457
 
1445
1458
  @api_hub_stub.create_spec request, options do |result, operation|
1446
1459
  yield result, operation if block_given?
1447
- return result
1448
1460
  end
1449
1461
  rescue ::Gapic::Rest::Error => e
1450
1462
  raise ::Google::Cloud::Error.from_error(e)
@@ -1528,7 +1540,6 @@ module Google
1528
1540
 
1529
1541
  @api_hub_stub.get_spec request, options do |result, operation|
1530
1542
  yield result, operation if block_given?
1531
- return result
1532
1543
  end
1533
1544
  rescue ::Gapic::Rest::Error => e
1534
1545
  raise ::Google::Cloud::Error.from_error(e)
@@ -1609,7 +1620,6 @@ module Google
1609
1620
 
1610
1621
  @api_hub_stub.get_spec_contents request, options do |result, operation|
1611
1622
  yield result, operation if block_given?
1612
- return result
1613
1623
  end
1614
1624
  rescue ::Gapic::Rest::Error => e
1615
1625
  raise ::Google::Cloud::Error.from_error(e)
@@ -1758,7 +1768,7 @@ module Google
1758
1768
  @api_hub_stub.list_specs request, options do |result, operation|
1759
1769
  result = ::Gapic::Rest::PagedEnumerable.new @api_hub_stub, :list_specs, "specs", request, result, options
1760
1770
  yield result, operation if block_given?
1761
- return result
1771
+ throw :response, result
1762
1772
  end
1763
1773
  rescue ::Gapic::Rest::Error => e
1764
1774
  raise ::Google::Cloud::Error.from_error(e)
@@ -1864,7 +1874,6 @@ module Google
1864
1874
 
1865
1875
  @api_hub_stub.update_spec request, options do |result, operation|
1866
1876
  yield result, operation if block_given?
1867
- return result
1868
1877
  end
1869
1878
  rescue ::Gapic::Rest::Error => e
1870
1879
  raise ::Google::Cloud::Error.from_error(e)
@@ -1947,7 +1956,6 @@ module Google
1947
1956
 
1948
1957
  @api_hub_stub.delete_spec request, options do |result, operation|
1949
1958
  yield result, operation if block_given?
1950
- return result
1951
1959
  end
1952
1960
  rescue ::Gapic::Rest::Error => e
1953
1961
  raise ::Google::Cloud::Error.from_error(e)
@@ -2028,7 +2036,6 @@ module Google
2028
2036
 
2029
2037
  @api_hub_stub.get_api_operation request, options do |result, operation|
2030
2038
  yield result, operation if block_given?
2031
- return result
2032
2039
  end
2033
2040
  rescue ::Gapic::Rest::Error => e
2034
2041
  raise ::Google::Cloud::Error.from_error(e)
@@ -2166,7 +2173,7 @@ module Google
2166
2173
  @api_hub_stub.list_api_operations request, options do |result, operation|
2167
2174
  result = ::Gapic::Rest::PagedEnumerable.new @api_hub_stub, :list_api_operations, "api_operations", request, result, options
2168
2175
  yield result, operation if block_given?
2169
- return result
2176
+ throw :response, result
2170
2177
  end
2171
2178
  rescue ::Gapic::Rest::Error => e
2172
2179
  raise ::Google::Cloud::Error.from_error(e)
@@ -2247,7 +2254,6 @@ module Google
2247
2254
 
2248
2255
  @api_hub_stub.get_definition request, options do |result, operation|
2249
2256
  yield result, operation if block_given?
2250
- return result
2251
2257
  end
2252
2258
  rescue ::Gapic::Rest::Error => e
2253
2259
  raise ::Google::Cloud::Error.from_error(e)
@@ -2342,7 +2348,6 @@ module Google
2342
2348
 
2343
2349
  @api_hub_stub.create_deployment request, options do |result, operation|
2344
2350
  yield result, operation if block_given?
2345
- return result
2346
2351
  end
2347
2352
  rescue ::Gapic::Rest::Error => e
2348
2353
  raise ::Google::Cloud::Error.from_error(e)
@@ -2422,7 +2427,6 @@ module Google
2422
2427
 
2423
2428
  @api_hub_stub.get_deployment request, options do |result, operation|
2424
2429
  yield result, operation if block_given?
2425
- return result
2426
2430
  end
2427
2431
  rescue ::Gapic::Rest::Error => e
2428
2432
  raise ::Google::Cloud::Error.from_error(e)
@@ -2577,7 +2581,7 @@ module Google
2577
2581
  @api_hub_stub.list_deployments request, options do |result, operation|
2578
2582
  result = ::Gapic::Rest::PagedEnumerable.new @api_hub_stub, :list_deployments, "deployments", request, result, options
2579
2583
  yield result, operation if block_given?
2580
- return result
2584
+ throw :response, result
2581
2585
  end
2582
2586
  rescue ::Gapic::Rest::Error => e
2583
2587
  raise ::Google::Cloud::Error.from_error(e)
@@ -2678,7 +2682,6 @@ module Google
2678
2682
 
2679
2683
  @api_hub_stub.update_deployment request, options do |result, operation|
2680
2684
  yield result, operation if block_given?
2681
- return result
2682
2685
  end
2683
2686
  rescue ::Gapic::Rest::Error => e
2684
2687
  raise ::Google::Cloud::Error.from_error(e)
@@ -2758,7 +2761,6 @@ module Google
2758
2761
 
2759
2762
  @api_hub_stub.delete_deployment request, options do |result, operation|
2760
2763
  yield result, operation if block_given?
2761
- return result
2762
2764
  end
2763
2765
  rescue ::Gapic::Rest::Error => e
2764
2766
  raise ::Google::Cloud::Error.from_error(e)
@@ -2857,7 +2859,6 @@ module Google
2857
2859
 
2858
2860
  @api_hub_stub.create_attribute request, options do |result, operation|
2859
2861
  yield result, operation if block_given?
2860
- return result
2861
2862
  end
2862
2863
  rescue ::Gapic::Rest::Error => e
2863
2864
  raise ::Google::Cloud::Error.from_error(e)
@@ -2938,7 +2939,6 @@ module Google
2938
2939
 
2939
2940
  @api_hub_stub.get_attribute request, options do |result, operation|
2940
2941
  yield result, operation if block_given?
2941
- return result
2942
2942
  end
2943
2943
  rescue ::Gapic::Rest::Error => e
2944
2944
  raise ::Google::Cloud::Error.from_error(e)
@@ -3045,7 +3045,6 @@ module Google
3045
3045
 
3046
3046
  @api_hub_stub.update_attribute request, options do |result, operation|
3047
3047
  yield result, operation if block_given?
3048
- return result
3049
3048
  end
3050
3049
  rescue ::Gapic::Rest::Error => e
3051
3050
  raise ::Google::Cloud::Error.from_error(e)
@@ -3130,7 +3129,6 @@ module Google
3130
3129
 
3131
3130
  @api_hub_stub.delete_attribute request, options do |result, operation|
3132
3131
  yield result, operation if block_given?
3133
- return result
3134
3132
  end
3135
3133
  rescue ::Gapic::Rest::Error => e
3136
3134
  raise ::Google::Cloud::Error.from_error(e)
@@ -3270,7 +3268,7 @@ module Google
3270
3268
  @api_hub_stub.list_attributes request, options do |result, operation|
3271
3269
  result = ::Gapic::Rest::PagedEnumerable.new @api_hub_stub, :list_attributes, "attributes", request, result, options
3272
3270
  yield result, operation if block_given?
3273
- return result
3271
+ throw :response, result
3274
3272
  end
3275
3273
  rescue ::Gapic::Rest::Error => e
3276
3274
  raise ::Google::Cloud::Error.from_error(e)
@@ -3395,7 +3393,7 @@ module Google
3395
3393
  @api_hub_stub.search_resources request, options do |result, operation|
3396
3394
  result = ::Gapic::Rest::PagedEnumerable.new @api_hub_stub, :search_resources, "search_results", request, result, options
3397
3395
  yield result, operation if block_given?
3398
- return result
3396
+ throw :response, result
3399
3397
  end
3400
3398
  rescue ::Gapic::Rest::Error => e
3401
3399
  raise ::Google::Cloud::Error.from_error(e)
@@ -3489,7 +3487,6 @@ module Google
3489
3487
 
3490
3488
  @api_hub_stub.create_external_api request, options do |result, operation|
3491
3489
  yield result, operation if block_given?
3492
- return result
3493
3490
  end
3494
3491
  rescue ::Gapic::Rest::Error => e
3495
3492
  raise ::Google::Cloud::Error.from_error(e)
@@ -3570,7 +3567,6 @@ module Google
3570
3567
 
3571
3568
  @api_hub_stub.get_external_api request, options do |result, operation|
3572
3569
  yield result, operation if block_given?
3573
- return result
3574
3570
  end
3575
3571
  rescue ::Gapic::Rest::Error => e
3576
3572
  raise ::Google::Cloud::Error.from_error(e)
@@ -3666,7 +3662,6 @@ module Google
3666
3662
 
3667
3663
  @api_hub_stub.update_external_api request, options do |result, operation|
3668
3664
  yield result, operation if block_given?
3669
- return result
3670
3665
  end
3671
3666
  rescue ::Gapic::Rest::Error => e
3672
3667
  raise ::Google::Cloud::Error.from_error(e)
@@ -3747,7 +3742,6 @@ module Google
3747
3742
 
3748
3743
  @api_hub_stub.delete_external_api request, options do |result, operation|
3749
3744
  yield result, operation if block_given?
3750
- return result
3751
3745
  end
3752
3746
  rescue ::Gapic::Rest::Error => e
3753
3747
  raise ::Google::Cloud::Error.from_error(e)
@@ -3843,7 +3837,7 @@ module Google
3843
3837
  @api_hub_stub.list_external_apis request, options do |result, operation|
3844
3838
  result = ::Gapic::Rest::PagedEnumerable.new @api_hub_stub, :list_external_apis, "external_apis", request, result, options
3845
3839
  yield result, operation if block_given?
3846
- return result
3840
+ throw :response, result
3847
3841
  end
3848
3842
  rescue ::Gapic::Rest::Error => e
3849
3843
  raise ::Google::Cloud::Error.from_error(e)
@@ -3923,6 +3917,11 @@ module Google
3923
3917
  # default endpoint URL. The default value of nil uses the environment
3924
3918
  # universe (usually the default "googleapis.com" universe).
3925
3919
  # @return [::String,nil]
3920
+ # @!attribute [rw] logger
3921
+ # A custom logger to use for request/response debug logging, or the value
3922
+ # `:default` (the default) to construct a default logger, or `nil` to
3923
+ # explicitly disable logging.
3924
+ # @return [::Logger,:default,nil]
3926
3925
  #
3927
3926
  class Configuration
3928
3927
  extend ::Gapic::Config
@@ -3951,6 +3950,7 @@ module Google
3951
3950
  # by the host service.
3952
3951
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
3953
3952
  config_attr :bindings_override, {}, ::Hash, nil
3953
+ config_attr :logger, :default, ::Logger, nil, :default
3954
3954
 
3955
3955
  # @private
3956
3956
  def initialize parent_config = nil