google-cloud-backupdr-v1 0.3.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.
@@ -226,15 +226,27 @@ module Google
226
226
  endpoint: @config.endpoint,
227
227
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
228
228
  universe_domain: @config.universe_domain,
229
- credentials: credentials
229
+ credentials: credentials,
230
+ logger: @config.logger
230
231
  )
231
232
 
233
+ @backup_dr_stub.logger(stub: true)&.info do |entry|
234
+ entry.set_system_name
235
+ entry.set_service
236
+ entry.message = "Created client for #{entry.service}"
237
+ entry.set_credentials_fields credentials
238
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
239
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
240
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
241
+ end
242
+
232
243
  @location_client = Google::Cloud::Location::Locations::Rest::Client.new do |config|
233
244
  config.credentials = credentials
234
245
  config.quota_project = @quota_project_id
235
246
  config.endpoint = @backup_dr_stub.endpoint
236
247
  config.universe_domain = @backup_dr_stub.universe_domain
237
248
  config.bindings_override = @config.bindings_override
249
+ config.logger = @backup_dr_stub.logger if config.respond_to? :logger=
238
250
  end
239
251
 
240
252
  @iam_policy_client = Google::Iam::V1::IAMPolicy::Rest::Client.new do |config|
@@ -243,6 +255,7 @@ module Google
243
255
  config.endpoint = @backup_dr_stub.endpoint
244
256
  config.universe_domain = @backup_dr_stub.universe_domain
245
257
  config.bindings_override = @config.bindings_override
258
+ config.logger = @backup_dr_stub.logger if config.respond_to? :logger=
246
259
  end
247
260
  end
248
261
 
@@ -267,6 +280,15 @@ module Google
267
280
  #
268
281
  attr_reader :iam_policy_client
269
282
 
283
+ ##
284
+ # The logger used for request/response debug logging.
285
+ #
286
+ # @return [Logger]
287
+ #
288
+ def logger
289
+ @backup_dr_stub.logger
290
+ end
291
+
270
292
  # Service calls
271
293
 
272
294
  ##
@@ -360,7 +382,6 @@ module Google
360
382
 
361
383
  @backup_dr_stub.list_management_servers request, options do |result, operation|
362
384
  yield result, operation if block_given?
363
- return result
364
385
  end
365
386
  rescue ::Gapic::Rest::Error => e
366
387
  raise ::Google::Cloud::Error.from_error(e)
@@ -440,7 +461,6 @@ module Google
440
461
 
441
462
  @backup_dr_stub.get_management_server request, options do |result, operation|
442
463
  yield result, operation if block_given?
443
- return result
444
464
  end
445
465
  rescue ::Gapic::Rest::Error => e
446
466
  raise ::Google::Cloud::Error.from_error(e)
@@ -549,7 +569,7 @@ module Google
549
569
  @backup_dr_stub.create_management_server request, options do |result, operation|
550
570
  result = ::Gapic::Operation.new result, @operations_client, options: options
551
571
  yield result, operation if block_given?
552
- return result
572
+ throw :response, result
553
573
  end
554
574
  rescue ::Gapic::Rest::Error => e
555
575
  raise ::Google::Cloud::Error.from_error(e)
@@ -650,7 +670,7 @@ module Google
650
670
  @backup_dr_stub.delete_management_server request, options do |result, operation|
651
671
  result = ::Gapic::Operation.new result, @operations_client, options: options
652
672
  yield result, operation if block_given?
653
- return result
673
+ throw :response, result
654
674
  end
655
675
  rescue ::Gapic::Rest::Error => e
656
676
  raise ::Google::Cloud::Error.from_error(e)
@@ -760,7 +780,7 @@ module Google
760
780
  @backup_dr_stub.create_backup_vault request, options do |result, operation|
761
781
  result = ::Gapic::Operation.new result, @operations_client, options: options
762
782
  yield result, operation if block_given?
