google-cloud-gke_multi_cloud-v1 0.11.0 → 0.12.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -217,8 +217,19 @@ module Google
217
217
  endpoint: @config.endpoint,
218
218
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
219
219
  universe_domain: @config.universe_domain,
220
- credentials: credentials
220
+ credentials: credentials,
221
+ logger: @config.logger
221
222
  )
223
+
224
+ @aws_clusters_stub.logger(stub: true)&.info do |entry|
225
+ entry.set_system_name
226
+ entry.set_service
227
+ entry.message = "Created client for #{entry.service}"
228
+ entry.set_credentials_fields credentials
229
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
230
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
231
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
232
+ end
222
233
  end
223
234
 
224
235
  ##
@@ -228,6 +239,15 @@ module Google
228
239
  #
229
240
  attr_reader :operations_client
230
241
 
242
+ ##
243
+ # The logger used for request/response debug logging.
244
+ #
245
+ # @return [Logger]
246
+ #
247
+ def logger
248
+ @aws_clusters_stub.logger
249
+ end
250
+
231
251
  # Service calls
232
252
 
233
253
  ##
@@ -338,7 +358,7 @@ module Google
338
358
  @aws_clusters_stub.create_aws_cluster request, options do |result, operation|
339
359
  result = ::Gapic::Operation.new result, @operations_client, options: options
340
360
  yield result, operation if block_given?
341
- return result
361
+ throw :response, result
342
362
  end
343
363
  rescue ::Gapic::Rest::Error => e
344
364
  raise ::Google::Cloud::Error.from_error(e)
@@ -460,7 +480,7 @@ module Google
460
480
  @aws_clusters_stub.update_aws_cluster request, options do |result, operation|
461
481
  result = ::Gapic::Operation.new result, @operations_client, options: options
462
482
  yield result, operation if block_given?
463
- return result
483
+ throw :response, result
464
484
  end
465
485
  rescue ::Gapic::Rest::Error => e
466
486
  raise ::Google::Cloud::Error.from_error(e)
@@ -548,7 +568,6 @@ module Google
548
568
 
549
569
  @aws_clusters_stub.get_aws_cluster request, options do |result, operation|
550
570
  yield result, operation if block_given?
551
- return result
552
571
  end
553
572
  rescue ::Gapic::Rest::Error => e
554
573
  raise ::Google::Cloud::Error.from_error(e)
@@ -651,7 +670,7 @@ module Google
651
670
  @aws_clusters_stub.list_aws_clusters request, options do |result, operation|
652
671
  result = ::Gapic::Rest::PagedEnumerable.new @aws_clusters_stub, :list_aws_clusters, "aws_clusters", request, result, options
653
672
  yield result, operation if block_given?
654
- return result
673
+ throw :response, result
655
674
  end
656
675
  rescue ::Gapic::Rest::Error => e
657
676
  raise ::Google::Cloud::Error.from_error(e)
@@ -775,7 +794,7 @@ module Google
775
794
  @aws_clusters_stub.delete_aws_cluster request, options do |result, operation|
776
795
  result = ::Gapic::Operation.new result, @operations_client, options: options
777
796
  yield result, operation if block_given?
778
- return result
797
+ throw :response, result
779
798
  end
780
799
  rescue ::Gapic::Rest::Error => e
781
800
  raise ::Google::Cloud::Error.from_error(e)
@@ -872,7 +891,6 @@ module Google
872
891
 
873
892
  @aws_clusters_stub.generate_aws_cluster_agent_token request, options do |result, operation|
874
893
  yield result, operation if block_given?
875
- return result
876
894
  end
877
895
  rescue ::Gapic::Rest::Error => e
878
896
  raise ::Google::Cloud::Error.from_error(e)
@@ -960,7 +978,6 @@ module Google
960
978
 
961
979
  @aws_clusters_stub.generate_aws_access_token request, options do |result, operation|
962
980
  yield result, operation if block_given?
963
- return result
964
981
  end
965
982
  rescue ::Gapic::Rest::Error => e
966
983
  raise ::Google::Cloud::Error.from_error(e)
@@ -1075,7 +1092,7 @@ module Google
1075
1092
  @aws_clusters_stub.create_aws_node_pool request, options do |result, operation|
1076
1093
  result = ::Gapic::Operation.new result, @operations_client, options: options
1077
1094
  yield result, operation if block_given?
1078
- return result
1095
+ throw :response, result
1079
1096
  end
1080
1097
  rescue ::Gapic::Rest::Error => e
1081
1098
  raise ::Google::Cloud::Error.from_error(e)
