google-cloud-spanner-admin-database-v1 0.7.1 → 0.7.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -48,13 +48,12 @@ module Google
48
48
  # See {::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client::Configuration}
49
49
  # for a description of the configuration fields.
50
50
  #
51
- # ## Example
51
+ # @example
52
52
  #
53
- # To modify the configuration for all DatabaseAdmin clients:
54
- #
55
- # ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.configure do |config|
56
- # config.timeout = 10.0
57
- # end
53
+ # # Modify the configuration for all DatabaseAdmin clients
54
+ # ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.configure do |config|
55
+ # config.timeout = 10.0
56
+ # end
58
57
  #
59
58
  # @yield [config] Configure the Client client.
60
59
  # @yieldparam config [Client::Configuration]
@@ -171,19 +170,15 @@ module Google
171
170
  ##
172
171
  # Create a new DatabaseAdmin client object.
173
172
  #
174
- # ## Examples
175
- #
176
- # To create a new DatabaseAdmin client with the default
177
- # configuration:
178
- #
179
- # client = ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
173
+ # @example
180
174
  #
181
- # To create a new DatabaseAdmin client with a custom
182
- # configuration:
175
+ # # Create a client using the default configuration
176
+ # client = ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
183
177
  #
184
- # client = ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new do |config|
185
- # config.timeout = 10.0
186
- # end
178
+ # # Create a client using a custom configuration
179
+ # client = ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new do |config|
180
+ # config.timeout = 10.0
181
+ # end
187
182
  #
188
183
  # @yield [config] Configure the DatabaseAdmin client.
189
184
  # @yieldparam config [Client::Configuration]
@@ -203,10 +198,9 @@ module Google
203
198
 
204
199
  # Create credentials
205
200
  credentials = @config.credentials
206
- # Use self-signed JWT if the scope and endpoint are unchanged from default,
201
+ # Use self-signed JWT if the endpoint is unchanged from default,
207
202
  # but only if the default endpoint does not have a region prefix.
208
- enable_self_signed_jwt = @config.scope == Client.configure.scope &&
209
- @config.endpoint == Client.configure.endpoint &&
203
+ enable_self_signed_jwt = @config.endpoint == Client.configure.endpoint &&
210
204
  !@config.endpoint.split(".").first.include?("-")
211
205
  credentials ||= Credentials.default scope: @config.scope,
212
206
  enable_self_signed_jwt: enable_self_signed_jwt
@@ -218,6 +212,7 @@ module Google
218
212
 
219
213
  @operations_client = Operations.new do |config|
220
214
  config.credentials = credentials
215
+ config.quota_project = @quota_project_id
221
216
  config.endpoint = @config.endpoint
222
217
  end
223
218
 
@@ -276,6 +271,27 @@ module Google
276
271
  #
277
272
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
278
273
  #
274
+ # @example Basic example
275
+ # require "google/cloud/spanner/admin/database/v1"
276
+ #
277
+ # # Create a client object. The client can be reused for multiple calls.
278
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
279
+ #
280
+ # # Create a request. To set request fields, pass in keyword arguments.
281
+ # request = Google::Cloud::Spanner::Admin::Database::V1::ListDatabasesRequest.new
282
+ #
283
+ # # Call the list_databases method.
284
+ # result = client.list_databases request
285
+ #
286
+ # # The returned object is of type Gapic::PagedEnumerable. You can
287
+ # # iterate over all elements by calling #each, and the enumerable
288
+ # # will lazily make API calls to fetch subsequent pages. Other
289
+ # # methods are also available for managing paging directly.
290
+ # result.each do |response|
291
+ # # Each element is of type ::Google::Cloud::Spanner::Admin::Database::V1::Database.
292
+ # p response
293
+ # end
294
+ #
279
295
  def list_databases request, options = nil
280
296
  raise ::ArgumentError, "request must be provided" if request.nil?
281
297
 
@@ -293,16 +309,20 @@ module Google
293
309
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
294
310
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
295
311
 
296
- header_params = {
297
- "parent" => request.parent
298
- }
312
+ header_params = {}
313
+ if request.parent
314
+ header_params["parent"] = request.parent
315
+ end
316
+
299
317
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
300
318
  metadata[:"x-goog-request-params"] ||= request_params_header
301
319
 
302
320
  options.apply_defaults timeout: @config.rpcs.list_databases.timeout,
303
321
  metadata: metadata,
304
322
  retry_policy: @config.rpcs.list_databases.retry_policy
305
- options.apply_defaults metadata: @config.metadata,
323
+
324
+ options.apply_defaults timeout: @config.timeout,
325
+ metadata: @config.metadata,
306
326
  retry_policy: @config.retry_policy
307
327
 