763
- return result
783
+ throw :response, result
764
784
  end
765
785
  rescue ::Gapic::Rest::Error => e
766
786
  raise ::Google::Cloud::Error.from_error(e)
@@ -860,7 +880,6 @@ module Google
860
880
 
861
881
  @backup_dr_stub.list_backup_vaults request, options do |result, operation|
862
882
  yield result, operation if block_given?
863
- return result
864
883
  end
865
884
  rescue ::Gapic::Rest::Error => e
866
885
  raise ::Google::Cloud::Error.from_error(e)
@@ -959,7 +978,6 @@ module Google
959
978
 
960
979
  @backup_dr_stub.fetch_usable_backup_vaults request, options do |result, operation|
961
980
  yield result, operation if block_given?
962
- return result
963
981
  end
964
982
  rescue ::Gapic::Rest::Error => e
965
983
  raise ::Google::Cloud::Error.from_error(e)
@@ -1042,7 +1060,6 @@ module Google
1042
1060
 
1043
1061
  @backup_dr_stub.get_backup_vault request, options do |result, operation|
1044
1062
  yield result, operation if block_given?
1045
- return result
1046
1063
  end
1047
1064
  rescue ::Gapic::Rest::Error => e
1048
1065
  raise ::Google::Cloud::Error.from_error(e)
@@ -1155,7 +1172,7 @@ module Google
1155
1172
  @backup_dr_stub.update_backup_vault request, options do |result, operation|
1156
1173
  result = ::Gapic::Operation.new result, @operations_client, options: options
1157
1174
  yield result, operation if block_given?
1158
- return result
1175
+ throw :response, result
1159
1176
  end
1160
1177
  rescue ::Gapic::Rest::Error => e
1161
1178
  raise ::Google::Cloud::Error.from_error(e)
@@ -1269,7 +1286,7 @@ module Google
1269
1286
  @backup_dr_stub.delete_backup_vault request, options do |result, operation|
1270
1287
  result = ::Gapic::Operation.new result, @operations_client, options: options
1271
1288
  yield result, operation if block_given?
1272
- return result
1289
+ throw :response, result
1273
1290
  end
1274
1291
  rescue ::Gapic::Rest::Error => e
1275
1292
  raise ::Google::Cloud::Error.from_error(e)
@@ -1366,7 +1383,6 @@ module Google
1366
1383
 
1367
1384
  @backup_dr_stub.list_data_sources request, options do |result, operation|
1368
1385
  yield result, operation if block_given?
1369
- return result
1370
1386
  end
1371
1387
  rescue ::Gapic::Rest::Error => e
1372
1388
  raise ::Google::Cloud::Error.from_error(e)
@@ -1446,7 +1462,6 @@ module Google
1446
1462
 
1447
1463
  @backup_dr_stub.get_data_source request, options do |result, operation|
1448
1464
  yield result, operation if block_given?
1449
- return result
1450
1465
  end
1451
1466
  rescue ::Gapic::Rest::Error => e
1452
1467
  raise ::Google::Cloud::Error.from_error(e)
@@ -1555,7 +1570,7 @@ module Google
1555
1570
  @backup_dr_stub.update_data_source request, options do |result, operation|
1556
1571
  result = ::Gapic::Operation.new result, @operations_client, options: options
1557
1572
  yield result, operation if block_given?
1558
- return result
1573
+ throw :response, result
1559
1574
  end
1560
1575
  rescue ::Gapic::Rest::Error => e
1561
1576
  raise ::Google::Cloud::Error.from_error(e)
@@ -1655,7 +1670,6 @@ module Google
1655
1670
 
1656
1671
  @backup_dr_stub.list_backups request, options do |result, operation|
1657
1672
  yield result, operation if block_given?
1658
- return result
1659
1673
  end
1660
1674
  rescue ::Gapic::Rest::Error => e
1661
1675
  raise ::Google::Cloud::Error.from_error(e)
