google-cloud-spanner-admin-database-v1 1.2.1 → 1.3.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.
@@ -272,8 +272,19 @@ module Google
272
272
  endpoint: @config.endpoint,
273
273
  endpoint_template: DEFAULT_ENDPOINT_TEMPLATE,
274
274
  universe_domain: @config.universe_domain,
275
- credentials: credentials
275
+ credentials: credentials,
276
+ logger: @config.logger
276
277
  )
278
+
279
+ @database_admin_stub.logger(stub: true)&.info do |entry|
280
+ entry.set_system_name
281
+ entry.set_service
282
+ entry.message = "Created client for #{entry.service}"
283
+ entry.set_credentials_fields credentials
284
+ entry.set "customEndpoint", @config.endpoint if @config.endpoint
285
+ entry.set "defaultTimeout", @config.timeout if @config.timeout
286
+ entry.set "quotaProject", @quota_project_id if @quota_project_id
287
+ end
277
288
  end
278
289
 
279
290
  ##
@@ -283,6 +294,15 @@ module Google
283
294
  #
284
295
  attr_reader :operations_client
285
296
 
297
+ ##
298
+ # The logger used for request/response debug logging.
299
+ #
300
+ # @return [Logger]
301
+ #
302
+ def logger
303
+ @database_admin_stub.logger
304
+ end
305
+
286
306
  # Service calls
287
307
 
288
308
  ##
@@ -372,7 +392,7 @@ module Google
372
392
  @database_admin_stub.list_databases request, options do |result, operation|
373
393
  result = ::Gapic::Rest::PagedEnumerable.new @database_admin_stub, :list_databases, "databases", request, result, options
374
394
  yield result, operation if block_given?
375
- return result
395
+ throw :response, result
376
396
  end
377
397
  rescue ::Gapic::Rest::Error => e
378
398
  raise ::Google::Cloud::Error.from_error(e)
@@ -500,7 +520,7 @@ module Google
500
520
  @database_admin_stub.create_database request, options do |result, operation|
501
521
  result = ::Gapic::Operation.new result, @operations_client, options: options
502
522
  yield result, operation if block_given?
503
- return result
523
+ throw :response, result
504
524
  end
505
525
  rescue ::Gapic::Rest::Error => e
506
526
  raise ::Google::Cloud::Error.from_error(e)
@@ -580,7 +600,6 @@ module Google
580
600
 
581
601
  @database_admin_stub.get_database request, options do |result, operation|
582
602
  yield result, operation if block_given?
583
- return result
584
603
  end
585
604
  rescue ::Gapic::Rest::Error => e
586
605
  raise ::Google::Cloud::Error.from_error(e)
@@ -707,7 +726,7 @@ module Google
707
726
  @database_admin_stub.update_database request, options do |result, operation|
708
727
  result = ::Gapic::Operation.new result, @operations_client, options: options
709
728
  yield result, operation if block_given?
710
- return result
729
+ throw :response, result
711
730
  end
712
731
  rescue ::Gapic::Rest::Error => e
713
732
  raise ::Google::Cloud::Error.from_error(e)
@@ -840,7 +859,7 @@ module Google
840
859
  @database_admin_stub.update_database_ddl request, options do |result, operation|
841
860
  result = ::Gapic::Operation.new result, @operations_client, options: options
842
861
  yield result, operation if block_given?
843
- return result
862
+ throw :response, result
844
863
  end
845
864
  rescue ::Gapic::Rest::Error => e
846
865
  raise ::Google::Cloud::Error.from_error(e)
@@ -923,7 +942,6 @@ module Google
923
942
 
924
943
  @database_admin_stub.drop_database request, options do |result, operation|
925
944
  yield result, operation if block_given?
926
- return result
927
945
  end
928
946
  rescue ::Gapic::Rest::Error => e
929
947
  raise ::Google::Cloud::Error.from_error(e)
@@ -1006,7 +1024,6 @@ module Google
1006
1024
 
1007
1025
  @database_admin_stub.get_database_ddl request, options do |result, operation|
1008
1026
  yield result, operation if block_given?
