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