google-cloud-edge_network-v1 1.0.3 → 1.1.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.
@@ -246,15 +246,27 @@ module Google
246
246
  endpoint: @config.endpoint,
247
247
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
248
248
  universe_domain: @config.universe_domain,
249
- credentials: credentials
249
+ credentials: credentials,
250
+ logger: @config.logger
250
251
  )
251
252
 
253
+ @edge_network_stub.logger(stub: true)&.info do |entry|
254
+ entry.set_system_name
255
+ entry.set_service
256
+ entry.message = "Created client for #{entry.service}"
257
+ entry.set_credentials_fields credentials
258
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
259
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
260
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
261
+ end
262
+
252
263
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
253
264
  config.credentials = credentials
254
265
  config.quota_project = @quota_project_id
255
266
  config.endpoint = @edge_network_stub.endpoint
256
267
  config.universe_domain = @edge_network_stub.universe_domain
257
268
  config.bindings_override = @config.bindings_override
269
+ config.logger = @edge_network_stub.logger if config.respond_to? :logger=
258
270
  end
259
271
  end
260
272
 
@@ -272,6 +284,15 @@ module Google
272
284
  #
273
285
  attr_reader :location_client
274
286
 
287
+ ##
288
+ # The logger used for request/response debug logging.
289
+ #
290
+ # @return [Logger]
291
+ #
292
+ def logger
293
+ @edge_network_stub.logger
294
+ end
295
+
275
296
  # Service calls
276
297
 
277
298
  ##
@@ -347,7 +368,6 @@ module Google
347
368
 
348
369
  @edge_network_stub.initialize_zone request, options do |result, operation|
349
370
  yield result, operation if block_given?
350
- return result
351
371
  end
352
372
  rescue ::Gapic::Rest::Error => e
353
373
  raise ::Google::Cloud::Error.from_error(e)
@@ -440,7 +460,6 @@ module Google
440
460
 
441
461
  @edge_network_stub.list_zones request, options do |result, operation|
442
462
  yield result, operation if block_given?
443
- return result
444
463
  end
445
464
  rescue ::Gapic::Rest::Error => e
446
465
  raise ::Google::Cloud::Error.from_error(e)
@@ -520,7 +539,6 @@ module Google
520
539
 
521
540
  @edge_network_stub.get_zone request, options do |result, operation|
522
541
  yield result, operation if block_given?
523
- return result
524
542
  end
525
543
  rescue ::Gapic::Rest::Error => e
526
544
  raise ::Google::Cloud::Error.from_error(e)
@@ -612,7 +630,6 @@ module Google
612
630
 
613
631
  @edge_network_stub.list_networks request, options do |result, operation|
614
632
  yield result, operation if block_given?
615
- return result
616
633
  end
617
634
  rescue ::Gapic::Rest::Error => e
618
635
  raise ::Google::Cloud::Error.from_error(e)
@@ -691,7 +708,6 @@ module Google
691
708
 
692
709
  @edge_network_stub.get_network request, options do |result, operation|
693
710
  yield result, operation if block_given?
694
- return result
695
711
  end
696
712
  rescue ::Gapic::Rest::Error => e
697
713
  raise ::Google::Cloud::Error.from_error(e)
@@ -770,7 +786,6 @@ module Google
770
786
 
771
787
  @edge_network_stub.diagnose_network request, options do |result, operation|
772
788
  yield result, operation if block_given?
773
- return result
774
789
  end
775
790
  rescue ::Gapic::Rest::Error => e
776
791
  raise ::Google::Cloud::Error.from_error(e)
@@ -877,7 +892,7 @@ module Google
877
892
  @edge_network_stub.create_network request, options do |result, operation|
878
893
  result = ::Gapic::Operation.new result, @operations_client, options: options
879
894
  yield result, operation if block_given?
880
- return result
895
+ throw :response, result
881
896
  end