1009
- return result
1010
1027
  end
1011
1028
  rescue ::Gapic::Rest::Error => e
1012
1029
  raise ::Google::Cloud::Error.from_error(e)
@@ -1103,7 +1120,6 @@ module Google
1103
1120
 
1104
1121
  @database_admin_stub.set_iam_policy request, options do |result, operation|
1105
1122
  yield result, operation if block_given?
1106
- return result
1107
1123
  end
1108
1124
  rescue ::Gapic::Rest::Error => e
1109
1125
  raise ::Google::Cloud::Error.from_error(e)
@@ -1193,7 +1209,6 @@ module Google
1193
1209
 
1194
1210
  @database_admin_stub.get_iam_policy request, options do |result, operation|
1195
1211
  yield result, operation if block_given?
1196
- return result
1197
1212
  end
1198
1213
  rescue ::Gapic::Rest::Error => e
1199
1214
  raise ::Google::Cloud::Error.from_error(e)
@@ -1287,7 +1302,6 @@ module Google
1287
1302
 
1288
1303
  @database_admin_stub.test_iam_permissions request, options do |result, operation|
1289
1304
  yield result, operation if block_given?
1290
- return result
1291
1305
  end
1292
1306
  rescue ::Gapic::Rest::Error => e
1293
1307
  raise ::Google::Cloud::Error.from_error(e)
@@ -1402,7 +1416,7 @@ module Google
1402
1416
  @database_admin_stub.create_backup request, options do |result, operation|
1403
1417
  result = ::Gapic::Operation.new result, @operations_client, options: options
1404
1418
  yield result, operation if block_given?
1405
- return result
1419
+ throw :response, result
1406
1420
  end
1407
1421
  rescue ::Gapic::Rest::Error => e
1408
1422
  raise ::Google::Cloud::Error.from_error(e)
@@ -1525,7 +1539,7 @@ module Google
1525
1539
  @database_admin_stub.copy_backup request, options do |result, operation|
1526
1540
  result = ::Gapic::Operation.new result, @operations_client, options: options
1527
1541
  yield result, operation if block_given?
1528
- return result
1542
+ throw :response, result
1529
1543
  end
1530
1544
  rescue ::Gapic::Rest::Error => e
1531
1545
  raise ::Google::Cloud::Error.from_error(e)
@@ -1607,7 +1621,6 @@ module Google
1607
1621
 
1608
1622
  @database_admin_stub.get_backup request, options do |result, operation|
1609
1623
  yield result, operation if block_given?
1610
- return result
1611
1624
  end
1612
1625
  rescue ::Gapic::Rest::Error => e
1613
1626
  raise ::Google::Cloud::Error.from_error(e)
@@ -1696,7 +1709,6 @@ module Google
1696
1709
 
1697
1710
  @database_admin_stub.update_backup request, options do |result, operation|
1698
1711
  yield result, operation if block_given?
1699
- return result
1700
1712
  end
1701
1713
  rescue ::Gapic::Rest::Error => e
1702
1714
  raise ::Google::Cloud::Error.from_error(e)
@@ -1778,7 +1790,6 @@ module Google
1778
1790
 
1779
1791
  @database_admin_stub.delete_backup request, options do |result, operation|
1780
1792
  yield result, operation if block_given?
1781
- return result
1782
1793
  end
1783
1794
  rescue ::Gapic::Rest::Error => e
1784
1795
  raise ::Google::Cloud::Error.from_error(e)
@@ -1915,7 +1926,7 @@ module Google
1915
1926
  @database_admin_stub.list_backups request, options do |result, operation|
1916
1927
  result = ::Gapic::Rest::PagedEnumerable.new @database_admin_stub, :list_backups, "backups", request, result, options
1917
1928
  yield result, operation if block_given?
1918
- return result
1929
+ throw :response, result
1919
1930
  end
1920
1931
  rescue ::Gapic::Rest::Error => e
1921
1932
  raise ::Google::Cloud::Error.from_error(e)
@@ -2037,7 +2048,7 @@ module Google
2037
2048
  @database_admin_stub.restore_database request, options do |result, operation|