308
328
  @database_admin_stub.call_rpc :list_databases, request, options: options do |response, operation|
@@ -366,6 +386,28 @@ module Google
366
386
  #
367
387
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
368
388
  #
389
+ # @example Basic example
390
+ # require "google/cloud/spanner/admin/database/v1"
391
+ #
392
+ # # Create a client object. The client can be reused for multiple calls.
393
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
394
+ #
395
+ # # Create a request. To set request fields, pass in keyword arguments.
396
+ # request = Google::Cloud::Spanner::Admin::Database::V1::CreateDatabaseRequest.new
397
+ #
398
+ # # Call the create_database method.
399
+ # result = client.create_database request
400
+ #
401
+ # # The returned object is of type Gapic::Operation. You can use this
402
+ # # object to check the status of an operation, cancel it, or wait
403
+ # # for results. Here is how to block until completion:
404
+ # result.wait_until_done! timeout: 60
405
+ # if result.response?
406
+ # p result.response
407
+ # else
408
+ # puts "Error!"
409
+ # end
410
+ #
369
411
  def create_database request, options = nil
370
412
  raise ::ArgumentError, "request must be provided" if request.nil?
371
413
 
@@ -383,16 +425,20 @@ module Google
383
425
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
384
426
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
385
427
 
386
- header_params = {
387
- "parent" => request.parent
388
- }
428
+ header_params = {}
429
+ if request.parent
430
+ header_params["parent"] = request.parent
431
+ end
432
+
389
433
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
390
434
  metadata[:"x-goog-request-params"] ||= request_params_header
391
435
 
392
436
  options.apply_defaults timeout: @config.rpcs.create_database.timeout,
393
437
  metadata: metadata,
394
438
  retry_policy: @config.rpcs.create_database.retry_policy
395
- options.apply_defaults metadata: @config.metadata,
439
+
440
+ options.apply_defaults timeout: @config.timeout,
441
+ metadata: @config.metadata,
396
442
  retry_policy: @config.retry_policy
397
443
 
398
444
  @database_admin_stub.call_rpc :create_database, request, options: options do |response, operation|
@@ -434,6 +480,21 @@ module Google
434
480
  #
435
481
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
436
482
  #
483
+ # @example Basic example
484
+ # require "google/cloud/spanner/admin/database/v1"
485
+ #
486
+ # # Create a client object. The client can be reused for multiple calls.
487
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
488
+ #
489
+ # # Create a request. To set request fields, pass in keyword arguments.
490
+ # request = Google::Cloud::Spanner::Admin::Database::V1::GetDatabaseRequest.new
491
+ #
492
+ # # Call the get_database method.
493
+ # result = client.get_database request
494
+ #
495
+ # # The returned object is of type Google::Cloud::Spanner::Admin::Database::V1::Database.
496
+ # p result
497
+ #
437
498
  def get_database request, options = nil
438
499
  raise ::ArgumentError, "request must be provided" if request.nil?
439
500
 
@@ -451,16 +512,20 @@ module Google
451
512
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
452
513
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
453
514
 
454
- header_params = {
455
- "name" => request.name
456
- }
515
+ header_params = {}
516
+ if request.name
517
+ header_params["name"] = request.name
518
+ end
519
+
457
520
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
458
521
  metadata[:"x-goog-request-params"] ||= request_params_header
459
522
 
460
523
  options.apply_defaults timeout: @config.rpcs.get_database.timeout,
461
524
  metadata: metadata,
462
525
  retry_policy: @config.rpcs.get_database.retry_policy
463
- options.apply_defaults metadata: @config.metadata,
526
+
527
+ options.apply_defaults timeout: @config.timeout,
528
+ metadata: @config.metadata,
464
529
  retry_policy: @config.retry_policy
465
530
 
466
531
  @database_admin_stub.call_rpc :get_database, request, options: options do |response, operation|
@@ -528,6 +593,28 @@ module Google
528
593
  #
529
594
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
530
595
  #
596
+ # @example Basic example
597
+ # require "google/cloud/spanner/admin/database/v1"
598
+ #
599
+ # # Create a client object. The client can be reused for multiple calls.
600
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
601
+ #
602
+ # # Create a request. To set request fields, pass in keyword arguments.
603
+ # request = Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseDdlRequest.new
604
+ #
605
+ # # Call the update_database_ddl method.
606
+ # result = client.update_database_ddl request
607
+ #
608
+ # # The returned object is of type Gapic::Operation. You can use this
609
+ # # object to check the status of an operation, cancel it, or wait
610
+ # # for results. Here is how to block until completion:
611
+ # result.wait_until_done! timeout: 60
612
+ # if result.response?
613
+ # p result.response
614
+ # else
615
+ # puts "Error!"
616
+ # end
617
+ #
531
618
  def update_database_ddl request, options = nil
