google-cloud-spanner-admin-database-v1 0.7.0 → 0.7.4

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