google-cloud-edge_network-v1 1.0.2 → 1.1.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: bea3652264e89c33cb017389872db6cfa7d27c77ac8a88a209d5736d5e34a645
4
- data.tar.gz: 87222162ba1e7620fa40f62546c31d3d54678cd9400a7177e4b535230677bed6
3
+ metadata.gz: d1e5e0e7002a42307ee59d9a6d0c7e30c27780a0b40b030fd0219557cc13cc6d
4
+ data.tar.gz: 8efcb13746801f453477e303bf617d0f3c3866839675bd31797fb1f5a9bbfbbe
5
5
  SHA512:
6
- metadata.gz: 55234d52067109d9f5c9f40b510e267f45f5da27c91b0d0ed06af3986f29bcec70dde5da622dc55c02e3ecacbc5a21964f27bcca5dcc75ced049891f8590b772
7
- data.tar.gz: ff0a46fd85cd7adbf42519e78f694322a7b232650bfb8b0c6b0ac1dc5d1cef92c6da0253702b2b64cf7e07da8801f5748ad6abdb4fb232ff28e6b84932d64862
6
+ metadata.gz: 36fadd4fd7641c233e6342c27b2de2cde12c2daf42a4a97e720d8ec37279d75ac4853ca2541e6021541eaef4b10bbcbb404018327d7d6c3be6154153d3c8460b
7
+ data.tar.gz: f5ea9767c37afbf3936e16494e18f3d3e7ec5fb39bafbaa6422dd8487c2368730cc15d1969fb79de389e3df8641e7c120288b35cbee2260635770a5a9e151208
data/README.md CHANGED
@@ -42,33 +42,43 @@ for class and method documentation.
42
42
  See also the [Product Documentation](https://cloud.google.com/distributed-cloud/edge/latest/docs/overview)
43
43
  for general usage information.
44
44
 
45
- ## Enabling Logging
46
-
47
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
48
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
49
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
50
- that will write logs to [Cloud Logging](https://cloud.google.com/logging/). See [grpc/logconfig.rb](https://github.com/grpc/grpc/blob/master/src/ruby/lib/grpc/logconfig.rb)
51
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
52
-
53
- Configuring a Ruby stdlib logger:
45
+ ## Debug Logging
46
+
47
+ This library comes with opt-in Debug Logging that can help you troubleshoot
48
+ your application's integration with the API. When logging is activated, key
49
+ events such as requests and responses, along with data payloads and metadata
50
+ such as headers and client configuration, are logged to the standard error
51
+ stream.
52
+
53
+ **WARNING:** Client Library Debug Logging includes your data payloads in
54
+ plaintext, which could include sensitive data such as PII for yourself or your
55
+ customers, private keys, or other security data that could be compromising if
56
+ leaked. Always practice good data hygiene with your application logs, and follow
57
+ the principle of least access. Google also recommends that Client Library Debug
58
+ Logging be enabled only temporarily during active debugging, and not used
59
+ permanently in production.
60
+
61
+ To enable logging, set the environment variable `GOOGLE_SDK_RUBY_LOGGING_GEMS`
62
+ to the value `all`. Alternatively, you can set the value to a comma-delimited
63
+ list of client library gem names. This will select the default logging behavior,
64
+ which writes logs to the standard error stream. On a local workstation, this may
65
+ result in logs appearing on the console. When running on a Google Cloud hosting
66
+ service such as [Google Cloud Run](https://cloud.google.com/run), this generally
67
+ results in logs appearing alongside your application logs in the
68
+ [Google Cloud Logging](https://cloud.google.com/logging/) service.
69
+
70
+ You can customize logging by modifying the `logger` configuration when
71
+ constructing a client object. For example:
54
72
 
55
73
  ```ruby
74
+ require "google/cloud/edge_network/v1"
56
75
  require "logger"
57
76
 
58
- module MyLogger
59
- LOGGER = Logger.new $stderr, level: Logger::WARN
60
- def logger
61
- LOGGER
62
- end
63
- end
64
-
65
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
66
- module GRPC
67
- extend MyLogger
77
+ client = ::Google::Cloud::EdgeNetwork::V1::EdgeNetwork::Client.new do |config|
78
+ config.logger = Logger.new "my-app.log"
68
79
  end
69
80
  ```
70
81
 
71
-
72
82
  ## Google Cloud Samples
73
83
 
74
84
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
@@ -253,14 +253,26 @@ module Google
253
253
  universe_domain: @config.universe_domain,
254
254
  channel_args: @config.channel_args,
255
255
  interceptors: @config.interceptors,
256
- channel_pool_config: @config.channel_pool
256
+ channel_pool_config: @config.channel_pool,
257
+ logger: @config.logger
257
258
  )
258
259
 
260
+ @edge_network_stub.stub_logger&.info do |entry|
261
+ entry.set_system_name
262
+ entry.set_service
263
+ entry.message = "Created client for #{entry.service}"
264
+ entry.set_credentials_fields credentials
265
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
266
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
267
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
268
+ end
269
+
259
270
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
260
271
  config.credentials = credentials
261
272
  config.quota_project = @quota_project_id
262
273
  config.endpoint = @edge_network_stub.endpoint
263
274
  config.universe_domain = @edge_network_stub.universe_domain
275
+ config.logger = @edge_network_stub.logger if config.respond_to? :logger=
264
276
  end
265
277
  end
266
278
 
@@ -278,6 +290,15 @@ module Google
278
290
  #
279
291
  attr_reader :location_client
280
292
 
293
+ ##
294
+ # The logger used for request/response debug logging.
295
+ #
296
+ # @return [Logger]
297
+ #
298
+ def logger
299
+ @edge_network_stub.logger
300
+ end
301
+
281
302
  # Service calls
282
303
 
283
304
  ##
@@ -360,7 +381,6 @@ module Google
360
381
 
361
382
  @edge_network_stub.call_rpc :initialize_zone, request, options: options do |response, operation|
362
383
  yield response, operation if block_given?
363
- return response
364
384
  end
365
385
  rescue ::GRPC::BadStatus => e
366
386
  raise ::Google::Cloud::Error.from_error(e)
@@ -463,7 +483,7 @@ module Google
463
483
  @edge_network_stub.call_rpc :list_zones, request, options: options do |response, operation|
464
484
  response = ::Gapic::PagedEnumerable.new @edge_network_stub, :list_zones, request, response, operation, options
465
485
  yield response, operation if block_given?
466
- return response
486
+ throw :response, response
467
487
  end
468
488
  rescue ::GRPC::BadStatus => e
469
489
  raise ::Google::Cloud::Error.from_error(e)
@@ -552,7 +572,6 @@ module Google
552
572
 
553
573
  @edge_network_stub.call_rpc :get_zone, request, options: options do |response, operation|
554
574
  yield response, operation if block_given?
555
- return response
556
575
  end
557
576
  rescue ::GRPC::BadStatus => e
558
577
  raise ::Google::Cloud::Error.from_error(e)
@@ -652,7 +671,7 @@ module Google
652
671
  @edge_network_stub.call_rpc :list_networks, request, options: options do |response, operation|
653
672
  response = ::Gapic::PagedEnumerable.new @edge_network_stub, :list_networks, request, response, operation, options
654
673
  yield response, operation if block_given?
655
- return response
674
+ throw :response, response
656
675
  end
657
676
  rescue ::GRPC::BadStatus => e
658
677
  raise ::Google::Cloud::Error.from_error(e)
@@ -738,7 +757,6 @@ module Google
738
757
 
739
758
  @edge_network_stub.call_rpc :get_network, request, options: options do |response, operation|
740
759
  yield response, operation if block_given?
741
- return response
742
760
  end
743
761
  rescue ::GRPC::BadStatus => e
744
762
  raise ::Google::Cloud::Error.from_error(e)
@@ -824,7 +842,6 @@ module Google
824
842
 
825
843
  @edge_network_stub.call_rpc :diagnose_network, request, options: options do |response, operation|
826
844
  yield response, operation if block_given?
827
- return response
828
845
  end
829
846
  rescue ::GRPC::BadStatus => e
830
847
  raise ::Google::Cloud::Error.from_error(e)
@@ -938,7 +955,7 @@ module Google
938
955
  @edge_network_stub.call_rpc :create_network, request, options: options do |response, operation|
939
956
  response = ::Gapic::Operation.new response, @operations_client, options: options
940
957
  yield response, operation if block_given?
941
- return response
958
+ throw :response, response
942
959
  end
943
960
  rescue ::GRPC::BadStatus => e
944
961
  raise ::Google::Cloud::Error.from_error(e)
@@ -1046,7 +1063,7 @@ module Google
1046
1063
  @edge_network_stub.call_rpc :delete_network, request, options: options do |response, operation|
1047
1064
  response = ::Gapic::Operation.new response, @operations_client, options: options
1048
1065
  yield response, operation if block_given?
1049
- return response
1066
+ throw :response, response
1050
1067
  end
1051
1068
  rescue ::GRPC::BadStatus => e
1052
1069
  raise ::Google::Cloud::Error.from_error(e)
@@ -1146,7 +1163,7 @@ module Google
1146
1163
  @edge_network_stub.call_rpc :list_subnets, request, options: options do |response, operation|
1147
1164
  response = ::Gapic::PagedEnumerable.new @edge_network_stub, :list_subnets, request, response, operation, options
1148
1165
  yield response, operation if block_given?
1149
- return response
1166
+ throw :response, response
1150
1167
  end
1151
1168
  rescue ::GRPC::BadStatus => e
1152
1169
  raise ::Google::Cloud::Error.from_error(e)
@@ -1232,7 +1249,6 @@ module Google
1232
1249
 
1233
1250
  @edge_network_stub.call_rpc :get_subnet, request, options: options do |response, operation|
1234
1251
  yield response, operation if block_given?
1235
- return response
1236
1252
  end
1237
1253
  rescue ::GRPC::BadStatus => e
1238
1254
  raise ::Google::Cloud::Error.from_error(e)
@@ -1346,7 +1362,7 @@ module Google
1346
1362
  @edge_network_stub.call_rpc :create_subnet, request, options: options do |response, operation|
1347
1363
  response = ::Gapic::Operation.new response, @operations_client, options: options
1348
1364
  yield response, operation if block_given?
1349
- return response
1365
+ throw :response, response
1350
1366
  end
1351
1367
  rescue ::GRPC::BadStatus => e
1352
1368
  raise ::Google::Cloud::Error.from_error(e)
@@ -1460,7 +1476,7 @@ module Google
1460
1476
  @edge_network_stub.call_rpc :update_subnet, request, options: options do |response, operation|
1461
1477
  response = ::Gapic::Operation.new response, @operations_client, options: options
1462
1478
  yield response, operation if block_given?
1463
- return response
1479
+ throw :response, response
1464
1480
  end
1465
1481
  rescue ::GRPC::BadStatus => e
1466
1482
  raise ::Google::Cloud::Error.from_error(e)
@@ -1568,7 +1584,7 @@ module Google
1568
1584
  @edge_network_stub.call_rpc :delete_subnet, request, options: options do |response, operation|
1569
1585
  response = ::Gapic::Operation.new response, @operations_client, options: options
1570
1586
  yield response, operation if block_given?
1571
- return response
1587
+ throw :response, response
1572
1588
  end
1573
1589
  rescue ::GRPC::BadStatus => e
1574
1590
  raise ::Google::Cloud::Error.from_error(e)
@@ -1668,7 +1684,7 @@ module Google
1668
1684
  @edge_network_stub.call_rpc :list_interconnects, request, options: options do |response, operation|
1669
1685
  response = ::Gapic::PagedEnumerable.new @edge_network_stub, :list_interconnects, request, response, operation, options
1670
1686
  yield response, operation if block_given?
1671
- return response
1687
+ throw :response, response
1672
1688
  end
1673
1689
  rescue ::GRPC::BadStatus => e
1674
1690
  raise ::Google::Cloud::Error.from_error(e)
@@ -1754,7 +1770,6 @@ module Google
1754
1770
 
1755
1771
  @edge_network_stub.call_rpc :get_interconnect, request, options: options do |response, operation|
1756
1772
  yield response, operation if block_given?
1757
- return response
1758
1773
  end
1759
1774
  rescue ::GRPC::BadStatus => e
1760
1775
  raise ::Google::Cloud::Error.from_error(e)
@@ -1840,7 +1855,6 @@ module Google
1840
1855
 
1841
1856
  @edge_network_stub.call_rpc :diagnose_interconnect, request, options: options do |response, operation|
1842
1857
  yield response, operation if block_given?
1843
- return response
1844
1858
  end
1845
1859
  rescue ::GRPC::BadStatus => e
1846
1860
  raise ::Google::Cloud::Error.from_error(e)
@@ -1940,7 +1954,7 @@ module Google
1940
1954
  @edge_network_stub.call_rpc :list_interconnect_attachments, request, options: options do |response, operation|
1941
1955
  response = ::Gapic::PagedEnumerable.new @edge_network_stub, :list_interconnect_attachments, request, response, operation, options
1942
1956
  yield response, operation if block_given?
1943
- return response
1957
+ throw :response, response
1944
1958
  end
1945
1959
  rescue ::GRPC::BadStatus => e
1946
1960
  raise ::Google::Cloud::Error.from_error(e)
@@ -2026,7 +2040,6 @@ module Google
2026
2040
 
2027
2041
  @edge_network_stub.call_rpc :get_interconnect_attachment, request, options: options do |response, operation|
2028
2042
  yield response, operation if block_given?
2029
- return response
2030
2043
  end
2031
2044
  rescue ::GRPC::BadStatus => e
2032
2045
  raise ::Google::Cloud::Error.from_error(e)
@@ -2140,7 +2153,7 @@ module Google
2140
2153
  @edge_network_stub.call_rpc :create_interconnect_attachment, request, options: options do |response, operation|
2141
2154
  response = ::Gapic::Operation.new response, @operations_client, options: options
2142
2155
  yield response, operation if block_given?
2143
- return response
2156
+ throw :response, response
2144
2157
  end
2145
2158
  rescue ::GRPC::BadStatus => e
2146
2159
  raise ::Google::Cloud::Error.from_error(e)
@@ -2248,7 +2261,7 @@ module Google
2248
2261
  @edge_network_stub.call_rpc :delete_interconnect_attachment, request, options: options do |response, operation|
2249
2262
  response = ::Gapic::Operation.new response, @operations_client, options: options
2250
2263
  yield response, operation if block_given?
2251
- return response
2264
+ throw :response, response
2252
2265
  end
2253
2266
  rescue ::GRPC::BadStatus => e
2254
2267
  raise ::Google::Cloud::Error.from_error(e)
@@ -2348,7 +2361,7 @@ module Google
2348
2361
  @edge_network_stub.call_rpc :list_routers, request, options: options do |response, operation|
2349
2362
  response = ::Gapic::PagedEnumerable.new @edge_network_stub, :list_routers, request, response, operation, options
2350
2363
  yield response, operation if block_given?
2351
- return response
2364
+ throw :response, response
2352
2365
  end
2353
2366
  rescue ::GRPC::BadStatus => e
2354
2367
  raise ::Google::Cloud::Error.from_error(e)
@@ -2434,7 +2447,6 @@ module Google
2434
2447
 
2435
2448
  @edge_network_stub.call_rpc :get_router, request, options: options do |response, operation|
2436
2449
  yield response, operation if block_given?
2437
- return response
2438
2450
  end
2439
2451
  rescue ::GRPC::BadStatus => e
2440
2452
  raise ::Google::Cloud::Error.from_error(e)
@@ -2520,7 +2532,6 @@ module Google
2520
2532
 
2521
2533
  @edge_network_stub.call_rpc :diagnose_router, request, options: options do |response, operation|
2522
2534
  yield response, operation if block_given?
2523
- return response
2524
2535
  end
2525
2536
  rescue ::GRPC::BadStatus => e
2526
2537
  raise ::Google::Cloud::Error.from_error(e)
@@ -2634,7 +2645,7 @@ module Google
2634
2645
  @edge_network_stub.call_rpc :create_router, request, options: options do |response, operation|
2635
2646
  response = ::Gapic::Operation.new response, @operations_client, options: options
2636
2647
  yield response, operation if block_given?
2637
- return response
2648
+ throw :response, response
2638
2649
  end
2639
2650
  rescue ::GRPC::BadStatus => e
2640
2651
  raise ::Google::Cloud::Error.from_error(e)
@@ -2748,7 +2759,7 @@ module Google
2748
2759
  @edge_network_stub.call_rpc :update_router, request, options: options do |response, operation|
2749
2760
  response = ::Gapic::Operation.new response, @operations_client, options: options
2750
2761
  yield response, operation if block_given?
2751
- return response
2762
+ throw :response, response
2752
2763
  end
2753
2764
  rescue ::GRPC::BadStatus => e
2754
2765
  raise ::Google::Cloud::Error.from_error(e)
@@ -2856,7 +2867,7 @@ module Google
2856
2867
  @edge_network_stub.call_rpc :delete_router, request, options: options do |response, operation|
2857
2868
  response = ::Gapic::Operation.new response, @operations_client, options: options
2858
2869
  yield response, operation if block_given?
2859
- return response
2870
+ throw :response, response
2860
2871
  end
2861
2872
  rescue ::GRPC::BadStatus => e
2862
2873
  raise ::Google::Cloud::Error.from_error(e)
@@ -2945,6 +2956,11 @@ module Google
2945
2956
  # default endpoint URL. The default value of nil uses the environment
2946
2957
  # universe (usually the default "googleapis.com" universe).
2947
2958
  # @return [::String,nil]
2959
+ # @!attribute [rw] logger
2960
+ # A custom logger to use for request/response debug logging, or the value
2961
+ # `:default` (the default) to construct a default logger, or `nil` to
2962
+ # explicitly disable logging.
2963
+ # @return [::Logger,:default,nil]
2948
2964
  #
2949
2965
  class Configuration
2950
2966
  extend ::Gapic::Config
@@ -2969,6 +2985,7 @@ module Google
2969
2985
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2970
2986
  config_attr :quota_project, nil, ::String, nil
2971
2987
  config_attr :universe_domain, nil, ::String, nil
2988
+ config_attr :logger, :default, ::Logger, nil, :default
2972
2989
 
2973
2990
  # @private
2974
2991
  def initialize parent_config = nil
@@ -124,14 +124,6 @@ module Google
124
124
  # Lists operations that match the specified filter in the request. If the
125
125
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
126
126
  #
127
- # NOTE: the `name` binding allows API services to override the binding
128
- # to use different resource name schemes, such as `users/*/operations`. To
129
- # override the binding, API services can add a binding such as
130
- # `"/v1/{name=users/*}/operations"` to their service configuration.
131
- # For backwards compatibility, the default name includes the operations
132
- # collection id, however overriding users must ensure the name binding
133
- # is the parent resource, without the operations collection id.
134
- #
135
127
  # @overload list_operations(request, options = nil)
136
128
  # Pass arguments to `list_operations` via a request object, either of type
137
129
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -221,7 +213,7 @@ module Google
221
213
  wrap_lro_operation = ->(op_response) { ::Gapic::Operation.new op_response, @operations_client }
222
214
  response = ::Gapic::PagedEnumerable.new @operations_stub, :list_operations, request, response, operation, options, format_resource: wrap_lro_operation
223
215
  yield response, operation if block_given?
224
- return response
216
+ throw :response, response
225
217
  end
226
218
  rescue ::GRPC::BadStatus => e
227
219
  raise ::Google::Cloud::Error.from_error(e)
@@ -317,7 +309,7 @@ module Google
317
309
  @operations_stub.call_rpc :get_operation, request, options: options do |response, operation|
318
310
  response = ::Gapic::Operation.new response, @operations_client, options: options
319
311
  yield response, operation if block_given?
320
- return response
312
+ throw :response, response
321
313
  end
322
314
  rescue ::GRPC::BadStatus => e
323
315
  raise ::Google::Cloud::Error.from_error(e)
@@ -406,7 +398,6 @@ module Google
406
398
 
407
399
  @operations_stub.call_rpc :delete_operation, request, options: options do |response, operation|
408
400
  yield response, operation if block_given?
409
- return response
410
401
  end
411
402
  rescue ::GRPC::BadStatus => e
412
403
  raise ::Google::Cloud::Error.from_error(e)
@@ -421,8 +412,9 @@ module Google
421
412
  # other methods to check whether the cancellation succeeded or whether the
422
413
  # operation completed despite cancellation. On successful cancellation,
423
414
  # the operation is not deleted; instead, it becomes an operation with
424
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
425
- # corresponding to `Code.CANCELLED`.
415
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
416
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
417
+ # `Code.CANCELLED`.
426
418
  #
427
419
  # @overload cancel_operation(request, options = nil)
428
420
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -501,7 +493,6 @@ module Google
501
493
 
502
494
  @operations_stub.call_rpc :cancel_operation, request, options: options do |response, operation|
503
495
  yield response, operation if block_given?
504
- return response
505
496
  end
506
497
  rescue ::GRPC::BadStatus => e
507
498
  raise ::Google::Cloud::Error.from_error(e)
@@ -599,7 +590,7 @@ module Google
599
590
  @operations_stub.call_rpc :wait_operation, request, options: options do |response, operation|
600
591
  response = ::Gapic::Operation.new response, @operations_client, options: options
601
592
  yield response, operation if block_given?
602
- return response
593
+ throw :response, response
603
594
  end
604
595
  rescue ::GRPC::BadStatus => e
605
596
  raise ::Google::Cloud::Error.from_error(e)
@@ -688,6 +679,11 @@ module Google
688
679
  # default endpoint URL. The default value of nil uses the environment
689
680
  # universe (usually the default "googleapis.com" universe).
690
681
  # @return [::String,nil]
682
+ # @!attribute [rw] logger
683
+ # A custom logger to use for request/response debug logging, or the value
684
+ # `:default` (the default) to construct a default logger, or `nil` to
685
+ # explicitly disable logging.
686
+ # @return [::Logger,:default,nil]
691
687
  #
692
688
  class Configuration
693
689
  extend ::Gapic::Config
@@ -712,6 +708,7 @@ module Google
712
708
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
713
709
  config_attr :quota_project, nil, ::String, nil
714
710
  config_attr :universe_domain, nil, ::String, nil
711
+ config_attr :logger, :default, ::Logger, nil, :default
715
712
 
716
713
  # @private
717
714
  def initialize parent_config = nil