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.
@@ -232,15 +232,27 @@ module Google
232
232
  endpoint: @config.endpoint,
233
233
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
234
234
  universe_domain: @config.universe_domain,
235
- credentials: credentials
235
+ credentials: credentials,
236
+ logger: @config.logger
236
237
  )
237
238
 
239
+ @edge_container_stub.logger(stub: true)&.info do |entry|
240
+ entry.set_system_name
241
+ entry.set_service
242
+ entry.message = "Created client for #{entry.service}"
243
+ entry.set_credentials_fields credentials
244
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
245
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
246
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
247
+ end
248
+
238
249
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
239
250
  config.credentials = credentials
240
251
  config.quota_project = @quota_project_id
241
252
  config.endpoint = @edge_container_stub.endpoint
242
253
  config.universe_domain = @edge_container_stub.universe_domain
243
254
  config.bindings_override = @config.bindings_override
255
+ config.logger = @edge_container_stub.logger if config.respond_to? :logger=
244
256
  end
245
257
  end
246
258
 
@@ -258,6 +270,15 @@ module Google
258
270
  #
259
271
  attr_reader :location_client
260
272
 
273
+ ##
274
+ # The logger used for request/response debug logging.
275
+ #
276
+ # @return [Logger]
277
+ #
278
+ def logger
279
+ @edge_container_stub.logger
280
+ end
281
+
261
282
  # Service calls
262
283
 
263
284
  ##
@@ -346,7 +367,6 @@ module Google
346
367
 
347
368
  @edge_container_stub.list_clusters request, options do |result, operation|
348
369
  yield result, operation if block_given?
349
- return result
350
370
  end
351
371
  rescue ::Gapic::Rest::Error => e
352
372
  raise ::Google::Cloud::Error.from_error(e)
@@ -425,7 +445,6 @@ module Google
425
445
 
426
446
  @edge_container_stub.get_cluster request, options do |result, operation|
427
447
  yield result, operation if block_given?
428
- return result
429
448
  end
430
449
  rescue ::Gapic::Rest::Error => e
431
450
  raise ::Google::Cloud::Error.from_error(e)
@@ -520,7 +539,7 @@ module Google
520
539
  @edge_container_stub.create_cluster request, options do |result, operation|
521
540
  result = ::Gapic::Operation.new result, @operations_client, options: options
522
541
  yield result, operation if block_given?
523
- return result
542
+ throw :response, result
524
543
  end
525
544
  rescue ::Gapic::Rest::Error => e
526
545
  raise ::Google::Cloud::Error.from_error(e)
@@ -617,7 +636,7 @@ module Google
617
636
  @edge_container_stub.update_cluster request, options do |result, operation|
618
637
  result = ::Gapic::Operation.new result, @operations_client, options: options
619
638
  yield result, operation if block_given?
620
- return result
639
+ throw :response, result
621
640
  end
622
641
  rescue ::Gapic::Rest::Error => e
623
642
  raise ::Google::Cloud::Error.from_error(e)
@@ -712,7 +731,7 @@ module Google
712
731
  @edge_container_stub.upgrade_cluster request, options do |result, operation|
713
732
  result = ::Gapic::Operation.new result, @operations_client, options: options
714
733
  yield result, operation if block_given?
715
- return result
734
+ throw :response, result
716
735
  end
717
736
  rescue ::Gapic::Rest::Error => e
718
737
  raise ::Google::Cloud::Error.from_error(e)
@@ -803,7 +822,7 @@ module Google
803
822
  @edge_container_stub.delete_cluster request, options do |result, operation|
804
823
  result = ::Gapic::Operation.new result, @operations_client, options: options
805
824
  yield result, operation if block_given?
806
- return result
825
+ throw :response, result
807
826
  end
808
827
  rescue ::Gapic::Rest::Error => e
809
828
  raise ::Google::Cloud::Error.from_error(e)
@@ -882,7 +901,6 @@ module Google
882
901
 
