google-cloud-spanner-admin-database-v1 0.7.3 → 0.7.6

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,10 +31,11 @@ module Google
31
31
  #
32
32
  # Cloud Spanner Database Admin API
33
33
  #
34
- # The Cloud Spanner Database Admin API can be used to create, drop, and
35
- # list databases. It also enables updating the schema of pre-existing
36
- # databases. It can be also used to create, delete and list backups for a
37
- # database and to restore from an existing backup.
34
+ # The Cloud Spanner Database Admin API can be used to:
35
+ # * create, drop, and list databases
36
+ # * update the schema of pre-existing databases
37
+ # * create, delete and list backups for a database
38
+ # * restore a database from an existing backup
38
39
  #
39
40
  class Client
40
41
  include Paths
@@ -212,6 +213,7 @@ module Google
212
213
 
213
214
  @operations_client = Operations.new do |config|
214
215
  config.credentials = credentials
216
+ config.quota_project = @quota_project_id
215
217
  config.endpoint = @config.endpoint
216
218
  end
217
219
 
@@ -270,6 +272,27 @@ module Google
270
272
  #
271
273
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
272
274
  #
275
+ # @example Basic example
276
+ # require "google/cloud/spanner/admin/database/v1"
277
+ #
278
+ # # Create a client object. The client can be reused for multiple calls.
279
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
280
+ #
281
+ # # Create a request. To set request fields, pass in keyword arguments.
282
+ # request = Google::Cloud::Spanner::Admin::Database::V1::ListDatabasesRequest.new
283
+ #
284
+ # # Call the list_databases method.
285
+ # result = client.list_databases request
286
+ #
287
+ # # The returned object is of type Gapic::PagedEnumerable. You can
288
+ # # iterate over all elements by calling #each, and the enumerable
289
+ # # will lazily make API calls to fetch subsequent pages. Other
290
+ # # methods are also available for managing paging directly.
291
+ # result.each do |response|
292
+ # # Each element is of type ::Google::Cloud::Spanner::Admin::Database::V1::Database.
293
+ # p response
294
+ # end
295
+ #
273
296
  def list_databases request, options = nil
274
297
  raise ::ArgumentError, "request must be provided" if request.nil?
275
298
 
@@ -287,9 +310,11 @@ module Google
287
310
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
288
311
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
289
312
 
290
- header_params = {
291
- "parent" => request.parent
292
- }
313
+ header_params = {}
314
+ if request.parent
315
+ header_params["parent"] = request.parent
316
+ end
317
+
293
318
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
294
319
  metadata[:"x-goog-request-params"] ||= request_params_header
295
320
 
@@ -330,7 +355,7 @@ module Google
330
355
  # @param options [::Gapic::CallOptions, ::Hash]
331
356
  # Overrides the default settings for this call, e.g, timeout, retries, etc. Optional.
332
357
  #
333
- # @overload create_database(parent: nil, create_statement: nil, extra_statements: nil, encryption_config: nil)
358
+ # @overload create_database(parent: nil, create_statement: nil, extra_statements: nil, encryption_config: nil, database_dialect: nil)
334
359
  # Pass arguments to `create_database` via keyword arguments. Note that at
335
360
  # least one keyword argument is required. To specify no parameters, or to keep all
336
361
  # the default parameter values, pass an empty Hash as a request object (see above).
@@ -353,6 +378,8 @@ module Google
353
378
  # Optional. The encryption configuration for the database. If this field is not
354
379
  # specified, Cloud Spanner will encrypt/decrypt all data at rest using
355
380
  # Google default encryption.
381
+ # @param database_dialect [::Google::Cloud::Spanner::Admin::Database::V1::DatabaseDialect]
382
+ # Optional. The dialect of the Cloud Spanner Database.
356
383
  #
357
384
  # @yield [response, operation] Access the result along with the RPC operation
358
385
  # @yieldparam response [::Gapic::Operation]
@@ -362,6 +389,28 @@ module Google
362
389
  #