2038
2049
  result = ::Gapic::Operation.new result, @operations_client, options: options
2039
2050
  yield result, operation if block_given?
2040
- return result
2051
+ throw :response, result
2041
2052
  end
2042
2053
  rescue ::Gapic::Rest::Error => e
2043
2054
  raise ::Google::Cloud::Error.from_error(e)
@@ -2184,7 +2195,7 @@ module Google
2184
2195
  @database_admin_stub.list_database_operations request, options do |result, operation|
2185
2196
  result = ::Gapic::Rest::PagedEnumerable.new @database_admin_stub, :list_database_operations, "operations", request, result, options
2186
2197
  yield result, operation if block_given?
2187
- return result
2198
+ throw :response, result
2188
2199
  end
2189
2200
  rescue ::Gapic::Rest::Error => e
2190
2201
  raise ::Google::Cloud::Error.from_error(e)
@@ -2358,7 +2369,7 @@ module Google
2358
2369
  @database_admin_stub.list_backup_operations request, options do |result, operation|
2359
2370
  result = ::Gapic::Rest::PagedEnumerable.new @database_admin_stub, :list_backup_operations, "operations", request, result, options
2360
2371
  yield result, operation if block_given?
2361
- return result
2372
+ throw :response, result
2362
2373
  end
2363
2374
  rescue ::Gapic::Rest::Error => e
2364
2375
  raise ::Google::Cloud::Error.from_error(e)
@@ -2452,7 +2463,7 @@ module Google
2452
2463
  @database_admin_stub.list_database_roles request, options do |result, operation|
2453
2464
  result = ::Gapic::Rest::PagedEnumerable.new @database_admin_stub, :list_database_roles, "database_roles", request, result, options
2454
2465
  yield result, operation if block_given?
2455
- return result
2466
+ throw :response, result
2456
2467
  end
2457
2468
  rescue ::Gapic::Rest::Error => e
2458
2469
  raise ::Google::Cloud::Error.from_error(e)
@@ -2537,7 +2548,6 @@ module Google
2537
2548
 
2538
2549
  @database_admin_stub.create_backup_schedule request, options do |result, operation|
2539
2550
  yield result, operation if block_given?
2540
- return result
2541
2551
  end
2542
2552
  rescue ::Gapic::Rest::Error => e
2543
2553
  raise ::Google::Cloud::Error.from_error(e)
@@ -2618,7 +2628,6 @@ module Google
2618
2628
 
2619
2629
  @database_admin_stub.get_backup_schedule request, options do |result, operation|
2620
2630
  yield result, operation if block_given?
2621
- return result
2622
2631
  end
2623
2632
  rescue ::Gapic::Rest::Error => e
2624
2633
  raise ::Google::Cloud::Error.from_error(e)
@@ -2705,7 +2714,6 @@ module Google
2705
2714
 
2706
2715
  @database_admin_stub.update_backup_schedule request, options do |result, operation|
2707
2716
  yield result, operation if block_given?
2708
- return result
2709
2717
  end
2710
2718
  rescue ::Gapic::Rest::Error => e
2711
2719
  raise ::Google::Cloud::Error.from_error(e)
@@ -2786,7 +2794,6 @@ module Google
2786
2794
 
2787
2795
  @database_admin_stub.delete_backup_schedule request, options do |result, operation|
2788
2796
  yield result, operation if block_given?
2789
- return result
2790
2797
  end
2791
2798
  rescue ::Gapic::Rest::Error => e
2792
2799
  raise ::Google::Cloud::Error.from_error(e)
@@ -2881,7 +2888,7 @@ module Google
2881
2888
  @database_admin_stub.list_backup_schedules request, options do |result, operation|
2882
2889
  result = ::Gapic::Rest::PagedEnumerable.new @database_admin_stub, :list_backup_schedules, "backup_schedules", request, result, options
2883
2890
  yield result, operation if block_given?
2884
- return result
2891
+ throw :response, result
2885
2892
  end
2886
2893
  rescue ::Gapic::Rest::Error => e
2887
2894
  raise ::Google::Cloud::Error.from_error(e)