882
897
  rescue ::Gapic::Rest::Error => e
883
898
  raise ::Google::Cloud::Error.from_error(e)
@@ -978,7 +993,7 @@ module Google
978
993
  @edge_network_stub.delete_network request, options do |result, operation|
979
994
  result = ::Gapic::Operation.new result, @operations_client, options: options
980
995
  yield result, operation if block_given?
981
- return result
996
+ throw :response, result
982
997
  end
983
998
  rescue ::Gapic::Rest::Error => e
984
999
  raise ::Google::Cloud::Error.from_error(e)
@@ -1070,7 +1085,6 @@ module Google
1070
1085
 
1071
1086
  @edge_network_stub.list_subnets request, options do |result, operation|
1072
1087
  yield result, operation if block_given?
1073
- return result
1074
1088
  end
1075
1089
  rescue ::Gapic::Rest::Error => e
1076
1090
  raise ::Google::Cloud::Error.from_error(e)
@@ -1149,7 +1163,6 @@ module Google
1149
1163
 
1150
1164
  @edge_network_stub.get_subnet request, options do |result, operation|
1151
1165
  yield result, operation if block_given?
1152
- return result
1153
1166
  end
1154
1167
  rescue ::Gapic::Rest::Error => e
1155
1168
  raise ::Google::Cloud::Error.from_error(e)
@@ -1256,7 +1269,7 @@ module Google
1256
1269
  @edge_network_stub.create_subnet request, options do |result, operation|
1257
1270
  result = ::Gapic::Operation.new result, @operations_client, options: options
1258
1271
  yield result, operation if block_given?
1259
- return result
1272
+ throw :response, result
1260
1273
  end
1261
1274
  rescue ::Gapic::Rest::Error => e
1262
1275
  raise ::Google::Cloud::Error.from_error(e)
@@ -1363,7 +1376,7 @@ module Google
1363
1376
  @edge_network_stub.update_subnet request, options do |result, operation|
1364
1377
  result = ::Gapic::Operation.new result, @operations_client, options: options
1365
1378
  yield result, operation if block_given?
1366
- return result
1379
+ throw :response, result
1367
1380
  end
1368
1381
  rescue ::Gapic::Rest::Error => e
1369
1382
  raise ::Google::Cloud::Error.from_error(e)
@@ -1464,7 +1477,7 @@ module Google
1464
1477
  @edge_network_stub.delete_subnet request, options do |result, operation|
1465
1478
  result = ::Gapic::Operation.new result, @operations_client, options: options
1466
1479
  yield result, operation if block_given?
1467
- return result
1480
+ throw :response, result
1468
1481
  end
1469
1482
  rescue ::Gapic::Rest::Error => e
1470
1483
  raise ::Google::Cloud::Error.from_error(e)
@@ -1556,7 +1569,6 @@ module Google
1556
1569
 
1557
1570
  @edge_network_stub.list_interconnects request, options do |result, operation|
1558
1571
  yield result, operation if block_given?
1559
- return result
1560
1572
  end
1561
1573
  rescue ::Gapic::Rest::Error => e
1562
1574
  raise ::Google::Cloud::Error.from_error(e)
@@ -1635,7 +1647,6 @@ module Google
1635
1647
 
1636
1648
  @edge_network_stub.get_interconnect request, options do |result, operation|
1637
1649
  yield result, operation if block_given?
1638
- return result
1639
1650
  end
1640
1651
  rescue ::Gapic::Rest::Error => e
1641
1652
  raise ::Google::Cloud::Error.from_error(e)
@@ -1714,7 +1725,6 @@ module Google
1714
1725
 
1715
1726
  @edge_network_stub.diagnose_interconnect request, options do |result, operation|
1716
1727
  yield result, operation if block_given?
1717
- return result
1718
1728
  end
1719
1729
  rescue ::Gapic::Rest::Error => e
1720
1730
  raise ::Google::Cloud::Error.from_error(e)