@@ -1738,7 +1752,6 @@ module Google
1738
1752
 
1739
1753
  @backup_dr_stub.get_backup request, options do |result, operation|
1740
1754
  yield result, operation if block_given?
1741
- return result
1742
1755
  end
1743
1756
  rescue ::Gapic::Rest::Error => e
1744
1757
  raise ::Google::Cloud::Error.from_error(e)
@@ -1845,7 +1858,7 @@ module Google
1845
1858
  @backup_dr_stub.update_backup request, options do |result, operation|
1846
1859
  result = ::Gapic::Operation.new result, @operations_client, options: options
1847
1860
  yield result, operation if block_given?
1848
- return result
1861
+ throw :response, result
1849
1862
  end
1850
1863
  rescue ::Gapic::Rest::Error => e
1851
1864
  raise ::Google::Cloud::Error.from_error(e)
@@ -1946,7 +1959,7 @@ module Google
1946
1959
  @backup_dr_stub.delete_backup request, options do |result, operation|
1947
1960
  result = ::Gapic::Operation.new result, @operations_client, options: options
1948
1961
  yield result, operation if block_given?
1949
- return result
1962
+ throw :response, result
1950
1963
  end
1951
1964
  rescue ::Gapic::Rest::Error => e
1952
1965
  raise ::Google::Cloud::Error.from_error(e)
@@ -2052,7 +2065,7 @@ module Google
2052
2065
  @backup_dr_stub.restore_backup request, options do |result, operation|
2053
2066
  result = ::Gapic::Operation.new result, @operations_client, options: options
2054
2067
  yield result, operation if block_given?
2055
- return result
2068
+ throw :response, result
2056
2069
  end
2057
2070
  rescue ::Gapic::Rest::Error => e
2058
2071
  raise ::Google::Cloud::Error.from_error(e)
@@ -2162,7 +2175,7 @@ module Google
2162
2175
  @backup_dr_stub.create_backup_plan request, options do |result, operation|
2163
2176
  result = ::Gapic::Operation.new result, @operations_client, options: options
2164
2177
  yield result, operation if block_given?
2165
- return result
2178
+ throw :response, result
2166
2179
  end
2167
2180
  rescue ::Gapic::Rest::Error => e
2168
2181
  raise ::Google::Cloud::Error.from_error(e)
@@ -2243,7 +2256,6 @@ module Google
2243
2256
 
2244
2257
  @backup_dr_stub.get_backup_plan request, options do |result, operation|
2245
2258
  yield result, operation if block_given?
2246
- return result
2247
2259
  end
2248
2260
  rescue ::Gapic::Rest::Error => e
2249
2261
  raise ::Google::Cloud::Error.from_error(e)
@@ -2348,7 +2360,6 @@ module Google
2348
2360
 
2349
2361
  @backup_dr_stub.list_backup_plans request, options do |result, operation|
2350
2362
  yield result, operation if block_given?
2351
- return result
2352
2363
  end
2353
2364
  rescue ::Gapic::Rest::Error => e
2354
2365
  raise ::Google::Cloud::Error.from_error(e)
@@ -2451,7 +2462,7 @@ module Google
2451
2462
  @backup_dr_stub.delete_backup_plan request, options do |result, operation|
2452
2463
  result = ::Gapic::Operation.new result, @operations_client, options: options
2453
2464
  yield result, operation if block_given?
2454
- return result
2465
+ throw :response, result
2455
2466
  end
2456
2467
  rescue ::Gapic::Rest::Error => e
2457
2468
  raise ::Google::Cloud::Error.from_error(e)
@@ -2559,7 +2570,7 @@ module Google
2559
2570
  @backup_dr_stub.create_backup_plan_association request, options do |result, operation|
2560
2571
  result = ::Gapic::Operation.new result, @operations_client, options: options
2561
2572
  yield result, operation if block_given?
2562
- return result
2573
+ throw :response, result
2563
2574
  end