363
390
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
364
391
  #
392
+ # @example Basic example
393
+ # require "google/cloud/spanner/admin/database/v1"
394
+ #
395
+ # # Create a client object. The client can be reused for multiple calls.
396
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
397
+ #
398
+ # # Create a request. To set request fields, pass in keyword arguments.
399
+ # request = Google::Cloud::Spanner::Admin::Database::V1::CreateDatabaseRequest.new
400
+ #
401
+ # # Call the create_database method.
402
+ # result = client.create_database request
403
+ #
404
+ # # The returned object is of type Gapic::Operation. You can use this
405
+ # # object to check the status of an operation, cancel it, or wait
406
+ # # for results. Here is how to block until completion:
407
+ # result.wait_until_done! timeout: 60
408
+ # if result.response?
409
+ # p result.response
410
+ # else
411
+ # puts "Error!"
412
+ # end
413
+ #
365
414
  def create_database request, options = nil
366
415
  raise ::ArgumentError, "request must be provided" if request.nil?
367
416
 
@@ -379,9 +428,11 @@ module Google
379
428
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
380
429
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
381
430
 
382
- header_params = {
383
- "parent" => request.parent
384
- }
431
+ header_params = {}
432
+ if request.parent
433
+ header_params["parent"] = request.parent
434
+ end
435
+
385
436
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
386
437
  metadata[:"x-goog-request-params"] ||= request_params_header
387
438
 
@@ -432,6 +483,21 @@ module Google
432
483
  #
433
484
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
434
485
  #
486
+ # @example Basic example
487
+ # require "google/cloud/spanner/admin/database/v1"
488
+ #
489
+ # # Create a client object. The client can be reused for multiple calls.
490
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
491
+ #
492
+ # # Create a request. To set request fields, pass in keyword arguments.
493
+ # request = Google::Cloud::Spanner::Admin::Database::V1::GetDatabaseRequest.new
494
+ #
495
+ # # Call the get_database method.
496
+ # result = client.get_database request
497
+ #
498
+ # # The returned object is of type Google::Cloud::Spanner::Admin::Database::V1::Database.
499
+ # p result
500
+ #
435
501
  def get_database request, options = nil
436
502
  raise ::ArgumentError, "request must be provided" if request.nil?
437
503
 
@@ -449,9 +515,11 @@ module Google
449
515
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
450
516
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
451
517
 
452
- header_params = {
453
- "name" => request.name
454
- }
518
+ header_params = {}
519
+ if request.name
520
+ header_params["name"] = request.name
521
+ end
522
+
455
523
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
456
524
  metadata[:"x-goog-request-params"] ||= request_params_header
457
525
 
@@ -528,6 +596,28 @@ module Google
528
596
  #
529
597
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
530
598
  #
599
+ # @example Basic example
600
+ # require "google/cloud/spanner/admin/database/v1"
601
+ #
602
+ # # Create a client object. The client can be reused for multiple calls.
603
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
604
+ #
605
+ # # Create a request. To set request fields, pass in keyword arguments.
606
+ # request = Google::Cloud::Spanner::Admin::Database::V1::UpdateDatabaseDdlRequest.new
607
+ #
608
+ # # Call the update_database_ddl method.
609
+ # result = client.update_database_ddl request
610
+ #
611
+ # # The returned object is of type Gapic::Operation. You can use this
612
+ # # object to check the status of an operation, cancel it, or wait
613
+ # # for results. Here is how to block until completion:
614
+ # result.wait_until_done! timeout: 60
615
+ # if result.response?
616
+ # p result.response
617
+ # else
618
+ # puts "Error!"
619
+ # end
620
+ #
531
621
  def update_database_ddl request, options = nil
532
622
  raise ::ArgumentError, "request must be provided" if request.nil?
533
623
 
@@ -545,9 +635,11 @@ module Google
545
635
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
546
636
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
547
637
 