@@ -1806,7 +1816,6 @@ module Google
1806
1816
 
1807
1817
  @edge_network_stub.list_interconnect_attachments request, options do |result, operation|
1808
1818
  yield result, operation if block_given?
1809
- return result
1810
1819
  end
1811
1820
  rescue ::Gapic::Rest::Error => e
1812
1821
  raise ::Google::Cloud::Error.from_error(e)
@@ -1885,7 +1894,6 @@ module Google
1885
1894
 
1886
1895
  @edge_network_stub.get_interconnect_attachment request, options do |result, operation|
1887
1896
  yield result, operation if block_given?
1888
- return result
1889
1897
  end
1890
1898
  rescue ::Gapic::Rest::Error => e
1891
1899
  raise ::Google::Cloud::Error.from_error(e)
@@ -1992,7 +2000,7 @@ module Google
1992
2000
  @edge_network_stub.create_interconnect_attachment request, options do |result, operation|
1993
2001
  result = ::Gapic::Operation.new result, @operations_client, options: options
1994
2002
  yield result, operation if block_given?
1995
- return result
2003
+ throw :response, result
1996
2004
  end
1997
2005
  rescue ::Gapic::Rest::Error => e
1998
2006
  raise ::Google::Cloud::Error.from_error(e)
@@ -2093,7 +2101,7 @@ module Google
2093
2101
  @edge_network_stub.delete_interconnect_attachment request, options do |result, operation|
2094
2102
  result = ::Gapic::Operation.new result, @operations_client, options: options
2095
2103
  yield result, operation if block_given?
2096
- return result
2104
+ throw :response, result
2097
2105
  end
2098
2106
  rescue ::Gapic::Rest::Error => e
2099
2107
  raise ::Google::Cloud::Error.from_error(e)
@@ -2185,7 +2193,6 @@ module Google
2185
2193
 
2186
2194
  @edge_network_stub.list_routers request, options do |result, operation|
2187
2195
  yield result, operation if block_given?
2188
- return result
2189
2196
  end
2190
2197
  rescue ::Gapic::Rest::Error => e
2191
2198
  raise ::Google::Cloud::Error.from_error(e)
@@ -2264,7 +2271,6 @@ module Google
2264
2271
 
2265
2272
  @edge_network_stub.get_router request, options do |result, operation|
2266
2273
  yield result, operation if block_given?
2267
- return result
2268
2274
  end
2269
2275
  rescue ::Gapic::Rest::Error => e
2270
2276
  raise ::Google::Cloud::Error.from_error(e)
@@ -2343,7 +2349,6 @@ module Google
2343
2349
 
2344
2350
  @edge_network_stub.diagnose_router request, options do |result, operation|
2345
2351
  yield result, operation if block_given?
2346
- return result
2347
2352
  end
2348
2353
  rescue ::Gapic::Rest::Error => e
2349
2354
  raise ::Google::Cloud::Error.from_error(e)
@@ -2450,7 +2455,7 @@ module Google
2450
2455
  @edge_network_stub.create_router request, options do |result, operation|
2451
2456
  result = ::Gapic::Operation.new result, @operations_client, options: options
2452
2457
  yield result, operation if block_given?
2453
- return result
2458
+ throw :response, result
2454
2459
  end
2455
2460
  rescue ::Gapic::Rest::Error => e
2456
2461
  raise ::Google::Cloud::Error.from_error(e)
@@ -2557,7 +2562,7 @@ module Google
2557
2562
  @edge_network_stub.update_router request, options do |result, operation|
2558
2563
  result = ::Gapic::Operation.new result, @operations_client, options: options
2559
2564
  yield result, operation if block_given?
2560
- return result
2565
+ throw :response, result
2561
2566
  end
2562
2567
  rescue ::Gapic::Rest::Error => e
2563
2568
  raise ::Google::Cloud::Error.from_error(e)
