google-cloud-spanner-admin-database-v1 1.9.0

Google Cloud Client Libraries for Rust - Cloud Spanner API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.
#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]

/// Implements a client for the Cloud Spanner API.
///
/// # Example
/// ```
/// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
/// use google_cloud_gax::paginator::ItemPaginator as _;
/// # async fn sample() -> Result<(), Box<dyn std::error::Error>> {
///     let client = DatabaseAdmin::builder().build().await?;
///     let parent = "parent_value";
///     let mut list = client.list_databases()
///         .set_parent(parent)
///         .by_item();
///     while let Some(item) = list.next().await.transpose()? {
///         println!("{:?}", item);
///     }
/// # Ok(()) }
/// ```
///
/// # Service Description
///
/// Cloud Spanner Database Admin API
///
/// The Cloud Spanner Database Admin API can be used to:
///
/// * create, drop, and list databases
/// * update the schema of pre-existing databases
/// * create, delete, copy and list backups for a database
/// * restore a database from an existing backup
///
/// # Configuration
///
/// To configure `DatabaseAdmin` use the `with_*` methods in the type returned
/// by [builder()][DatabaseAdmin::builder]. The default configuration should
/// work for most applications. Common configuration changes include
///
/// * [with_endpoint()]: by default this client uses the global default endpoint
///   (`https://spanner.googleapis.com`). Applications using regional
///   endpoints or running in restricted networks (e.g. a network configured
//    with [Private Google Access with VPC Service Controls]) may want to
///   override this default.
/// * [with_credentials()]: by default this client uses
///   [Application Default Credentials]. Applications using custom
///   authentication may need to override this default.
///
/// [with_endpoint()]: super::builder::database_admin::ClientBuilder::with_endpoint
/// [with_credentials()]: super::builder::database_admin::ClientBuilder::with_credentials
/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
///
/// # Pooling and Cloning
///
/// `DatabaseAdmin` holds a connection pool internally, it is advised to
/// create one and reuse it. You do not need to wrap `DatabaseAdmin` in
/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
/// already uses an `Arc` internally.
#[derive(Clone, Debug)]
pub struct DatabaseAdmin {
    inner: std::sync::Arc<dyn super::stub::dynamic::DatabaseAdmin>,
}

impl DatabaseAdmin {
    /// Returns a builder for [DatabaseAdmin].
    ///
    /// ```
    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// let client = DatabaseAdmin::builder().build().await?;
    /// # Ok(()) }
    /// ```
    pub fn builder() -> super::builder::database_admin::ClientBuilder {
        crate::new_client_builder(super::builder::database_admin::client::Factory)
    }

    /// Creates a new client from the provided stub.
    ///
    /// The most common case for calling this function is in tests mocking the
    /// client's behavior.
    pub fn from_stub<T>(stub: T) -> Self
    where
        T: super::stub::DatabaseAdmin + 'static,
    {
        Self {
            inner: std::sync::Arc::new(stub),
        }
    }

    pub(crate) async fn new(
        config: gaxi::options::ClientConfig,
    ) -> crate::ClientBuilderResult<Self> {
        let inner = Self::build_inner(config).await?;
        Ok(Self { inner })
    }