532
619
  raise ::ArgumentError, "request must be provided" if request.nil?
533
620
 
@@ -545,16 +632,20 @@ module Google
545
632
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
546
633
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
547
634
 
548
- header_params = {
549
- "database" => request.database
550
- }
635
+ header_params = {}
636
+ if request.database
637
+ header_params["database"] = request.database
638
+ end
639
+
551
640
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
552
641
  metadata[:"x-goog-request-params"] ||= request_params_header
553
642
 
554
643
  options.apply_defaults timeout: @config.rpcs.update_database_ddl.timeout,
555
644
  metadata: metadata,
556
645
  retry_policy: @config.rpcs.update_database_ddl.retry_policy
557
- options.apply_defaults metadata: @config.metadata,
646
+
647
+ options.apply_defaults timeout: @config.timeout,
648
+ metadata: @config.metadata,
558
649
  retry_policy: @config.retry_policy
559
650
 
560
651
  @database_admin_stub.call_rpc :update_database_ddl, request, options: options do |response, operation|
@@ -597,6 +688,21 @@ module Google
597
688
  #
598
689
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
599
690
  #
691
+ # @example Basic example
692
+ # require "google/cloud/spanner/admin/database/v1"
693
+ #
694
+ # # Create a client object. The client can be reused for multiple calls.
695
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
696
+ #
697
+ # # Create a request. To set request fields, pass in keyword arguments.
698
+ # request = Google::Cloud::Spanner::Admin::Database::V1::DropDatabaseRequest.new
699
+ #
700
+ # # Call the drop_database method.
701
+ # result = client.drop_database request
702
+ #
703
+ # # The returned object is of type Google::Protobuf::Empty.
704
+ # p result
705
+ #
600
706
  def drop_database request, options = nil
601
707
  raise ::ArgumentError, "request must be provided" if request.nil?
602
708
 
@@ -614,16 +720,20 @@ module Google
614
720
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
615
721
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
616
722
 
617
- header_params = {
618
- "database" => request.database
619
- }
723
+ header_params = {}
724
+ if request.database
725
+ header_params["database"] = request.database
726
+ end
727
+
620
728
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
621
729
  metadata[:"x-goog-request-params"] ||= request_params_header
622
730
 
623
731
  options.apply_defaults timeout: @config.rpcs.drop_database.timeout,
624
732
  metadata: metadata,
625
733
  retry_policy: @config.rpcs.drop_database.retry_policy
626
- options.apply_defaults metadata: @config.metadata,
734
+
735
+ options.apply_defaults timeout: @config.timeout,
736
+ metadata: @config.metadata,
627
737
  retry_policy: @config.retry_policy
628
738
 
629
739
  @database_admin_stub.call_rpc :drop_database, request, options: options do |response, operation|
@@ -667,6 +777,21 @@ module Google
667
777
  #
668
778
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
669
779
  #
780
+ # @example Basic example
781
+ # require "google/cloud/spanner/admin/database/v1"
782
+ #
783
+ # # Create a client object. The client can be reused for multiple calls.
784
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
785
+ #
786
+ # # Create a request. To set request fields, pass in keyword arguments.
787
+ # request = Google::Cloud::Spanner::Admin::Database::V1::GetDatabaseDdlRequest.new
788
+ #
789
+ # # Call the get_database_ddl method.
790
+ # result = client.get_database_ddl request
791
+ #
792
+ # # The returned object is of type Google::Cloud::Spanner::Admin::Database::V1::GetDatabaseDdlResponse.
793
+ # p result
794
+ #
670
795
  def get_database_ddl request, options = nil
671
796
  raise ::ArgumentError, "request must be provided" if request.nil?
672
797
 
@@ -684,16 +809,20 @@ module Google
684
809
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
685
810
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
686
811
 
687
- header_params = {
688
- "database" => request.database
689
- }
812
+ header_params = {}
813
+ if request.database
814
+ header_params["database"] = request.database
815
+ end
816
+
690
817
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
691
818
  metadata[:"x-goog-request-params"] ||= request_params_header
692
819
 
693
820
  options.apply_defaults timeout: @config.rpcs.get_database_ddl.timeout,
694
821
  metadata: metadata,
695
822
  retry_policy: @config.rpcs.get_database_ddl.retry_policy
696
- options.apply_defaults metadata: @config.metadata,
823
+
824
+ options.apply_defaults timeout: @config.timeout,
825
+ metadata: @config.metadata,
697
826
  retry_policy: @config.retry_policy
698
827
 
699
828
  @database_admin_stub.call_rpc :get_database_ddl, request, options: options do |response, operation|
@@ -745,6 +874,21 @@ module Google
745
874
  #
746
875
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
747
876
  #