883
902
  @edge_container_stub.generate_access_token request, options do |result, operation|
884
903
  yield result, operation if block_given?
885
- return result
886
904
  end
887
905
  rescue ::Gapic::Rest::Error => e
888
906
  raise ::Google::Cloud::Error.from_error(e)
@@ -961,7 +979,6 @@ module Google
961
979
 
962
980
  @edge_container_stub.generate_offline_credential request, options do |result, operation|
963
981
  yield result, operation if block_given?
964
- return result
965
982
  end
966
983
  rescue ::Gapic::Rest::Error => e
967
984
  raise ::Google::Cloud::Error.from_error(e)
@@ -1052,7 +1069,6 @@ module Google
1052
1069
 
1053
1070
  @edge_container_stub.list_node_pools request, options do |result, operation|
1054
1071
  yield result, operation if block_given?
1055
- return result
1056
1072
  end
1057
1073
  rescue ::Gapic::Rest::Error => e
1058
1074
  raise ::Google::Cloud::Error.from_error(e)
@@ -1131,7 +1147,6 @@ module Google
1131
1147
 
1132
1148
  @edge_container_stub.get_node_pool request, options do |result, operation|
1133
1149
  yield result, operation if block_given?
1134
- return result
1135
1150
  end
1136
1151
  rescue ::Gapic::Rest::Error => e
1137
1152
  raise ::Google::Cloud::Error.from_error(e)
@@ -1226,7 +1241,7 @@ module Google
1226
1241
  @edge_container_stub.create_node_pool request, options do |result, operation|
1227
1242
  result = ::Gapic::Operation.new result, @operations_client, options: options
1228
1243
  yield result, operation if block_given?
1229
- return result
1244
+ throw :response, result
1230
1245
  end
1231
1246
  rescue ::Gapic::Rest::Error => e
1232
1247
  raise ::Google::Cloud::Error.from_error(e)
@@ -1323,7 +1338,7 @@ module Google
1323
1338
  @edge_container_stub.update_node_pool request, options do |result, operation|
1324
1339
  result = ::Gapic::Operation.new result, @operations_client, options: options
1325
1340
  yield result, operation if block_given?
1326
- return result
1341
+ throw :response, result
1327
1342
  end
1328
1343
  rescue ::Gapic::Rest::Error => e
1329
1344
  raise ::Google::Cloud::Error.from_error(e)
@@ -1414,7 +1429,7 @@ module Google
1414
1429
  @edge_container_stub.delete_node_pool request, options do |result, operation|
1415
1430
  result = ::Gapic::Operation.new result, @operations_client, options: options
1416
1431
  yield result, operation if block_given?
1417
- return result
1432
+ throw :response, result
1418
1433
  end
1419
1434
  rescue ::Gapic::Rest::Error => e
1420
1435
  raise ::Google::Cloud::Error.from_error(e)
@@ -1505,7 +1520,6 @@ module Google
1505
1520
 
1506
1521
  @edge_container_stub.list_machines request, options do |result, operation|
1507
1522
  yield result, operation if block_given?
1508
- return result
1509
1523
  end
1510
1524
  rescue ::Gapic::Rest::Error => e
1511
1525
  raise ::Google::Cloud::Error.from_error(e)
@@ -1584,7 +1598,6 @@ module Google
1584
1598
 
1585
1599
  @edge_container_stub.get_machine request, options do |result, operation|
1586
1600
  yield result, operation if block_given?
1587
- return result
1588
1601
  end
1589
1602
  rescue ::Gapic::Rest::Error => e
1590
1603
  raise ::Google::Cloud::Error.from_error(e)
@@ -1676,7 +1689,6 @@ module Google
1676
1689
 
1677
1690
  @edge_container_stub.list_vpn_connections request, options do |result, operation|
1678
1691
  yield result, operation if block_given?
1679
- return result
1680
1692
  end
1681
1693
  rescue ::Gapic::Rest::Error => e
