google-cloud-gke_backup-v1 0.10.1 → 0.11.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.
@@ -249,15 +249,27 @@ module Google
249
249
  endpoint: @config.endpoint,
250
250
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
251
251
  universe_domain: @config.universe_domain,
252
- credentials: credentials
252
+ credentials: credentials,
253
+ logger: @config.logger
253
254
  )
254
255
 
256
+ @backup_for_gke_stub.logger(stub: true)&.info do |entry|
257
+ entry.set_system_name
258
+ entry.set_service
259
+ entry.message = "Created client for #{entry.service}"
260
+ entry.set_credentials_fields credentials
261
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
262
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
263
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
264
+ end
265
+
255
266
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
256
267
  config.credentials = credentials
257
268
  config.quota_project = @quota_project_id
258
269
  config.endpoint = @backup_for_gke_stub.endpoint
259
270
  config.universe_domain = @backup_for_gke_stub.universe_domain
260
271
  config.bindings_override = @config.bindings_override
272
+ config.logger = @backup_for_gke_stub.logger if config.respond_to? :logger=
261
273
  end
262
274
 
263
275
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
@@ -266,6 +278,7 @@ module Google
266
278
  config.endpoint = @backup_for_gke_stub.endpoint
267
279
  config.universe_domain = @backup_for_gke_stub.universe_domain
268
280
  config.bindings_override = @config.bindings_override
281
+ config.logger = @backup_for_gke_stub.logger if config.respond_to? :logger=
269
282
  end
270
283
  end
271
284
 
@@ -290,6 +303,15 @@ module Google
290
303
  #
291
304
  attr_reader :iam_policy_client
292
305
 
306
+ ##
307
+ # The logger used for request/response debug logging.
308
+ #
309
+ # @return [Logger]
310
+ #
311
+ def logger
312
+ @backup_for_gke_stub.logger
313
+ end
314
+
293
315
  # Service calls
294
316
 
295
317
  ##
@@ -385,7 +407,7 @@ module Google
385
407
  @backup_for_gke_stub.create_backup_plan request, options do |result, operation|
386
408
  result = ::Gapic::Operation.new result, @operations_client, options: options
387
409
  yield result, operation if block_given?
388
- return result
410
+ throw :response, result
389
411
  end
390
412
  rescue ::Gapic::Rest::Error => e
391
413
  raise ::Google::Cloud::Error.from_error(e)
@@ -487,7 +509,6 @@ module Google
487
509
 
488
510
  @backup_for_gke_stub.list_backup_plans request, options do |result, operation|
489
511
  yield result, operation if block_given?
490
- return result
491
512
  end
492
513
  rescue ::Gapic::Rest::Error => e
493
514
  raise ::Google::Cloud::Error.from_error(e)
@@ -567,7 +588,6 @@ module Google
567
588
 
568
589
  @backup_for_gke_stub.get_backup_plan request, options do |result, operation|
569
590
  yield result, operation if block_given?
570
- return result
571
591
  end
572
592
  rescue ::Gapic::Rest::Error => e
573
593
  raise ::Google::Cloud::Error.from_error(e)
@@ -665,7 +685,7 @@ module Google
665
685
  @backup_for_gke_stub.update_backup_plan request, options do |result, operation|
666
686
  result = ::Gapic::Operation.new result, @operations_client, options: options
667
687
  yield result, operation if block_given?
668
- return result
688
+ throw :response, result
669
689
  end
670
690
  rescue ::Gapic::Rest::Error => e
671
691
  raise ::Google::Cloud::Error.from_error(e)
@@ -757,7 +777,7 @@ module Google
757
777
  @backup_for_gke_stub.delete_backup_plan request, options do |result, operation|
758
778
  result = ::Gapic::Operation.new result, @operations_client, options: options
759
779
  yield result, operation if block_given?
760
- return result
780
+ throw :response, result
761
781
  end
762
782
  rescue ::Gapic::Rest::Error => e
763
783
  raise ::Google::Cloud::Error.from_error(e)
@@ -856,7 +876,7 @@ module Google
856
876
  @backup_for_gke_stub.create_backup request, options do |result, operation|
857
877
  result = ::Gapic::Operation.new result, @operations_client, options: options
858
878
  yield result, operation if block_given?
859
- return result
879
+ throw :response, result
860
880
  end
861
881
  rescue ::Gapic::Rest::Error => e
862
882
  raise ::Google::Cloud::Error.from_error(e)
@@ -959,7 +979,7 @@ module Google
959
979
  @backup_for_gke_stub.list_backups request, options do |result, operation|
960
980
  result = ::Gapic::Rest::PagedEnumerable.new @backup_for_gke_stub, :list_backups, "backups", request, result, options