877
+ # @example Basic example
878
+ # require "google/cloud/spanner/admin/database/v1"
879
+ #
880
+ # # Create a client object. The client can be reused for multiple calls.
881
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
882
+ #
883
+ # # Create a request. To set request fields, pass in keyword arguments.
884
+ # request = Google::Iam::V1::SetIamPolicyRequest.new
885
+ #
886
+ # # Call the set_iam_policy method.
887
+ # result = client.set_iam_policy request
888
+ #
889
+ # # The returned object is of type Google::Iam::V1::Policy.
890
+ # p result
891
+ #
748
892
  def set_iam_policy request, options = nil
749
893
  raise ::ArgumentError, "request must be provided" if request.nil?
750
894
 
@@ -762,16 +906,20 @@ module Google
762
906
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
763
907
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
764
908
 
765
- header_params = {
766
- "resource" => request.resource
767
- }
909
+ header_params = {}
910
+ if request.resource
911
+ header_params["resource"] = request.resource
912
+ end
913
+
768
914
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
769
915
  metadata[:"x-goog-request-params"] ||= request_params_header
770
916
 
771
917
  options.apply_defaults timeout: @config.rpcs.set_iam_policy.timeout,
772
918
  metadata: metadata,
773
919
  retry_policy: @config.rpcs.set_iam_policy.retry_policy
774
- options.apply_defaults metadata: @config.metadata,
920
+
921
+ options.apply_defaults timeout: @config.timeout,
922
+ metadata: @config.metadata,
775
923
  retry_policy: @config.retry_policy
776
924
 
777
925
  @database_admin_stub.call_rpc :set_iam_policy, request, options: options do |response, operation|
@@ -822,6 +970,21 @@ module Google
822
970
  #
823
971
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
824
972
  #
973
+ # @example Basic example
974
+ # require "google/cloud/spanner/admin/database/v1"
975
+ #
976
+ # # Create a client object. The client can be reused for multiple calls.
977
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
978
+ #
979
+ # # Create a request. To set request fields, pass in keyword arguments.
980
+ # request = Google::Iam::V1::GetIamPolicyRequest.new
981
+ #
982
+ # # Call the get_iam_policy method.
983
+ # result = client.get_iam_policy request
984
+ #
985
+ # # The returned object is of type Google::Iam::V1::Policy.
986
+ # p result
987
+ #
825
988
  def get_iam_policy request, options = nil
826
989
  raise ::ArgumentError, "request must be provided" if request.nil?
827
990
 
@@ -839,16 +1002,20 @@ module Google
839
1002
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
840
1003
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
841
1004
 
842
- header_params = {
843
- "resource" => request.resource
844
- }
1005
+ header_params = {}
1006
+ if request.resource
1007
+ header_params["resource"] = request.resource
1008
+ end
1009
+
845
1010
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
846
1011
  metadata[:"x-goog-request-params"] ||= request_params_header
847
1012
 
848
1013
  options.apply_defaults timeout: @config.rpcs.get_iam_policy.timeout,
849
1014
  metadata: metadata,
850
1015
  retry_policy: @config.rpcs.get_iam_policy.retry_policy
851
- options.apply_defaults metadata: @config.metadata,
1016
+
1017
+ options.apply_defaults timeout: @config.timeout,
1018
+ metadata: @config.metadata,
852
1019
  retry_policy: @config.retry_policy
853
1020
 
854
1021
  @database_admin_stub.call_rpc :get_iam_policy, request, options: options do |response, operation|
@@ -903,6 +1070,21 @@ module Google
903
1070
  #
904
1071
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
905
1072
  #
1073
+ # @example Basic example
1074
+ # require "google/cloud/spanner/admin/database/v1"
1075
+ #
1076
+ # # Create a client object. The client can be reused for multiple calls.
1077
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
1078
+ #
1079
+ # # Create a request. To set request fields, pass in keyword arguments.
1080
+ # request = Google::Iam::V1::TestIamPermissionsRequest.new
1081
+ #
1082
+ # # Call the test_iam_permissions method.
1083
+ # result = client.test_iam_permissions request
1084
+ #
1085
+ # # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
1086
+ # p result
1087
+ #
906
1088
  def test_iam_permissions request, options = nil
907
1089
  raise ::ArgumentError, "request must be provided" if request.nil?
908
1090
 
@@ -920,16 +1102,20 @@ module Google
920
1102
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
921
1103
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
922
1104
 
923
- header_params = {
924
- "resource" => request.resource
925
- }
1105
+ header_params = {}
1106
+ if request.resource
1107
+ header_params["resource"] = request.resource
1108
+ end
1109
+
926
1110
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
927
1111
  metadata[:"x-goog-request-params"] ||= request_params_header
928
1112
 