2564
2575
  rescue ::Gapic::Rest::Error => e
2565
2576
  raise ::Google::Cloud::Error.from_error(e)
@@ -2639,7 +2650,6 @@ module Google
2639
2650
 
2640
2651
  @backup_dr_stub.get_backup_plan_association request, options do |result, operation|
2641
2652
  yield result, operation if block_given?
2642
- return result
2643
2653
  end
2644
2654
  rescue ::Gapic::Rest::Error => e
2645
2655
  raise ::Google::Cloud::Error.from_error(e)
@@ -2734,7 +2744,6 @@ module Google
2734
2744
 
2735
2745
  @backup_dr_stub.list_backup_plan_associations request, options do |result, operation|
2736
2746
  yield result, operation if block_given?
2737
- return result
2738
2747
  end
2739
2748
  rescue ::Gapic::Rest::Error => e
2740
2749
  raise ::Google::Cloud::Error.from_error(e)
@@ -2836,7 +2845,7 @@ module Google
2836
2845
  @backup_dr_stub.delete_backup_plan_association request, options do |result, operation|
2837
2846
  result = ::Gapic::Operation.new result, @operations_client, options: options
2838
2847
  yield result, operation if block_given?
2839
- return result
2848
+ throw :response, result
2840
2849
  end
2841
2850
  rescue ::Gapic::Rest::Error => e
2842
2851
  raise ::Google::Cloud::Error.from_error(e)
@@ -2940,7 +2949,7 @@ module Google
2940
2949
  @backup_dr_stub.trigger_backup request, options do |result, operation|
2941
2950
  result = ::Gapic::Operation.new result, @operations_client, options: options
2942
2951
  yield result, operation if block_given?
2943
- return result
2952
+ throw :response, result
2944
2953
  end
2945
2954
  rescue ::Gapic::Rest::Error => e
2946
2955
  raise ::Google::Cloud::Error.from_error(e)
@@ -3020,6 +3029,11 @@ module Google
3020
3029
  # default endpoint URL. The default value of nil uses the environment
3021
3030
  # universe (usually the default "googleapis.com" universe).
3022
3031
  # @return [::String,nil]
3032
+ # @!attribute [rw] logger
3033
+ # A custom logger to use for request/response debug logging, or the value
3034
+ # `:default` (the default) to construct a default logger, or `nil` to
3035
+ # explicitly disable logging.
3036
+ # @return [::Logger,:default,nil]
3023
3037
  #
3024
3038
  class Configuration
3025
3039
  extend ::Gapic::Config
@@ -3048,6 +3062,7 @@ module Google
3048
3062
  # by the host service.
3049
3063
  # @return [::Hash{::Symbol=>::Array<::Gapic::Rest::GrpcTranscoder::HttpBinding>}]
3050
3064
  config_attr :bindings_override, {}, ::Hash, nil
3065
+ config_attr :logger, :default, ::Logger, nil, :default
3051
3066
 
3052
3067
  # @private
3053
3068
  def initialize parent_config = nil
@@ -196,7 +196,7 @@ module Google
196
196
  @operations_stub.list_operations request, options do |result, operation|
197
197
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
198
198
  yield result, operation if block_given?
199
- return result
199
+ throw :response, result
200
200
  end
201
201
  rescue ::Gapic::Rest::Error => e
202
202
  raise ::Google::Cloud::Error.from_error(e)
@@ -285,7 +285,7 @@ module Google
285
285
  @operations_stub.get_operation request, options do |result, operation|
286
286
  result = ::Gapic::Operation.new result, @operations_client, options: options
287
287
  yield result, operation if block_given?
288
- return result
288
+ throw :response, result
289
289
  end
290
290
  rescue ::Gapic::Rest::Error => e
291
291
  raise ::Google::Cloud::Error.from_error(e)
@@ -367,7 +367,6 @@ module Google
367
367
 
368
368
  @operations_stub.delete_operation request, options do |result, operation|