548
- header_params = {
549
- "database" => request.database
550
- }
638
+ header_params = {}
639
+ if request.database
640
+ header_params["database"] = request.database
641
+ end
642
+
551
643
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
552
644
  metadata[:"x-goog-request-params"] ||= request_params_header
553
645
 
@@ -572,6 +664,8 @@ module Google
572
664
  # Drops (aka deletes) a Cloud Spanner database.
573
665
  # Completed backups for the database will be retained according to their
574
666
  # `expire_time`.
667
+ # Note: Cloud Spanner might continue to accept requests for a few seconds
668
+ # after the database has been deleted.
575
669
  #
576
670
  # @overload drop_database(request, options = nil)
577
671
  # Pass arguments to `drop_database` via a request object, either of type
@@ -599,6 +693,21 @@ module Google
599
693
  #
600
694
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
601
695
  #
696
+ # @example Basic example
697
+ # require "google/cloud/spanner/admin/database/v1"
698
+ #
699
+ # # Create a client object. The client can be reused for multiple calls.
700
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
701
+ #
702
+ # # Create a request. To set request fields, pass in keyword arguments.
703
+ # request = Google::Cloud::Spanner::Admin::Database::V1::DropDatabaseRequest.new
704
+ #
705
+ # # Call the drop_database method.
706
+ # result = client.drop_database request
707
+ #
708
+ # # The returned object is of type Google::Protobuf::Empty.
709
+ # p result
710
+ #
602
711
  def drop_database request, options = nil
603
712
  raise ::ArgumentError, "request must be provided" if request.nil?
604
713
 
@@ -616,9 +725,11 @@ module Google
616
725
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
617
726
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
618
727
 
619
- header_params = {
620
- "database" => request.database
621
- }
728
+ header_params = {}
729
+ if request.database
730
+ header_params["database"] = request.database
731
+ end
732
+
622
733
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
623
734
  metadata[:"x-goog-request-params"] ||= request_params_header
624
735
 
@@ -671,6 +782,21 @@ module Google
671
782
  #
672
783
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
673
784
  #
785
+ # @example Basic example
786
+ # require "google/cloud/spanner/admin/database/v1"
787
+ #
788
+ # # Create a client object. The client can be reused for multiple calls.
789
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
790
+ #
791
+ # # Create a request. To set request fields, pass in keyword arguments.
792
+ # request = Google::Cloud::Spanner::Admin::Database::V1::GetDatabaseDdlRequest.new
793
+ #
794
+ # # Call the get_database_ddl method.
795
+ # result = client.get_database_ddl request
796
+ #
797
+ # # The returned object is of type Google::Cloud::Spanner::Admin::Database::V1::GetDatabaseDdlResponse.
798
+ # p result
799
+ #
674
800
  def get_database_ddl request, options = nil
675
801
  raise ::ArgumentError, "request must be provided" if request.nil?
676
802
 
@@ -688,9 +814,11 @@ module Google
688
814
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
689
815
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
690
816
 
691
- header_params = {
692
- "database" => request.database
693
- }
817
+ header_params = {}
818
+ if request.database
819
+ header_params["database"] = request.database
820
+ end
821
+
694
822
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
695
823
  metadata[:"x-goog-request-params"] ||= request_params_header
696
824
 
@@ -751,6 +879,21 @@ module Google
751
879
  #
752
880
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
753
881
  #
882
+ # @example Basic example
883
+ # require "google/cloud/spanner/admin/database/v1"
884
+ #
885
+ # # Create a client object. The client can be reused for multiple calls.
886
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
887
+ #
888
+ # # Create a request. To set request fields, pass in keyword arguments.
889
+ # request = Google::Iam::V1::SetIamPolicyRequest.new
890
+ #
891
+ # # Call the set_iam_policy method.
892
+ # result = client.set_iam_policy request
893
+ #
894
+ # # The returned object is of type Google::Iam::V1::Policy.
895
+ # p result
896
+ #
754
897
  def set_iam_policy request, options = nil
755
898
  raise ::ArgumentError, "request must be provided" if request.nil?