1682
1694
  raise ::Google::Cloud::Error.from_error(e)
@@ -1755,7 +1767,6 @@ module Google
1755
1767
 
1756
1768
  @edge_container_stub.get_vpn_connection request, options do |result, operation|
1757
1769
  yield result, operation if block_given?
1758
- return result
1759
1770
  end
1760
1771
  rescue ::Gapic::Rest::Error => e
1761
1772
  raise ::Google::Cloud::Error.from_error(e)
@@ -1850,7 +1861,7 @@ module Google
1850
1861
  @edge_container_stub.create_vpn_connection request, options do |result, operation|
1851
1862
  result = ::Gapic::Operation.new result, @operations_client, options: options
1852
1863
  yield result, operation if block_given?
1853
- return result
1864
+ throw :response, result
1854
1865
  end
1855
1866
  rescue ::Gapic::Rest::Error => e
1856
1867
  raise ::Google::Cloud::Error.from_error(e)
@@ -1941,7 +1952,7 @@ module Google
1941
1952
  @edge_container_stub.delete_vpn_connection request, options do |result, operation|
1942
1953
  result = ::Gapic::Operation.new result, @operations_client, options: options
1943
1954
  yield result, operation if block_given?
1944
- return result
1955
+ throw :response, result
1945
1956
  end
1946
1957
  rescue ::Gapic::Rest::Error => e
1947
1958
  raise ::Google::Cloud::Error.from_error(e)
@@ -2021,7 +2032,6 @@ module Google
2021
2032
 
2022
2033
  @edge_container_stub.get_server_config request, options do |result, operation|
2023
2034
  yield result, operation if block_given?
2024
- return result
2025
2035
  end
2026
2036
  rescue ::Gapic::Rest::Error => e
2027
2037
  raise ::Google::Cloud::Error.from_error(e)
@@ -2069,6 +2079,13 @@ module Google
2069
2079
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
2070
2080
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
2071
2081
  # * (`nil`) indicating no credentials
2082
+ #
2083
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
2084
+ # external source for authentication to Google Cloud, you must validate it before
2085
+ # providing it to a Google API client library. Providing an unvalidated credential
2086
+ # configuration to Google APIs can compromise the security of your systems and data.
2087
+ # For more information, refer to [Validate credential configurations from external
2088
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
2072
2089
  # @return [::Object]
2073
2090
  # @!attribute [rw] scope
2074
2091
  # The OAuth scopes
@@ -2101,6 +2118,11 @@ module Google
2101
2118
  # default endpoint URL. The default value of nil uses the environment
2102
2119
  # universe (usually the default "googleapis.com" universe).
2103
2120
  # @return [::String,nil]
2121
+ # @!attribute [rw] logger
2122
+ # A custom logger to use for request/response debug logging, or the value
2123
+ # `:default` (the default) to construct a default logger, or `nil` to
2124
+ # explicitly disable logging.
2125
+ # @return [::Logger,:default,nil]
2104
2126
  #
2105
2127
  class Configuration
2106
2128
  extend ::Gapic::Config
@@ -2129,6 +2151,7 @@ module Google
2129
2151
  # by the host service.
2130
2152
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
2131
2153
  config_attr :bindings_override, {}, ::Hash, nil
2154
+ config_attr :logger, :default, ::Logger, nil, :default
2132
2155
 
2133
2156
  # @private
2134
2157
  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)
@@ -511,6 +502,13 @@ module Google
511
502
  # * (`Signet::OAuth2::Client`) A signet oauth2 client object
512
503
  # (see the [signet docs](https://rubydoc.info/gems/signet/Signet/OAuth2/Client))
513
504
  # * (`nil`) indicating no credentials
505
+ #
506
+ # Warning: If you accept a credential configuration (JSON file or Hash) from an
507
+ # external source for authentication to Google Cloud, you must validate it before
508
+ # providing it to a Google API client library. Providing an unvalidated credential
509
+ # configuration to Google APIs can compromise the security of your systems and data.
510
+ # For more information, refer to [Validate credential configurations from external
511
+ # sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
514
512
  # @return [::Object]