@@ -2658,7 +2663,7 @@ module Google
2658
2663
  @edge_network_stub.delete_router request, options do |result, operation|
2659
2664
  result = ::Gapic::Operation.new result, @operations_client, options: options
2660
2665
  yield result, operation if block_given?
2661
- return result
2666
+ throw :response, result
2662
2667
  end
2663
2668
  rescue ::Gapic::Rest::Error => e
2664
2669
  raise ::Google::Cloud::Error.from_error(e)
@@ -2738,6 +2743,11 @@ module Google
2738
2743
  # default endpoint URL. The default value of nil uses the environment
2739
2744
  # universe (usually the default "googleapis.com" universe).
2740
2745
  # @return [::String,nil]
2746
+ # @!attribute [rw] logger
2747
+ # A custom logger to use for request/response debug logging, or the value
2748
+ # `:default` (the default) to construct a default logger, or `nil` to
2749
+ # explicitly disable logging.
2750
+ # @return [::Logger,:default,nil]
2741
2751
  #
2742
2752
  class Configuration
2743
2753
  extend ::Gapic::Config
@@ -2766,6 +2776,7 @@ module Google
2766
2776
  # by the host service.
2767
2777
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
2768
2778
  config_attr :bindings_override, {}, ::Hash, nil
2779
+ config_attr :logger, :default, ::Logger, nil, :default
2769
2780
 
2770
2781
  # @private
2771
2782
  def initialize parent_config = nil
@@ -115,14 +115,6 @@ module Google
115
115
  # Lists operations that match the specified filter in the request. If the
116
116
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
117
117
  #
118
- # NOTE: the `name` binding allows API services to override the binding
119
- # to use different resource name schemes, such as `users/*/operations`. To
120
- # override the binding, API services can add a binding such as
121
- # `"/v1/{name=users/*}/operations"` to their service configuration.
122
- # For backwards compatibility, the default name includes the operations
123
- # collection id, however overriding users must ensure the name binding
124
- # is the parent resource, without the operations collection id.
125
- #
126
118
  # @overload list_operations(request, options = nil)
127
119
  # Pass arguments to `list_operations` via a request object, either of type
128
120
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -204,7 +196,7 @@ module Google
204
196
  @operations_stub.list_operations request, options do |result, operation|
205
197
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
206
198
  yield result, operation if block_given?
207
- return result
199
+ throw :response, result
208
200
  end
209
201
  rescue ::Gapic::Rest::Error => e
210
202
  raise ::Google::Cloud::Error.from_error(e)
@@ -293,7 +285,7 @@ module Google
293
285
  @operations_stub.get_operation request, options do |result, operation|
294
286
  result = ::Gapic::Operation.new result, @operations_client, options: options
295
287
  yield result, operation if block_given?
296
- return result
288
+ throw :response, result
297
289
  end
298
290
  rescue ::Gapic::Rest::Error => e
299
291
  raise ::Google::Cloud::Error.from_error(e)
@@ -375,7 +367,6 @@ module Google
375
367
 
376
368
  @operations_stub.delete_operation request, options do |result, operation|
377
369
  yield result, operation if block_given?
378
- return result
379
370
  end
380
371
  rescue ::Gapic::Rest::Error => e
381
372
  raise ::Google::Cloud::Error.from_error(e)
@@ -390,8 +381,9 @@ module Google
390
381
  # other methods to check whether the cancellation succeeded or whether the
391
382
  # operation completed despite cancellation. On successful cancellation,
392
383
  # the operation is not deleted; instead, it becomes an operation with
393
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
394
- # corresponding to `Code.CANCELLED`.
384
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
385
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
386
+ # `Code.CANCELLED`.
395
387
  #
396
388
  # @overload cancel_operation(request, options = nil)
397
389
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -463,7 +455,6 @@ module Google
463
455
 
464
456
  @operations_stub.cancel_operation request, options do |result, operation|