961
981
  yield result, operation if block_given?
962
- return result
982
+ throw :response, result
963
983
  end
964
984
  rescue ::Gapic::Rest::Error => e
965
985
  raise ::Google::Cloud::Error.from_error(e)
@@ -1039,7 +1059,6 @@ module Google
1039
1059
 
1040
1060
  @backup_for_gke_stub.get_backup request, options do |result, operation|
1041
1061
  yield result, operation if block_given?
1042
- return result
1043
1062
  end
1044
1063
  rescue ::Gapic::Rest::Error => e
1045
1064
  raise ::Google::Cloud::Error.from_error(e)
@@ -1136,7 +1155,7 @@ module Google
1136
1155
  @backup_for_gke_stub.update_backup request, options do |result, operation|
1137
1156
  result = ::Gapic::Operation.new result, @operations_client, options: options
1138
1157
  yield result, operation if block_given?
1139
- return result
1158
+ throw :response, result
1140
1159
  end
1141
1160
  rescue ::Gapic::Rest::Error => e
1142
1161
  raise ::Google::Cloud::Error.from_error(e)
@@ -1232,7 +1251,7 @@ module Google
1232
1251
  @backup_for_gke_stub.delete_backup request, options do |result, operation|
1233
1252
  result = ::Gapic::Operation.new result, @operations_client, options: options
1234
1253
  yield result, operation if block_given?
1235
- return result
1254
+ throw :response, result
1236
1255
  end
1237
1256
  rescue ::Gapic::Rest::Error => e
1238
1257
  raise ::Google::Cloud::Error.from_error(e)
@@ -1335,7 +1354,7 @@ module Google
1335
1354
  @backup_for_gke_stub.list_volume_backups request, options do |result, operation|
1336
1355
  result = ::Gapic::Rest::PagedEnumerable.new @backup_for_gke_stub, :list_volume_backups, "volume_backups", request, result, options
1337
1356
  yield result, operation if block_given?
1338
- return result
1357
+ throw :response, result
1339
1358
  end
1340
1359
  rescue ::Gapic::Rest::Error => e
1341
1360
  raise ::Google::Cloud::Error.from_error(e)
@@ -1415,7 +1434,6 @@ module Google
1415
1434
 
1416
1435
  @backup_for_gke_stub.get_volume_backup request, options do |result, operation|
1417
1436
  yield result, operation if block_given?
1418
- return result
1419
1437
  end
1420
1438
  rescue ::Gapic::Rest::Error => e
1421
1439
  raise ::Google::Cloud::Error.from_error(e)
@@ -1514,7 +1532,7 @@ module Google
1514
1532
  @backup_for_gke_stub.create_restore_plan request, options do |result, operation|
1515
1533
  result = ::Gapic::Operation.new result, @operations_client, options: options
1516
1534
  yield result, operation if block_given?
1517
- return result
1535
+ throw :response, result
1518
1536
  end
1519
1537
  rescue ::Gapic::Rest::Error => e
1520
1538
  raise ::Google::Cloud::Error.from_error(e)
@@ -1616,7 +1634,6 @@ module Google
1616
1634
 
1617
1635
  @backup_for_gke_stub.list_restore_plans request, options do |result, operation|
1618
1636
  yield result, operation if block_given?
1619
- return result
1620
1637
  end
1621
1638
  rescue ::Gapic::Rest::Error => e
1622
1639
  raise ::Google::Cloud::Error.from_error(e)
@@ -1696,7 +1713,6 @@ module Google
1696
1713
 
1697
1714
  @backup_for_gke_stub.get_restore_plan request, options do |result, operation|
1698
1715
  yield result, operation if block_given?
1699
- return result
1700
1716
  end
1701
1717
  rescue ::Gapic::Rest::Error => e
1702
1718
  raise ::Google::Cloud::Error.from_error(e)
@@ -1793,7 +1809,7 @@ module Google
1793
1809
  @backup_for_gke_stub.update_restore_plan request, options do |result, operation|
1794
1810
  result = ::Gapic::Operation.new result, @operations_client, options: options
1795
1811
  yield result, operation if block_given?
1796
- return result
1812
+ throw :response, result
1797
1813
  end
1798
1814
  rescue ::Gapic::Rest::Error => e
1799
1815
  raise ::Google::Cloud::Error.from_error(e)
@@ -1889,7 +1905,7 @@ module Google
1889
1905
  @backup_for_gke_stub.delete_restore_plan request, options do |result, operation|
1890
1906
  result = ::Gapic::Operation.new result, @operations_client, options: options
1891
1907
  yield result, operation if block_given?
1892
- return result
1908
+ throw :response, result
1893
1909
  end
