google_cloud_spanner_admin_database_v1/
client.rs

1// Copyright 2025 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14//
15// Code generated by sidekick. DO NOT EDIT.
16#![allow(rustdoc::redundant_explicit_links)]
17#![allow(rustdoc::broken_intra_doc_links)]
18
19use crate::Result;
20use std::sync::Arc;
21
22/// Implements a client for the Cloud Spanner API.
23///
24/// # Example
25/// ```
26/// # tokio_test::block_on(async {
27/// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
28/// let client = DatabaseAdmin::builder().build().await?;
29/// // use `client` to make requests to the {Codec.APITitle}}.
30/// # gax::Result::<()>::Ok(()) });
31/// ```
32///
33/// # Service Description
34///
35/// Cloud Spanner Database Admin API
36///
37/// The Cloud Spanner Database Admin API can be used to:
38///
39/// * create, drop, and list databases
40/// * update the schema of pre-existing databases
41/// * create, delete, copy and list backups for a database
42/// * restore a database from an existing backup
43///
44/// # Configuration
45///
46/// To configure `DatabaseAdmin` use the `with_*` methods in the type returned
47/// by [builder()][DatabaseAdmin::builder]. The default configuration should
48/// work for most applications. Common configuration changes include
49///
50/// * [with_endpoint()]: by default this client uses the global default endpoint
51///   (`https://spanner.googleapis.com`). Applications using regional
52///   endpoints or running in restricted networks (e.g. a network configured
53//    with [Private Google Access with VPC Service Controls]) may want to
54///   override this default.
55/// * [with_credentials()]: by default this client uses
56///   [Application Default Credentials]. Applications using custom
57///   authentication may need to override this default.
58///
59/// [with_endpoint()]: super::builder::database_admin::ClientBuilder::with_endpoint
60/// [with_credentials()]: super::builder::database_admin::ClientBuilder::credentials
61/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
62/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
63///
64/// # Pooling and Cloning
65///
66/// `DatabaseAdmin` holds a connection pool internally, it is advised to
67/// create one and the reuse it.  You do not need to wrap `DatabaseAdmin` in
68/// an [Rc](std::rc::Rc) or [Arc] to reuse it, because it already uses an `Arc`
69/// internally.
70#[derive(Clone, Debug)]
71pub struct DatabaseAdmin {
72    inner: Arc<dyn super::stub::dynamic::DatabaseAdmin>,
73}
74
75impl DatabaseAdmin {
76    /// Returns a builder for [DatabaseAdmin].
77    ///
78    /// ```
79    /// # tokio_test::block_on(async {
80    /// # use google_cloud_spanner_admin_database_v1::client::DatabaseAdmin;
81    /// let client = DatabaseAdmin::builder().build().await?;
82    /// # gax::Result::<()>::Ok(()) });
83    /// ```
84    pub fn builder() -> super::builder::database_admin::ClientBuilder {
85        gax::client_builder::internal::new_builder(super::builder::database_admin::client::Factory)
86    }
87
88    /// Creates a new client from the provided stub.
89    ///
90    /// The most common case for calling this function is in tests mocking the
91    /// client's behavior.
92    pub fn from_stub<T>(stub: T) -> Self
93    where
94        T: super::stub::DatabaseAdmin + 'static,
95    {
96        Self {
97            inner: Arc::new(stub),
98        }
99    }
100
101    pub(crate) async fn new(config: gaxi::options::ClientConfig) -> Result<Self> {
102        let inner = Self::build_inner(config).await?;
103        Ok(Self { inner })
104    }
105
106    async fn build_inner(
107        conf: gaxi::options::ClientConfig,
108    ) -> Result<Arc<dyn super::stub::dynamic::DatabaseAdmin>> {
109        if gaxi::options::tracing_enabled(&conf) {
110            return Ok(Arc::new(Self::build_with_tracing(conf).await?));
111        }
112        Ok(Arc::new(Self::build_transport(conf).await?))
113    }
114
115    async fn build_transport(
116        conf: gaxi::options::ClientConfig,
117    ) -> Result<impl super::stub::DatabaseAdmin> {
118        super::transport::DatabaseAdmin::new(conf).await
119    }
120
121    async fn build_with_tracing(
122        conf: gaxi::options::ClientConfig,
123    ) -> Result<impl super::stub::DatabaseAdmin> {
124        Self::build_transport(conf)
125            .await
126            .map(super::tracing::DatabaseAdmin::new)
127    }
128
129    /// Lists Cloud Spanner databases.
130    pub fn list_databases(
131        &self,
132        parent: impl Into<std::string::String>,
133    ) -> super::builder::database_admin::ListDatabases {
134        super::builder::database_admin::ListDatabases::new(self.inner.clone())
135            .set_parent(parent.into())
136    }
137
138    /// Creates a new Cloud Spanner database and starts to prepare it for serving.
139    /// The returned [long-running operation][google.longrunning.Operation] will
140    /// have a name of the format `<database_name>/operations/<operation_id>` and
141    /// can be used to track preparation of the database. The
142    /// [metadata][google.longrunning.Operation.metadata] field type is
143    /// [CreateDatabaseMetadata][google.spanner.admin.database.v1.CreateDatabaseMetadata].
144    /// The [response][google.longrunning.Operation.response] field type is
145    /// [Database][google.spanner.admin.database.v1.Database], if successful.
146    ///
147    /// [google.longrunning.Operation]: longrunning::model::Operation
148    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
149    /// [google.longrunning.Operation.response]: longrunning::model::Operation::result
150    /// [google.spanner.admin.database.v1.CreateDatabaseMetadata]: crate::model::CreateDatabaseMetadata
151    /// [google.spanner.admin.database.v1.Database]: crate::model::Database
152    ///
153    /// # Long running operations
154    ///
155    /// This method is used to start, and/or poll a [long-running Operation].
156    /// The [Working with long-running operations] chapter in the [user guide]
157    /// covers these operations in detail.
158    ///
159    /// [long-running operation]: https://google.aip.dev/151
160    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
161    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
162    pub fn create_database(
163        &self,
164        parent: impl Into<std::string::String>,
165    ) -> super::builder::database_admin::CreateDatabase {
166        super::builder::database_admin::CreateDatabase::new(self.inner.clone())
167            .set_parent(parent.into())
168    }
169
170    /// Gets the state of a Cloud Spanner database.
171    pub fn get_database(
172        &self,
173        name: impl Into<std::string::String>,
174    ) -> super::builder::database_admin::GetDatabase {
175        super::builder::database_admin::GetDatabase::new(self.inner.clone()).set_name(name.into())
176    }
177
178    /// Updates a Cloud Spanner database. The returned
179    /// [long-running operation][google.longrunning.Operation] can be used to track
180    /// the progress of updating the database. If the named database does not
181    /// exist, returns `NOT_FOUND`.
182    ///
183    /// While the operation is pending:
184    ///
185    /// * The database's
186    ///   [reconciling][google.spanner.admin.database.v1.Database.reconciling]
187    ///   field is set to true.
188    /// * Cancelling the operation is best-effort. If the cancellation succeeds,
189    ///   the operation metadata's
190    ///   [cancel_time][google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time]
191    ///   is set, the updates are reverted, and the operation terminates with a
192    ///   `CANCELLED` status.
193    /// * New UpdateDatabase requests will return a `FAILED_PRECONDITION` error
194    ///   until the pending operation is done (returns successfully or with
195    ///   error).
196    /// * Reading the database via the API continues to give the pre-request
197    ///   values.
198    ///
199    /// Upon completion of the returned operation:
200    ///
201    /// * The new values are in effect and readable via the API.
202    /// * The database's
203    ///   [reconciling][google.spanner.admin.database.v1.Database.reconciling]
204    ///   field becomes false.
205    ///
206    /// The returned [long-running operation][google.longrunning.Operation] will
207    /// have a name of the format
208    /// `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`
209    /// and can be used to track the database modification. The
210    /// [metadata][google.longrunning.Operation.metadata] field type is
211    /// [UpdateDatabaseMetadata][google.spanner.admin.database.v1.UpdateDatabaseMetadata].
212    /// The [response][google.longrunning.Operation.response] field type is
213    /// [Database][google.spanner.admin.database.v1.Database], if successful.
214    ///
215    /// [google.longrunning.Operation]: longrunning::model::Operation
216    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
217    /// [google.longrunning.Operation.response]: longrunning::model::Operation::result
218    /// [google.spanner.admin.database.v1.Database]: crate::model::Database
219    /// [google.spanner.admin.database.v1.Database.reconciling]: crate::model::Database::reconciling
220    /// [google.spanner.admin.database.v1.UpdateDatabaseMetadata]: crate::model::UpdateDatabaseMetadata
221    /// [google.spanner.admin.database.v1.UpdateDatabaseMetadata.cancel_time]: crate::model::UpdateDatabaseMetadata::cancel_time
222    ///
223    /// # Long running operations
224    ///
225    /// This method is used to start, and/or poll a [long-running Operation].
226    /// The [Working with long-running operations] chapter in the [user guide]
227    /// covers these operations in detail.
228    ///
229    /// [long-running operation]: https://google.aip.dev/151
230    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
231    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
232    pub fn update_database(
233        &self,
234        database: impl Into<crate::model::Database>,
235    ) -> super::builder::database_admin::UpdateDatabase {
236        super::builder::database_admin::UpdateDatabase::new(self.inner.clone())
237            .set_database(database.into())
238    }
239
240    /// Updates the schema of a Cloud Spanner database by
241    /// creating/altering/dropping tables, columns, indexes, etc. The returned
242    /// [long-running operation][google.longrunning.Operation] will have a name of
243    /// the format `<database_name>/operations/<operation_id>` and can be used to
244    /// track execution of the schema change(s). The
245    /// [metadata][google.longrunning.Operation.metadata] field type is
246    /// [UpdateDatabaseDdlMetadata][google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata].
247    /// The operation has no response.
248    ///
249    /// [google.longrunning.Operation]: longrunning::model::Operation
250    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
251    /// [google.spanner.admin.database.v1.UpdateDatabaseDdlMetadata]: crate::model::UpdateDatabaseDdlMetadata
252    ///
253    /// # Long running operations
254    ///
255    /// This method is used to start, and/or poll a [long-running Operation].
256    /// The [Working with long-running operations] chapter in the [user guide]
257    /// covers these operations in detail.
258    ///
259    /// [long-running operation]: https://google.aip.dev/151
260    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
261    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
262    pub fn update_database_ddl(
263        &self,
264        database: impl Into<std::string::String>,
265    ) -> super::builder::database_admin::UpdateDatabaseDdl {
266        super::builder::database_admin::UpdateDatabaseDdl::new(self.inner.clone())
267            .set_database(database.into())
268    }
269
270    /// Drops (aka deletes) a Cloud Spanner database.
271    /// Completed backups for the database will be retained according to their
272    /// `expire_time`.
273    /// Note: Cloud Spanner might continue to accept requests for a few seconds
274    /// after the database has been deleted.
275    pub fn drop_database(
276        &self,
277        database: impl Into<std::string::String>,
278    ) -> super::builder::database_admin::DropDatabase {
279        super::builder::database_admin::DropDatabase::new(self.inner.clone())
280            .set_database(database.into())
281    }
282
283    /// Returns the schema of a Cloud Spanner database as a list of formatted
284    /// DDL statements. This method does not show pending schema updates, those may
285    /// be queried using the [Operations][google.longrunning.Operations] API.
286    ///
287    /// [google.longrunning.Operations]: longrunning::client::Operations
288    pub fn get_database_ddl(
289        &self,
290        database: impl Into<std::string::String>,
291    ) -> super::builder::database_admin::GetDatabaseDdl {
292        super::builder::database_admin::GetDatabaseDdl::new(self.inner.clone())
293            .set_database(database.into())
294    }
295
296    /// Sets the access control policy on a database or backup resource.
297    /// Replaces any existing policy.
298    ///
299    /// Authorization requires `spanner.databases.setIamPolicy`
300    /// permission on [resource][google.iam.v1.SetIamPolicyRequest.resource].
301    /// For backups, authorization requires `spanner.backups.setIamPolicy`
302    /// permission on [resource][google.iam.v1.SetIamPolicyRequest.resource].
303    ///
304    /// [google.iam.v1.SetIamPolicyRequest.resource]: iam_v1::model::SetIamPolicyRequest::resource
305    pub fn set_iam_policy(
306        &self,
307        resource: impl Into<std::string::String>,
308    ) -> super::builder::database_admin::SetIamPolicy {
309        super::builder::database_admin::SetIamPolicy::new(self.inner.clone())
310            .set_resource(resource.into())
311    }
312
313    /// Gets the access control policy for a database or backup resource.
314    /// Returns an empty policy if a database or backup exists but does not have a
315    /// policy set.
316    ///
317    /// Authorization requires `spanner.databases.getIamPolicy` permission on
318    /// [resource][google.iam.v1.GetIamPolicyRequest.resource].
319    /// For backups, authorization requires `spanner.backups.getIamPolicy`
320    /// permission on [resource][google.iam.v1.GetIamPolicyRequest.resource].
321    ///
322    /// [google.iam.v1.GetIamPolicyRequest.resource]: iam_v1::model::GetIamPolicyRequest::resource
323    pub fn get_iam_policy(
324        &self,
325        resource: impl Into<std::string::String>,
326    ) -> super::builder::database_admin::GetIamPolicy {
327        super::builder::database_admin::GetIamPolicy::new(self.inner.clone())
328            .set_resource(resource.into())
329    }
330
331    /// Returns permissions that the caller has on the specified database or backup
332    /// resource.
333    ///
334    /// Attempting this RPC on a non-existent Cloud Spanner database will
335    /// result in a NOT_FOUND error if the user has
336    /// `spanner.databases.list` permission on the containing Cloud
337    /// Spanner instance. Otherwise returns an empty set of permissions.
338    /// Calling this method on a backup that does not exist will
339    /// result in a NOT_FOUND error if the user has
340    /// `spanner.backups.list` permission on the containing instance.
341    pub fn test_iam_permissions(
342        &self,
343        resource: impl Into<std::string::String>,
344    ) -> super::builder::database_admin::TestIamPermissions {
345        super::builder::database_admin::TestIamPermissions::new(self.inner.clone())
346            .set_resource(resource.into())
347    }
348
349    /// Starts creating a new Cloud Spanner Backup.
350    /// The returned backup [long-running operation][google.longrunning.Operation]
351    /// will have a name of the format
352    /// `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
353    /// and can be used to track creation of the backup. The
354    /// [metadata][google.longrunning.Operation.metadata] field type is
355    /// [CreateBackupMetadata][google.spanner.admin.database.v1.CreateBackupMetadata].
356    /// The [response][google.longrunning.Operation.response] field type is
357    /// [Backup][google.spanner.admin.database.v1.Backup], if successful.
358    /// Cancelling the returned operation will stop the creation and delete the
359    /// backup. There can be only one pending backup creation per database. Backup
360    /// creation of different databases can run concurrently.
361    ///
362    /// [google.longrunning.Operation]: longrunning::model::Operation
363    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
364    /// [google.longrunning.Operation.response]: longrunning::model::Operation::result
365    /// [google.spanner.admin.database.v1.Backup]: crate::model::Backup
366    /// [google.spanner.admin.database.v1.CreateBackupMetadata]: crate::model::CreateBackupMetadata
367    ///
368    /// # Long running operations
369    ///
370    /// This method is used to start, and/or poll a [long-running Operation].
371    /// The [Working with long-running operations] chapter in the [user guide]
372    /// covers these operations in detail.
373    ///
374    /// [long-running operation]: https://google.aip.dev/151
375    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
376    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
377    pub fn create_backup(
378        &self,
379        parent: impl Into<std::string::String>,
380    ) -> super::builder::database_admin::CreateBackup {
381        super::builder::database_admin::CreateBackup::new(self.inner.clone())
382            .set_parent(parent.into())
383    }
384
385    /// Starts copying a Cloud Spanner Backup.
386    /// The returned backup [long-running operation][google.longrunning.Operation]
387    /// will have a name of the format
388    /// `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation_id>`
389    /// and can be used to track copying of the backup. The operation is associated
390    /// with the destination backup.
391    /// The [metadata][google.longrunning.Operation.metadata] field type is
392    /// [CopyBackupMetadata][google.spanner.admin.database.v1.CopyBackupMetadata].
393    /// The [response][google.longrunning.Operation.response] field type is
394    /// [Backup][google.spanner.admin.database.v1.Backup], if successful.
395    /// Cancelling the returned operation will stop the copying and delete the
396    /// destination backup. Concurrent CopyBackup requests can run on the same
397    /// source backup.
398    ///
399    /// [google.longrunning.Operation]: longrunning::model::Operation
400    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
401    /// [google.longrunning.Operation.response]: longrunning::model::Operation::result
402    /// [google.spanner.admin.database.v1.Backup]: crate::model::Backup
403    /// [google.spanner.admin.database.v1.CopyBackupMetadata]: crate::model::CopyBackupMetadata
404    ///
405    /// # Long running operations
406    ///
407    /// This method is used to start, and/or poll a [long-running Operation].
408    /// The [Working with long-running operations] chapter in the [user guide]
409    /// covers these operations in detail.
410    ///
411    /// [long-running operation]: https://google.aip.dev/151
412    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
413    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
414    pub fn copy_backup(
415        &self,
416        parent: impl Into<std::string::String>,
417    ) -> super::builder::database_admin::CopyBackup {
418        super::builder::database_admin::CopyBackup::new(self.inner.clone())
419            .set_parent(parent.into())
420    }
421
422    /// Gets metadata on a pending or completed
423    /// [Backup][google.spanner.admin.database.v1.Backup].
424    ///
425    /// [google.spanner.admin.database.v1.Backup]: crate::model::Backup
426    pub fn get_backup(
427        &self,
428        name: impl Into<std::string::String>,
429    ) -> super::builder::database_admin::GetBackup {
430        super::builder::database_admin::GetBackup::new(self.inner.clone()).set_name(name.into())
431    }
432
433    /// Updates a pending or completed
434    /// [Backup][google.spanner.admin.database.v1.Backup].
435    ///
436    /// [google.spanner.admin.database.v1.Backup]: crate::model::Backup
437    pub fn update_backup(
438        &self,
439        backup: impl Into<crate::model::Backup>,
440    ) -> super::builder::database_admin::UpdateBackup {
441        super::builder::database_admin::UpdateBackup::new(self.inner.clone())
442            .set_backup(backup.into())
443    }
444
445    /// Deletes a pending or completed
446    /// [Backup][google.spanner.admin.database.v1.Backup].
447    ///
448    /// [google.spanner.admin.database.v1.Backup]: crate::model::Backup
449    pub fn delete_backup(
450        &self,
451        name: impl Into<std::string::String>,
452    ) -> super::builder::database_admin::DeleteBackup {
453        super::builder::database_admin::DeleteBackup::new(self.inner.clone()).set_name(name.into())
454    }
455
456    /// Lists completed and pending backups.
457    /// Backups returned are ordered by `create_time` in descending order,
458    /// starting from the most recent `create_time`.
459    pub fn list_backups(
460        &self,
461        parent: impl Into<std::string::String>,
462    ) -> super::builder::database_admin::ListBackups {
463        super::builder::database_admin::ListBackups::new(self.inner.clone())
464            .set_parent(parent.into())
465    }
466
467    /// Create a new database by restoring from a completed backup. The new
468    /// database must be in the same project and in an instance with the same
469    /// instance configuration as the instance containing
470    /// the backup. The returned database [long-running
471    /// operation][google.longrunning.Operation] has a name of the format
472    /// `projects/<project>/instances/<instance>/databases/<database>/operations/<operation_id>`,
473    /// and can be used to track the progress of the operation, and to cancel it.
474    /// The [metadata][google.longrunning.Operation.metadata] field type is
475    /// [RestoreDatabaseMetadata][google.spanner.admin.database.v1.RestoreDatabaseMetadata].
476    /// The [response][google.longrunning.Operation.response] type
477    /// is [Database][google.spanner.admin.database.v1.Database], if
478    /// successful. Cancelling the returned operation will stop the restore and
479    /// delete the database.
480    /// There can be only one database being restored into an instance at a time.
481    /// Once the restore operation completes, a new restore operation can be
482    /// initiated, without waiting for the optimize operation associated with the
483    /// first restore to complete.
484    ///
485    /// [google.longrunning.Operation]: longrunning::model::Operation
486    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
487    /// [google.longrunning.Operation.response]: longrunning::model::Operation::result
488    /// [google.spanner.admin.database.v1.Database]: crate::model::Database
489    /// [google.spanner.admin.database.v1.RestoreDatabaseMetadata]: crate::model::RestoreDatabaseMetadata
490    ///
491    /// # Long running operations
492    ///
493    /// This method is used to start, and/or poll a [long-running Operation].
494    /// The [Working with long-running operations] chapter in the [user guide]
495    /// covers these operations in detail.
496    ///
497    /// [long-running operation]: https://google.aip.dev/151
498    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
499    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
500    pub fn restore_database(
501        &self,
502        parent: impl Into<std::string::String>,
503    ) -> super::builder::database_admin::RestoreDatabase {
504        super::builder::database_admin::RestoreDatabase::new(self.inner.clone())
505            .set_parent(parent.into())
506    }
507
508    /// Lists database [longrunning-operations][google.longrunning.Operation].
509    /// A database operation has a name of the form
510    /// `projects/<project>/instances/<instance>/databases/<database>/operations/<operation>`.
511    /// The long-running operation
512    /// [metadata][google.longrunning.Operation.metadata] field type
513    /// `metadata.type_url` describes the type of the metadata. Operations returned
514    /// include those that have completed/failed/canceled within the last 7 days,
515    /// and pending operations.
516    ///
517    /// [google.longrunning.Operation]: longrunning::model::Operation
518    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
519    pub fn list_database_operations(
520        &self,
521        parent: impl Into<std::string::String>,
522    ) -> super::builder::database_admin::ListDatabaseOperations {
523        super::builder::database_admin::ListDatabaseOperations::new(self.inner.clone())
524            .set_parent(parent.into())
525    }
526
527    /// Lists the backup [long-running operations][google.longrunning.Operation] in
528    /// the given instance. A backup operation has a name of the form
529    /// `projects/<project>/instances/<instance>/backups/<backup>/operations/<operation>`.
530    /// The long-running operation
531    /// [metadata][google.longrunning.Operation.metadata] field type
532    /// `metadata.type_url` describes the type of the metadata. Operations returned
533    /// include those that have completed/failed/canceled within the last 7 days,
534    /// and pending operations. Operations returned are ordered by
535    /// `operation.metadata.value.progress.start_time` in descending order starting
536    /// from the most recently started operation.
537    ///
538    /// [google.longrunning.Operation]: longrunning::model::Operation
539    /// [google.longrunning.Operation.metadata]: longrunning::model::Operation::metadata
540    pub fn list_backup_operations(
541        &self,
542        parent: impl Into<std::string::String>,
543    ) -> super::builder::database_admin::ListBackupOperations {
544        super::builder::database_admin::ListBackupOperations::new(self.inner.clone())
545            .set_parent(parent.into())
546    }
547
548    /// Lists Cloud Spanner database roles.
549    pub fn list_database_roles(
550        &self,
551        parent: impl Into<std::string::String>,
552    ) -> super::builder::database_admin::ListDatabaseRoles {
553        super::builder::database_admin::ListDatabaseRoles::new(self.inner.clone())
554            .set_parent(parent.into())
555    }
556
557    /// Adds split points to specified tables, indexes of a database.
558    pub fn add_split_points(
559        &self,
560        database: impl Into<std::string::String>,
561    ) -> super::builder::database_admin::AddSplitPoints {
562        super::builder::database_admin::AddSplitPoints::new(self.inner.clone())
563            .set_database(database.into())
564    }
565
566    /// Creates a new backup schedule.
567    pub fn create_backup_schedule(
568        &self,
569        parent: impl Into<std::string::String>,
570    ) -> super::builder::database_admin::CreateBackupSchedule {
571        super::builder::database_admin::CreateBackupSchedule::new(self.inner.clone())
572            .set_parent(parent.into())
573    }
574
575    /// Gets backup schedule for the input schedule name.
576    pub fn get_backup_schedule(
577        &self,
578        name: impl Into<std::string::String>,
579    ) -> super::builder::database_admin::GetBackupSchedule {
580        super::builder::database_admin::GetBackupSchedule::new(self.inner.clone())
581            .set_name(name.into())
582    }
583
584    /// Updates a backup schedule.
585    pub fn update_backup_schedule(
586        &self,
587        backup_schedule: impl Into<crate::model::BackupSchedule>,
588    ) -> super::builder::database_admin::UpdateBackupSchedule {
589        super::builder::database_admin::UpdateBackupSchedule::new(self.inner.clone())
590            .set_backup_schedule(backup_schedule.into())
591    }
592
593    /// Deletes a backup schedule.
594    pub fn delete_backup_schedule(
595        &self,
596        name: impl Into<std::string::String>,
597    ) -> super::builder::database_admin::DeleteBackupSchedule {
598        super::builder::database_admin::DeleteBackupSchedule::new(self.inner.clone())
599            .set_name(name.into())
600    }
601
602    /// Lists all the backup schedules for the database.
603    pub fn list_backup_schedules(
604        &self,
605        parent: impl Into<std::string::String>,
606    ) -> super::builder::database_admin::ListBackupSchedules {
607        super::builder::database_admin::ListBackupSchedules::new(self.inner.clone())
608            .set_parent(parent.into())
609    }
610
611    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
612    ///
613    /// [google.longrunning.Operations]: longrunning::client::Operations
614    pub fn list_operations(
615        &self,
616        name: impl Into<std::string::String>,
617    ) -> super::builder::database_admin::ListOperations {
618        super::builder::database_admin::ListOperations::new(self.inner.clone())
619            .set_name(name.into())
620    }
621
622    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
623    ///
624    /// [google.longrunning.Operations]: longrunning::client::Operations
625    pub fn get_operation(
626        &self,
627        name: impl Into<std::string::String>,
628    ) -> super::builder::database_admin::GetOperation {
629        super::builder::database_admin::GetOperation::new(self.inner.clone()).set_name(name.into())
630    }
631
632    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
633    ///
634    /// [google.longrunning.Operations]: longrunning::client::Operations
635    pub fn delete_operation(
636        &self,
637        name: impl Into<std::string::String>,
638    ) -> super::builder::database_admin::DeleteOperation {
639        super::builder::database_admin::DeleteOperation::new(self.inner.clone())
640            .set_name(name.into())
641    }
642
643    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
644    ///
645    /// [google.longrunning.Operations]: longrunning::client::Operations
646    pub fn cancel_operation(
647        &self,
648        name: impl Into<std::string::String>,
649    ) -> super::builder::database_admin::CancelOperation {
650        super::builder::database_admin::CancelOperation::new(self.inner.clone())
651            .set_name(name.into())
652    }
653}