756
899
 
@@ -768,9 +911,11 @@ module Google
768
911
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
769
912
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
770
913
 
771
- header_params = {
772
- "resource" => request.resource
773
- }
914
+ header_params = {}
915
+ if request.resource
916
+ header_params["resource"] = request.resource
917
+ end
918
+
774
919
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
775
920
  metadata[:"x-goog-request-params"] ||= request_params_header
776
921
 
@@ -830,6 +975,21 @@ module Google
830
975
  #
831
976
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
832
977
  #
978
+ # @example Basic example
979
+ # require "google/cloud/spanner/admin/database/v1"
980
+ #
981
+ # # Create a client object. The client can be reused for multiple calls.
982
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
983
+ #
984
+ # # Create a request. To set request fields, pass in keyword arguments.
985
+ # request = Google::Iam::V1::GetIamPolicyRequest.new
986
+ #
987
+ # # Call the get_iam_policy method.
988
+ # result = client.get_iam_policy request
989
+ #
990
+ # # The returned object is of type Google::Iam::V1::Policy.
991
+ # p result
992
+ #
833
993
  def get_iam_policy request, options = nil
834
994
  raise ::ArgumentError, "request must be provided" if request.nil?
835
995
 
@@ -847,9 +1007,11 @@ module Google
847
1007
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
848
1008
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
849
1009
 
850
- header_params = {
851
- "resource" => request.resource
852
- }
1010
+ header_params = {}
1011
+ if request.resource
1012
+ header_params["resource"] = request.resource
1013
+ end
1014
+
853
1015
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
854
1016
  metadata[:"x-goog-request-params"] ||= request_params_header
855
1017
 
@@ -913,6 +1075,21 @@ module Google
913
1075
  #
914
1076
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
915
1077
  #
1078
+ # @example Basic example
1079
+ # require "google/cloud/spanner/admin/database/v1"
1080
+ #
1081
+ # # Create a client object. The client can be reused for multiple calls.
1082
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
1083
+ #
1084
+ # # Create a request. To set request fields, pass in keyword arguments.
1085
+ # request = Google::Iam::V1::TestIamPermissionsRequest.new
1086
+ #
1087
+ # # Call the test_iam_permissions method.
1088
+ # result = client.test_iam_permissions request
1089
+ #
1090
+ # # The returned object is of type Google::Iam::V1::TestIamPermissionsResponse.
1091
+ # p result
1092
+ #
916
1093
  def test_iam_permissions request, options = nil
917
1094
  raise ::ArgumentError, "request must be provided" if request.nil?
918
1095
 
@@ -930,9 +1107,11 @@ module Google
930
1107
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
931
1108
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
932
1109
 
933
- header_params = {
934
- "resource" => request.resource
935
- }
1110
+ header_params = {}
1111
+ if request.resource
1112
+ header_params["resource"] = request.resource
1113
+ end
1114
+
936
1115
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
937
1116
  metadata[:"x-goog-request-params"] ||= request_params_header
938
1117
 
@@ -1009,6 +1188,28 @@ module Google
1009
1188
  #
1010
1189
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1011
1190
  #
1191
+ # @example Basic example
1192
+ # require "google/cloud/spanner/admin/database/v1"
1193
+ #
1194
+ # # Create a client object. The client can be reused for multiple calls.
1195
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
1196
+ #
1197
+ # # Create a request. To set request fields, pass in keyword arguments.
1198
+ # request = Google::Cloud::Spanner::Admin::Database::V1::CreateBackupRequest.new
1199
+ #
1200
+ # # Call the create_backup method.
1201
+ # result = client.create_backup request
1202
+ #
1203
+ # # The returned object is of type Gapic::Operation. You can use this
1204
+ # # object to check the status of an operation, cancel it, or wait
1205
+ # # for results. Here is how to block until completion:
1206
+ # result.wait_until_done! timeout: 60
1207
+ # if result.response?
1208
+ # p result.response
1209
+ # else
1210
+ # puts "Error!"
1211
+ # end
1212
+ #
1012
1213
  def create_backup request, options = nil