369
369
  yield result, operation if block_given?
370
- return result
371
370
  end
372
371
  rescue ::Gapic::Rest::Error => e
373
372
  raise ::Google::Cloud::Error.from_error(e)
@@ -456,7 +455,6 @@ module Google
456
455
 
457
456
  @operations_stub.cancel_operation request, options do |result, operation|
458
457
  yield result, operation if block_given?
459
- return result
460
458
  end
461
459
  rescue ::Gapic::Rest::Error => e
462
460
  raise ::Google::Cloud::Error.from_error(e)
@@ -536,6 +534,11 @@ module Google
536
534
  # default endpoint URL. The default value of nil uses the environment
537
535
  # universe (usually the default "googleapis.com" universe).
538
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]
539
542
  #
540
543
  class Configuration
541
544
  extend ::Gapic::Config
@@ -557,6 +560,7 @@ module Google
557
560
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
558
561
  config_attr :quota_project, nil, ::String, nil
559
562
  config_attr :universe_domain, nil, ::String, nil
563
+ config_attr :logger, :default, ::Logger, nil, :default
560
564
 
561
565
  # @private
562
566
  def initialize parent_config = nil
@@ -676,16 +680,18 @@ module Google
676
680
 
677
681
  response = @client_stub.make_http_request(
678
682
  verb,
679
- uri: uri,
680
- body: body || "",
681
- params: query_string_params,
683
+ uri: uri,
684
+ body: body || "",
685
+ params: query_string_params,
686
+ method_name: "list_operations",
682
687
  options: options
683
688
  )
684
689
  operation = ::Gapic::Rest::TransportOperation.new response
685
690
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
686
-
687
- yield result, operation if block_given?
688
- result
691
+ catch :response do
692
+ yield result, operation if block_given?
693
+ result
694
+ end
689
695
  end
690
696
 
691
697
  ##
@@ -714,16 +720,18 @@ module Google
714
720
 
715
721
  response = @client_stub.make_http_request(
716
722
  verb,
717
- uri: uri,
718
- body: body || "",
719
- params: query_string_params,
723
+ uri: uri,
724
+ body: body || "",
725
+ params: query_string_params,
726
+ method_name: "get_operation",
720
727
  options: options
721
728
  )
722
729
  operation = ::Gapic::Rest::TransportOperation.new response
723
730
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
724
-
725
- yield result, operation if block_given?
726
- result
731
+ catch :response do
732
+ yield result, operation if block_given?
733
+ result
734
+ end
727
735
  end
728
736
 
729
737
  ##
@@ -752,16 +760,18 @@ module Google
752
760
 
753
761
  response = @client_stub.make_http_request(
754
762
  verb,
755
- uri: uri,
756
- body: body || "",
757
- params: query_string_params,
763
+ uri: uri,
764
+ body: body || "",
765
+ params: query_string_params,
766
+ method_name: "delete_operation",
758
767
  options: options
759
768
  )
760
769
  operation = ::Gapic::Rest::TransportOperation.new response
761
770
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
762
-
763
- yield result, operation if block_given?
764
- result
771
+ catch :response do
772
+ yield result, operation if block_given?
773
+ result
774
+ end
765
775
  end
766
776
 
767
777
  ##
@@ -790,16 +800,18 @@ module Google
790
800
 
791
801
  response = @client_stub.make_http_request(
792
802
  verb,
793
- uri: uri,
794
- body: body || "",
795
- params: query_string_params,
803
+ uri: uri,
804
+ body: body || "",
805
+ params: query_string_params,
806
+ method_name: "cancel_operation",
796
807
  options: options
797
808
  )
798
809
  operation = ::Gapic::Rest::TransportOperation.new response
799
810
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
800
-
801
- yield result, operation if block_given?
802
- result
811
+ catch :response do
812
+ yield result, operation if block_given?
813
+ result
814
+ end
803
815
  end
804
816
 
805
817
  ##