Skip to main content

google_cloud_backupdr_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
19/// Implements a client for the Backup and DR Service API.
20///
21/// # Example
22/// ```
23/// # async fn sample() -> gax::client_builder::Result<()> {
24/// # use google_cloud_backupdr_v1::client::BackupDR;
25/// let client = BackupDR::builder().build().await?;
26/// // use `client` to make requests to the Backup and DR Service API.
27/// # Ok(()) }
28/// ```
29///
30/// # Service Description
31///
32/// The BackupDR Service
33///
34/// # Configuration
35///
36/// To configure `BackupDR` use the `with_*` methods in the type returned
37/// by [builder()][BackupDR::builder]. The default configuration should
38/// work for most applications. Common configuration changes include
39///
40/// * [with_endpoint()]: by default this client uses the global default endpoint
41///   (`https://backupdr.googleapis.com`). Applications using regional
42///   endpoints or running in restricted networks (e.g. a network configured
43//    with [Private Google Access with VPC Service Controls]) may want to
44///   override this default.
45/// * [with_credentials()]: by default this client uses
46///   [Application Default Credentials]. Applications using custom
47///   authentication may need to override this default.
48///
49/// [with_endpoint()]: super::builder::backup_dr::ClientBuilder::with_endpoint
50/// [with_credentials()]: super::builder::backup_dr::ClientBuilder::credentials
51/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
52/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
53///
54/// # Pooling and Cloning
55///
56/// `BackupDR` holds a connection pool internally, it is advised to
57/// create one and the reuse it.  You do not need to wrap `BackupDR` in
58/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
59/// already uses an `Arc` internally.
60#[derive(Clone, Debug)]
61pub struct BackupDR {
62    inner: std::sync::Arc<dyn super::stub::dynamic::BackupDR>,
63}
64
65impl BackupDR {
66    /// Returns a builder for [BackupDR].
67    ///
68    /// ```
69    /// # async fn sample() -> gax::client_builder::Result<()> {
70    /// # use google_cloud_backupdr_v1::client::BackupDR;
71    /// let client = BackupDR::builder().build().await?;
72    /// # Ok(()) }
73    /// ```
74    pub fn builder() -> super::builder::backup_dr::ClientBuilder {
75        gax::client_builder::internal::new_builder(super::builder::backup_dr::client::Factory)
76    }
77
78    /// Creates a new client from the provided stub.
79    ///
80    /// The most common case for calling this function is in tests mocking the
81    /// client's behavior.
82    pub fn from_stub<T>(stub: T) -> Self
83    where
84        T: super::stub::BackupDR + 'static,
85    {
86        Self {
87            inner: std::sync::Arc::new(stub),
88        }
89    }
90
91    pub(crate) async fn new(
92        config: gaxi::options::ClientConfig,
93    ) -> gax::client_builder::Result<Self> {
94        let inner = Self::build_inner(config).await?;
95        Ok(Self { inner })
96    }
97
98    async fn build_inner(
99        conf: gaxi::options::ClientConfig,
100    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::BackupDR>> {
101        if gaxi::options::tracing_enabled(&conf) {
102            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
103        }
104        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
105    }
106
107    async fn build_transport(
108        conf: gaxi::options::ClientConfig,
109    ) -> gax::client_builder::Result<impl super::stub::BackupDR> {
110        super::transport::BackupDR::new(conf).await
111    }
112
113    async fn build_with_tracing(
114        conf: gaxi::options::ClientConfig,
115    ) -> gax::client_builder::Result<impl super::stub::BackupDR> {
116        Self::build_transport(conf)
117            .await
118            .map(super::tracing::BackupDR::new)
119    }
120
121    /// Lists ManagementServers in a given project and location.
122    pub fn list_management_servers(&self) -> super::builder::backup_dr::ListManagementServers {
123        super::builder::backup_dr::ListManagementServers::new(self.inner.clone())
124    }
125
126    /// Gets details of a single ManagementServer.
127    pub fn get_management_server(&self) -> super::builder::backup_dr::GetManagementServer {
128        super::builder::backup_dr::GetManagementServer::new(self.inner.clone())
129    }
130
131    /// Creates a new ManagementServer in a given project and location.
132    ///
133    /// # Long running operations
134    ///
135    /// This method is used to start, and/or poll a [long-running Operation].
136    /// The [Working with long-running operations] chapter in the [user guide]
137    /// covers these operations in detail.
138    ///
139    /// [long-running operation]: https://google.aip.dev/151
140    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
141    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
142    pub fn create_management_server(&self) -> super::builder::backup_dr::CreateManagementServer {
143        super::builder::backup_dr::CreateManagementServer::new(self.inner.clone())
144    }
145
146    /// Deletes a single ManagementServer.
147    ///
148    /// # Long running operations
149    ///
150    /// This method is used to start, and/or poll a [long-running Operation].
151    /// The [Working with long-running operations] chapter in the [user guide]
152    /// covers these operations in detail.
153    ///
154    /// [long-running operation]: https://google.aip.dev/151
155    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
156    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
157    pub fn delete_management_server(&self) -> super::builder::backup_dr::DeleteManagementServer {
158        super::builder::backup_dr::DeleteManagementServer::new(self.inner.clone())
159    }
160
161    /// Creates a new BackupVault in a given project and location.
162    ///
163    /// # Long running operations
164    ///
165    /// This method is used to start, and/or poll a [long-running Operation].
166    /// The [Working with long-running operations] chapter in the [user guide]
167    /// covers these operations in detail.
168    ///
169    /// [long-running operation]: https://google.aip.dev/151
170    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
171    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
172    pub fn create_backup_vault(&self) -> super::builder::backup_dr::CreateBackupVault {
173        super::builder::backup_dr::CreateBackupVault::new(self.inner.clone())
174    }
175
176    /// Lists BackupVaults in a given project and location.
177    pub fn list_backup_vaults(&self) -> super::builder::backup_dr::ListBackupVaults {
178        super::builder::backup_dr::ListBackupVaults::new(self.inner.clone())
179    }
180
181    /// FetchUsableBackupVaults lists usable BackupVaults in a given project and
182    /// location. Usable BackupVault are the ones that user has
183    /// backupdr.backupVaults.get permission.
184    pub fn fetch_usable_backup_vaults(&self) -> super::builder::backup_dr::FetchUsableBackupVaults {
185        super::builder::backup_dr::FetchUsableBackupVaults::new(self.inner.clone())
186    }
187
188    /// Gets details of a BackupVault.
189    pub fn get_backup_vault(&self) -> super::builder::backup_dr::GetBackupVault {
190        super::builder::backup_dr::GetBackupVault::new(self.inner.clone())
191    }
192
193    /// Updates the settings of a BackupVault.
194    ///
195    /// # Long running operations
196    ///
197    /// This method is used to start, and/or poll a [long-running Operation].
198    /// The [Working with long-running operations] chapter in the [user guide]
199    /// covers these operations in detail.
200    ///
201    /// [long-running operation]: https://google.aip.dev/151
202    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
203    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
204    pub fn update_backup_vault(&self) -> super::builder::backup_dr::UpdateBackupVault {
205        super::builder::backup_dr::UpdateBackupVault::new(self.inner.clone())
206    }
207
208    /// Deletes a BackupVault.
209    ///
210    /// # Long running operations
211    ///
212    /// This method is used to start, and/or poll a [long-running Operation].
213    /// The [Working with long-running operations] chapter in the [user guide]
214    /// covers these operations in detail.
215    ///
216    /// [long-running operation]: https://google.aip.dev/151
217    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
218    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
219    pub fn delete_backup_vault(&self) -> super::builder::backup_dr::DeleteBackupVault {
220        super::builder::backup_dr::DeleteBackupVault::new(self.inner.clone())
221    }
222
223    /// Lists DataSources in a given project and location.
224    pub fn list_data_sources(&self) -> super::builder::backup_dr::ListDataSources {
225        super::builder::backup_dr::ListDataSources::new(self.inner.clone())
226    }
227
228    /// Gets details of a DataSource.
229    pub fn get_data_source(&self) -> super::builder::backup_dr::GetDataSource {
230        super::builder::backup_dr::GetDataSource::new(self.inner.clone())
231    }
232
233    /// Updates the settings of a DataSource.
234    ///
235    /// # Long running operations
236    ///
237    /// This method is used to start, and/or poll a [long-running Operation].
238    /// The [Working with long-running operations] chapter in the [user guide]
239    /// covers these operations in detail.
240    ///
241    /// [long-running operation]: https://google.aip.dev/151
242    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
243    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
244    pub fn update_data_source(&self) -> super::builder::backup_dr::UpdateDataSource {
245        super::builder::backup_dr::UpdateDataSource::new(self.inner.clone())
246    }
247
248    /// Lists Backups in a given project and location.
249    pub fn list_backups(&self) -> super::builder::backup_dr::ListBackups {
250        super::builder::backup_dr::ListBackups::new(self.inner.clone())
251    }
252
253    /// Fetch Backups for a given resource type.
254    pub fn fetch_backups_for_resource_type(
255        &self,
256    ) -> super::builder::backup_dr::FetchBackupsForResourceType {
257        super::builder::backup_dr::FetchBackupsForResourceType::new(self.inner.clone())
258    }
259
260    /// Gets details of a Backup.
261    pub fn get_backup(&self) -> super::builder::backup_dr::GetBackup {
262        super::builder::backup_dr::GetBackup::new(self.inner.clone())
263    }
264
265    /// Updates the settings of a Backup.
266    ///
267    /// # Long running operations
268    ///
269    /// This method is used to start, and/or poll a [long-running Operation].
270    /// The [Working with long-running operations] chapter in the [user guide]
271    /// covers these operations in detail.
272    ///
273    /// [long-running operation]: https://google.aip.dev/151
274    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
275    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
276    pub fn update_backup(&self) -> super::builder::backup_dr::UpdateBackup {
277        super::builder::backup_dr::UpdateBackup::new(self.inner.clone())
278    }
279
280    /// Deletes a Backup.
281    ///
282    /// # Long running operations
283    ///
284    /// This method is used to start, and/or poll a [long-running Operation].
285    /// The [Working with long-running operations] chapter in the [user guide]
286    /// covers these operations in detail.
287    ///
288    /// [long-running operation]: https://google.aip.dev/151
289    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
290    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
291    pub fn delete_backup(&self) -> super::builder::backup_dr::DeleteBackup {
292        super::builder::backup_dr::DeleteBackup::new(self.inner.clone())
293    }
294
295    /// Restore from a Backup
296    ///
297    /// # Long running operations
298    ///
299    /// This method is used to start, and/or poll a [long-running Operation].
300    /// The [Working with long-running operations] chapter in the [user guide]
301    /// covers these operations in detail.
302    ///
303    /// [long-running operation]: https://google.aip.dev/151
304    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
305    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
306    pub fn restore_backup(&self) -> super::builder::backup_dr::RestoreBackup {
307        super::builder::backup_dr::RestoreBackup::new(self.inner.clone())
308    }
309
310    /// Create a BackupPlan
311    ///
312    /// # Long running operations
313    ///
314    /// This method is used to start, and/or poll a [long-running Operation].
315    /// The [Working with long-running operations] chapter in the [user guide]
316    /// covers these operations in detail.
317    ///
318    /// [long-running operation]: https://google.aip.dev/151
319    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
320    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
321    pub fn create_backup_plan(&self) -> super::builder::backup_dr::CreateBackupPlan {
322        super::builder::backup_dr::CreateBackupPlan::new(self.inner.clone())
323    }
324
325    /// Update a BackupPlan.
326    ///
327    /// # Long running operations
328    ///
329    /// This method is used to start, and/or poll a [long-running Operation].
330    /// The [Working with long-running operations] chapter in the [user guide]
331    /// covers these operations in detail.
332    ///
333    /// [long-running operation]: https://google.aip.dev/151
334    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
335    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
336    pub fn update_backup_plan(&self) -> super::builder::backup_dr::UpdateBackupPlan {
337        super::builder::backup_dr::UpdateBackupPlan::new(self.inner.clone())
338    }
339
340    /// Gets details of a single BackupPlan.
341    pub fn get_backup_plan(&self) -> super::builder::backup_dr::GetBackupPlan {
342        super::builder::backup_dr::GetBackupPlan::new(self.inner.clone())
343    }
344
345    /// Lists BackupPlans in a given project and location.
346    pub fn list_backup_plans(&self) -> super::builder::backup_dr::ListBackupPlans {
347        super::builder::backup_dr::ListBackupPlans::new(self.inner.clone())
348    }
349
350    /// Deletes a single BackupPlan.
351    ///
352    /// # Long running operations
353    ///
354    /// This method is used to start, and/or poll a [long-running Operation].
355    /// The [Working with long-running operations] chapter in the [user guide]
356    /// covers these operations in detail.
357    ///
358    /// [long-running operation]: https://google.aip.dev/151
359    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
360    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
361    pub fn delete_backup_plan(&self) -> super::builder::backup_dr::DeleteBackupPlan {
362        super::builder::backup_dr::DeleteBackupPlan::new(self.inner.clone())
363    }
364
365    /// Gets details of a single BackupPlanRevision.
366    pub fn get_backup_plan_revision(&self) -> super::builder::backup_dr::GetBackupPlanRevision {
367        super::builder::backup_dr::GetBackupPlanRevision::new(self.inner.clone())
368    }
369
370    /// Lists BackupPlanRevisions in a given project and location.
371    pub fn list_backup_plan_revisions(&self) -> super::builder::backup_dr::ListBackupPlanRevisions {
372        super::builder::backup_dr::ListBackupPlanRevisions::new(self.inner.clone())
373    }
374
375    /// Create a BackupPlanAssociation
376    ///
377    /// # Long running operations
378    ///
379    /// This method is used to start, and/or poll a [long-running Operation].
380    /// The [Working with long-running operations] chapter in the [user guide]
381    /// covers these operations in detail.
382    ///
383    /// [long-running operation]: https://google.aip.dev/151
384    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
385    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
386    pub fn create_backup_plan_association(
387        &self,
388    ) -> super::builder::backup_dr::CreateBackupPlanAssociation {
389        super::builder::backup_dr::CreateBackupPlanAssociation::new(self.inner.clone())
390    }
391
392    /// Update a BackupPlanAssociation.
393    ///
394    /// # Long running operations
395    ///
396    /// This method is used to start, and/or poll a [long-running Operation].
397    /// The [Working with long-running operations] chapter in the [user guide]
398    /// covers these operations in detail.
399    ///
400    /// [long-running operation]: https://google.aip.dev/151
401    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
402    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
403    pub fn update_backup_plan_association(
404        &self,
405    ) -> super::builder::backup_dr::UpdateBackupPlanAssociation {
406        super::builder::backup_dr::UpdateBackupPlanAssociation::new(self.inner.clone())
407    }
408
409    /// Gets details of a single BackupPlanAssociation.
410    pub fn get_backup_plan_association(
411        &self,
412    ) -> super::builder::backup_dr::GetBackupPlanAssociation {
413        super::builder::backup_dr::GetBackupPlanAssociation::new(self.inner.clone())
414    }
415
416    /// Lists BackupPlanAssociations in a given project and location.
417    pub fn list_backup_plan_associations(
418        &self,
419    ) -> super::builder::backup_dr::ListBackupPlanAssociations {
420        super::builder::backup_dr::ListBackupPlanAssociations::new(self.inner.clone())
421    }
422
423    /// List BackupPlanAssociations for a given resource type.
424    pub fn fetch_backup_plan_associations_for_resource_type(
425        &self,
426    ) -> super::builder::backup_dr::FetchBackupPlanAssociationsForResourceType {
427        super::builder::backup_dr::FetchBackupPlanAssociationsForResourceType::new(
428            self.inner.clone(),
429        )
430    }
431
432    /// Deletes a single BackupPlanAssociation.
433    ///
434    /// # Long running operations
435    ///
436    /// This method is used to start, and/or poll a [long-running Operation].
437    /// The [Working with long-running operations] chapter in the [user guide]
438    /// covers these operations in detail.
439    ///
440    /// [long-running operation]: https://google.aip.dev/151
441    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
442    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
443    pub fn delete_backup_plan_association(
444        &self,
445    ) -> super::builder::backup_dr::DeleteBackupPlanAssociation {
446        super::builder::backup_dr::DeleteBackupPlanAssociation::new(self.inner.clone())
447    }
448
449    /// Triggers a new Backup.
450    ///
451    /// # Long running operations
452    ///
453    /// This method is used to start, and/or poll a [long-running Operation].
454    /// The [Working with long-running operations] chapter in the [user guide]
455    /// covers these operations in detail.
456    ///
457    /// [long-running operation]: https://google.aip.dev/151
458    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
459    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
460    pub fn trigger_backup(&self) -> super::builder::backup_dr::TriggerBackup {
461        super::builder::backup_dr::TriggerBackup::new(self.inner.clone())
462    }
463
464    /// Gets details of a single DataSourceReference.
465    pub fn get_data_source_reference(&self) -> super::builder::backup_dr::GetDataSourceReference {
466        super::builder::backup_dr::GetDataSourceReference::new(self.inner.clone())
467    }
468
469    /// Lists DataSourceReferences for a given project and location.
470    pub fn list_data_source_references(
471        &self,
472    ) -> super::builder::backup_dr::ListDataSourceReferences {
473        super::builder::backup_dr::ListDataSourceReferences::new(self.inner.clone())
474    }
475
476    /// Fetch DataSourceReferences for a given project, location and resource type.
477    pub fn fetch_data_source_references_for_resource_type(
478        &self,
479    ) -> super::builder::backup_dr::FetchDataSourceReferencesForResourceType {
480        super::builder::backup_dr::FetchDataSourceReferencesForResourceType::new(self.inner.clone())
481    }
482
483    /// Initializes the service related config for a project.
484    ///
485    /// # Long running operations
486    ///
487    /// This method is used to start, and/or poll a [long-running Operation].
488    /// The [Working with long-running operations] chapter in the [user guide]
489    /// covers these operations in detail.
490    ///
491    /// [long-running operation]: https://google.aip.dev/151
492    /// [user guide]: https://googleapis.github.io/google-cloud-rust/
493    /// [working with long-running operations]: https://googleapis.github.io/google-cloud-rust/working_with_long_running_operations.html
494    pub fn initialize_service(&self) -> super::builder::backup_dr::InitializeService {
495        super::builder::backup_dr::InitializeService::new(self.inner.clone())
496    }
497
498    /// Lists information about the supported locations for this service.
499    pub fn list_locations(&self) -> super::builder::backup_dr::ListLocations {
500        super::builder::backup_dr::ListLocations::new(self.inner.clone())
501    }
502
503    /// Gets information about a location.
504    pub fn get_location(&self) -> super::builder::backup_dr::GetLocation {
505        super::builder::backup_dr::GetLocation::new(self.inner.clone())
506    }
507
508    /// Sets the access control policy on the specified resource. Replaces
509    /// any existing policy.
510    ///
511    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
512    /// errors.
513    pub fn set_iam_policy(&self) -> super::builder::backup_dr::SetIamPolicy {
514        super::builder::backup_dr::SetIamPolicy::new(self.inner.clone())
515    }
516
517    /// Gets the access control policy for a resource. Returns an empty policy
518    /// if the resource exists and does not have a policy set.
519    pub fn get_iam_policy(&self) -> super::builder::backup_dr::GetIamPolicy {
520        super::builder::backup_dr::GetIamPolicy::new(self.inner.clone())
521    }
522
523    /// Returns permissions that a caller has on the specified resource. If the
524    /// resource does not exist, this will return an empty set of
525    /// permissions, not a `NOT_FOUND` error.
526    ///
527    /// Note: This operation is designed to be used for building
528    /// permission-aware UIs and command-line tools, not for authorization
529    /// checking. This operation may "fail open" without warning.
530    pub fn test_iam_permissions(&self) -> super::builder::backup_dr::TestIamPermissions {
531        super::builder::backup_dr::TestIamPermissions::new(self.inner.clone())
532    }
533
534    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
535    ///
536    /// [google.longrunning.Operations]: longrunning::client::Operations
537    pub fn list_operations(&self) -> super::builder::backup_dr::ListOperations {
538        super::builder::backup_dr::ListOperations::new(self.inner.clone())
539    }
540
541    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
542    ///
543    /// [google.longrunning.Operations]: longrunning::client::Operations
544    pub fn get_operation(&self) -> super::builder::backup_dr::GetOperation {
545        super::builder::backup_dr::GetOperation::new(self.inner.clone())
546    }
547
548    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
549    ///
550    /// [google.longrunning.Operations]: longrunning::client::Operations
551    pub fn delete_operation(&self) -> super::builder::backup_dr::DeleteOperation {
552        super::builder::backup_dr::DeleteOperation::new(self.inner.clone())
553    }
554
555    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
556    ///
557    /// [google.longrunning.Operations]: longrunning::client::Operations
558    pub fn cancel_operation(&self) -> super::builder::backup_dr::CancelOperation {
559        super::builder::backup_dr::CancelOperation::new(self.inner.clone())
560    }
561}
562
563/// Implements a client for the Backup and DR Service API.
564///
565/// # Example
566/// ```
567/// # async fn sample() -> gax::client_builder::Result<()> {
568/// # use google_cloud_backupdr_v1::client::BackupDrProtectionSummary;
569/// let client = BackupDrProtectionSummary::builder().build().await?;
570/// // use `client` to make requests to the Backup and DR Service API.
571/// # Ok(()) }
572/// ```
573///
574/// # Service Description
575///
576/// The Protection Summary service.
577///
578/// # Configuration
579///
580/// To configure `BackupDrProtectionSummary` use the `with_*` methods in the type returned
581/// by [builder()][BackupDrProtectionSummary::builder]. The default configuration should
582/// work for most applications. Common configuration changes include
583///
584/// * [with_endpoint()]: by default this client uses the global default endpoint
585///   (`https://backupdr.googleapis.com`). Applications using regional
586///   endpoints or running in restricted networks (e.g. a network configured
587//    with [Private Google Access with VPC Service Controls]) may want to
588///   override this default.
589/// * [with_credentials()]: by default this client uses
590///   [Application Default Credentials]. Applications using custom
591///   authentication may need to override this default.
592///
593/// [with_endpoint()]: super::builder::backup_dr_protection_summary::ClientBuilder::with_endpoint
594/// [with_credentials()]: super::builder::backup_dr_protection_summary::ClientBuilder::credentials
595/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
596/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
597///
598/// # Pooling and Cloning
599///
600/// `BackupDrProtectionSummary` holds a connection pool internally, it is advised to
601/// create one and the reuse it.  You do not need to wrap `BackupDrProtectionSummary` in
602/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
603/// already uses an `Arc` internally.
604#[derive(Clone, Debug)]
605pub struct BackupDrProtectionSummary {
606    inner: std::sync::Arc<dyn super::stub::dynamic::BackupDrProtectionSummary>,
607}
608
609impl BackupDrProtectionSummary {
610    /// Returns a builder for [BackupDrProtectionSummary].
611    ///
612    /// ```
613    /// # async fn sample() -> gax::client_builder::Result<()> {
614    /// # use google_cloud_backupdr_v1::client::BackupDrProtectionSummary;
615    /// let client = BackupDrProtectionSummary::builder().build().await?;
616    /// # Ok(()) }
617    /// ```
618    pub fn builder() -> super::builder::backup_dr_protection_summary::ClientBuilder {
619        gax::client_builder::internal::new_builder(
620            super::builder::backup_dr_protection_summary::client::Factory,
621        )
622    }
623
624    /// Creates a new client from the provided stub.
625    ///
626    /// The most common case for calling this function is in tests mocking the
627    /// client's behavior.
628    pub fn from_stub<T>(stub: T) -> Self
629    where
630        T: super::stub::BackupDrProtectionSummary + 'static,
631    {
632        Self {
633            inner: std::sync::Arc::new(stub),
634        }
635    }
636
637    pub(crate) async fn new(
638        config: gaxi::options::ClientConfig,
639    ) -> gax::client_builder::Result<Self> {
640        let inner = Self::build_inner(config).await?;
641        Ok(Self { inner })
642    }
643
644    async fn build_inner(
645        conf: gaxi::options::ClientConfig,
646    ) -> gax::client_builder::Result<
647        std::sync::Arc<dyn super::stub::dynamic::BackupDrProtectionSummary>,
648    > {
649        if gaxi::options::tracing_enabled(&conf) {
650            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
651        }
652        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
653    }
654
655    async fn build_transport(
656        conf: gaxi::options::ClientConfig,
657    ) -> gax::client_builder::Result<impl super::stub::BackupDrProtectionSummary> {
658        super::transport::BackupDrProtectionSummary::new(conf).await
659    }
660
661    async fn build_with_tracing(
662        conf: gaxi::options::ClientConfig,
663    ) -> gax::client_builder::Result<impl super::stub::BackupDrProtectionSummary> {
664        Self::build_transport(conf)
665            .await
666            .map(super::tracing::BackupDrProtectionSummary::new)
667    }
668
669    /// Lists ResourceBackupConfigs.
670    pub fn list_resource_backup_configs(
671        &self,
672    ) -> super::builder::backup_dr_protection_summary::ListResourceBackupConfigs {
673        super::builder::backup_dr_protection_summary::ListResourceBackupConfigs::new(
674            self.inner.clone(),
675        )
676    }
677
678    /// Lists information about the supported locations for this service.
679    pub fn list_locations(&self) -> super::builder::backup_dr_protection_summary::ListLocations {
680        super::builder::backup_dr_protection_summary::ListLocations::new(self.inner.clone())
681    }
682
683    /// Gets information about a location.
684    pub fn get_location(&self) -> super::builder::backup_dr_protection_summary::GetLocation {
685        super::builder::backup_dr_protection_summary::GetLocation::new(self.inner.clone())
686    }
687
688    /// Sets the access control policy on the specified resource. Replaces
689    /// any existing policy.
690    ///
691    /// Can return `NOT_FOUND`, `INVALID_ARGUMENT`, and `PERMISSION_DENIED`
692    /// errors.
693    pub fn set_iam_policy(&self) -> super::builder::backup_dr_protection_summary::SetIamPolicy {
694        super::builder::backup_dr_protection_summary::SetIamPolicy::new(self.inner.clone())
695    }
696
697    /// Gets the access control policy for a resource. Returns an empty policy
698    /// if the resource exists and does not have a policy set.
699    pub fn get_iam_policy(&self) -> super::builder::backup_dr_protection_summary::GetIamPolicy {
700        super::builder::backup_dr_protection_summary::GetIamPolicy::new(self.inner.clone())
701    }
702
703    /// Returns permissions that a caller has on the specified resource. If the
704    /// resource does not exist, this will return an empty set of
705    /// permissions, not a `NOT_FOUND` error.
706    ///
707    /// Note: This operation is designed to be used for building
708    /// permission-aware UIs and command-line tools, not for authorization
709    /// checking. This operation may "fail open" without warning.
710    pub fn test_iam_permissions(
711        &self,
712    ) -> super::builder::backup_dr_protection_summary::TestIamPermissions {
713        super::builder::backup_dr_protection_summary::TestIamPermissions::new(self.inner.clone())
714    }
715
716    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
717    ///
718    /// [google.longrunning.Operations]: longrunning::client::Operations
719    pub fn list_operations(&self) -> super::builder::backup_dr_protection_summary::ListOperations {
720        super::builder::backup_dr_protection_summary::ListOperations::new(self.inner.clone())
721    }
722
723    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
724    ///
725    /// [google.longrunning.Operations]: longrunning::client::Operations
726    pub fn get_operation(&self) -> super::builder::backup_dr_protection_summary::GetOperation {
727        super::builder::backup_dr_protection_summary::GetOperation::new(self.inner.clone())
728    }
729
730    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
731    ///
732    /// [google.longrunning.Operations]: longrunning::client::Operations
733    pub fn delete_operation(
734        &self,
735    ) -> super::builder::backup_dr_protection_summary::DeleteOperation {
736        super::builder::backup_dr_protection_summary::DeleteOperation::new(self.inner.clone())
737    }
738
739    /// Provides the [Operations][google.longrunning.Operations] service functionality in this service.
740    ///
741    /// [google.longrunning.Operations]: longrunning::client::Operations
742    pub fn cancel_operation(
743        &self,
744    ) -> super::builder::backup_dr_protection_summary::CancelOperation {
745        super::builder::backup_dr_protection_summary::CancelOperation::new(self.inner.clone())
746    }
747}