465
457
  yield result, operation if block_given?
466
- return result
467
458
  end
468
459
  rescue ::Gapic::Rest::Error => e
469
460
  raise ::Google::Cloud::Error.from_error(e)
@@ -543,6 +534,11 @@ module Google
543
534
  # default endpoint URL. The default value of nil uses the environment
544
535
  # universe (usually the default "googleapis.com" universe).
545
536
  # @return [::String,nil]
537
+ # @!attribute [rw] logger
538
+ # A custom logger to use for request/response debug logging, or the value
539
+ # `:default` (the default) to construct a default logger, or `nil` to
540
+ # explicitly disable logging.
541
+ # @return [::Logger,:default,nil]
546
542
  #
547
543
  class Configuration
548
544
  extend ::Gapic::Config
@@ -564,6 +560,7 @@ module Google
564
560
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
565
561
  config_attr :quota_project, nil, ::String, nil
566
562
  config_attr :universe_domain, nil, ::String, nil
563
+ config_attr :logger, :default, ::Logger, nil, :default
567
564
 
568
565
  # @private
569
566
  def initialize parent_config = nil
@@ -683,16 +680,18 @@ module Google
683
680
 
684
681
  response = @client_stub.make_http_request(
685
682
  verb,
686
- uri: uri,
687
- body: body || "",
688
- params: query_string_params,
683
+ uri: uri,
684
+ body: body || "",
685
+ params: query_string_params,
686
+ method_name: "list_operations",
689
687
  options: options
690
688
  )
691
689
  operation = ::Gapic::Rest::TransportOperation.new response
692
690
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
693
-
694
- yield result, operation if block_given?
695
- result
691
+ catch :response do
692
+ yield result, operation if block_given?
693
+ result
694
+ end
696
695
  end
697
696
 
698
697
  ##
@@ -721,16 +720,18 @@ module Google
721
720
 
722
721
  response = @client_stub.make_http_request(
723
722
  verb,
724
- uri: uri,
725
- body: body || "",
726
- params: query_string_params,
723
+ uri: uri,
724
+ body: body || "",
725
+ params: query_string_params,
726
+ method_name: "get_operation",
727
727
  options: options
728
728
  )
729
729
  operation = ::Gapic::Rest::TransportOperation.new response
730
730
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
731
-
732
- yield result, operation if block_given?
733
- result
731
+ catch :response do
732
+ yield result, operation if block_given?
733
+ result
734
+ end
734
735
  end
735
736
 
736
737
  ##
@@ -759,16 +760,18 @@ module Google
759
760
 
760
761
  response = @client_stub.make_http_request(
761
762
  verb,
762
- uri: uri,
763
- body: body || "",
764
- params: query_string_params,
763
+ uri: uri,
764
+ body: body || "",
765
+ params: query_string_params,
766
+ method_name: "delete_operation",
765
767
  options: options
766
768
  )
767
769
  operation = ::Gapic::Rest::TransportOperation.new response
768
770
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
769
-
770
- yield result, operation if block_given?
771
- result
771
+ catch :response do
772
+ yield result, operation if block_given?
773
+ result
774
+ end
772
775
  end
773
776
 
774
777
  ##
@@ -797,16 +800,18 @@ module Google
797
800
 
798
801
  response = @client_stub.make_http_request(
799
802
  verb,
800
- uri: uri,
801
- body: body || "",
802
- params: query_string_params,
803
+ uri: uri,
804
+ body: body || "",
805
+ params: query_string_params,
806
+ method_name: "cancel_operation",
803
807
  options: options
804
808
  )
805
809
  operation = ::Gapic::Rest::TransportOperation.new response
806
810
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
807
-
808
- yield result, operation if block_given?
809
- result
811
+ catch :response do
812
+ yield result, operation if block_given?
813
+ result
814
+ end
810
815
  end
811
816
 
812
817
  ##