929
1113
  options.apply_defaults timeout: @config.rpcs.test_iam_permissions.timeout,
930
1114
  metadata: metadata,
931
1115
  retry_policy: @config.rpcs.test_iam_permissions.retry_policy
932
- options.apply_defaults metadata: @config.metadata,
1116
+
1117
+ options.apply_defaults timeout: @config.timeout,
1118
+ metadata: @config.metadata,
933
1119
  retry_policy: @config.retry_policy
934
1120
 
935
1121
  @database_admin_stub.call_rpc :test_iam_permissions, request, options: options do |response, operation|
@@ -997,6 +1183,28 @@ module Google
997
1183
  #
998
1184
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
999
1185
  #
1186
+ # @example Basic example
1187
+ # require "google/cloud/spanner/admin/database/v1"
1188
+ #
1189
+ # # Create a client object. The client can be reused for multiple calls.
1190
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
1191
+ #
1192
+ # # Create a request. To set request fields, pass in keyword arguments.
1193
+ # request = Google::Cloud::Spanner::Admin::Database::V1::CreateBackupRequest.new
1194
+ #
1195
+ # # Call the create_backup method.
1196
+ # result = client.create_backup request
1197
+ #
1198
+ # # The returned object is of type Gapic::Operation. You can use this
1199
+ # # object to check the status of an operation, cancel it, or wait
1200
+ # # for results. Here is how to block until completion:
1201
+ # result.wait_until_done! timeout: 60
1202
+ # if result.response?
1203
+ # p result.response
1204
+ # else
1205
+ # puts "Error!"
1206
+ # end
1207
+ #
1000
1208
  def create_backup request, options = nil
1001
1209
  raise ::ArgumentError, "request must be provided" if request.nil?
1002
1210
 
@@ -1014,16 +1222,20 @@ module Google
1014
1222
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
1015
1223
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1016
1224
 
1017
- header_params = {
1018
- "parent" => request.parent
1019
- }
1225
+ header_params = {}
1226
+ if request.parent
1227
+ header_params["parent"] = request.parent
1228
+ end
1229
+
1020
1230
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1021
1231
  metadata[:"x-goog-request-params"] ||= request_params_header
1022
1232
 
1023
1233
  options.apply_defaults timeout: @config.rpcs.create_backup.timeout,
1024
1234
  metadata: metadata,
1025
1235
  retry_policy: @config.rpcs.create_backup.retry_policy
1026
- options.apply_defaults metadata: @config.metadata,
1236
+
1237
+ options.apply_defaults timeout: @config.timeout,
1238
+ metadata: @config.metadata,
1027
1239
  retry_policy: @config.retry_policy
1028
1240
 
1029
1241
  @database_admin_stub.call_rpc :create_backup, request, options: options do |response, operation|
@@ -1066,6 +1278,21 @@ module Google
1066
1278
  #
1067
1279
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1068
1280
  #
1281
+ # @example Basic example
1282
+ # require "google/cloud/spanner/admin/database/v1"
1283
+ #
1284
+ # # Create a client object. The client can be reused for multiple calls.
1285
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
1286
+ #
1287
+ # # Create a request. To set request fields, pass in keyword arguments.
1288
+ # request = Google::Cloud::Spanner::Admin::Database::V1::GetBackupRequest.new
1289
+ #
1290
+ # # Call the get_backup method.
1291
+ # result = client.get_backup request
1292
+ #
1293
+ # # The returned object is of type Google::Cloud::Spanner::Admin::Database::V1::Backup.
1294
+ # p result
1295
+ #
1069
1296
  def get_backup request, options = nil
1070
1297
  raise ::ArgumentError, "request must be provided" if request.nil?
1071
1298
 
@@ -1083,16 +1310,20 @@ module Google
1083
1310
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
1084
1311
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1085
1312
 
1086
- header_params = {
1087
- "name" => request.name
1088
- }
1313
+ header_params = {}
1314
+ if request.name
1315
+ header_params["name"] = request.name
1316
+ end
1317
+
1089
1318
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1090
1319
  metadata[:"x-goog-request-params"] ||= request_params_header
1091
1320
 
1092
1321
  options.apply_defaults timeout: @config.rpcs.get_backup.timeout,
1093
1322
  metadata: metadata,
1094
1323
  retry_policy: @config.rpcs.get_backup.retry_policy
1095
- options.apply_defaults metadata: @config.metadata,
1324
+
1325
+ options.apply_defaults timeout: @config.timeout,
1326
+ metadata: @config.metadata,
1096
1327
  retry_policy: @config.retry_policy
1097
1328
 
1098
1329
  @database_admin_stub.call_rpc :get_backup, request, options: options do |response, operation|
@@ -1141,6 +1372,21 @@ module Google
1141
1372
  #