@@ -1200,7 +1217,7 @@ module Google
1200
1217
  @aws_clusters_stub.update_aws_node_pool request, options do |result, operation|
1201
1218
  result = ::Gapic::Operation.new result, @operations_client, options: options
1202
1219
  yield result, operation if block_given?
1203
- return result
1220
+ throw :response, result
1204
1221
  end
1205
1222
  rescue ::Gapic::Rest::Error => e
1206
1223
  raise ::Google::Cloud::Error.from_error(e)
@@ -1303,7 +1320,7 @@ module Google
1303
1320
  @aws_clusters_stub.rollback_aws_node_pool_update request, options do |result, operation|
1304
1321
  result = ::Gapic::Operation.new result, @operations_client, options: options
1305
1322
  yield result, operation if block_given?
1306
- return result
1323
+ throw :response, result
1307
1324
  end
1308
1325
  rescue ::Gapic::Rest::Error => e
1309
1326
  raise ::Google::Cloud::Error.from_error(e)
@@ -1391,7 +1408,6 @@ module Google
1391
1408
 
1392
1409
  @aws_clusters_stub.get_aws_node_pool request, options do |result, operation|
1393
1410
  yield result, operation if block_given?
1394
- return result
1395
1411
  end
1396
1412
  rescue ::Gapic::Rest::Error => e
1397
1413
  raise ::Google::Cloud::Error.from_error(e)
@@ -1496,7 +1512,7 @@ module Google
1496
1512
  @aws_clusters_stub.list_aws_node_pools request, options do |result, operation|
1497
1513
  result = ::Gapic::Rest::PagedEnumerable.new @aws_clusters_stub, :list_aws_node_pools, "aws_node_pools", request, result, options
1498
1514
  yield result, operation if block_given?
1499
- return result
1515
+ throw :response, result
1500
1516
  end
1501
1517
  rescue ::Gapic::Rest::Error => e
1502
1518
  raise ::Google::Cloud::Error.from_error(e)
@@ -1618,7 +1634,7 @@ module Google
1618
1634
  @aws_clusters_stub.delete_aws_node_pool request, options do |result, operation|
1619
1635
  result = ::Gapic::Operation.new result, @operations_client, options: options
1620
1636
  yield result, operation if block_given?
1621
- return result
1637
+ throw :response, result
1622
1638
  end
1623
1639
  rescue ::Gapic::Rest::Error => e
1624
1640
  raise ::Google::Cloud::Error.from_error(e)
@@ -1703,7 +1719,6 @@ module Google
1703
1719
 
1704
1720
  @aws_clusters_stub.get_aws_open_id_config request, options do |result, operation|
1705
1721
  yield result, operation if block_given?
1706
- return result
1707
1722
  end
1708
1723
  rescue ::Gapic::Rest::Error => e
1709
1724
  raise ::Google::Cloud::Error.from_error(e)
@@ -1785,7 +1800,6 @@ module Google
1785
1800
 
1786
1801
  @aws_clusters_stub.get_aws_json_web_keys request, options do |result, operation|
1787
1802
  yield result, operation if block_given?
1788
- return result
1789
1803
  end
1790
1804
  rescue ::Gapic::Rest::Error => e
1791
1805
  raise ::Google::Cloud::Error.from_error(e)
@@ -1873,7 +1887,6 @@ module Google
1873
1887
 
1874
1888
  @aws_clusters_stub.get_aws_server_config request, options do |result, operation|
1875
1889
  yield result, operation if block_given?
1876
- return result
1877
1890
  end
1878
1891
  rescue ::Gapic::Rest::Error => e
1879
1892
  raise ::Google::Cloud::Error.from_error(e)
@@ -1953,6 +1966,11 @@ module Google
1953
1966
  # default endpoint URL. The default value of nil uses the environment
1954
1967
  # universe (usually the default "googleapis.com" universe).
1955
1968
  # @return [::String,nil]
1969
+ # @!attribute [rw] logger
1970
+ # A custom logger to use for request/response debug logging, or the value
1971
+ # `:default` (the default) to construct a default logger, or `nil` to
1972
+ # explicitly disable logging.
1973
+ # @return [::Logger,:default,nil]
1956
1974
  #
1957
1975
  class Configuration
1958
1976
  extend ::Gapic::Config
@@ -1974,6 +1992,7 @@ module Google
1974
1992
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
1975
1993
  config_attr :quota_project, nil, ::String, nil
1976
1994
  config_attr :universe_domain, nil, ::String, nil
1995
+ config_attr :logger, :default, ::Logger, nil, :default
1977
1996
 
1978
1997
  # @private
1979
1998
  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
  ##