@@ -2961,6 +2968,11 @@ module Google
2961
2968
  # default endpoint URL. The default value of nil uses the environment
2962
2969
  # universe (usually the default "googleapis.com" universe).
2963
2970
  # @return [::String,nil]
2971
+ # @!attribute [rw] logger
2972
+ # A custom logger to use for request/response debug logging, or the value
2973
+ # `:default` (the default) to construct a default logger, or `nil` to
2974
+ # explicitly disable logging.
2975
+ # @return [::Logger,:default,nil]
2964
2976
  #
2965
2977
  class Configuration
2966
2978
  extend ::Gapic::Config
@@ -2982,6 +2994,7 @@ module Google
2982
2994
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
2983
2995
  config_attr :quota_project, nil, ::String, nil
2984
2996
  config_attr :universe_domain, nil, ::String, nil
2997
+ config_attr :logger, :default, ::Logger, nil, :default
2985
2998
 
2986
2999
  # @private
2987
3000
  def initialize parent_config = nil
@@ -117,14 +117,6 @@ module Google
117
117
  # Lists operations that match the specified filter in the request. If the
118
118
  # server doesn't support this method, it returns `UNIMPLEMENTED`.
119
119
  #
120
- # NOTE: the `name` binding allows API services to override the binding
121
- # to use different resource name schemes, such as `users/*/operations`. To
122
- # override the binding, API services can add a binding such as
123
- # `"/v1/{name=users/*}/operations"` to their service configuration.
124
- # For backwards compatibility, the default name includes the operations
125
- # collection id, however overriding users must ensure the name binding
126
- # is the parent resource, without the operations collection id.
127
- #
128
120
  # @overload list_operations(request, options = nil)
129
121
  # Pass arguments to `list_operations` via a request object, either of type
130
122
  # {::Google::Longrunning::ListOperationsRequest} or an equivalent Hash.
@@ -206,7 +198,7 @@ module Google
206
198
  @operations_stub.list_operations request, options do |result, operation|
207
199
  result = ::Gapic::Rest::PagedEnumerable.new @operations_stub, :list_operations, "operations", request, result, options
208
200
  yield result, operation if block_given?
209
- return result
201
+ throw :response, result
210
202
  end
211
203
  rescue ::Gapic::Rest::Error => e
212
204
  raise ::Google::Cloud::Error.from_error(e)
@@ -295,7 +287,7 @@ module Google
295
287
  @operations_stub.get_operation request, options do |result, operation|
296
288
  result = ::Gapic::Operation.new result, @operations_client, options: options
297
289
  yield result, operation if block_given?
298
- return result
290
+ throw :response, result
299
291
  end
300
292
  rescue ::Gapic::Rest::Error => e
301
293
  raise ::Google::Cloud::Error.from_error(e)
@@ -377,7 +369,6 @@ module Google
377
369
 
378
370
  @operations_stub.delete_operation request, options do |result, operation|
379
371
  yield result, operation if block_given?
380
- return result
381
372
  end
382
373
  rescue ::Gapic::Rest::Error => e
383
374
  raise ::Google::Cloud::Error.from_error(e)
@@ -392,8 +383,9 @@ module Google
392
383
  # other methods to check whether the cancellation succeeded or whether the
393
384
  # operation completed despite cancellation. On successful cancellation,
394
385
  # the operation is not deleted; instead, it becomes an operation with
395
- # an {::Google::Longrunning::Operation#error Operation.error} value with a {::Google::Rpc::Status#code google.rpc.Status.code} of 1,
396
- # corresponding to `Code.CANCELLED`.
386
+ # an {::Google::Longrunning::Operation#error Operation.error} value with a
387
+ # {::Google::Rpc::Status#code google.rpc.Status.code} of `1`, corresponding to
388
+ # `Code.CANCELLED`.
397
389
  #
398
390
  # @overload cancel_operation(request, options = nil)
399
391
  # Pass arguments to `cancel_operation` via a request object, either of type
@@ -465,7 +457,6 @@ module Google
465
457
 
466
458
  @operations_stub.cancel_operation request, options do |result, operation|