1142
1373
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1143
1374
  #
1375
+ # @example Basic example
1376
+ # require "google/cloud/spanner/admin/database/v1"
1377
+ #
1378
+ # # Create a client object. The client can be reused for multiple calls.
1379
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
1380
+ #
1381
+ # # Create a request. To set request fields, pass in keyword arguments.
1382
+ # request = Google::Cloud::Spanner::Admin::Database::V1::UpdateBackupRequest.new
1383
+ #
1384
+ # # Call the update_backup method.
1385
+ # result = client.update_backup request
1386
+ #
1387
+ # # The returned object is of type Google::Cloud::Spanner::Admin::Database::V1::Backup.
1388
+ # p result
1389
+ #
1144
1390
  def update_backup request, options = nil
1145
1391
  raise ::ArgumentError, "request must be provided" if request.nil?
1146
1392
 
@@ -1158,16 +1404,20 @@ module Google
1158
1404
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
1159
1405
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1160
1406
 
1161
- header_params = {
1162
- "backup.name" => request.backup.name
1163
- }
1407
+ header_params = {}
1408
+ if request.backup&.name
1409
+ header_params["backup.name"] = request.backup.name
1410
+ end
1411
+
1164
1412
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1165
1413
  metadata[:"x-goog-request-params"] ||= request_params_header
1166
1414
 
1167
1415
  options.apply_defaults timeout: @config.rpcs.update_backup.timeout,
1168
1416
  metadata: metadata,
1169
1417
  retry_policy: @config.rpcs.update_backup.retry_policy
1170
- options.apply_defaults metadata: @config.metadata,
1418
+
1419
+ options.apply_defaults timeout: @config.timeout,
1420
+ metadata: @config.metadata,
1171
1421
  retry_policy: @config.retry_policy
1172
1422
 
1173
1423
  @database_admin_stub.call_rpc :update_backup, request, options: options do |response, operation|
@@ -1209,6 +1459,21 @@ module Google
1209
1459
  #
1210
1460
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1211
1461
  #
1462
+ # @example Basic example
1463
+ # require "google/cloud/spanner/admin/database/v1"
1464
+ #
1465
+ # # Create a client object. The client can be reused for multiple calls.
1466
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
1467
+ #
1468
+ # # Create a request. To set request fields, pass in keyword arguments.
1469
+ # request = Google::Cloud::Spanner::Admin::Database::V1::DeleteBackupRequest.new
1470
+ #
1471
+ # # Call the delete_backup method.
1472
+ # result = client.delete_backup request
1473
+ #
1474
+ # # The returned object is of type Google::Protobuf::Empty.
1475
+ # p result
1476
+ #
1212
1477
  def delete_backup request, options = nil
1213
1478
  raise ::ArgumentError, "request must be provided" if request.nil?
1214
1479
 
@@ -1226,16 +1491,20 @@ module Google
1226
1491
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
1227
1492
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1228
1493
 
1229
- header_params = {
1230
- "name" => request.name
1231
- }
1494
+ header_params = {}
1495
+ if request.name
1496
+ header_params["name"] = request.name
1497
+ end
1498
+
1232
1499
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1233
1500
  metadata[:"x-goog-request-params"] ||= request_params_header
1234
1501
 
1235
1502
  options.apply_defaults timeout: @config.rpcs.delete_backup.timeout,
1236
1503
  metadata: metadata,
1237
1504
  retry_policy: @config.rpcs.delete_backup.retry_policy
1238
- options.apply_defaults metadata: @config.metadata,
1505
+
1506
+ options.apply_defaults timeout: @config.timeout,
1507
+ metadata: @config.metadata,
1239
1508
  retry_policy: @config.retry_policy
1240
1509
 
1241
1510
  @database_admin_stub.call_rpc :delete_backup, request, options: options do |response, operation|
@@ -1322,6 +1591,27 @@ module Google
1322
1591
  #
1323
1592
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1324
1593
  #
1594
+ # @example Basic example
1595
+ # require "google/cloud/spanner/admin/database/v1"
1596
+ #
1597
+ # # Create a client object. The client can be reused for multiple calls.
1598
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
1599
+ #
1600
+ # # Create a request. To set request fields, pass in keyword arguments.
1601
+ # request = Google::Cloud::Spanner::Admin::Database::V1::ListBackupsRequest.new
1602
+ #
1603
+ # # Call the list_backups method.
1604
+ # result = client.list_backups request
1605
+ #
1606
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1607
+ # # iterate over all elements by calling #each, and the enumerable
1608
+ # # will lazily make API calls to fetch subsequent pages. Other
1609
+ # # methods are also available for managing paging directly.
1610
+ # result.each do |response|
1611
+ # # Each element is of type ::Google::Cloud::Spanner::Admin::Database::V1::Backup.
1612
+ # p response
1613
+ # end
1614
+ #
1325
1615
  def list_backups request, options = nil