1013
1214
  raise ::ArgumentError, "request must be provided" if request.nil?
1014
1215
 
@@ -1026,9 +1227,11 @@ module Google
1026
1227
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
1027
1228
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1028
1229
 
1029
- header_params = {
1030
- "parent" => request.parent
1031
- }
1230
+ header_params = {}
1231
+ if request.parent
1232
+ header_params["parent"] = request.parent
1233
+ end
1234
+
1032
1235
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1033
1236
  metadata[:"x-goog-request-params"] ||= request_params_header
1034
1237
 
@@ -1080,6 +1283,21 @@ module Google
1080
1283
  #
1081
1284
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1082
1285
  #
1286
+ # @example Basic example
1287
+ # require "google/cloud/spanner/admin/database/v1"
1288
+ #
1289
+ # # Create a client object. The client can be reused for multiple calls.
1290
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
1291
+ #
1292
+ # # Create a request. To set request fields, pass in keyword arguments.
1293
+ # request = Google::Cloud::Spanner::Admin::Database::V1::GetBackupRequest.new
1294
+ #
1295
+ # # Call the get_backup method.
1296
+ # result = client.get_backup request
1297
+ #
1298
+ # # The returned object is of type Google::Cloud::Spanner::Admin::Database::V1::Backup.
1299
+ # p result
1300
+ #
1083
1301
  def get_backup request, options = nil
1084
1302
  raise ::ArgumentError, "request must be provided" if request.nil?
1085
1303
 
@@ -1097,9 +1315,11 @@ module Google
1097
1315
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
1098
1316
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1099
1317
 
1100
- header_params = {
1101
- "name" => request.name
1102
- }
1318
+ header_params = {}
1319
+ if request.name
1320
+ header_params["name"] = request.name
1321
+ end
1322
+
1103
1323
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1104
1324
  metadata[:"x-goog-request-params"] ||= request_params_header
1105
1325
 
@@ -1157,6 +1377,21 @@ module Google
1157
1377
  #
1158
1378
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1159
1379
  #
1380
+ # @example Basic example
1381
+ # require "google/cloud/spanner/admin/database/v1"
1382
+ #
1383
+ # # Create a client object. The client can be reused for multiple calls.
1384
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
1385
+ #
1386
+ # # Create a request. To set request fields, pass in keyword arguments.
1387
+ # request = Google::Cloud::Spanner::Admin::Database::V1::UpdateBackupRequest.new
1388
+ #
1389
+ # # Call the update_backup method.
1390
+ # result = client.update_backup request
1391
+ #
1392
+ # # The returned object is of type Google::Cloud::Spanner::Admin::Database::V1::Backup.
1393
+ # p result
1394
+ #
1160
1395
  def update_backup request, options = nil
1161
1396
  raise ::ArgumentError, "request must be provided" if request.nil?
1162
1397
 
@@ -1174,9 +1409,11 @@ module Google
1174
1409
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
1175
1410
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1176
1411
 
1177
- header_params = {
1178
- "backup.name" => request.backup.name
1179
- }
1412
+ header_params = {}
1413
+ if request.backup&.name
1414
+ header_params["backup.name"] = request.backup.name
1415
+ end
1416
+
1180
1417
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1181
1418
  metadata[:"x-goog-request-params"] ||= request_params_header
1182
1419
 
@@ -1227,6 +1464,21 @@ module Google
1227
1464
  #
1228
1465
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1229
1466
  #
1467
+ # @example Basic example
1468
+ # require "google/cloud/spanner/admin/database/v1"
1469
+ #
1470
+ # # Create a client object. The client can be reused for multiple calls.
1471
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
1472
+ #
1473
+ # # Create a request. To set request fields, pass in keyword arguments.
1474
+ # request = Google::Cloud::Spanner::Admin::Database::V1::DeleteBackupRequest.new
1475
+ #
1476
+ # # Call the delete_backup method.
1477
+ # result = client.delete_backup request
1478
+ #
1479
+ # # The returned object is of type Google::Protobuf::Empty.
1480
+ # p result
1481
+ #
1230
1482
  def delete_backup request, options = nil