515
513
  # @!attribute [rw] scope
516
514
  # The OAuth scopes
@@ -543,6 +541,11 @@ module Google
543
541
  # default endpoint URL. The default value of nil uses the environment
544
542
  # universe (usually the default "googleapis.com" universe).
545
543
  # @return [::String,nil]
544
+ # @!attribute [rw] logger
545
+ # A custom logger to use for request/response debug logging, or the value
546
+ # `:default` (the default) to construct a default logger, or `nil` to
547
+ # explicitly disable logging.
548
+ # @return [::Logger,:default,nil]
546
549
  #
547
550
  class Configuration
548
551
  extend ::Gapic::Config
@@ -564,6 +567,7 @@ module Google
564
567
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
565
568
  config_attr :quota_project, nil, ::String, nil
566
569
  config_attr :universe_domain, nil, ::String, nil
570
+ config_attr :logger, :default, ::Logger, nil, :default
567
571
 
568
572
  # @private
569
573
  def initialize parent_config = nil
@@ -683,16 +687,18 @@ module Google
683
687
 
684
688
  response = @client_stub.make_http_request(
685
689
  verb,
686
- uri: uri,
687
- body: body || "",
688
- params: query_string_params,
690
+ uri: uri,
691
+ body: body || "",
692
+ params: query_string_params,
693
+ method_name: "list_operations",
689
694
  options: options
690
695
  )
691
696
  operation = ::Gapic::Rest::TransportOperation.new response
692
697
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
693
-
694
- yield result, operation if block_given?
695
- result
698
+ catch :response do
699
+ yield result, operation if block_given?
700
+ result
701
+ end
696
702
  end
697
703
 
698
704
  ##
@@ -721,16 +727,18 @@ module Google
721
727
 
722
728
  response = @client_stub.make_http_request(
723
729
  verb,
724
- uri: uri,
725
- body: body || "",
726
- params: query_string_params,
730
+ uri: uri,
731
+ body: body || "",
732
+ params: query_string_params,
733
+ method_name: "get_operation",
727
734
  options: options
728
735
  )
729
736
  operation = ::Gapic::Rest::TransportOperation.new response
730
737
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
731
-
732
- yield result, operation if block_given?
733
- result
738
+ catch :response do
739
+ yield result, operation if block_given?
740
+ result
741
+ end
734
742
  end
735
743
 
736
744
  ##
@@ -759,16 +767,18 @@ module Google
759
767
 
760
768
  response = @client_stub.make_http_request(
761
769
  verb,
762
- uri: uri,
763
- body: body || "",
764
- params: query_string_params,
770
+ uri: uri,
771
+ body: body || "",
772
+ params: query_string_params,
773
+ method_name: "delete_operation",
765
774
  options: options
766
775
  )
767
776
  operation = ::Gapic::Rest::TransportOperation.new response
768
777
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
769
-
770
- yield result, operation if block_given?
771
- result
778
+ catch :response do
779
+ yield result, operation if block_given?
780
+ result
781
+ end
772
782
  end
773
783
 
774
784
  ##
@@ -797,16 +807,18 @@ module Google
797
807
 
798
808
  response = @client_stub.make_http_request(
799
809
  verb,
800
- uri: uri,
801
- body: body || "",
802
- params: query_string_params,
810
+ uri: uri,
811
+ body: body || "",
812
+ params: query_string_params,
813
+ method_name: "cancel_operation",
803
814
  options: options
804
815
  )
805
816
  operation = ::Gapic::Rest::TransportOperation.new response
806
817
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
807
-
808
- yield result, operation if block_given?
809
- result
818
+ catch :response do
819
+ yield result, operation if block_given?
820
+ result
821
+ end
810
822
  end
811
823
 
812
824
  ##