google-cloud-edge_container-v1 0.2.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d848ad458afddcc4f5236d6522fae53fc6f6dd900e73abe1695970ae02536e35
4
- data.tar.gz: 7e2d8fa50da0bb3d11cd2906b2dc5fb593f807df09efa03d212341183da88741
3
+ metadata.gz: 30a96e687134ef64ae7bdae20aa0c8fdce39a311f6096ab1749f8e81198f455d
4
+ data.tar.gz: b745f5e8402a818943ee383518a4bbb30d51ac6f1c5cf1dd44b846468e906145
5
5
  SHA512:
6
- metadata.gz: 95928b6a7af7a8d72bfcb5a0c5140823babdc18d296eb7c984018ec9c761de8a2f396e48a3c2e3b5b5a6fc2a514efcf40a321c3d63fc686a5baa2020a4355a3b
7
- data.tar.gz: fb19faf714667e3697065f7e2b8c427113cdab565622ee5d259829660ceeabc3b20d0dd8466f3380c57ed934ede67e9cc874efd96ab1006f7afd060fd607eeca
6
+ metadata.gz: 96ca65a7942ffd9dc55d68d4f6c250613bcde2d5d91ef069e199d14ea9cdbf9bf96bb0b16511c65d6c24eb67a2b900cd96631b919712225ce6c90b6bd701e1fb
7
+ data.tar.gz: '0969121a78b94053b7400dbf0d6b597ce46611dc46cdf66fe6bda0841a0bcfb1af6d2253111313df84ba4436e25af928d578e5efb6e564e04d1a17177b883e76'
data/README.md CHANGED
@@ -43,40 +43,50 @@ for class and method documentation.
43
43
  See also the [Product Documentation](https://cloud.google.com/distributed-cloud/edge/latest/docs/overview)
44
44
  for general usage information.
45
45
 
46
- ## Enabling Logging
47
-
48
- To enable logging for this library, set the logger for the underlying [gRPC](https://github.com/grpc/grpc/tree/master/src/ruby) library.
49
- The logger that you set may be a Ruby stdlib [`Logger`](https://ruby-doc.org/current/stdlibs/logger/Logger.html) as shown below,
50
- or a [`Google::Cloud::Logging::Logger`](https://cloud.google.com/ruby/docs/reference/google-cloud-logging/latest)
51
- 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)
52
- and the gRPC [spec_helper.rb](https://github.com/grpc/grpc/blob/master/src/ruby/spec/spec_helper.rb) for additional information.
53
-
54
- Configuring a Ruby stdlib logger:
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:
55
73
 
56
74
  ```ruby
75
+ require "google/cloud/edge_container/v1"
57
76
  require "logger"
58
77
 
59
- module MyLogger
60
- LOGGER = Logger.new $stderr, level: Logger::WARN
61
- def logger
62
- LOGGER
63
- end
64
- end
65
-
66
- # Define a gRPC module-level logger method before grpc/logconfig.rb loads.
67
- module GRPC
68
- extend MyLogger
78
+ client = ::Google::Cloud::EdgeContainer::V1::EdgeContainer::Client.new do |config|
79
+ config.logger = Logger.new "my-app.log"
69
80
  end
70
81
  ```
71
82
 
72
-
73
83
  ## Google Cloud Samples
74
84
 
75
85
  To browse ready to use code samples check [Google Cloud Samples](https://cloud.google.com/docs/samples).
76
86
 
77
87
  ## Supported Ruby Versions
78
88
 
79
- This library is supported on Ruby 2.7+.
89
+ This library is supported on Ruby 3.0+.
80
90
 
81
91
  Google provides official support for Ruby versions that are actively supported
82
92
  by Ruby Core—that is, Ruby versions that are either in normal maintenance or
@@ -239,14 +239,26 @@ module Google
239
239
  universe_domain: @config.universe_domain,
240
240
  channel_args: @config.channel_args,
241
241
  interceptors: @config.interceptors,
242
- channel_pool_config: @config.channel_pool
242
+ channel_pool_config: @config.channel_pool,
243
+ logger: @config.logger
243
244
  )
244
245
 
246
+ @edge_container_stub.stub_logger&.info do |entry|
247
+ entry.set_system_name
248
+ entry.set_service
249
+ entry.message = "Created client for #{entry.service}"
250
+ entry.set_credentials_fields credentials
251
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
252
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
253
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
254
+ end
255
+
245
256
  @location_client = Google::Cloud::Location::Locations::Client.new do |config|
246
257
  config.credentials = credentials
247
258
  config.quota_project = @quota_project_id
248
259
  config.endpoint = @edge_container_stub.endpoint
249
260
  config.universe_domain = @edge_container_stub.universe_domain
261
+ config.logger = @edge_container_stub.logger if config.respond_to? :logger=
250
262
  end
251
263
  end
252
264
 
@@ -264,6 +276,15 @@ module Google
264
276
  #
265
277
  attr_reader :location_client
266
278
 
279
+ ##
280
+ # The logger used for request/response debug logging.
281
+ #
282
+ # @return [Logger]
283
+ #
284
+ def logger
285
+ @edge_container_stub.logger
286
+ end
287
+
267
288
  # Service calls
268
289
 
269
290
  ##
@@ -360,7 +381,7 @@ module Google
360
381
  @edge_container_stub.call_rpc :list_clusters, request, options: options do |response, operation|
361
382
  response = ::Gapic::PagedEnumerable.new @edge_container_stub, :list_clusters, request, response, operation, options
362
383
  yield response, operation if block_given?
363
- return response
384
+ throw :response, response
364
385
  end
365
386
  rescue ::GRPC::BadStatus => e
366
387
  raise ::Google::Cloud::Error.from_error(e)
@@ -446,7 +467,6 @@ module Google
446
467
 
447
468
  @edge_container_stub.call_rpc :get_cluster, request, options: options do |response, operation|
448
469
  yield response, operation if block_given?
449
- return response
450
470
  end
451
471
  rescue ::GRPC::BadStatus => e
452
472
  raise ::Google::Cloud::Error.from_error(e)
@@ -548,7 +568,7 @@ module Google
548
568
  @edge_container_stub.call_rpc :create_cluster, request, options: options do |response, operation|
549
569
  response = ::Gapic::Operation.new response, @operations_client, options: options
550
570
  yield response, operation if block_given?
551
- return response
571
+ throw :response, response
552
572
  end
553
573
  rescue ::GRPC::BadStatus => e
554
574
  raise ::Google::Cloud::Error.from_error(e)
@@ -652,7 +672,7 @@ module Google
652
672
  @edge_container_stub.call_rpc :update_cluster, request, options: options do |response, operation|
653
673
  response = ::Gapic::Operation.new response, @operations_client, options: options
654
674
  yield response, operation if block_given?
655
- return response
675
+ throw :response, response
656
676
  end
657
677
  rescue ::GRPC::BadStatus => e
658
678
  raise ::Google::Cloud::Error.from_error(e)
@@ -754,7 +774,7 @@ module Google
754
774
  @edge_container_stub.call_rpc :upgrade_cluster, request, options: options do |response, operation|
755
775
  response = ::Gapic::Operation.new response, @operations_client, options: options
756
776
  yield response, operation if block_given?
757
- return response
777
+ throw :response, response
758
778
  end
759
779
  rescue ::GRPC::BadStatus => e
760
780
  raise ::Google::Cloud::Error.from_error(e)
@@ -852,7 +872,7 @@ module Google
852
872
  @edge_container_stub.call_rpc :delete_cluster, request, options: options do |response, operation|
853
873
  response = ::Gapic::Operation.new response, @operations_client, options: options
854
874
  yield response, operation if block_given?
855
- return response
875
+ throw :response, response
856
876
  end
857
877
  rescue ::GRPC::BadStatus => e
858
878
  raise ::Google::Cloud::Error.from_error(e)
@@ -938,7 +958,6 @@ module Google
938
958
 
939
959
  @edge_container_stub.call_rpc :generate_access_token, request, options: options do |response, operation|
940
960
  yield response, operation if block_given?
941
- return response
942
961
  end
943
962
  rescue ::GRPC::BadStatus => e
944
963
  raise ::Google::Cloud::Error.from_error(e)
@@ -1024,7 +1043,6 @@ module Google
1024
1043
 
1025
1044
  @edge_container_stub.call_rpc :generate_offline_credential, request, options: options do |response, operation|
1026
1045
  yield response, operation if block_given?
1027
- return response
1028
1046
  end
1029
1047
  rescue ::GRPC::BadStatus => e
1030
1048
  raise ::Google::Cloud::Error.from_error(e)
@@ -1123,7 +1141,7 @@ module Google
1123
1141
  @edge_container_stub.call_rpc :list_node_pools, request, options: options do |response, operation|
1124
1142
  response = ::Gapic::PagedEnumerable.new @edge_container_stub, :list_node_pools, request, response, operation, options
1125
1143
  yield response, operation if block_given?
1126
- return response
1144
+ throw :response, response
1127
1145
  end
1128
1146
  rescue ::GRPC::BadStatus => e
1129
1147
  raise ::Google::Cloud::Error.from_error(e)
@@ -1209,7 +1227,6 @@ module Google
1209
1227
 
1210
1228
  @edge_container_stub.call_rpc :get_node_pool, request, options: options do |response, operation|
1211
1229
  yield response, operation if block_given?
1212
- return response
1213
1230
  end
1214
1231
  rescue ::GRPC::BadStatus => e
1215
1232
  raise ::Google::Cloud::Error.from_error(e)
@@ -1311,7 +1328,7 @@ module Google
1311
1328
  @edge_container_stub.call_rpc :create_node_pool, request, options: options do |response, operation|
1312
1329
  response = ::Gapic::Operation.new response, @operations_client, options: options
1313
1330
  yield response, operation if block_given?
1314
- return response
1331
+ throw :response, response
1315
1332
  end
1316
1333
  rescue ::GRPC::BadStatus => e
1317
1334
  raise ::Google::Cloud::Error.from_error(e)
@@ -1415,7 +1432,7 @@ module Google
1415
1432
  @edge_container_stub.call_rpc :update_node_pool, request, options: options do |response, operation|
1416
1433
  response = ::Gapic::Operation.new response, @operations_client, options: options
1417
1434
  yield response, operation if block_given?
1418
- return response
1435
+ throw :response, response
1419
1436
  end
1420
1437
  rescue ::GRPC::BadStatus => e
1421
1438
  raise ::Google::Cloud::Error.from_error(e)
@@ -1513,7 +1530,7 @@ module Google
1513
1530
  @edge_container_stub.call_rpc :delete_node_pool, request, options: options do |response, operation|
1514
1531
  response = ::Gapic::Operation.new response, @operations_client, options: options
1515
1532
  yield response, operation if block_given?
1516
- return response
1533
+ throw :response, response
1517
1534
  end
1518
1535
  rescue ::GRPC::BadStatus => e
1519
1536
  raise ::Google::Cloud::Error.from_error(e)
@@ -1612,7 +1629,7 @@ module Google
1612
1629
  @edge_container_stub.call_rpc :list_machines, request, options: options do |response, operation|
1613
1630
  response = ::Gapic::PagedEnumerable.new @edge_container_stub, :list_machines, request, response, operation, options
1614
1631
  yield response, operation if block_given?
1615
- return response
1632
+ throw :response, response
1616
1633
  end
1617
1634
  rescue ::GRPC::BadStatus => e
1618
1635
  raise ::Google::Cloud::Error.from_error(e)
@@ -1698,7 +1715,6 @@ module Google
1698
1715
 
1699
1716
  @edge_container_stub.call_rpc :get_machine, request, options: options do |response, operation|
1700
1717
  yield response, operation if block_given?
1701
- return response
1702
1718
  end
1703
1719
  rescue ::GRPC::BadStatus => e
1704
1720
  raise ::Google::Cloud::Error.from_error(e)
@@ -1798,7 +1814,7 @@ module Google
1798
1814
  @edge_container_stub.call_rpc :list_vpn_connections, request, options: options do |response, operation|
1799
1815
  response = ::Gapic::PagedEnumerable.new @edge_container_stub, :list_vpn_connections, request, response, operation, options
1800
1816
  yield response, operation if block_given?
1801
- return response
1817
+ throw :response, response
1802
1818
  end
1803
1819
  rescue ::GRPC::BadStatus => e
1804
1820
  raise ::Google::Cloud::Error.from_error(e)
@@ -1884,7 +1900,6 @@ module Google
1884
1900
 
1885
1901
  @edge_container_stub.call_rpc :get_vpn_connection, request, options: options do |response, operation|
1886
1902
  yield response, operation if block_given?
1887
- return response
1888
1903
  end
1889
1904
  rescue ::GRPC::BadStatus => e
1890
1905
  raise ::Google::Cloud::Error.from_error(e)
@@ -1986,7 +2001,7 @@ module Google
1986
2001
  @edge_container_stub.call_rpc :create_vpn_connection, request, options: options do |response, operation|
1987
2002
  response = ::Gapic::Operation.new response, @operations_client, options: options
1988
2003
  yield response, operation if block_given?
1989
- return response
2004
+ throw :response, response
1990
2005
  end
1991
2006
  rescue ::GRPC::BadStatus => e
1992
2007
  raise ::Google::Cloud::Error.from_error(e)
@@ -2084,7 +2099,7 @@ module Google
2084
2099
  @edge_container_stub.call_rpc :delete_vpn_connection, request, options: options do |response, operation|
2085
2100
  response = ::Gapic::Operation.new response, @operations_client, options: options
2086
2101
  yield response, operation if block_given?
2087
- return response
2102
+ throw :response, response
2088
2103
  end
2089
2104
  rescue ::GRPC::BadStatus => e
2090
2105
  raise ::Google::Cloud::Error.from_error(e)
@@ -2171,7 +2186,6 @@ module Google
2171
2186
 
2172
2187
  @edge_container_stub.call_rpc :get_server_config, request, options: options do |response, operation|
2173
2188
  yield response, operation if block_given?
2174
- return response
2175
2189
  end
2176
2190
  rescue ::GRPC::BadStatus => e
2177
2191
  raise ::Google::Cloud::Error.from_error(e)
@@ -2221,6 +2235,13 @@ module Google
2221
2235
  # * (`GRPC::Core::Channel`) a gRPC channel with included credentials
2222
2236
  # * (`GRPC::Core::ChannelCredentials`) a gRPC credentails object
2223
2237
  # * (`nil`) indicating no credentials
2238
+ #
2239
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
2240
+ # external source for authentication to Google Cloud, you must validate it before
2241
+ # providing it to a Google API client library. Providing an unvalidated credential
2242
+ # configuration to Google APIs can compromise the security of your systems and data.
2243
+ # For more information, refer to [Validate credential configurations from external
2244
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
2224
2245
  # @return [::Object]
2225
2246
  # @!attribute [rw] scope
2226
2247
  # The OAuth scopes
@@ -2260,6 +2281,11 @@ module Google
2260
2281
  # default endpoint URL. The default value of nil uses the environment
2261
2282
  # universe (usually the default "googleapis.com" universe).
2262
2283
  # @return [::String,nil]
2284
+ # @!attribute [rw] logger
2285
+ # A custom logger to use for request/response debug logging, or the value
2286
+ # `:default` (the default) to construct a default logger, or `nil` to
2287
+ # explicitly disable logging.
2288
+ # @return [::Logger,:default,nil]
2263
2289
  #
2264
2290
  class Configuration
2265
2291
  extend ::Gapic::Config
@@ -2284,6 +2310,7 @@ module Google
2284
2310
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2285
2311
  config_attr :quota_project, nil, ::String, nil
2286
2312
  config_attr :universe_domain, nil, ::String, nil
2313
+ config_attr :logger, :default, ::Logger, nil, :default
2287
2314
 
2288
2315
  # @private
2289
2316
  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