467
459
  yield result, operation if block_given?
468
- return result
469
460
  end
470
461
  rescue ::Gapic::Rest::Error => e
471
462
  raise ::Google::Cloud::Error.from_error(e)
@@ -545,6 +536,11 @@ module Google
545
536
  # default endpoint URL. The default value of nil uses the environment
546
537
  # universe (usually the default "googleapis.com" universe).
547
538
  # @return [::String,nil]
539
+ # @!attribute [rw] logger
540
+ # A custom logger to use for request/response debug logging, or the value
541
+ # `:default` (the default) to construct a default logger, or `nil` to
542
+ # explicitly disable logging.
543
+ # @return [::Logger,:default,nil]
548
544
  #
549
545
  class Configuration
550
546
  extend ::Gapic::Config
@@ -566,6 +562,7 @@ module Google
566
562
  config_attr :retry_policy, nil, ::Hash, ::Proc, nil
567
563
  config_attr :quota_project, nil, ::String, nil
568
564
  config_attr :universe_domain, nil, ::String, nil
565
+ config_attr :logger, :default, ::Logger, nil, :default
569
566
 
570
567
  # @private
571
568
  def initialize parent_config = nil
@@ -685,16 +682,18 @@ module Google
685
682
 
686
683
  response = @client_stub.make_http_request(
687
684
  verb,
688
- uri: uri,
689
- body: body || "",
690
- params: query_string_params,
685
+ uri: uri,
686
+ body: body || "",
687
+ params: query_string_params,
688
+ method_name: "list_operations",
691
689
  options: options
692
690
  )
693
691
  operation = ::Gapic::Rest::TransportOperation.new response
694
692
  result = ::Google::Longrunning::ListOperationsResponse.decode_json response.body, ignore_unknown_fields: true
695
-
696
- yield result, operation if block_given?
697
- result
693
+ catch :response do
694
+ yield result, operation if block_given?
695
+ result
696
+ end
698
697
  end
699
698
 
700
699
  ##
@@ -723,16 +722,18 @@ module Google
723
722
 
724
723
  response = @client_stub.make_http_request(
725
724
  verb,
726
- uri: uri,
727
- body: body || "",
728
- params: query_string_params,
725
+ uri: uri,
726
+ body: body || "",
727
+ params: query_string_params,
728
+ method_name: "get_operation",
729
729
  options: options
730
730
  )
731
731
  operation = ::Gapic::Rest::TransportOperation.new response
732
732
  result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true
733
-
734
- yield result, operation if block_given?
735
- result
733
+ catch :response do
734
+ yield result, operation if block_given?
735
+ result
736
+ end
736
737
  end
737
738
 
738
739
  ##
@@ -761,16 +762,18 @@ module Google
761
762
 
762
763
  response = @client_stub.make_http_request(
763
764
  verb,
764
- uri: uri,
765
- body: body || "",
766
- params: query_string_params,
765
+ uri: uri,
766
+ body: body || "",
767
+ params: query_string_params,
768
+ method_name: "delete_operation",
767
769
  options: options
768
770
  )
769
771
  operation = ::Gapic::Rest::TransportOperation.new response
770
772
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
771
-
772
- yield result, operation if block_given?
773
- result
773
+ catch :response do
774
+ yield result, operation if block_given?
775
+ result
776
+ end
774
777
  end
775
778
 
776
779
  ##
@@ -799,16 +802,18 @@ module Google
799
802
 
800
803
  response = @client_stub.make_http_request(
801
804
  verb,
802
- uri: uri,
803
- body: body || "",
804
- params: query_string_params,
805
+ uri: uri,
806
+ body: body || "",
807
+ params: query_string_params,
808
+ method_name: "cancel_operation",
805
809
  options: options
806
810
  )
807
811
  operation = ::Gapic::Rest::TransportOperation.new response
808
812
  result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true
809
-
810
- yield result, operation if block_given?
811
- result
813
+ catch :response do
814
+ yield result, operation if block_given?
815
+ result
816
+ end
812
817
  end
813
818
 
814
819
  ##