1894
1910
  rescue ::Gapic::Rest::Error => e
1895
1911
  raise ::Google::Cloud::Error.from_error(e)
@@ -1988,7 +2004,7 @@ module Google
1988
2004
  @backup_for_gke_stub.create_restore request, options do |result, operation|
1989
2005
  result = ::Gapic::Operation.new result, @operations_client, options: options
1990
2006
  yield result, operation if block_given?
1991
- return result
2007
+ throw :response, result
1992
2008
  end
1993
2009
  rescue ::Gapic::Rest::Error => e
1994
2010
  raise ::Google::Cloud::Error.from_error(e)
@@ -2090,7 +2106,6 @@ module Google
2090
2106
 
2091
2107
  @backup_for_gke_stub.list_restores request, options do |result, operation|
2092
2108
  yield result, operation if block_given?
2093
- return result
2094
2109
  end
2095
2110
  rescue ::Gapic::Rest::Error => e
2096
2111
  raise ::Google::Cloud::Error.from_error(e)
@@ -2170,7 +2185,6 @@ module Google
2170
2185
 
2171
2186
  @backup_for_gke_stub.get_restore request, options do |result, operation|
2172
2187
  yield result, operation if block_given?
2173
- return result
2174
2188
  end
2175
2189
  rescue ::Gapic::Rest::Error => e
2176
2190
  raise ::Google::Cloud::Error.from_error(e)
@@ -2267,7 +2281,7 @@ module Google
2267
2281
  @backup_for_gke_stub.update_restore request, options do |result, operation|
2268
2282
  result = ::Gapic::Operation.new result, @operations_client, options: options
2269
2283
  yield result, operation if block_given?
2270
- return result
2284
+ throw :response, result
2271
2285
  end
2272
2286
  rescue ::Gapic::Rest::Error => e
2273
2287
  raise ::Google::Cloud::Error.from_error(e)
@@ -2363,7 +2377,7 @@ module Google
2363
2377
  @backup_for_gke_stub.delete_restore request, options do |result, operation|
2364
2378
  result = ::Gapic::Operation.new result, @operations_client, options: options
2365
2379
  yield result, operation if block_given?
2366
- return result
2380
+ throw :response, result
2367
2381
  end
2368
2382
  rescue ::Gapic::Rest::Error => e
2369
2383
  raise ::Google::Cloud::Error.from_error(e)
@@ -2466,7 +2480,7 @@ module Google
2466
2480
  @backup_for_gke_stub.list_volume_restores request, options do |result, operation|
2467
2481
  result = ::Gapic::Rest::PagedEnumerable.new @backup_for_gke_stub, :list_volume_restores, "volume_restores", request, result, options
2468
2482
  yield result, operation if block_given?
2469
- return result
2483
+ throw :response, result
2470
2484
  end
2471
2485
  rescue ::Gapic::Rest::Error => e
2472
2486
  raise ::Google::Cloud::Error.from_error(e)
@@ -2546,7 +2560,6 @@ module Google
2546
2560
 
2547
2561
  @backup_for_gke_stub.get_volume_restore request, options do |result, operation|
2548
2562
  yield result, operation if block_given?
2549
- return result
2550
2563
  end
2551
2564
  rescue ::Gapic::Rest::Error => e
2552
2565
  raise ::Google::Cloud::Error.from_error(e)
@@ -2627,7 +2640,6 @@ module Google
2627
2640
 
2628
2641
  @backup_for_gke_stub.get_backup_index_download_url request, options do |result, operation|
2629
2642
  yield result, operation if block_given?
2630
- return result
2631
2643
  end
2632
2644
  rescue ::Gapic::Rest::Error => e
2633
2645
  raise ::Google::Cloud::Error.from_error(e)
@@ -2707,6 +2719,11 @@ module Google
2707
2719
  # default endpoint URL. The default value of nil uses the environment
2708
2720
  # universe (usually the default "googleapis.com" universe).
2709
2721
  # @return [::String,nil]
2722
+ # @!attribute [rw] logger
2723
+ # A custom logger to use for request/response debug logging, or the value
2724
+ # `:default` (the default) to construct a default logger, or `nil` to
2725
+ # explicitly disable logging.
2726
+ # @return [::Logger,:default,nil]
2710
2727
  #
2711
2728
  class Configuration
2712
2729
  extend ::Gapic::Config
@@ -2735,6 +2752,7 @@ module Google
2735
2752
  # by the host service.
2736
2753
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
2737
2754
  config_attr :bindings_override, {}, ::Hash, nil
2755
+ config_attr :logger, :default, ::Logger, nil, :default
2738
2756
 
2739
2757
  # @private
2740
2758
  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
  ##