1231
1483
  raise ::ArgumentError, "request must be provided" if request.nil?
1232
1484
 
@@ -1244,9 +1496,11 @@ module Google
1244
1496
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
1245
1497
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1246
1498
 
1247
- header_params = {
1248
- "name" => request.name
1249
- }
1499
+ header_params = {}
1500
+ if request.name
1501
+ header_params["name"] = request.name
1502
+ end
1503
+
1250
1504
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1251
1505
  metadata[:"x-goog-request-params"] ||= request_params_header
1252
1506
 
@@ -1342,6 +1596,27 @@ module Google
1342
1596
  #
1343
1597
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1344
1598
  #
1599
+ # @example Basic example
1600
+ # require "google/cloud/spanner/admin/database/v1"
1601
+ #
1602
+ # # Create a client object. The client can be reused for multiple calls.
1603
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
1604
+ #
1605
+ # # Create a request. To set request fields, pass in keyword arguments.
1606
+ # request = Google::Cloud::Spanner::Admin::Database::V1::ListBackupsRequest.new
1607
+ #
1608
+ # # Call the list_backups method.
1609
+ # result = client.list_backups request
1610
+ #
1611
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1612
+ # # iterate over all elements by calling #each, and the enumerable
1613
+ # # will lazily make API calls to fetch subsequent pages. Other
1614
+ # # methods are also available for managing paging directly.
1615
+ # result.each do |response|
1616
+ # # Each element is of type ::Google::Cloud::Spanner::Admin::Database::V1::Backup.
1617
+ # p response
1618
+ # end
1619
+ #
1345
1620
  def list_backups request, options = nil
1346
1621
  raise ::ArgumentError, "request must be provided" if request.nil?
1347
1622
 
@@ -1359,9 +1634,11 @@ module Google
1359
1634
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
1360
1635
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1361
1636
 
1362
- header_params = {
1363
- "parent" => request.parent
1364
- }
1637
+ header_params = {}
1638
+ if request.parent
1639
+ header_params["parent"] = request.parent
1640
+ end
1641
+
1365
1642
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1366
1643
  metadata[:"x-goog-request-params"] ||= request_params_header
1367
1644
 
@@ -1446,6 +1723,28 @@ module Google
1446
1723
  #
1447
1724
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1448
1725
  #
1726
+ # @example Basic example
1727
+ # require "google/cloud/spanner/admin/database/v1"
1728
+ #
1729
+ # # Create a client object. The client can be reused for multiple calls.
1730
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
1731
+ #
1732
+ # # Create a request. To set request fields, pass in keyword arguments.
1733
+ # request = Google::Cloud::Spanner::Admin::Database::V1::RestoreDatabaseRequest.new
1734
+ #
1735
+ # # Call the restore_database method.
1736
+ # result = client.restore_database request
1737
+ #
1738
+ # # The returned object is of type Gapic::Operation. You can use this
1739
+ # # object to check the status of an operation, cancel it, or wait
1740
+ # # for results. Here is how to block until completion:
1741
+ # result.wait_until_done! timeout: 60
1742
+ # if result.response?
1743
+ # p result.response
1744
+ # else
1745
+ # puts "Error!"
1746
+ # end
1747
+ #
1449
1748
  def restore_database request, options = nil
1450
1749
  raise ::ArgumentError, "request must be provided" if request.nil?
1451
1750
 
@@ -1463,9 +1762,11 @@ module Google
1463
1762
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
1464
1763
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1465
1764
 
1466
- header_params = {
1467
- "parent" => request.parent
1468
- }
1765
+ header_params = {}
1766
+ if request.parent
1767
+ header_params["parent"] = request.parent
1768
+ end
1769
+
1469
1770
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1470
1771
  metadata[:"x-goog-request-params"] ||= request_params_header