    async fn build_inner(
        conf: gaxi::options::ClientConfig,
    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::DatabaseAdmin>> {
        if gaxi::options::tracing_enabled(&conf) {
            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
        }
        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
    }

    async fn build_transport(
        conf: gaxi::options::ClientConfig,
    ) -> crate::ClientBuilderResult<impl super::stub::DatabaseAdmin> {
        super::transport::DatabaseAdmin::new(conf).await
    }

    async fn build_with_tracing(
        conf: gaxi::options::ClientConfig,
    ) -> crate::ClientBuilderResult<impl super::stub::DatabaseAdmin> {
        Self::build_transport(conf)
            .await
            .map(super::tracing::DatabaseAdmin::new)
    }

    /// Lists Cloud Spanner databases.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_gax::paginator::ItemPaginator as _;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin, parent: &str
    /// ) -> Result<()> {
    ///     let mut list = client.list_databases()
    ///         .set_parent(parent)
    ///         .by_item();
    ///     while let Some(item) = list.next().await.transpose()? {
    ///         println!("{:?}", item);
    ///     }
    ///     Ok(())
    /// }
    /// ```
    pub fn list_databases(&self) -> super::builder::database_admin::ListDatabases {
        super::builder::database_admin::ListDatabases::new(self.inner.clone())
    }

    /// Creates a new Cloud Spanner database and starts to prepare it for serving.
    /// The returned [long-running operation][google.longrunning.Operation] will
    /// have a name of the format `<database_name>/operations/<operation_id>` and
    /// can be used to track preparation of the database. The
    /// [metadata][google.longrunning.Operation.metadata] field type is
    /// [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata].
    /// The [response][google.longrunning.Operation.response] field type is
    /// [Database][google.spanner.admin.database.v1.Database], if successful.
    ///
    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
    /// [google.longrunning.Operation.response]: google_cloud_longrunning::model::Operation::result
    /// [google.spanner.admin.database.v1.CreateDatabaseMetadata]: crate::model::CreateDatabaseMetadata
    /// [google.spanner.admin.database.v1.Database]: crate::model::Database
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_lro::Poller;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin
    /// ) -> Result<()> {
    ///     let response = client.create_database()
    ///         /* set fields */
    ///         .poller().until_done().await?;
    ///     println!("response {:?}", response);
    ///     Ok(())
    /// }
    /// ```
    pub fn create_database(&self) -> super::builder::database_admin::CreateDatabase {
        super::builder::database_admin::CreateDatabase::new(self.inner.clone())
    }

    /// Gets the state of a Cloud Spanner database.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin, name: &str
    /// ) -> Result<()> {
    ///     let response = client.get_database()
    ///         .set_name(name)
    ///         .send().await?;
    ///     println!("response {:?}", response);
    ///     Ok(())
    /// }
    /// ```
    pub fn get_database(&self) -> super::builder::database_admin::GetDatabase {
        super::builder::database_admin::GetDatabase::new(self.inner.clone())
    }

    /// Updates a Cloud Spanner database. The returned
    /// [long-running operation][google.longrunning.Operation] can be used to track
    /// the progress of updating the database. If the named database does not
    /// exist, returns `NOT_FOUND`.
    ///
    /// While the operation is pending:
    ///
    /// * The database's
    ///   [reconciling][google.spanner.admin.database.v1.Database.reconciling]
    ///   field is set to true.
    /// * Cancelling the operation is best-effort. If the cancellation succeeds,
    ///   the operation metadata's
    ///   [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time]
    ///   is set, the updates are reverted, and the operation terminates with a
    ///   `CANCELLED` status.
    /// * New UpdateDatabase requests will return a `FAILED_PRECONDITION` error
    ///   until the pending operation is done (returns successfully or with
    ///   error).
    /// * Reading the database via the API continues to give the pre-request
    ///   values.
    ///
    /// Upon completion of the returned operation:
    ///
    /// * The new values are in effect and readable via the API.
    /// * The database's
    ///   [reconciling][google.spanner.admin.database.v1.Database.reconciling]
    ///   field becomes false.
    ///
    /// The returned [long-running operation][google.longrunning.Operation] will
    /// have a name of the format
    /// `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`
    /// and can be used to track the database modification. The
    /// [metadata][google.longrunning.Operation.metadata] field type is
    /// [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata].
    /// The [response][google.longrunning.Operation.response] field type is
    /// [Database][google.spanner.admin.database.v1.Database], if successful.
    ///
    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
    /// [google.longrunning.Operation.response]: google_cloud_longrunning::model::Operation::result
    /// [google.spanner.admin.database.v1.Database]: crate::model::Database
    /// [google.spanner.admin.database.v1.Database.reconciling]: crate::model::Database::reconciling
    /// [google.spanner.admin.database.v1.UpdateDatabaseMetadata]: crate::model::UpdateDatabaseMetadata
    /// [google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time]: crate::model::UpdateDatabaseMetadata::cancel_time
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_lro::Poller;
    /// # extern crate wkt as google_cloud_wkt;
    /// use google_cloud_wkt::FieldMask;
    /// use google_cloud_spanner_admin_database_v1::model::Database;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin, name: &str
    /// ) -> Result<()> {
    ///     let response = client.update_database()
    ///         .set_database(
    ///             Database::new().set_name(name)/* set fields */
    ///         )
    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
    ///         .poller().until_done().await?;
    ///     println!("response {:?}", response);
    ///     Ok(())
    /// }
    /// ```
    pub fn update_database(&self) -> super::builder::database_admin::UpdateDatabase {
        super::builder::database_admin::UpdateDatabase::new(self.inner.clone())
    }

    /// Updates the schema of a Cloud Spanner database by
    /// creating/altering/dropping tables, columns, indexes, etc. The returned
    /// [long-running operation][google.longrunning.Operation] will have a name of
    /// the format `<database_name>/operations/<operation_id>` and can be used to
    /// track execution of the schema change(s). The
    /// [metadata][google.longrunning.Operation.metadata] field type is
    /// [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata].
    /// The operation has no response.
    ///
    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
    /// [google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]: crate::model::UpdateDatabaseDdlMetadata
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_lro::Poller;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin
    /// ) -> Result<()> {
    ///     client.update_database_ddl()
    ///         /* set fields */
    ///         .poller().until_done().await?;
    ///     Ok(())
    /// }
    /// ```
    pub fn update_database_ddl(&self) -> super::builder::database_admin::UpdateDatabaseDdl {
        super::builder::database_admin::UpdateDatabaseDdl::new(self.inner.clone())
    }

    /// Drops (aka deletes) a Cloud Spanner database.
    /// Completed backups for the database will be retained according to their
    /// `expire_time`.
    /// Note: Cloud Spanner might continue to accept requests for a few seconds
    /// after the database has been deleted.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin
    /// ) -> Result<()> {
    ///     client.drop_database()
    ///         /* set fields */
    ///         .send().await?;
    ///     Ok(())
    /// }
    /// ```
    pub fn drop_database(&self) -> super::builder::database_admin::DropDatabase {
        super::builder::database_admin::DropDatabase::new(self.inner.clone())
    }

    /// Returns the schema of a Cloud Spanner database as a list of formatted
    /// DDL statements. This method does not show pending schema updates, those may
    /// be queried using the [Operations][google.longrunning.Operations] API.
    ///
    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin
    /// ) -> Result<()> {
    ///     let response = client.get_database_ddl()
    ///         /* set fields */
    ///         .send().await?;
    ///     println!("response {:?}", response);
    ///     Ok(())
    /// }
    /// ```
    pub fn get_database_ddl(&self) -> super::builder::database_admin::GetDatabaseDdl {
        super::builder::database_admin::GetDatabaseDdl::new(self.inner.clone())
    }

    /// Sets the access control policy on a database or backup resource.
    /// Replaces any existing policy.
    ///
    /// Authorization requires `spanner.databases.setIamPolicy`
    /// permission on [resource][google.iam.v1.SetIamPolicyRequest.resource].
    /// For backups, authorization requires `spanner.backups.setIamPolicy`
    /// permission on [resource][google.iam.v1.SetIamPolicyRequest.resource].
    ///
    /// [google.iam.v1.SetIamPolicyRequest.resource]: google_cloud_iam_v1::model::SetIamPolicyRequest::resource
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin
    /// ) -> Result<()> {
    ///     let response = client.set_iam_policy()
    ///         /* set fields */
    ///         .send().await?;
    ///     println!("response {:?}", response);
    ///     Ok(())
    /// }
    /// ```
    pub fn set_iam_policy(&self) -> super::builder::database_admin::SetIamPolicy {
        super::builder::database_admin::SetIamPolicy::new(self.inner.clone())
    }

    /// Gets the access control policy for a database or backup resource.
    /// Returns an empty policy if a database or backup exists but does not have a
    /// policy set.
    ///
    /// Authorization requires `spanner.databases.getIamPolicy` permission on
    /// [resource][google.iam.v1.GetIamPolicyRequest.resource].
    /// For backups, authorization requires `spanner.backups.getIamPolicy`
    /// permission on [resource][google.iam.v1.GetIamPolicyRequest.resource].
    ///
    /// [google.iam.v1.GetIamPolicyRequest.resource]: google_cloud_iam_v1::model::GetIamPolicyRequest::resource
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin
    /// ) -> Result<()> {
    ///     let response = client.get_iam_policy()
    ///         /* set fields */
    ///         .send().await?;
    ///     println!("response {:?}", response);
    ///     Ok(())
    /// }
    /// ```
    pub fn get_iam_policy(&self) -> super::builder::database_admin::GetIamPolicy {
        super::builder::database_admin::GetIamPolicy::new(self.inner.clone())
    }

    /// Returns permissions that the caller has on the specified database or backup
    /// resource.
    ///
    /// Attempting this RPC on a non-existent Cloud Spanner database will
    /// result in a NOT_FOUND error if the user has
    /// `spanner.databases.list` permission on the containing Cloud
    /// Spanner instance. Otherwise returns an empty set of permissions.
    /// Calling this method on a backup that does not exist will
    /// result in a NOT_FOUND error if the user has
    /// `spanner.backups.list` permission on the containing instance.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin
    /// ) -> Result<()> {
    ///     let response = client.test_iam_permissions()
    ///         /* set fields */
    ///         .send().await?;
    ///     println!("response {:?}", response);
    ///     Ok(())
    /// }
    /// ```
    pub fn test_iam_permissions(&self) -> super::builder::database_admin::TestIamPermissions {
        super::builder::database_admin::TestIamPermissions::new(self.inner.clone())
    }

    /// Starts creating a new Cloud Spanner Backup.
    /// The returned backup [long-running operation][google.longrunning.Operation]
    /// will have a name of the format
    /// `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
    /// and can be used to track creation of the backup. The
    /// [metadata][google.longrunning.Operation.metadata] field type is
    /// [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].
    /// The [response][google.longrunning.Operation.response] field type is
    /// [Backup][google.spanner.admin.database.v1.Backup], if successful.
    /// Cancelling the returned operation will stop the creation and delete the
    /// backup. There can be only one pending backup creation per database. Backup
    /// creation of different databases can run concurrently.
    ///
    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
    /// [google.longrunning.Operation.response]: google_cloud_longrunning::model::Operation::result
    /// [google.spanner.admin.database.v1.Backup]: crate::model::Backup
    /// [google.spanner.admin.database.v1.CreateBackupMetadata]: crate::model::CreateBackupMetadata
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_lro::Poller;
    /// use google_cloud_spanner_admin_database_v1::model::Backup;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin, parent: &str
    /// ) -> Result<()> {
    ///     let response = client.create_backup()
    ///         .set_parent(parent)
    ///         .set_backup_id("backup_id_value")
    ///         .set_backup(
    ///             Backup::new()/* set fields */
    ///         )
    ///         .poller().until_done().await?;
    ///     println!("response {:?}", response);
    ///     Ok(())
    /// }
    /// ```
    pub fn create_backup(&self) -> super::builder::database_admin::CreateBackup {
        super::builder::database_admin::CreateBackup::new(self.inner.clone())
    }

    /// Starts copying a Cloud Spanner Backup.
    /// The returned backup [long-running operation][google.longrunning.Operation]
    /// will have a name of the format
    /// `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
    /// and can be used to track copying of the backup. The operation is associated
    /// with the destination backup.
    /// The [metadata][google.longrunning.Operation.metadata] field type is
    /// [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata].
    /// The [response][google.longrunning.Operation.response] field type is
    /// [Backup][google.spanner.admin.database.v1.Backup], if successful.
    /// Cancelling the returned operation will stop the copying and delete the
    /// destination backup. Concurrent CopyBackup requests can run on the same
    /// source backup.
    ///
    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
    /// [google.longrunning.Operation.response]: google_cloud_longrunning::model::Operation::result
    /// [google.spanner.admin.database.v1.Backup]: crate::model::Backup
    /// [google.spanner.admin.database.v1.CopyBackupMetadata]: crate::model::CopyBackupMetadata
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_lro::Poller;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin
    /// ) -> Result<()> {
    ///     let response = client.copy_backup()
    ///         /* set fields */
    ///         .poller().until_done().await?;
    ///     println!("response {:?}", response);
    ///     Ok(())
    /// }
    /// ```
    pub fn copy_backup(&self) -> super::builder::database_admin::CopyBackup {
        super::builder::database_admin::CopyBackup::new(self.inner.clone())
    }

    /// Gets metadata on a pending or completed
    /// [Backup][google.spanner.admin.database.v1.Backup].
    ///
    /// [google.spanner.admin.database.v1.Backup]: crate::model::Backup
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin, name: &str
    /// ) -> Result<()> {
    ///     let response = client.get_backup()
    ///         .set_name(name)
    ///         .send().await?;
    ///     println!("response {:?}", response);
    ///     Ok(())
    /// }
    /// ```
    pub fn get_backup(&self) -> super::builder::database_admin::GetBackup {
        super::builder::database_admin::GetBackup::new(self.inner.clone())
    }

    /// Updates a pending or completed
    /// [Backup][google.spanner.admin.database.v1.Backup].
    ///
    /// [google.spanner.admin.database.v1.Backup]: crate::model::Backup
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// # extern crate wkt as google_cloud_wkt;
    /// use google_cloud_wkt::FieldMask;
    /// use google_cloud_spanner_admin_database_v1::model::Backup;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin, name: &str
    /// ) -> Result<()> {
    ///     let response = client.update_backup()
    ///         .set_backup(
    ///             Backup::new().set_name(name)/* set fields */
    ///         )
    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
    ///         .send().await?;
    ///     println!("response {:?}", response);
    ///     Ok(())
    /// }
    /// ```
    pub fn update_backup(&self) -> super::builder::database_admin::UpdateBackup {
        super::builder::database_admin::UpdateBackup::new(self.inner.clone())
    }

    /// Deletes a pending or completed
    /// [Backup][google.spanner.admin.database.v1.Backup].
    ///
    /// [google.spanner.admin.database.v1.Backup]: crate::model::Backup
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin, name: &str
    /// ) -> Result<()> {
    ///     client.delete_backup()
    ///         .set_name(name)
    ///         .send().await?;
    ///     Ok(())
    /// }
    /// ```
    pub fn delete_backup(&self) -> super::builder::database_admin::DeleteBackup {
        super::builder::database_admin::DeleteBackup::new(self.inner.clone())
    }

    /// Lists completed and pending backups.
    /// Backups returned are ordered by `create_time` in descending order,
    /// starting from the most recent `create_time`.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_gax::paginator::ItemPaginator as _;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin, parent: &str
    /// ) -> Result<()> {
    ///     let mut list = client.list_backups()
    ///         .set_parent(parent)
    ///         .by_item();
    ///     while let Some(item) = list.next().await.transpose()? {
    ///         println!("{:?}", item);
    ///     }
    ///     Ok(())
    /// }
    /// ```
    pub fn list_backups(&self) -> super::builder::database_admin::ListBackups {
        super::builder::database_admin::ListBackups::new(self.inner.clone())
    }

    /// Create a new database by restoring from a completed backup. The new
    /// database must be in the same project and in an instance with the same
    /// instance configuration as the instance containing
    /// the backup. The returned database [long-running
    /// operation][google.longrunning.Operation] has a name of the format
    /// `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`,
    /// and can be used to track the progress of the operation, and to cancel it.
    /// The [metadata][google.longrunning.Operation.metadata] field type is
    /// [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata].
    /// The [response][google.longrunning.Operation.response] type
    /// is [Database][google.spanner.admin.database.v1.Database], if
    /// successful. Cancelling the returned operation will stop the restore and
    /// delete the database.
    /// There can be only one database being restored into an instance at a time.
    /// Once the restore operation completes, a new restore operation can be
    /// initiated, without waiting for the optimize operation associated with the
    /// first restore to complete.
    ///
    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
    /// [google.longrunning.Operation.response]: google_cloud_longrunning::model::Operation::result
    /// [google.spanner.admin.database.v1.Database]: crate::model::Database
    /// [google.spanner.admin.database.v1.RestoreDatabaseMetadata]: crate::model::RestoreDatabaseMetadata
    ///
    /// # Long running operations
    ///
    /// This method is used to start, and/or poll a [long-running Operation].
    /// The [Working with long-running operations] chapter in the [user guide]
    /// covers these operations in detail.
    ///
    /// [long-running operation]: https://google.aip.dev/151
    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_lro::Poller;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin
    /// ) -> Result<()> {
    ///     let response = client.restore_database()
    ///         /* set fields */
    ///         .poller().until_done().await?;
    ///     println!("response {:?}", response);
    ///     Ok(())
    /// }
    /// ```
    pub fn restore_database(&self) -> super::builder::database_admin::RestoreDatabase {
        super::builder::database_admin::RestoreDatabase::new(self.inner.clone())
    }

    /// Lists database [longrunning-operations][google.longrunning.Operation].
    /// A database operation has a name of the form
    /// `projects/<project>/instances/<instance>/databases/<database>/operations/<operation>`.
    /// The long-running operation
    /// [metadata][google.longrunning.Operation.metadata] field type
    /// `metadata.type_url` describes the type of the metadata. Operations returned
    /// include those that have completed/failed/canceled within the last 7 days,
    /// and pending operations.
    ///
    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_gax::paginator::ItemPaginator as _;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin
    /// ) -> Result<()> {
    ///     let mut list = client.list_database_operations()
    ///         /* set fields */
    ///         .by_item();
    ///     while let Some(item) = list.next().await.transpose()? {
    ///         println!("{:?}", item);
    ///     }
    ///     Ok(())
    /// }
    /// ```
    pub fn list_database_operations(
        &self,
    ) -> super::builder::database_admin::ListDatabaseOperations {
        super::builder::database_admin::ListDatabaseOperations::new(self.inner.clone())
    }

    /// Lists the backup [long-running operations][google.longrunning.Operation] in
    /// the given instance. A backup operation has a name of the form
    /// `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation>`.
    /// The long-running operation
    /// [metadata][google.longrunning.Operation.metadata] field type
    /// `metadata.type_url` describes the type of the metadata. Operations returned
    /// include those that have completed/failed/canceled within the last 7 days,
    /// and pending operations. Operations returned are ordered by
    /// `operation.metadata.value.progress.start_time` in descending order starting
    /// from the most recently started operation.
    ///
    /// [google.longrunning.Operation]: google_cloud_longrunning::model::Operation
    /// [google.longrunning.Operation.metadata]: google_cloud_longrunning::model::Operation::metadata
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_gax::paginator::ItemPaginator as _;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin
    /// ) -> Result<()> {
    ///     let mut list = client.list_backup_operations()
    ///         /* set fields */
    ///         .by_item();
    ///     while let Some(item) = list.next().await.transpose()? {
    ///         println!("{:?}", item);
    ///     }
    ///     Ok(())
    /// }
    /// ```
    pub fn list_backup_operations(&self) -> super::builder::database_admin::ListBackupOperations {
        super::builder::database_admin::ListBackupOperations::new(self.inner.clone())
    }

    /// Lists Cloud Spanner database roles.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_gax::paginator::ItemPaginator as _;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin, parent: &str
    /// ) -> Result<()> {
    ///     let mut list = client.list_database_roles()
    ///         .set_parent(parent)
    ///         .by_item();
    ///     while let Some(item) = list.next().await.transpose()? {
    ///         println!("{:?}", item);
    ///     }
    ///     Ok(())
    /// }
    /// ```
    pub fn list_database_roles(&self) -> super::builder::database_admin::ListDatabaseRoles {
        super::builder::database_admin::ListDatabaseRoles::new(self.inner.clone())
    }

    /// Adds split points to specified tables, indexes of a database.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin
    /// ) -> Result<()> {
    ///     let response = client.add_split_points()
    ///         /* set fields */
    ///         .send().await?;
    ///     println!("response {:?}", response);
    ///     Ok(())
    /// }
    /// ```
    pub fn add_split_points(&self) -> super::builder::database_admin::AddSplitPoints {
        super::builder::database_admin::AddSplitPoints::new(self.inner.clone())
    }

    /// Creates a new backup schedule.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin, parent: &str
    /// ) -> Result<()> {
    ///     let response = client.create_backup_schedule()
    ///         .set_parent(parent)
    ///         .set_backup_schedule(
    ///             BackupSchedule::new()/* set fields */
    ///         )
    ///         .send().await?;
    ///     println!("response {:?}", response);
    ///     Ok(())
    /// }
    /// ```
    pub fn create_backup_schedule(&self) -> super::builder::database_admin::CreateBackupSchedule {
        super::builder::database_admin::CreateBackupSchedule::new(self.inner.clone())
    }

    /// Gets backup schedule for the input schedule name.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin, name: &str
    /// ) -> Result<()> {
    ///     let response = client.get_backup_schedule()
    ///         .set_name(name)
    ///         .send().await?;
    ///     println!("response {:?}", response);
    ///     Ok(())
    /// }
    /// ```
    pub fn get_backup_schedule(&self) -> super::builder::database_admin::GetBackupSchedule {
        super::builder::database_admin::GetBackupSchedule::new(self.inner.clone())
    }

    /// Updates a backup schedule.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// # extern crate wkt as google_cloud_wkt;
    /// use google_cloud_wkt::FieldMask;
    /// use google_cloud_spanner_admin_database_v1::model::BackupSchedule;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin, name: &str
    /// ) -> Result<()> {
    ///     let response = client.update_backup_schedule()
    ///         .set_backup_schedule(
    ///             BackupSchedule::new().set_name(name)/* set fields */
    ///         )
    ///         .set_update_mask(FieldMask::default().set_paths(["updated.field.path1", "updated.field.path2"]))
    ///         .send().await?;
    ///     println!("response {:?}", response);
    ///     Ok(())
    /// }
    /// ```
    pub fn update_backup_schedule(&self) -> super::builder::database_admin::UpdateBackupSchedule {
        super::builder::database_admin::UpdateBackupSchedule::new(self.inner.clone())
    }

    /// Deletes a backup schedule.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin, name: &str
    /// ) -> Result<()> {
    ///     client.delete_backup_schedule()
    ///         .set_name(name)
    ///         .send().await?;
    ///     Ok(())
    /// }
    /// ```
    pub fn delete_backup_schedule(&self) -> super::builder::database_admin::DeleteBackupSchedule {
        super::builder::database_admin::DeleteBackupSchedule::new(self.inner.clone())
    }

    /// Lists all the backup schedules for the database.
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_gax::paginator::ItemPaginator as _;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin, parent: &str
    /// ) -> Result<()> {
    ///     let mut list = client.list_backup_schedules()
    ///         .set_parent(parent)
    ///         .by_item();
    ///     while let Some(item) = list.next().await.transpose()? {
    ///         println!("{:?}", item);
    ///     }
    ///     Ok(())
    /// }
    /// ```
    pub fn list_backup_schedules(&self) -> super::builder::database_admin::ListBackupSchedules {
        super::builder::database_admin::ListBackupSchedules::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_gax::paginator::ItemPaginator as _;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin
    /// ) -> Result<()> {
    ///     let mut list = client.list_operations()
    ///         /* set fields */
    ///         .by_item();
    ///     while let Some(item) = list.next().await.transpose()? {
    ///         println!("{:?}", item);
    ///     }
    ///     Ok(())
    /// }
    /// ```
    pub fn list_operations(&self) -> super::builder::database_admin::ListOperations {
        super::builder::database_admin::ListOperations::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin
    /// ) -> Result<()> {
    ///     let response = client.get_operation()
    ///         /* set fields */
    ///         .send().await?;
    ///     println!("response {:?}", response);
    ///     Ok(())
    /// }
    /// ```
    pub fn get_operation(&self) -> super::builder::database_admin::GetOperation {
        super::builder::database_admin::GetOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin
    /// ) -> Result<()> {
    ///     client.delete_operation()
    ///         /* set fields */
    ///         .send().await?;
    ///     Ok(())
    /// }
    /// ```
    pub fn delete_operation(&self) -> super::builder::database_admin::DeleteOperation {
        super::builder::database_admin::DeleteOperation::new(self.inner.clone())
    }

    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
    ///
    /// [google.longrunning.Operations]: google-cloud-longrunning::client::Operations
    ///
    /// # Example
    /// ```
    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
    /// use google_cloud_spanner_admin_database_v1::Result;
    /// async fn sample(
    ///    client: &DatabaseAdmin
    /// ) -> Result<()> {
    ///     client.cancel_operation()
    ///         /* set fields */
    ///         .send().await?;
    ///     Ok(())
    /// }
    /// ```
    pub fn cancel_operation(&self) -> super::builder::database_admin::CancelOperation {
        super::builder::database_admin::CancelOperation::new(self.inner.clone())
    }
}