1326
1616
  raise ::ArgumentError, "request must be provided" if request.nil?
1327
1617
 
@@ -1339,16 +1629,20 @@ module Google
1339
1629
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
1340
1630
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1341
1631
 
1342
- header_params = {
1343
- "parent" => request.parent
1344
- }
1632
+ header_params = {}
1633
+ if request.parent
1634
+ header_params["parent"] = request.parent
1635
+ end
1636
+
1345
1637
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1346
1638
  metadata[:"x-goog-request-params"] ||= request_params_header
1347
1639
 
1348
1640
  options.apply_defaults timeout: @config.rpcs.list_backups.timeout,
1349
1641
  metadata: metadata,
1350
1642
  retry_policy: @config.rpcs.list_backups.retry_policy
1351
- options.apply_defaults metadata: @config.metadata,
1643
+
1644
+ options.apply_defaults timeout: @config.timeout,
1645
+ metadata: @config.metadata,
1352
1646
  retry_policy: @config.retry_policy
1353
1647
 
1354
1648
  @database_admin_stub.call_rpc :list_backups, request, options: options do |response, operation|
@@ -1424,6 +1718,28 @@ module Google
1424
1718
  #
1425
1719
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1426
1720
  #
1721
+ # @example Basic example
1722
+ # require "google/cloud/spanner/admin/database/v1"
1723
+ #
1724
+ # # Create a client object. The client can be reused for multiple calls.
1725
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
1726
+ #
1727
+ # # Create a request. To set request fields, pass in keyword arguments.
1728
+ # request = Google::Cloud::Spanner::Admin::Database::V1::RestoreDatabaseRequest.new
1729
+ #
1730
+ # # Call the restore_database method.
1731
+ # result = client.restore_database request
1732
+ #
1733
+ # # The returned object is of type Gapic::Operation. You can use this
1734
+ # # object to check the status of an operation, cancel it, or wait
1735
+ # # for results. Here is how to block until completion:
1736
+ # result.wait_until_done! timeout: 60
1737
+ # if result.response?
1738
+ # p result.response
1739
+ # else
1740
+ # puts "Error!"
1741
+ # end
1742
+ #
1427
1743
  def restore_database request, options = nil
1428
1744
  raise ::ArgumentError, "request must be provided" if request.nil?
1429
1745
 
@@ -1441,16 +1757,20 @@ module Google
1441
1757
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
1442
1758
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1443
1759
 
1444
- header_params = {
1445
- "parent" => request.parent
1446
- }
1760
+ header_params = {}
1761
+ if request.parent
1762
+ header_params["parent"] = request.parent
1763
+ end
1764
+
1447
1765
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1448
1766
  metadata[:"x-goog-request-params"] ||= request_params_header
1449
1767
 
1450
1768
  options.apply_defaults timeout: @config.rpcs.restore_database.timeout,
1451
1769
  metadata: metadata,
1452
1770
  retry_policy: @config.rpcs.restore_database.retry_policy
1453
- options.apply_defaults metadata: @config.metadata,
1771
+
1772
+ options.apply_defaults timeout: @config.timeout,
1773
+ metadata: @config.metadata,
1454
1774
  retry_policy: @config.retry_policy
1455
1775
 
1456
1776
  @database_admin_stub.call_rpc :restore_database, request, options: options do |response, operation|
@@ -1548,6 +1868,27 @@ module Google
1548
1868
  #
1549
1869
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1550
1870
  #
1871
+ # @example Basic example
1872
+ # require "google/cloud/spanner/admin/database/v1"
1873
+ #
1874
+ # # Create a client object. The client can be reused for multiple calls.
1875
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
1876
+ #
1877
+ # # Create a request. To set request fields, pass in keyword arguments.
1878
+ # request = Google::Cloud::Spanner::Admin::Database::V1::ListDatabaseOperationsRequest.new
1879
+ #
1880
+ # # Call the list_database_operations method.
1881
+ # result = client.list_database_operations request
1882
+ #
1883
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1884
+ # # iterate over all elements by calling #each, and the enumerable
1885
+ # # will lazily make API calls to fetch subsequent pages. Other
1886
+ # # methods are also available for managing paging directly.
1887
+ # result.each do |response|
1888
+ # # Each element is of type ::Google::Longrunning::Operation.
1889
+ # p response
1890
+ # end
1891
+ #
1551
1892
  def list_database_operations request, options = nil
1552
1893
  raise ::ArgumentError, "request must be provided" if request.nil?
1553
1894
 
@@ -1565,16 +1906,20 @@ module Google
1565
1906
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
1566
1907
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1567
1908
 