1471
1772
 
@@ -1572,6 +1873,27 @@ module Google
1572
1873
  #
1573
1874
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1574
1875
  #
1876
+ # @example Basic example
1877
+ # require "google/cloud/spanner/admin/database/v1"
1878
+ #
1879
+ # # Create a client object. The client can be reused for multiple calls.
1880
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
1881
+ #
1882
+ # # Create a request. To set request fields, pass in keyword arguments.
1883
+ # request = Google::Cloud::Spanner::Admin::Database::V1::ListDatabaseOperationsRequest.new
1884
+ #
1885
+ # # Call the list_database_operations method.
1886
+ # result = client.list_database_operations request
1887
+ #
1888
+ # # The returned object is of type Gapic::PagedEnumerable. You can
1889
+ # # iterate over all elements by calling #each, and the enumerable
1890
+ # # will lazily make API calls to fetch subsequent pages. Other
1891
+ # # methods are also available for managing paging directly.
1892
+ # result.each do |response|
1893
+ # # Each element is of type ::Google::Longrunning::Operation.
1894
+ # p response
1895
+ # end
1896
+ #
1575
1897
  def list_database_operations request, options = nil
1576
1898
  raise ::ArgumentError, "request must be provided" if request.nil?
1577
1899
 
@@ -1589,9 +1911,11 @@ module Google
1589
1911
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
1590
1912
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1591
1913
 
1592
- header_params = {
1593
- "parent" => request.parent
1594
- }
1914
+ header_params = {}
1915
+ if request.parent
1916
+ header_params["parent"] = request.parent
1917
+ end
1918
+
1595
1919
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1596
1920
  metadata[:"x-goog-request-params"] ||= request_params_header
1597
1921
 
@@ -1699,6 +2023,27 @@ module Google
1699
2023
  #
1700
2024
  # @raise [::Google::Cloud::Error] if the RPC is aborted.
1701
2025
  #
2026
+ # @example Basic example
2027
+ # require "google/cloud/spanner/admin/database/v1"
2028
+ #
2029
+ # # Create a client object. The client can be reused for multiple calls.
2030
+ # client = Google::Cloud::Spanner::Admin::Database::V1::DatabaseAdmin::Client.new
2031
+ #
2032
+ # # Create a request. To set request fields, pass in keyword arguments.
2033
+ # request = Google::Cloud::Spanner::Admin::Database::V1::ListBackupOperationsRequest.new
2034
+ #
2035
+ # # Call the list_backup_operations method.
2036
+ # result = client.list_backup_operations request
2037
+ #
2038
+ # # The returned object is of type Gapic::PagedEnumerable. You can
2039
+ # # iterate over all elements by calling #each, and the enumerable
2040
+ # # will lazily make API calls to fetch subsequent pages. Other
2041
+ # # methods are also available for managing paging directly.
2042
+ # result.each do |response|
2043
+ # # Each element is of type ::Google::Longrunning::Operation.
2044
+ # p response
2045
+ # end
2046
+ #
1702
2047
  def list_backup_operations request, options = nil
1703
2048
  raise ::ArgumentError, "request must be provided" if request.nil?
1704
2049
 
@@ -1716,9 +2061,11 @@ module Google
1716
2061
  gapic_version: ::Google::Cloud::Spanner::Admin::Database::V1::VERSION
1717
2062
  metadata[:"x-goog-user-project"] = @quota_project_id if @quota_project_id
1718
2063
 
1719
- header_params = {
1720
- "parent" => request.parent
1721
- }
2064
+ header_params = {}
2065
+ if request.parent
2066
+ header_params["parent"] = request.parent
2067
+ end
2068
+
1722
2069
  request_params_header = header_params.map { |k, v| "#{k}=#{v}" }.join("&")
1723
2070
  metadata[:"x-goog-request-params"] ||= request_params_header
1724
2071