1568
- header_params = {
1569
- "parent" => request.parent
1570
- }
1909
+ header_params = {}
1910
+ if request.parent
1911
+ header_params["parent"] = request.parent
1912
+ end
1913
+
1571
1914
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1572
1915
  metadata[:"x-goog-request-params"] ||= request_params_header
1573
1916
 
1574
1917
  options.apply_defaults timeout: @config.rpcs.list_database_operations.timeout,
1575
1918
  metadata: metadata,
1576
1919
  retry_policy: @config.rpcs.list_database_operations.retry_policy
1577
- options.apply_defaults metadata: @config.metadata,
1920
+
1921
+ options.apply_defaults timeout: @config.timeout,
1922
+ metadata: @config.metadata,
1578
1923
  retry_policy: @config.retry_policy
1579
1924
 
1580
1925
  @database_admin_stub.call_rpc :list_database_operations, request, options: options do |response, operation|
@@ -1673,6 +2018,27 @@ module Google
1673
2018
  #
1674
2019
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1675
2020
  #
2021
+ # @example Basic example
2022
+ # require "google/cloud/spanner/admin/database/v1"
2023
+ #
2024
+ # # Create a client object. The client can be reused for multiple calls.
2025
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
2026
+ #
2027
+ # # Create a request. To set request fields, pass in keyword arguments.
2028
+ # request = Google::Cloud::Spanner::Admin::Database::V1::ListBackupOperationsRequest.new
2029
+ #
2030
+ # # Call the list_backup_operations method.
2031
+ # result = client.list_backup_operations request
2032
+ #
2033
+ # # The returned object is of type Gapic::PagedEnumerable. You can
2034
+ # # iterate over all elements by calling #each, and the enumerable
2035
+ # # will lazily make API calls to fetch subsequent pages. Other
2036
+ # # methods are also available for managing paging directly.
2037
+ # result.each do |response|
2038
+ # # Each element is of type ::Google::Longrunning::Operation.
2039
+ # p response
2040
+ # end
2041
+ #
1676
2042
  def list_backup_operations request, options = nil
1677
2043
  raise ::ArgumentError, "request must be provided" if request.nil?
1678
2044
 
@@ -1690,16 +2056,20 @@ module Google
1690
2056
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
1691
2057
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1692
2058
 
1693
- header_params = {
1694
- "parent" => request.parent
1695
- }
2059
+ header_params = {}
2060
+ if request.parent
2061
+ header_params["parent"] = request.parent
2062
+ end
2063
+
1696
2064
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1697
2065
  metadata[:"x-goog-request-params"] ||= request_params_header
1698
2066
 
1699
2067
  options.apply_defaults timeout: @config.rpcs.list_backup_operations.timeout,
1700
2068
  metadata: metadata,
1701
2069
  retry_policy: @config.rpcs.list_backup_operations.retry_policy
1702
- options.apply_defaults metadata: @config.metadata,
2070
+
2071
+ options.apply_defaults timeout: @config.timeout,
2072
+ metadata: @config.metadata,
1703
2073
  retry_policy: @config.retry_policy
1704
2074
 
1705
2075
  @database_admin_stub.call_rpc :list_backup_operations, request, options: options do |response, operation|
@@ -1725,22 +2095,21 @@ module Google
1725
2095
  # Configuration can be applied globally to all clients, or to a single client
1726
2096
  # on construction.
1727
2097
  #
1728
- # # Examples
1729
- #
1730
- # To modify the global config, setting the timeout for list_databases
1731
- # to 20 seconds, and all remaining timeouts to 10 seconds:
1732
- #
1733
- # ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.configure do |config|
1734
- # config.timeout = 10.0
1735
- # config.rpcs.list_databases.timeout = 20.0
1736
- # end
1737
- #
1738
- # To apply the above configuration only to a new client:
1739
- #
1740
- # client = ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new do |config|
1741
- # config.timeout = 10.0
1742
- # config.rpcs.list_databases.timeout = 20.0
1743
- # end
2098
+ # @example
2099
+ #
2100
+ # # Modify the global config, setting the timeout for
2101
+ # # list_databases to 20 seconds,
2102
+ # # and all remaining timeouts to 10 seconds.
2103
+ # ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.configure do |config|
2104
+ # config.timeout = 10.0
2105
+ # config.rpcs.list_databases.timeout = 20.0
2106
+ # end
2107
+ #
2108
+ # # Apply the above configuration only to a new client.
2109
+ # client = ::Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new do |config|
2110
+ # config.timeout = 10.0
2111
+ # config.rpcs.list_databases.timeout = 20.0
2112
+ # end
1744
2113
  #
1745
2114
  # @!attribute [rw] endpoint
1746
2115
  # The hostname or hostname:port of the service endpoint.