Skip to main content

google_cloud_sql_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::bare_urls)]
17#![allow(rustdoc::broken_intra_doc_links)]
18#![allow(rustdoc::invalid_html_tags)]
19#![allow(rustdoc::redundant_explicit_links)]
20
21/// Implements a client for the Cloud SQL Admin API.
22///
23/// # Example
24/// ```
25/// # use google_cloud_sql_v1::client::SqlBackupRunsService;
26/// async fn sample(
27/// ) -> anyhow::Result<()> {
28///     let client = SqlBackupRunsService::builder().build().await?;
29///     let response = client.delete()
30///         /* set fields */
31///         .send().await?;
32///     println!("response {:?}", response);
33///     Ok(())
34/// }
35/// ```
36///
37/// # Service Description
38///
39/// Service for managing database backups.
40///
41/// # Configuration
42///
43/// To configure `SqlBackupRunsService` use the `with_*` methods in the type returned
44/// by [builder()][SqlBackupRunsService::builder]. The default configuration should
45/// work for most applications. Common configuration changes include
46///
47/// * [with_endpoint()]: by default this client uses the global default endpoint
48///   (`https://sqladmin.googleapis.com`). Applications using regional
49///   endpoints or running in restricted networks (e.g. a network configured
50///   with [Private Google Access with VPC Service Controls]) may want to
51///   override this default.
52/// * [with_credentials()]: by default this client uses
53///   [Application Default Credentials]. Applications using custom
54///   authentication may need to override this default.
55///
56/// [with_endpoint()]: super::builder::sql_backup_runs_service::ClientBuilder::with_endpoint
57/// [with_credentials()]: super::builder::sql_backup_runs_service::ClientBuilder::with_credentials
58/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
59/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
60///
61/// # Pooling and Cloning
62///
63/// `SqlBackupRunsService` holds a connection pool internally, it is advised to
64/// create one and reuse it. You do not need to wrap `SqlBackupRunsService` in
65/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
66/// already uses an `Arc` internally.
67#[derive(Clone, Debug)]
68pub struct SqlBackupRunsService {
69    inner: std::sync::Arc<dyn super::stub::dynamic::SqlBackupRunsService>,
70}
71
72impl SqlBackupRunsService {
73    /// Returns a builder for [SqlBackupRunsService].
74    ///
75    /// ```
76    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
77    /// # use google_cloud_sql_v1::client::SqlBackupRunsService;
78    /// let client = SqlBackupRunsService::builder().build().await?;
79    /// # Ok(()) }
80    /// ```
81    pub fn builder() -> super::builder::sql_backup_runs_service::ClientBuilder {
82        crate::new_client_builder(super::builder::sql_backup_runs_service::client::Factory)
83    }
84
85    /// Creates a new client from the provided stub.
86    ///
87    /// The most common case for calling this function is in tests mocking the
88    /// client's behavior.
89    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
90    where
91        T: super::stub::SqlBackupRunsService + 'static,
92    {
93        Self { inner: stub.into() }
94    }
95
96    pub(crate) async fn new(
97        config: gaxi::options::ClientConfig,
98    ) -> crate::ClientBuilderResult<Self> {
99        let inner = Self::build_inner(config).await?;
100        Ok(Self { inner })
101    }
102
103    async fn build_inner(
104        conf: gaxi::options::ClientConfig,
105    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SqlBackupRunsService>>
106    {
107        if gaxi::options::tracing_enabled(&conf) {
108            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
109        }
110        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
111    }
112
113    async fn build_transport(
114        conf: gaxi::options::ClientConfig,
115    ) -> crate::ClientBuilderResult<impl super::stub::SqlBackupRunsService> {
116        super::transport::SqlBackupRunsService::new(conf).await
117    }
118
119    async fn build_with_tracing(
120        conf: gaxi::options::ClientConfig,
121    ) -> crate::ClientBuilderResult<impl super::stub::SqlBackupRunsService> {
122        Self::build_transport(conf)
123            .await
124            .map(super::tracing::SqlBackupRunsService::new)
125    }
126
127    /// Deletes the backup taken by a backup run.
128    ///
129    /// # Example
130    /// ```
131    /// # use google_cloud_sql_v1::client::SqlBackupRunsService;
132    /// use google_cloud_sql_v1::Result;
133    /// async fn sample(
134    ///    client: &SqlBackupRunsService
135    /// ) -> Result<()> {
136    ///     let response = client.delete()
137    ///         /* set fields */
138    ///         .send().await?;
139    ///     println!("response {:?}", response);
140    ///     Ok(())
141    /// }
142    /// ```
143    pub fn delete(&self) -> super::builder::sql_backup_runs_service::Delete {
144        super::builder::sql_backup_runs_service::Delete::new(self.inner.clone())
145    }
146
147    /// Retrieves a resource containing information about a backup run.
148    ///
149    /// # Example
150    /// ```
151    /// # use google_cloud_sql_v1::client::SqlBackupRunsService;
152    /// use google_cloud_sql_v1::Result;
153    /// async fn sample(
154    ///    client: &SqlBackupRunsService
155    /// ) -> Result<()> {
156    ///     let response = client.get()
157    ///         /* set fields */
158    ///         .send().await?;
159    ///     println!("response {:?}", response);
160    ///     Ok(())
161    /// }
162    /// ```
163    pub fn get(&self) -> super::builder::sql_backup_runs_service::Get {
164        super::builder::sql_backup_runs_service::Get::new(self.inner.clone())
165    }
166
167    /// Creates a new backup run on demand.
168    ///
169    /// # Example
170    /// ```
171    /// # use google_cloud_sql_v1::client::SqlBackupRunsService;
172    /// use google_cloud_sql_v1::Result;
173    /// async fn sample(
174    ///    client: &SqlBackupRunsService
175    /// ) -> Result<()> {
176    ///     let response = client.insert()
177    ///         /* set fields */
178    ///         .send().await?;
179    ///     println!("response {:?}", response);
180    ///     Ok(())
181    /// }
182    /// ```
183    pub fn insert(&self) -> super::builder::sql_backup_runs_service::Insert {
184        super::builder::sql_backup_runs_service::Insert::new(self.inner.clone())
185    }
186
187    /// Lists all backup runs associated with the project or a given instance
188    /// and configuration in the reverse chronological order of the backup
189    /// initiation time.
190    ///
191    /// # Example
192    /// ```
193    /// # use google_cloud_sql_v1::client::SqlBackupRunsService;
194    /// use google_cloud_gax::paginator::ItemPaginator as _;
195    /// use google_cloud_sql_v1::Result;
196    /// async fn sample(
197    ///    client: &SqlBackupRunsService
198    /// ) -> Result<()> {
199    ///     let mut list = client.list()
200    ///         /* set fields */
201    ///         .by_item();
202    ///     while let Some(item) = list.next().await.transpose()? {
203    ///         println!("{:?}", item);
204    ///     }
205    ///     Ok(())
206    /// }
207    /// ```
208    pub fn list(&self) -> super::builder::sql_backup_runs_service::List {
209        super::builder::sql_backup_runs_service::List::new(self.inner.clone())
210    }
211}
212
213/// Implements a client for the Cloud SQL Admin API.
214///
215/// # Example
216/// ```
217/// # use google_cloud_sql_v1::client::SqlBackupsService;
218/// use google_cloud_gax::paginator::ItemPaginator as _;
219/// async fn sample(
220///    project_id: &str,
221/// ) -> anyhow::Result<()> {
222///     let client = SqlBackupsService::builder().build().await?;
223///     let mut list = client.list_backups()
224///         .set_parent(format!("projects/{project_id}"))
225///         .by_item();
226///     while let Some(item) = list.next().await.transpose()? {
227///         println!("{:?}", item);
228///     }
229///     Ok(())
230/// }
231/// ```
232///
233/// # Service Description
234///
235///
236/// # Configuration
237///
238/// To configure `SqlBackupsService` use the `with_*` methods in the type returned
239/// by [builder()][SqlBackupsService::builder]. The default configuration should
240/// work for most applications. Common configuration changes include
241///
242/// * [with_endpoint()]: by default this client uses the global default endpoint
243///   (`https://sqladmin.googleapis.com`). Applications using regional
244///   endpoints or running in restricted networks (e.g. a network configured
245///   with [Private Google Access with VPC Service Controls]) may want to
246///   override this default.
247/// * [with_credentials()]: by default this client uses
248///   [Application Default Credentials]. Applications using custom
249///   authentication may need to override this default.
250///
251/// [with_endpoint()]: super::builder::sql_backups_service::ClientBuilder::with_endpoint
252/// [with_credentials()]: super::builder::sql_backups_service::ClientBuilder::with_credentials
253/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
254/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
255///
256/// # Pooling and Cloning
257///
258/// `SqlBackupsService` holds a connection pool internally, it is advised to
259/// create one and reuse it. You do not need to wrap `SqlBackupsService` in
260/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
261/// already uses an `Arc` internally.
262#[derive(Clone, Debug)]
263pub struct SqlBackupsService {
264    inner: std::sync::Arc<dyn super::stub::dynamic::SqlBackupsService>,
265}
266
267impl SqlBackupsService {
268    /// Returns a builder for [SqlBackupsService].
269    ///
270    /// ```
271    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
272    /// # use google_cloud_sql_v1::client::SqlBackupsService;
273    /// let client = SqlBackupsService::builder().build().await?;
274    /// # Ok(()) }
275    /// ```
276    pub fn builder() -> super::builder::sql_backups_service::ClientBuilder {
277        crate::new_client_builder(super::builder::sql_backups_service::client::Factory)
278    }
279
280    /// Creates a new client from the provided stub.
281    ///
282    /// The most common case for calling this function is in tests mocking the
283    /// client's behavior.
284    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
285    where
286        T: super::stub::SqlBackupsService + 'static,
287    {
288        Self { inner: stub.into() }
289    }
290
291    pub(crate) async fn new(
292        config: gaxi::options::ClientConfig,
293    ) -> crate::ClientBuilderResult<Self> {
294        let inner = Self::build_inner(config).await?;
295        Ok(Self { inner })
296    }
297
298    async fn build_inner(
299        conf: gaxi::options::ClientConfig,
300    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SqlBackupsService>>
301    {
302        if gaxi::options::tracing_enabled(&conf) {
303            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
304        }
305        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
306    }
307
308    async fn build_transport(
309        conf: gaxi::options::ClientConfig,
310    ) -> crate::ClientBuilderResult<impl super::stub::SqlBackupsService> {
311        super::transport::SqlBackupsService::new(conf).await
312    }
313
314    async fn build_with_tracing(
315        conf: gaxi::options::ClientConfig,
316    ) -> crate::ClientBuilderResult<impl super::stub::SqlBackupsService> {
317        Self::build_transport(conf)
318            .await
319            .map(super::tracing::SqlBackupsService::new)
320    }
321
322    /// Creates a backup for a Cloud SQL instance. This API can be used only to
323    /// create on-demand backups.
324    ///
325    /// # Example
326    /// ```
327    /// # use google_cloud_sql_v1::client::SqlBackupsService;
328    /// use google_cloud_sql_v1::Result;
329    /// async fn sample(
330    ///    client: &SqlBackupsService
331    /// ) -> Result<()> {
332    ///     let response = client.create_backup()
333    ///         /* set fields */
334    ///         .send().await?;
335    ///     println!("response {:?}", response);
336    ///     Ok(())
337    /// }
338    /// ```
339    pub fn create_backup(&self) -> super::builder::sql_backups_service::CreateBackup {
340        super::builder::sql_backups_service::CreateBackup::new(self.inner.clone())
341    }
342
343    /// Retrieves a resource containing information about a backup.
344    ///
345    /// # Example
346    /// ```
347    /// # use google_cloud_sql_v1::client::SqlBackupsService;
348    /// use google_cloud_sql_v1::Result;
349    /// async fn sample(
350    ///    client: &SqlBackupsService, project_id: &str, backup_id: &str
351    /// ) -> Result<()> {
352    ///     let response = client.get_backup()
353    ///         .set_name(format!("projects/{project_id}/backups/{backup_id}"))
354    ///         .send().await?;
355    ///     println!("response {:?}", response);
356    ///     Ok(())
357    /// }
358    /// ```
359    pub fn get_backup(&self) -> super::builder::sql_backups_service::GetBackup {
360        super::builder::sql_backups_service::GetBackup::new(self.inner.clone())
361    }
362
363    /// Lists all backups associated with the project.
364    ///
365    /// # Example
366    /// ```
367    /// # use google_cloud_sql_v1::client::SqlBackupsService;
368    /// use google_cloud_gax::paginator::ItemPaginator as _;
369    /// use google_cloud_sql_v1::Result;
370    /// async fn sample(
371    ///    client: &SqlBackupsService, project_id: &str
372    /// ) -> Result<()> {
373    ///     let mut list = client.list_backups()
374    ///         .set_parent(format!("projects/{project_id}"))
375    ///         .by_item();
376    ///     while let Some(item) = list.next().await.transpose()? {
377    ///         println!("{:?}", item);
378    ///     }
379    ///     Ok(())
380    /// }
381    /// ```
382    pub fn list_backups(&self) -> super::builder::sql_backups_service::ListBackups {
383        super::builder::sql_backups_service::ListBackups::new(self.inner.clone())
384    }
385
386    /// Updates the retention period and description of the backup. You can use
387    /// this API to update final backups only.
388    ///
389    /// # Example
390    /// ```
391    /// # use google_cloud_sql_v1::client::SqlBackupsService;
392    /// use google_cloud_sql_v1::Result;
393    /// async fn sample(
394    ///    client: &SqlBackupsService
395    /// ) -> Result<()> {
396    ///     let response = client.update_backup()
397    ///         /* set fields */
398    ///         .send().await?;
399    ///     println!("response {:?}", response);
400    ///     Ok(())
401    /// }
402    /// ```
403    pub fn update_backup(&self) -> super::builder::sql_backups_service::UpdateBackup {
404        super::builder::sql_backups_service::UpdateBackup::new(self.inner.clone())
405    }
406
407    /// Deletes the backup.
408    ///
409    /// # Example
410    /// ```
411    /// # use google_cloud_sql_v1::client::SqlBackupsService;
412    /// use google_cloud_sql_v1::Result;
413    /// async fn sample(
414    ///    client: &SqlBackupsService, project_id: &str, backup_id: &str
415    /// ) -> Result<()> {
416    ///     let response = client.delete_backup()
417    ///         .set_name(format!("projects/{project_id}/backups/{backup_id}"))
418    ///         .send().await?;
419    ///     println!("response {:?}", response);
420    ///     Ok(())
421    /// }
422    /// ```
423    pub fn delete_backup(&self) -> super::builder::sql_backups_service::DeleteBackup {
424        super::builder::sql_backups_service::DeleteBackup::new(self.inner.clone())
425    }
426}
427
428/// Implements a client for the Cloud SQL Admin API.
429///
430/// # Example
431/// ```
432/// # use google_cloud_sql_v1::client::BlueGreenDeploymentsService;
433/// use google_cloud_gax::paginator::ItemPaginator as _;
434/// async fn sample(
435///    project_id: &str,
436///    location_id: &str,
437/// ) -> anyhow::Result<()> {
438///     let client = BlueGreenDeploymentsService::builder().build().await?;
439///     let mut list = client.list_blue_green_deployments()
440///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
441///         .by_item();
442///     while let Some(item) = list.next().await.transpose()? {
443///         println!("{:?}", item);
444///     }
445///     Ok(())
446/// }
447/// ```
448///
449/// # Service Description
450///
451/// Service for managing blue-green deployments.
452///
453/// # Configuration
454///
455/// To configure `BlueGreenDeploymentsService` use the `with_*` methods in the type returned
456/// by [builder()][BlueGreenDeploymentsService::builder]. The default configuration should
457/// work for most applications. Common configuration changes include
458///
459/// * [with_endpoint()]: by default this client uses the global default endpoint
460///   (`https://sqladmin.googleapis.com`). Applications using regional
461///   endpoints or running in restricted networks (e.g. a network configured
462///   with [Private Google Access with VPC Service Controls]) may want to
463///   override this default.
464/// * [with_credentials()]: by default this client uses
465///   [Application Default Credentials]. Applications using custom
466///   authentication may need to override this default.
467///
468/// [with_endpoint()]: super::builder::blue_green_deployments_service::ClientBuilder::with_endpoint
469/// [with_credentials()]: super::builder::blue_green_deployments_service::ClientBuilder::with_credentials
470/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
471/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
472///
473/// # Pooling and Cloning
474///
475/// `BlueGreenDeploymentsService` holds a connection pool internally, it is advised to
476/// create one and reuse it. You do not need to wrap `BlueGreenDeploymentsService` in
477/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
478/// already uses an `Arc` internally.
479#[derive(Clone, Debug)]
480pub struct BlueGreenDeploymentsService {
481    inner: std::sync::Arc<dyn super::stub::dynamic::BlueGreenDeploymentsService>,
482}
483
484impl BlueGreenDeploymentsService {
485    /// Returns a builder for [BlueGreenDeploymentsService].
486    ///
487    /// ```
488    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
489    /// # use google_cloud_sql_v1::client::BlueGreenDeploymentsService;
490    /// let client = BlueGreenDeploymentsService::builder().build().await?;
491    /// # Ok(()) }
492    /// ```
493    pub fn builder() -> super::builder::blue_green_deployments_service::ClientBuilder {
494        crate::new_client_builder(super::builder::blue_green_deployments_service::client::Factory)
495    }
496
497    /// Creates a new client from the provided stub.
498    ///
499    /// The most common case for calling this function is in tests mocking the
500    /// client's behavior.
501    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
502    where
503        T: super::stub::BlueGreenDeploymentsService + 'static,
504    {
505        Self { inner: stub.into() }
506    }
507
508    pub(crate) async fn new(
509        config: gaxi::options::ClientConfig,
510    ) -> crate::ClientBuilderResult<Self> {
511        let inner = Self::build_inner(config).await?;
512        Ok(Self { inner })
513    }
514
515    async fn build_inner(
516        conf: gaxi::options::ClientConfig,
517    ) -> crate::ClientBuilderResult<
518        std::sync::Arc<dyn super::stub::dynamic::BlueGreenDeploymentsService>,
519    > {
520        if gaxi::options::tracing_enabled(&conf) {
521            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
522        }
523        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
524    }
525
526    async fn build_transport(
527        conf: gaxi::options::ClientConfig,
528    ) -> crate::ClientBuilderResult<impl super::stub::BlueGreenDeploymentsService> {
529        super::transport::BlueGreenDeploymentsService::new(conf).await
530    }
531
532    async fn build_with_tracing(
533        conf: gaxi::options::ClientConfig,
534    ) -> crate::ClientBuilderResult<impl super::stub::BlueGreenDeploymentsService> {
535        Self::build_transport(conf)
536            .await
537            .map(super::tracing::BlueGreenDeploymentsService::new)
538    }
539
540    /// Creates a blue-green deployment under a given project and location.
541    ///
542    /// # Example
543    /// ```
544    /// # use google_cloud_sql_v1::client::BlueGreenDeploymentsService;
545    /// use google_cloud_sql_v1::Result;
546    /// async fn sample(
547    ///    client: &BlueGreenDeploymentsService
548    /// ) -> Result<()> {
549    ///     let response = client.create_blue_green_deployment()
550    ///         /* set fields */
551    ///         .send().await?;
552    ///     println!("response {:?}", response);
553    ///     Ok(())
554    /// }
555    /// ```
556    pub fn create_blue_green_deployment(
557        &self,
558    ) -> super::builder::blue_green_deployments_service::CreateBlueGreenDeployment {
559        super::builder::blue_green_deployments_service::CreateBlueGreenDeployment::new(
560            self.inner.clone(),
561        )
562    }
563
564    /// Retrieves a blue-green deployment resource under a given project and
565    /// location.
566    ///
567    /// # Example
568    /// ```
569    /// # use google_cloud_sql_v1::client::BlueGreenDeploymentsService;
570    /// use google_cloud_sql_v1::Result;
571    /// async fn sample(
572    ///    client: &BlueGreenDeploymentsService, project_id: &str, location_id: &str, blue_green_deployment_id: &str
573    /// ) -> Result<()> {
574    ///     let response = client.get_blue_green_deployment()
575    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/blueGreenDeployments/{blue_green_deployment_id}"))
576    ///         .send().await?;
577    ///     println!("response {:?}", response);
578    ///     Ok(())
579    /// }
580    /// ```
581    pub fn get_blue_green_deployment(
582        &self,
583    ) -> super::builder::blue_green_deployments_service::GetBlueGreenDeployment {
584        super::builder::blue_green_deployments_service::GetBlueGreenDeployment::new(
585            self.inner.clone(),
586        )
587    }
588
589    /// Switches over to green instance for a blue-green deployment.
590    ///
591    /// # Example
592    /// ```
593    /// # use google_cloud_sql_v1::client::BlueGreenDeploymentsService;
594    /// use google_cloud_sql_v1::Result;
595    /// async fn sample(
596    ///    client: &BlueGreenDeploymentsService
597    /// ) -> Result<()> {
598    ///     let response = client.switchover_blue_green_deployment()
599    ///         /* set fields */
600    ///         .send().await?;
601    ///     println!("response {:?}", response);
602    ///     Ok(())
603    /// }
604    /// ```
605    pub fn switchover_blue_green_deployment(
606        &self,
607    ) -> super::builder::blue_green_deployments_service::SwitchoverBlueGreenDeployment {
608        super::builder::blue_green_deployments_service::SwitchoverBlueGreenDeployment::new(
609            self.inner.clone(),
610        )
611    }
612
613    /// Lists blue-green deployments under a given project.
614    ///
615    /// # Example
616    /// ```
617    /// # use google_cloud_sql_v1::client::BlueGreenDeploymentsService;
618    /// use google_cloud_gax::paginator::ItemPaginator as _;
619    /// use google_cloud_sql_v1::Result;
620    /// async fn sample(
621    ///    client: &BlueGreenDeploymentsService, project_id: &str, location_id: &str
622    /// ) -> Result<()> {
623    ///     let mut list = client.list_blue_green_deployments()
624    ///         .set_parent(format!("projects/{project_id}/locations/{location_id}"))
625    ///         .by_item();
626    ///     while let Some(item) = list.next().await.transpose()? {
627    ///         println!("{:?}", item);
628    ///     }
629    ///     Ok(())
630    /// }
631    /// ```
632    pub fn list_blue_green_deployments(
633        &self,
634    ) -> super::builder::blue_green_deployments_service::ListBlueGreenDeployments {
635        super::builder::blue_green_deployments_service::ListBlueGreenDeployments::new(
636            self.inner.clone(),
637        )
638    }
639
640    /// Deletes a blue-green deployment.
641    ///
642    /// # Example
643    /// ```
644    /// # use google_cloud_sql_v1::client::BlueGreenDeploymentsService;
645    /// use google_cloud_sql_v1::Result;
646    /// async fn sample(
647    ///    client: &BlueGreenDeploymentsService, project_id: &str, location_id: &str, blue_green_deployment_id: &str
648    /// ) -> Result<()> {
649    ///     let response = client.delete_blue_green_deployment()
650    ///         .set_name(format!("projects/{project_id}/locations/{location_id}/blueGreenDeployments/{blue_green_deployment_id}"))
651    ///         .send().await?;
652    ///     println!("response {:?}", response);
653    ///     Ok(())
654    /// }
655    /// ```
656    pub fn delete_blue_green_deployment(
657        &self,
658    ) -> super::builder::blue_green_deployments_service::DeleteBlueGreenDeployment {
659        super::builder::blue_green_deployments_service::DeleteBlueGreenDeployment::new(
660            self.inner.clone(),
661        )
662    }
663}
664
665/// Implements a client for the Cloud SQL Admin API.
666///
667/// # Example
668/// ```
669/// # use google_cloud_sql_v1::client::SqlConnectService;
670/// async fn sample(
671/// ) -> anyhow::Result<()> {
672///     let client = SqlConnectService::builder().build().await?;
673///     let response = client.get_connect_settings()
674///         /* set fields */
675///         .send().await?;
676///     println!("response {:?}", response);
677///     Ok(())
678/// }
679/// ```
680///
681/// # Service Description
682///
683/// Cloud SQL connect service.
684///
685/// # Configuration
686///
687/// To configure `SqlConnectService` use the `with_*` methods in the type returned
688/// by [builder()][SqlConnectService::builder]. The default configuration should
689/// work for most applications. Common configuration changes include
690///
691/// * [with_endpoint()]: by default this client uses the global default endpoint
692///   (`https://sqladmin.googleapis.com`). Applications using regional
693///   endpoints or running in restricted networks (e.g. a network configured
694///   with [Private Google Access with VPC Service Controls]) may want to
695///   override this default.
696/// * [with_credentials()]: by default this client uses
697///   [Application Default Credentials]. Applications using custom
698///   authentication may need to override this default.
699///
700/// [with_endpoint()]: super::builder::sql_connect_service::ClientBuilder::with_endpoint
701/// [with_credentials()]: super::builder::sql_connect_service::ClientBuilder::with_credentials
702/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
703/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
704///
705/// # Pooling and Cloning
706///
707/// `SqlConnectService` holds a connection pool internally, it is advised to
708/// create one and reuse it. You do not need to wrap `SqlConnectService` in
709/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
710/// already uses an `Arc` internally.
711#[derive(Clone, Debug)]
712pub struct SqlConnectService {
713    inner: std::sync::Arc<dyn super::stub::dynamic::SqlConnectService>,
714}
715
716impl SqlConnectService {
717    /// Returns a builder for [SqlConnectService].
718    ///
719    /// ```
720    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
721    /// # use google_cloud_sql_v1::client::SqlConnectService;
722    /// let client = SqlConnectService::builder().build().await?;
723    /// # Ok(()) }
724    /// ```
725    pub fn builder() -> super::builder::sql_connect_service::ClientBuilder {
726        crate::new_client_builder(super::builder::sql_connect_service::client::Factory)
727    }
728
729    /// Creates a new client from the provided stub.
730    ///
731    /// The most common case for calling this function is in tests mocking the
732    /// client's behavior.
733    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
734    where
735        T: super::stub::SqlConnectService + 'static,
736    {
737        Self { inner: stub.into() }
738    }
739
740    pub(crate) async fn new(
741        config: gaxi::options::ClientConfig,
742    ) -> crate::ClientBuilderResult<Self> {
743        let inner = Self::build_inner(config).await?;
744        Ok(Self { inner })
745    }
746
747    async fn build_inner(
748        conf: gaxi::options::ClientConfig,
749    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SqlConnectService>>
750    {
751        if gaxi::options::tracing_enabled(&conf) {
752            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
753        }
754        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
755    }
756
757    async fn build_transport(
758        conf: gaxi::options::ClientConfig,
759    ) -> crate::ClientBuilderResult<impl super::stub::SqlConnectService> {
760        super::transport::SqlConnectService::new(conf).await
761    }
762
763    async fn build_with_tracing(
764        conf: gaxi::options::ClientConfig,
765    ) -> crate::ClientBuilderResult<impl super::stub::SqlConnectService> {
766        Self::build_transport(conf)
767            .await
768            .map(super::tracing::SqlConnectService::new)
769    }
770
771    /// Retrieves connect settings about a Cloud SQL instance.
772    ///
773    /// # Example
774    /// ```
775    /// # use google_cloud_sql_v1::client::SqlConnectService;
776    /// use google_cloud_sql_v1::Result;
777    /// async fn sample(
778    ///    client: &SqlConnectService
779    /// ) -> Result<()> {
780    ///     let response = client.get_connect_settings()
781    ///         /* set fields */
782    ///         .send().await?;
783    ///     println!("response {:?}", response);
784    ///     Ok(())
785    /// }
786    /// ```
787    pub fn get_connect_settings(&self) -> super::builder::sql_connect_service::GetConnectSettings {
788        super::builder::sql_connect_service::GetConnectSettings::new(self.inner.clone())
789    }
790
791    /// Retrieves connect settings about a Cloud SQL instance using the instance
792    /// DNS name.
793    ///
794    /// # Example
795    /// ```
796    /// # use google_cloud_sql_v1::client::SqlConnectService;
797    /// use google_cloud_sql_v1::Result;
798    /// async fn sample(
799    ///    client: &SqlConnectService
800    /// ) -> Result<()> {
801    ///     let response = client.resolve_connect_settings()
802    ///         /* set fields */
803    ///         .send().await?;
804    ///     println!("response {:?}", response);
805    ///     Ok(())
806    /// }
807    /// ```
808    pub fn resolve_connect_settings(
809        &self,
810    ) -> super::builder::sql_connect_service::ResolveConnectSettings {
811        super::builder::sql_connect_service::ResolveConnectSettings::new(self.inner.clone())
812    }
813
814    /// Generates a short-lived X509 certificate containing the provided public key
815    /// and signed by a private key specific to the target instance. Users may use
816    /// the certificate to authenticate as themselves when connecting to the
817    /// database.
818    ///
819    /// # Example
820    /// ```
821    /// # use google_cloud_sql_v1::client::SqlConnectService;
822    /// use google_cloud_sql_v1::Result;
823    /// async fn sample(
824    ///    client: &SqlConnectService
825    /// ) -> Result<()> {
826    ///     let response = client.generate_ephemeral_cert()
827    ///         /* set fields */
828    ///         .send().await?;
829    ///     println!("response {:?}", response);
830    ///     Ok(())
831    /// }
832    /// ```
833    pub fn generate_ephemeral_cert(
834        &self,
835    ) -> super::builder::sql_connect_service::GenerateEphemeralCert {
836        super::builder::sql_connect_service::GenerateEphemeralCert::new(self.inner.clone())
837    }
838}
839
840/// Implements a client for the Cloud SQL Admin API.
841///
842/// # Example
843/// ```
844/// # use google_cloud_sql_v1::client::SqlDatabasesService;
845/// async fn sample(
846/// ) -> anyhow::Result<()> {
847///     let client = SqlDatabasesService::builder().build().await?;
848///     let response = client.delete()
849///         /* set fields */
850///         .send().await?;
851///     println!("response {:?}", response);
852///     Ok(())
853/// }
854/// ```
855///
856/// # Service Description
857///
858/// Service to manage databases.
859///
860/// # Configuration
861///
862/// To configure `SqlDatabasesService` use the `with_*` methods in the type returned
863/// by [builder()][SqlDatabasesService::builder]. The default configuration should
864/// work for most applications. Common configuration changes include
865///
866/// * [with_endpoint()]: by default this client uses the global default endpoint
867///   (`https://sqladmin.googleapis.com`). Applications using regional
868///   endpoints or running in restricted networks (e.g. a network configured
869///   with [Private Google Access with VPC Service Controls]) may want to
870///   override this default.
871/// * [with_credentials()]: by default this client uses
872///   [Application Default Credentials]. Applications using custom
873///   authentication may need to override this default.
874///
875/// [with_endpoint()]: super::builder::sql_databases_service::ClientBuilder::with_endpoint
876/// [with_credentials()]: super::builder::sql_databases_service::ClientBuilder::with_credentials
877/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
878/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
879///
880/// # Pooling and Cloning
881///
882/// `SqlDatabasesService` holds a connection pool internally, it is advised to
883/// create one and reuse it. You do not need to wrap `SqlDatabasesService` in
884/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
885/// already uses an `Arc` internally.
886#[derive(Clone, Debug)]
887pub struct SqlDatabasesService {
888    inner: std::sync::Arc<dyn super::stub::dynamic::SqlDatabasesService>,
889}
890
891impl SqlDatabasesService {
892    /// Returns a builder for [SqlDatabasesService].
893    ///
894    /// ```
895    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
896    /// # use google_cloud_sql_v1::client::SqlDatabasesService;
897    /// let client = SqlDatabasesService::builder().build().await?;
898    /// # Ok(()) }
899    /// ```
900    pub fn builder() -> super::builder::sql_databases_service::ClientBuilder {
901        crate::new_client_builder(super::builder::sql_databases_service::client::Factory)
902    }
903
904    /// Creates a new client from the provided stub.
905    ///
906    /// The most common case for calling this function is in tests mocking the
907    /// client's behavior.
908    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
909    where
910        T: super::stub::SqlDatabasesService + 'static,
911    {
912        Self { inner: stub.into() }
913    }
914
915    pub(crate) async fn new(
916        config: gaxi::options::ClientConfig,
917    ) -> crate::ClientBuilderResult<Self> {
918        let inner = Self::build_inner(config).await?;
919        Ok(Self { inner })
920    }
921
922    async fn build_inner(
923        conf: gaxi::options::ClientConfig,
924    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SqlDatabasesService>>
925    {
926        if gaxi::options::tracing_enabled(&conf) {
927            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
928        }
929        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
930    }
931
932    async fn build_transport(
933        conf: gaxi::options::ClientConfig,
934    ) -> crate::ClientBuilderResult<impl super::stub::SqlDatabasesService> {
935        super::transport::SqlDatabasesService::new(conf).await
936    }
937
938    async fn build_with_tracing(
939        conf: gaxi::options::ClientConfig,
940    ) -> crate::ClientBuilderResult<impl super::stub::SqlDatabasesService> {
941        Self::build_transport(conf)
942            .await
943            .map(super::tracing::SqlDatabasesService::new)
944    }
945
946    /// Deletes a database from a Cloud SQL instance.
947    ///
948    /// # Example
949    /// ```
950    /// # use google_cloud_sql_v1::client::SqlDatabasesService;
951    /// use google_cloud_sql_v1::Result;
952    /// async fn sample(
953    ///    client: &SqlDatabasesService
954    /// ) -> Result<()> {
955    ///     let response = client.delete()
956    ///         /* set fields */
957    ///         .send().await?;
958    ///     println!("response {:?}", response);
959    ///     Ok(())
960    /// }
961    /// ```
962    pub fn delete(&self) -> super::builder::sql_databases_service::Delete {
963        super::builder::sql_databases_service::Delete::new(self.inner.clone())
964    }
965
966    /// Retrieves a resource containing information about a database inside a Cloud
967    /// SQL instance.
968    ///
969    /// # Example
970    /// ```
971    /// # use google_cloud_sql_v1::client::SqlDatabasesService;
972    /// use google_cloud_sql_v1::Result;
973    /// async fn sample(
974    ///    client: &SqlDatabasesService
975    /// ) -> Result<()> {
976    ///     let response = client.get()
977    ///         /* set fields */
978    ///         .send().await?;
979    ///     println!("response {:?}", response);
980    ///     Ok(())
981    /// }
982    /// ```
983    pub fn get(&self) -> super::builder::sql_databases_service::Get {
984        super::builder::sql_databases_service::Get::new(self.inner.clone())
985    }
986
987    /// Inserts a resource containing information about a database inside a Cloud
988    /// SQL instance.
989    ///
990    /// **Note:** You can't modify the default character set and collation.
991    ///
992    /// # Example
993    /// ```
994    /// # use google_cloud_sql_v1::client::SqlDatabasesService;
995    /// use google_cloud_sql_v1::Result;
996    /// async fn sample(
997    ///    client: &SqlDatabasesService
998    /// ) -> Result<()> {
999    ///     let response = client.insert()
1000    ///         /* set fields */
1001    ///         .send().await?;
1002    ///     println!("response {:?}", response);
1003    ///     Ok(())
1004    /// }
1005    /// ```
1006    pub fn insert(&self) -> super::builder::sql_databases_service::Insert {
1007        super::builder::sql_databases_service::Insert::new(self.inner.clone())
1008    }
1009
1010    /// Lists databases in the specified Cloud SQL instance.
1011    ///
1012    /// # Example
1013    /// ```
1014    /// # use google_cloud_sql_v1::client::SqlDatabasesService;
1015    /// use google_cloud_sql_v1::Result;
1016    /// async fn sample(
1017    ///    client: &SqlDatabasesService
1018    /// ) -> Result<()> {
1019    ///     let response = client.list()
1020    ///         /* set fields */
1021    ///         .send().await?;
1022    ///     println!("response {:?}", response);
1023    ///     Ok(())
1024    /// }
1025    /// ```
1026    pub fn list(&self) -> super::builder::sql_databases_service::List {
1027        super::builder::sql_databases_service::List::new(self.inner.clone())
1028    }
1029
1030    /// Partially updates a resource containing information about a database inside
1031    /// a Cloud SQL instance. This method supports patch semantics.
1032    ///
1033    /// # Example
1034    /// ```
1035    /// # use google_cloud_sql_v1::client::SqlDatabasesService;
1036    /// use google_cloud_sql_v1::Result;
1037    /// async fn sample(
1038    ///    client: &SqlDatabasesService
1039    /// ) -> Result<()> {
1040    ///     let response = client.patch()
1041    ///         /* set fields */
1042    ///         .send().await?;
1043    ///     println!("response {:?}", response);
1044    ///     Ok(())
1045    /// }
1046    /// ```
1047    pub fn patch(&self) -> super::builder::sql_databases_service::Patch {
1048        super::builder::sql_databases_service::Patch::new(self.inner.clone())
1049    }
1050
1051    /// Updates a resource containing information about a database inside a Cloud
1052    /// SQL instance.
1053    ///
1054    /// # Example
1055    /// ```
1056    /// # use google_cloud_sql_v1::client::SqlDatabasesService;
1057    /// use google_cloud_sql_v1::Result;
1058    /// async fn sample(
1059    ///    client: &SqlDatabasesService
1060    /// ) -> Result<()> {
1061    ///     let response = client.update()
1062    ///         /* set fields */
1063    ///         .send().await?;
1064    ///     println!("response {:?}", response);
1065    ///     Ok(())
1066    /// }
1067    /// ```
1068    pub fn update(&self) -> super::builder::sql_databases_service::Update {
1069        super::builder::sql_databases_service::Update::new(self.inner.clone())
1070    }
1071}
1072
1073/// Implements a client for the Cloud SQL Admin API.
1074///
1075/// # Example
1076/// ```
1077/// # use google_cloud_sql_v1::client::SqlFlagsService;
1078/// async fn sample(
1079/// ) -> anyhow::Result<()> {
1080///     let client = SqlFlagsService::builder().build().await?;
1081///     let response = client.list()
1082///         /* set fields */
1083///         .send().await?;
1084///     println!("response {:?}", response);
1085///     Ok(())
1086/// }
1087/// ```
1088///
1089/// # Service Description
1090///
1091/// Service to manage database flags for Cloud SQL instances.
1092///
1093/// # Configuration
1094///
1095/// To configure `SqlFlagsService` use the `with_*` methods in the type returned
1096/// by [builder()][SqlFlagsService::builder]. The default configuration should
1097/// work for most applications. Common configuration changes include
1098///
1099/// * [with_endpoint()]: by default this client uses the global default endpoint
1100///   (`https://sqladmin.googleapis.com`). Applications using regional
1101///   endpoints or running in restricted networks (e.g. a network configured
1102///   with [Private Google Access with VPC Service Controls]) may want to
1103///   override this default.
1104/// * [with_credentials()]: by default this client uses
1105///   [Application Default Credentials]. Applications using custom
1106///   authentication may need to override this default.
1107///
1108/// [with_endpoint()]: super::builder::sql_flags_service::ClientBuilder::with_endpoint
1109/// [with_credentials()]: super::builder::sql_flags_service::ClientBuilder::with_credentials
1110/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1111/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1112///
1113/// # Pooling and Cloning
1114///
1115/// `SqlFlagsService` holds a connection pool internally, it is advised to
1116/// create one and reuse it. You do not need to wrap `SqlFlagsService` in
1117/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1118/// already uses an `Arc` internally.
1119#[derive(Clone, Debug)]
1120pub struct SqlFlagsService {
1121    inner: std::sync::Arc<dyn super::stub::dynamic::SqlFlagsService>,
1122}
1123
1124impl SqlFlagsService {
1125    /// Returns a builder for [SqlFlagsService].
1126    ///
1127    /// ```
1128    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1129    /// # use google_cloud_sql_v1::client::SqlFlagsService;
1130    /// let client = SqlFlagsService::builder().build().await?;
1131    /// # Ok(()) }
1132    /// ```
1133    pub fn builder() -> super::builder::sql_flags_service::ClientBuilder {
1134        crate::new_client_builder(super::builder::sql_flags_service::client::Factory)
1135    }
1136
1137    /// Creates a new client from the provided stub.
1138    ///
1139    /// The most common case for calling this function is in tests mocking the
1140    /// client's behavior.
1141    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1142    where
1143        T: super::stub::SqlFlagsService + 'static,
1144    {
1145        Self { inner: stub.into() }
1146    }
1147
1148    pub(crate) async fn new(
1149        config: gaxi::options::ClientConfig,
1150    ) -> crate::ClientBuilderResult<Self> {
1151        let inner = Self::build_inner(config).await?;
1152        Ok(Self { inner })
1153    }
1154
1155    async fn build_inner(
1156        conf: gaxi::options::ClientConfig,
1157    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SqlFlagsService>> {
1158        if gaxi::options::tracing_enabled(&conf) {
1159            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1160        }
1161        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1162    }
1163
1164    async fn build_transport(
1165        conf: gaxi::options::ClientConfig,
1166    ) -> crate::ClientBuilderResult<impl super::stub::SqlFlagsService> {
1167        super::transport::SqlFlagsService::new(conf).await
1168    }
1169
1170    async fn build_with_tracing(
1171        conf: gaxi::options::ClientConfig,
1172    ) -> crate::ClientBuilderResult<impl super::stub::SqlFlagsService> {
1173        Self::build_transport(conf)
1174            .await
1175            .map(super::tracing::SqlFlagsService::new)
1176    }
1177
1178    /// Lists all available database flags for Cloud SQL instances.
1179    ///
1180    /// # Example
1181    /// ```
1182    /// # use google_cloud_sql_v1::client::SqlFlagsService;
1183    /// use google_cloud_sql_v1::Result;
1184    /// async fn sample(
1185    ///    client: &SqlFlagsService
1186    /// ) -> Result<()> {
1187    ///     let response = client.list()
1188    ///         /* set fields */
1189    ///         .send().await?;
1190    ///     println!("response {:?}", response);
1191    ///     Ok(())
1192    /// }
1193    /// ```
1194    pub fn list(&self) -> super::builder::sql_flags_service::List {
1195        super::builder::sql_flags_service::List::new(self.inner.clone())
1196    }
1197}
1198
1199/// Implements a client for the Cloud SQL Admin API.
1200///
1201/// # Example
1202/// ```
1203/// # use google_cloud_sql_v1::client::SqlInstancesService;
1204/// async fn sample(
1205/// ) -> anyhow::Result<()> {
1206///     let client = SqlInstancesService::builder().build().await?;
1207///     let response = client.add_server_ca()
1208///         /* set fields */
1209///         .send().await?;
1210///     println!("response {:?}", response);
1211///     Ok(())
1212/// }
1213/// ```
1214///
1215/// # Service Description
1216///
1217///
1218/// # Configuration
1219///
1220/// To configure `SqlInstancesService` use the `with_*` methods in the type returned
1221/// by [builder()][SqlInstancesService::builder]. The default configuration should
1222/// work for most applications. Common configuration changes include
1223///
1224/// * [with_endpoint()]: by default this client uses the global default endpoint
1225///   (`https://sqladmin.googleapis.com`). Applications using regional
1226///   endpoints or running in restricted networks (e.g. a network configured
1227///   with [Private Google Access with VPC Service Controls]) may want to
1228///   override this default.
1229/// * [with_credentials()]: by default this client uses
1230///   [Application Default Credentials]. Applications using custom
1231///   authentication may need to override this default.
1232///
1233/// [with_endpoint()]: super::builder::sql_instances_service::ClientBuilder::with_endpoint
1234/// [with_credentials()]: super::builder::sql_instances_service::ClientBuilder::with_credentials
1235/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1236/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1237///
1238/// # Pooling and Cloning
1239///
1240/// `SqlInstancesService` holds a connection pool internally, it is advised to
1241/// create one and reuse it. You do not need to wrap `SqlInstancesService` in
1242/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1243/// already uses an `Arc` internally.
1244#[derive(Clone, Debug)]
1245pub struct SqlInstancesService {
1246    inner: std::sync::Arc<dyn super::stub::dynamic::SqlInstancesService>,
1247}
1248
1249impl SqlInstancesService {
1250    /// Returns a builder for [SqlInstancesService].
1251    ///
1252    /// ```
1253    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
1254    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1255    /// let client = SqlInstancesService::builder().build().await?;
1256    /// # Ok(()) }
1257    /// ```
1258    pub fn builder() -> super::builder::sql_instances_service::ClientBuilder {
1259        crate::new_client_builder(super::builder::sql_instances_service::client::Factory)
1260    }
1261
1262    /// Creates a new client from the provided stub.
1263    ///
1264    /// The most common case for calling this function is in tests mocking the
1265    /// client's behavior.
1266    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1267    where
1268        T: super::stub::SqlInstancesService + 'static,
1269    {
1270        Self { inner: stub.into() }
1271    }
1272
1273    pub(crate) async fn new(
1274        config: gaxi::options::ClientConfig,
1275    ) -> crate::ClientBuilderResult<Self> {
1276        let inner = Self::build_inner(config).await?;
1277        Ok(Self { inner })
1278    }
1279
1280    async fn build_inner(
1281        conf: gaxi::options::ClientConfig,
1282    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SqlInstancesService>>
1283    {
1284        if gaxi::options::tracing_enabled(&conf) {
1285            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1286        }
1287        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1288    }
1289
1290    async fn build_transport(
1291        conf: gaxi::options::ClientConfig,
1292    ) -> crate::ClientBuilderResult<impl super::stub::SqlInstancesService> {
1293        super::transport::SqlInstancesService::new(conf).await
1294    }
1295
1296    async fn build_with_tracing(
1297        conf: gaxi::options::ClientConfig,
1298    ) -> crate::ClientBuilderResult<impl super::stub::SqlInstancesService> {
1299        Self::build_transport(conf)
1300            .await
1301            .map(super::tracing::SqlInstancesService::new)
1302    }
1303
1304    /// Adds a new trusted Certificate Authority (CA) version for the specified
1305    /// instance. Required to prepare for a certificate rotation. If a CA version
1306    /// was previously added but never used in a certificate rotation, this
1307    /// operation replaces that version. There cannot be more than one CA version
1308    /// waiting to be rotated in. For instances that have enabled Certificate
1309    /// Authority Service (CAS) based server CA, use AddServerCertificate to add a
1310    /// new server certificate.
1311    ///
1312    /// # Example
1313    /// ```
1314    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1315    /// use google_cloud_sql_v1::Result;
1316    /// async fn sample(
1317    ///    client: &SqlInstancesService
1318    /// ) -> Result<()> {
1319    ///     let response = client.add_server_ca()
1320    ///         /* set fields */
1321    ///         .send().await?;
1322    ///     println!("response {:?}", response);
1323    ///     Ok(())
1324    /// }
1325    /// ```
1326    pub fn add_server_ca(&self) -> super::builder::sql_instances_service::AddServerCa {
1327        super::builder::sql_instances_service::AddServerCa::new(self.inner.clone())
1328    }
1329
1330    /// Add a new trusted server certificate version for the specified instance
1331    /// using Certificate Authority Service (CAS) server CA. Required to prepare
1332    /// for a certificate rotation. If a server certificate version was previously
1333    /// added but never used in a certificate rotation, this operation replaces
1334    /// that version. There cannot be more than one certificate version waiting to
1335    /// be rotated in. For instances not using CAS server CA, use AddServerCa
1336    /// instead.
1337    ///
1338    /// # Example
1339    /// ```
1340    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1341    /// use google_cloud_sql_v1::Result;
1342    /// async fn sample(
1343    ///    client: &SqlInstancesService
1344    /// ) -> Result<()> {
1345    ///     let response = client.add_server_certificate()
1346    ///         /* set fields */
1347    ///         .send().await?;
1348    ///     println!("response {:?}", response);
1349    ///     Ok(())
1350    /// }
1351    /// ```
1352    pub fn add_server_certificate(
1353        &self,
1354    ) -> super::builder::sql_instances_service::AddServerCertificate {
1355        super::builder::sql_instances_service::AddServerCertificate::new(self.inner.clone())
1356    }
1357
1358    /// Adds a new Entra ID certificate for the specified instance. If an Entra ID
1359    /// certificate was previously added but never used in a certificate rotation,
1360    /// this operation replaces that version.
1361    ///
1362    /// # Example
1363    /// ```
1364    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1365    /// use google_cloud_sql_v1::Result;
1366    /// async fn sample(
1367    ///    client: &SqlInstancesService
1368    /// ) -> Result<()> {
1369    ///     let response = client.add_entra_id_certificate()
1370    ///         /* set fields */
1371    ///         .send().await?;
1372    ///     println!("response {:?}", response);
1373    ///     Ok(())
1374    /// }
1375    /// ```
1376    pub fn add_entra_id_certificate(
1377        &self,
1378    ) -> super::builder::sql_instances_service::AddEntraIdCertificate {
1379        super::builder::sql_instances_service::AddEntraIdCertificate::new(self.inner.clone())
1380    }
1381
1382    /// Creates a Cloud SQL instance as a clone of the source instance. Using this
1383    /// operation might cause your instance to restart.
1384    ///
1385    /// # Example
1386    /// ```
1387    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1388    /// use google_cloud_sql_v1::Result;
1389    /// async fn sample(
1390    ///    client: &SqlInstancesService
1391    /// ) -> Result<()> {
1392    ///     let response = client.clone()
1393    ///         /* set fields */
1394    ///         .send().await?;
1395    ///     println!("response {:?}", response);
1396    ///     Ok(())
1397    /// }
1398    /// ```
1399    #[allow(clippy::should_implement_trait)]
1400    pub fn clone(&self) -> super::builder::sql_instances_service::Clone {
1401        super::builder::sql_instances_service::Clone::new(self.inner.clone())
1402    }
1403
1404    /// Deletes a Cloud SQL instance.
1405    ///
1406    /// # Example
1407    /// ```
1408    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1409    /// use google_cloud_sql_v1::Result;
1410    /// async fn sample(
1411    ///    client: &SqlInstancesService
1412    /// ) -> Result<()> {
1413    ///     let response = client.delete()
1414    ///         /* set fields */
1415    ///         .send().await?;
1416    ///     println!("response {:?}", response);
1417    ///     Ok(())
1418    /// }
1419    /// ```
1420    pub fn delete(&self) -> super::builder::sql_instances_service::Delete {
1421        super::builder::sql_instances_service::Delete::new(self.inner.clone())
1422    }
1423
1424    /// Demotes the stand-alone instance to be a Cloud SQL read replica for an
1425    /// external database server.
1426    ///
1427    /// # Example
1428    /// ```
1429    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1430    /// use google_cloud_sql_v1::Result;
1431    /// async fn sample(
1432    ///    client: &SqlInstancesService
1433    /// ) -> Result<()> {
1434    ///     let response = client.demote_master()
1435    ///         /* set fields */
1436    ///         .send().await?;
1437    ///     println!("response {:?}", response);
1438    ///     Ok(())
1439    /// }
1440    /// ```
1441    pub fn demote_master(&self) -> super::builder::sql_instances_service::DemoteMaster {
1442        super::builder::sql_instances_service::DemoteMaster::new(self.inner.clone())
1443    }
1444
1445    /// Demotes an existing standalone instance to be a Cloud SQL read replica
1446    /// for an external database server.
1447    ///
1448    /// # Example
1449    /// ```
1450    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1451    /// use google_cloud_sql_v1::Result;
1452    /// async fn sample(
1453    ///    client: &SqlInstancesService
1454    /// ) -> Result<()> {
1455    ///     let response = client.demote()
1456    ///         /* set fields */
1457    ///         .send().await?;
1458    ///     println!("response {:?}", response);
1459    ///     Ok(())
1460    /// }
1461    /// ```
1462    pub fn demote(&self) -> super::builder::sql_instances_service::Demote {
1463        super::builder::sql_instances_service::Demote::new(self.inner.clone())
1464    }
1465
1466    /// Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL
1467    /// dump or CSV file.
1468    ///
1469    /// # Example
1470    /// ```
1471    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1472    /// use google_cloud_sql_v1::Result;
1473    /// async fn sample(
1474    ///    client: &SqlInstancesService
1475    /// ) -> Result<()> {
1476    ///     let response = client.export()
1477    ///         /* set fields */
1478    ///         .send().await?;
1479    ///     println!("response {:?}", response);
1480    ///     Ok(())
1481    /// }
1482    /// ```
1483    pub fn export(&self) -> super::builder::sql_instances_service::Export {
1484        super::builder::sql_instances_service::Export::new(self.inner.clone())
1485    }
1486
1487    /// Initiates a manual failover of a high availability (HA) primary instance
1488    /// to a standby instance, which becomes the primary instance. Users are
1489    /// then rerouted to the new primary. For more information, see the
1490    /// [Overview of high
1491    /// availability](https://cloud.google.com/sql/docs/mysql/high-availability)
1492    /// page in the Cloud SQL documentation.
1493    /// If using Legacy HA (MySQL only), this causes the instance to failover to
1494    /// its failover replica instance.
1495    ///
1496    /// # Example
1497    /// ```
1498    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1499    /// use google_cloud_sql_v1::Result;
1500    /// async fn sample(
1501    ///    client: &SqlInstancesService
1502    /// ) -> Result<()> {
1503    ///     let response = client.failover()
1504    ///         /* set fields */
1505    ///         .send().await?;
1506    ///     println!("response {:?}", response);
1507    ///     Ok(())
1508    /// }
1509    /// ```
1510    pub fn failover(&self) -> super::builder::sql_instances_service::Failover {
1511        super::builder::sql_instances_service::Failover::new(self.inner.clone())
1512    }
1513
1514    /// Reencrypt CMEK instance with latest key version.
1515    ///
1516    /// # Example
1517    /// ```
1518    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1519    /// use google_cloud_sql_v1::Result;
1520    /// async fn sample(
1521    ///    client: &SqlInstancesService
1522    /// ) -> Result<()> {
1523    ///     let response = client.reencrypt()
1524    ///         /* set fields */
1525    ///         .send().await?;
1526    ///     println!("response {:?}", response);
1527    ///     Ok(())
1528    /// }
1529    /// ```
1530    pub fn reencrypt(&self) -> super::builder::sql_instances_service::Reencrypt {
1531        super::builder::sql_instances_service::Reencrypt::new(self.inner.clone())
1532    }
1533
1534    /// Retrieves a resource containing information about a Cloud SQL instance.
1535    ///
1536    /// # Example
1537    /// ```
1538    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1539    /// use google_cloud_sql_v1::Result;
1540    /// async fn sample(
1541    ///    client: &SqlInstancesService
1542    /// ) -> Result<()> {
1543    ///     let response = client.get()
1544    ///         /* set fields */
1545    ///         .send().await?;
1546    ///     println!("response {:?}", response);
1547    ///     Ok(())
1548    /// }
1549    /// ```
1550    pub fn get(&self) -> super::builder::sql_instances_service::Get {
1551        super::builder::sql_instances_service::Get::new(self.inner.clone())
1552    }
1553
1554    /// Imports data into a Cloud SQL instance from a SQL dump  or CSV file in
1555    /// Cloud Storage.
1556    ///
1557    /// # Example
1558    /// ```
1559    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1560    /// use google_cloud_sql_v1::Result;
1561    /// async fn sample(
1562    ///    client: &SqlInstancesService
1563    /// ) -> Result<()> {
1564    ///     let response = client.import()
1565    ///         /* set fields */
1566    ///         .send().await?;
1567    ///     println!("response {:?}", response);
1568    ///     Ok(())
1569    /// }
1570    /// ```
1571    pub fn import(&self) -> super::builder::sql_instances_service::Import {
1572        super::builder::sql_instances_service::Import::new(self.inner.clone())
1573    }
1574
1575    /// Creates a new Cloud SQL instance.
1576    ///
1577    /// # Example
1578    /// ```
1579    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1580    /// use google_cloud_sql_v1::Result;
1581    /// async fn sample(
1582    ///    client: &SqlInstancesService
1583    /// ) -> Result<()> {
1584    ///     let response = client.insert()
1585    ///         /* set fields */
1586    ///         .send().await?;
1587    ///     println!("response {:?}", response);
1588    ///     Ok(())
1589    /// }
1590    /// ```
1591    pub fn insert(&self) -> super::builder::sql_instances_service::Insert {
1592        super::builder::sql_instances_service::Insert::new(self.inner.clone())
1593    }
1594
1595    /// Lists instances under a given project.
1596    ///
1597    /// # Example
1598    /// ```
1599    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1600    /// use google_cloud_gax::paginator::ItemPaginator as _;
1601    /// use google_cloud_sql_v1::Result;
1602    /// async fn sample(
1603    ///    client: &SqlInstancesService
1604    /// ) -> Result<()> {
1605    ///     let mut list = client.list()
1606    ///         /* set fields */
1607    ///         .by_item();
1608    ///     while let Some(item) = list.next().await.transpose()? {
1609    ///         println!("{:?}", item);
1610    ///     }
1611    ///     Ok(())
1612    /// }
1613    /// ```
1614    pub fn list(&self) -> super::builder::sql_instances_service::List {
1615        super::builder::sql_instances_service::List::new(self.inner.clone())
1616    }
1617
1618    /// Lists all of the trusted Certificate Authorities (CAs) for the specified
1619    /// instance. There can be up to three CAs listed: the CA that was used to sign
1620    /// the certificate that is currently in use, a CA that has been added but not
1621    /// yet used to sign a certificate, and a CA used to sign a certificate that
1622    /// has previously rotated out.
1623    ///
1624    /// # Example
1625    /// ```
1626    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1627    /// use google_cloud_sql_v1::Result;
1628    /// async fn sample(
1629    ///    client: &SqlInstancesService
1630    /// ) -> Result<()> {
1631    ///     let response = client.list_server_cas()
1632    ///         /* set fields */
1633    ///         .send().await?;
1634    ///     println!("response {:?}", response);
1635    ///     Ok(())
1636    /// }
1637    /// ```
1638    pub fn list_server_cas(&self) -> super::builder::sql_instances_service::ListServerCas {
1639        super::builder::sql_instances_service::ListServerCas::new(self.inner.clone())
1640    }
1641
1642    /// Lists all versions of server certificates and certificate authorities (CAs)
1643    /// for the specified instance. There can be up to three sets of certs listed:
1644    /// the certificate that is currently in use, a future that has been added but
1645    /// not yet used to sign a certificate, and a certificate that has been rotated
1646    /// out. For instances not using Certificate Authority Service (CAS) server CA,
1647    /// use ListServerCas instead.
1648    ///
1649    /// # Example
1650    /// ```
1651    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1652    /// use google_cloud_sql_v1::Result;
1653    /// async fn sample(
1654    ///    client: &SqlInstancesService
1655    /// ) -> Result<()> {
1656    ///     let response = client.list_server_certificates()
1657    ///         /* set fields */
1658    ///         .send().await?;
1659    ///     println!("response {:?}", response);
1660    ///     Ok(())
1661    /// }
1662    /// ```
1663    pub fn list_server_certificates(
1664        &self,
1665    ) -> super::builder::sql_instances_service::ListServerCertificates {
1666        super::builder::sql_instances_service::ListServerCertificates::new(self.inner.clone())
1667    }
1668
1669    /// Lists all versions of EntraID certificates for the specified instance.
1670    /// There can be up to three sets of certificates listed: the certificate that
1671    /// is currently in use, a future that has been added but not yet used to sign
1672    /// a certificate, and a certificate that has been rotated out.
1673    ///
1674    /// # Example
1675    /// ```
1676    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1677    /// use google_cloud_sql_v1::Result;
1678    /// async fn sample(
1679    ///    client: &SqlInstancesService
1680    /// ) -> Result<()> {
1681    ///     let response = client.list_entra_id_certificates()
1682    ///         /* set fields */
1683    ///         .send().await?;
1684    ///     println!("response {:?}", response);
1685    ///     Ok(())
1686    /// }
1687    /// ```
1688    pub fn list_entra_id_certificates(
1689        &self,
1690    ) -> super::builder::sql_instances_service::ListEntraIdCertificates {
1691        super::builder::sql_instances_service::ListEntraIdCertificates::new(self.inner.clone())
1692    }
1693
1694    /// Partially updates settings of a Cloud SQL instance by merging the request
1695    /// with the current configuration. This method supports patch semantics.
1696    ///
1697    /// # Example
1698    /// ```
1699    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1700    /// use google_cloud_sql_v1::Result;
1701    /// async fn sample(
1702    ///    client: &SqlInstancesService
1703    /// ) -> Result<()> {
1704    ///     let response = client.patch()
1705    ///         /* set fields */
1706    ///         .send().await?;
1707    ///     println!("response {:?}", response);
1708    ///     Ok(())
1709    /// }
1710    /// ```
1711    pub fn patch(&self) -> super::builder::sql_instances_service::Patch {
1712        super::builder::sql_instances_service::Patch::new(self.inner.clone())
1713    }
1714
1715    /// Promotes the read replica instance to be an independent Cloud SQL
1716    /// primary instance.
1717    /// Using this operation might cause your instance to restart.
1718    ///
1719    /// # Example
1720    /// ```
1721    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1722    /// use google_cloud_sql_v1::Result;
1723    /// async fn sample(
1724    ///    client: &SqlInstancesService
1725    /// ) -> Result<()> {
1726    ///     let response = client.promote_replica()
1727    ///         /* set fields */
1728    ///         .send().await?;
1729    ///     println!("response {:?}", response);
1730    ///     Ok(())
1731    /// }
1732    /// ```
1733    pub fn promote_replica(&self) -> super::builder::sql_instances_service::PromoteReplica {
1734        super::builder::sql_instances_service::PromoteReplica::new(self.inner.clone())
1735    }
1736
1737    /// Switches over from the primary instance to the DR replica
1738    /// instance.
1739    ///
1740    /// # Example
1741    /// ```
1742    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1743    /// use google_cloud_sql_v1::Result;
1744    /// async fn sample(
1745    ///    client: &SqlInstancesService
1746    /// ) -> Result<()> {
1747    ///     let response = client.switchover()
1748    ///         /* set fields */
1749    ///         .send().await?;
1750    ///     println!("response {:?}", response);
1751    ///     Ok(())
1752    /// }
1753    /// ```
1754    pub fn switchover(&self) -> super::builder::sql_instances_service::Switchover {
1755        super::builder::sql_instances_service::Switchover::new(self.inner.clone())
1756    }
1757
1758    /// Deletes all client certificates and generates a new server SSL certificate
1759    /// for the instance.
1760    ///
1761    /// # Example
1762    /// ```
1763    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1764    /// use google_cloud_sql_v1::Result;
1765    /// async fn sample(
1766    ///    client: &SqlInstancesService
1767    /// ) -> Result<()> {
1768    ///     let response = client.reset_ssl_config()
1769    ///         /* set fields */
1770    ///         .send().await?;
1771    ///     println!("response {:?}", response);
1772    ///     Ok(())
1773    /// }
1774    /// ```
1775    pub fn reset_ssl_config(&self) -> super::builder::sql_instances_service::ResetSslConfig {
1776        super::builder::sql_instances_service::ResetSslConfig::new(self.inner.clone())
1777    }
1778
1779    /// Restarts a Cloud SQL instance.
1780    ///
1781    /// # Example
1782    /// ```
1783    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1784    /// use google_cloud_sql_v1::Result;
1785    /// async fn sample(
1786    ///    client: &SqlInstancesService
1787    /// ) -> Result<()> {
1788    ///     let response = client.restart()
1789    ///         /* set fields */
1790    ///         .send().await?;
1791    ///     println!("response {:?}", response);
1792    ///     Ok(())
1793    /// }
1794    /// ```
1795    pub fn restart(&self) -> super::builder::sql_instances_service::Restart {
1796        super::builder::sql_instances_service::Restart::new(self.inner.clone())
1797    }
1798
1799    /// Restores a backup of a Cloud SQL instance. Using this operation might cause
1800    /// your instance to restart.
1801    ///
1802    /// # Example
1803    /// ```
1804    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1805    /// use google_cloud_sql_v1::Result;
1806    /// async fn sample(
1807    ///    client: &SqlInstancesService
1808    /// ) -> Result<()> {
1809    ///     let response = client.restore_backup()
1810    ///         /* set fields */
1811    ///         .send().await?;
1812    ///     println!("response {:?}", response);
1813    ///     Ok(())
1814    /// }
1815    /// ```
1816    pub fn restore_backup(&self) -> super::builder::sql_instances_service::RestoreBackup {
1817        super::builder::sql_instances_service::RestoreBackup::new(self.inner.clone())
1818    }
1819
1820    /// Rotates the server certificate to one signed by the Certificate Authority
1821    /// (CA) version previously added with the addServerCA method. For instances
1822    /// that have enabled Certificate Authority Service (CAS) based server CA,
1823    /// use RotateServerCertificate to rotate the server certificate.
1824    ///
1825    /// # Example
1826    /// ```
1827    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1828    /// use google_cloud_sql_v1::Result;
1829    /// async fn sample(
1830    ///    client: &SqlInstancesService
1831    /// ) -> Result<()> {
1832    ///     let response = client.rotate_server_ca()
1833    ///         /* set fields */
1834    ///         .send().await?;
1835    ///     println!("response {:?}", response);
1836    ///     Ok(())
1837    /// }
1838    /// ```
1839    pub fn rotate_server_ca(&self) -> super::builder::sql_instances_service::RotateServerCa {
1840        super::builder::sql_instances_service::RotateServerCa::new(self.inner.clone())
1841    }
1842
1843    /// Rotates the server certificate version to one previously added with the
1844    /// addServerCertificate method. For instances not using Certificate Authority
1845    /// Service (CAS) server CA, use RotateServerCa instead.
1846    ///
1847    /// # Example
1848    /// ```
1849    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1850    /// use google_cloud_sql_v1::Result;
1851    /// async fn sample(
1852    ///    client: &SqlInstancesService
1853    /// ) -> Result<()> {
1854    ///     let response = client.rotate_server_certificate()
1855    ///         /* set fields */
1856    ///         .send().await?;
1857    ///     println!("response {:?}", response);
1858    ///     Ok(())
1859    /// }
1860    /// ```
1861    pub fn rotate_server_certificate(
1862        &self,
1863    ) -> super::builder::sql_instances_service::RotateServerCertificate {
1864        super::builder::sql_instances_service::RotateServerCertificate::new(self.inner.clone())
1865    }
1866
1867    /// Rotates the server certificate version to one previously added with the
1868    /// addEntraIdCertificate method.
1869    ///
1870    /// # Example
1871    /// ```
1872    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1873    /// use google_cloud_sql_v1::Result;
1874    /// async fn sample(
1875    ///    client: &SqlInstancesService
1876    /// ) -> Result<()> {
1877    ///     let response = client.rotate_entra_id_certificate()
1878    ///         /* set fields */
1879    ///         .send().await?;
1880    ///     println!("response {:?}", response);
1881    ///     Ok(())
1882    /// }
1883    /// ```
1884    pub fn rotate_entra_id_certificate(
1885        &self,
1886    ) -> super::builder::sql_instances_service::RotateEntraIdCertificate {
1887        super::builder::sql_instances_service::RotateEntraIdCertificate::new(self.inner.clone())
1888    }
1889
1890    /// Starts the replication in the read replica instance.
1891    ///
1892    /// # Example
1893    /// ```
1894    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1895    /// use google_cloud_sql_v1::Result;
1896    /// async fn sample(
1897    ///    client: &SqlInstancesService
1898    /// ) -> Result<()> {
1899    ///     let response = client.start_replica()
1900    ///         /* set fields */
1901    ///         .send().await?;
1902    ///     println!("response {:?}", response);
1903    ///     Ok(())
1904    /// }
1905    /// ```
1906    pub fn start_replica(&self) -> super::builder::sql_instances_service::StartReplica {
1907        super::builder::sql_instances_service::StartReplica::new(self.inner.clone())
1908    }
1909
1910    /// Stops the replication in the read replica instance.
1911    ///
1912    /// # Example
1913    /// ```
1914    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1915    /// use google_cloud_sql_v1::Result;
1916    /// async fn sample(
1917    ///    client: &SqlInstancesService
1918    /// ) -> Result<()> {
1919    ///     let response = client.stop_replica()
1920    ///         /* set fields */
1921    ///         .send().await?;
1922    ///     println!("response {:?}", response);
1923    ///     Ok(())
1924    /// }
1925    /// ```
1926    pub fn stop_replica(&self) -> super::builder::sql_instances_service::StopReplica {
1927        super::builder::sql_instances_service::StopReplica::new(self.inner.clone())
1928    }
1929
1930    /// Truncate MySQL general and slow query log tables
1931    /// MySQL only.
1932    ///
1933    /// # Example
1934    /// ```
1935    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1936    /// use google_cloud_sql_v1::Result;
1937    /// async fn sample(
1938    ///    client: &SqlInstancesService
1939    /// ) -> Result<()> {
1940    ///     let response = client.truncate_log()
1941    ///         /* set fields */
1942    ///         .send().await?;
1943    ///     println!("response {:?}", response);
1944    ///     Ok(())
1945    /// }
1946    /// ```
1947    pub fn truncate_log(&self) -> super::builder::sql_instances_service::TruncateLog {
1948        super::builder::sql_instances_service::TruncateLog::new(self.inner.clone())
1949    }
1950
1951    /// Updates settings of a Cloud SQL instance. Using this operation might cause
1952    /// your instance to restart.
1953    ///
1954    /// # Example
1955    /// ```
1956    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1957    /// use google_cloud_sql_v1::Result;
1958    /// async fn sample(
1959    ///    client: &SqlInstancesService
1960    /// ) -> Result<()> {
1961    ///     let response = client.update()
1962    ///         /* set fields */
1963    ///         .send().await?;
1964    ///     println!("response {:?}", response);
1965    ///     Ok(())
1966    /// }
1967    /// ```
1968    pub fn update(&self) -> super::builder::sql_instances_service::Update {
1969        super::builder::sql_instances_service::Update::new(self.inner.clone())
1970    }
1971
1972    /// Generates a short-lived X509 certificate containing the provided public key
1973    /// and signed by a private key specific to the target instance. Users may use
1974    /// the certificate to authenticate as themselves when connecting to the
1975    /// database.
1976    ///
1977    /// # Example
1978    /// ```
1979    /// # use google_cloud_sql_v1::client::SqlInstancesService;
1980    /// use google_cloud_sql_v1::Result;
1981    /// async fn sample(
1982    ///    client: &SqlInstancesService
1983    /// ) -> Result<()> {
1984    ///     let response = client.create_ephemeral()
1985    ///         /* set fields */
1986    ///         .send().await?;
1987    ///     println!("response {:?}", response);
1988    ///     Ok(())
1989    /// }
1990    /// ```
1991    pub fn create_ephemeral(&self) -> super::builder::sql_instances_service::CreateEphemeral {
1992        super::builder::sql_instances_service::CreateEphemeral::new(self.inner.clone())
1993    }
1994
1995    /// Reschedules the maintenance on the given instance.
1996    ///
1997    /// # Example
1998    /// ```
1999    /// # use google_cloud_sql_v1::client::SqlInstancesService;
2000    /// use google_cloud_sql_v1::Result;
2001    /// async fn sample(
2002    ///    client: &SqlInstancesService
2003    /// ) -> Result<()> {
2004    ///     let response = client.reschedule_maintenance()
2005    ///         /* set fields */
2006    ///         .send().await?;
2007    ///     println!("response {:?}", response);
2008    ///     Ok(())
2009    /// }
2010    /// ```
2011    pub fn reschedule_maintenance(
2012        &self,
2013    ) -> super::builder::sql_instances_service::RescheduleMaintenance {
2014        super::builder::sql_instances_service::RescheduleMaintenance::new(self.inner.clone())
2015    }
2016
2017    /// Verify External primary instance external sync settings.
2018    ///
2019    /// # Example
2020    /// ```
2021    /// # use google_cloud_sql_v1::client::SqlInstancesService;
2022    /// use google_cloud_sql_v1::Result;
2023    /// async fn sample(
2024    ///    client: &SqlInstancesService
2025    /// ) -> Result<()> {
2026    ///     let response = client.verify_external_sync_settings()
2027    ///         /* set fields */
2028    ///         .send().await?;
2029    ///     println!("response {:?}", response);
2030    ///     Ok(())
2031    /// }
2032    /// ```
2033    pub fn verify_external_sync_settings(
2034        &self,
2035    ) -> super::builder::sql_instances_service::VerifyExternalSyncSettings {
2036        super::builder::sql_instances_service::VerifyExternalSyncSettings::new(self.inner.clone())
2037    }
2038
2039    /// Start External primary instance migration.
2040    ///
2041    /// # Example
2042    /// ```
2043    /// # use google_cloud_sql_v1::client::SqlInstancesService;
2044    /// use google_cloud_sql_v1::Result;
2045    /// async fn sample(
2046    ///    client: &SqlInstancesService
2047    /// ) -> Result<()> {
2048    ///     let response = client.start_external_sync()
2049    ///         /* set fields */
2050    ///         .send().await?;
2051    ///     println!("response {:?}", response);
2052    ///     Ok(())
2053    /// }
2054    /// ```
2055    pub fn start_external_sync(&self) -> super::builder::sql_instances_service::StartExternalSync {
2056        super::builder::sql_instances_service::StartExternalSync::new(self.inner.clone())
2057    }
2058
2059    /// Perform Disk Shrink on primary instance.
2060    ///
2061    /// # Example
2062    /// ```
2063    /// # use google_cloud_sql_v1::client::SqlInstancesService;
2064    /// use google_cloud_sql_v1::Result;
2065    /// async fn sample(
2066    ///    client: &SqlInstancesService
2067    /// ) -> Result<()> {
2068    ///     let response = client.perform_disk_shrink()
2069    ///         /* set fields */
2070    ///         .send().await?;
2071    ///     println!("response {:?}", response);
2072    ///     Ok(())
2073    /// }
2074    /// ```
2075    pub fn perform_disk_shrink(&self) -> super::builder::sql_instances_service::PerformDiskShrink {
2076        super::builder::sql_instances_service::PerformDiskShrink::new(self.inner.clone())
2077    }
2078
2079    /// Get Disk Shrink Config for a given instance.
2080    ///
2081    /// # Example
2082    /// ```
2083    /// # use google_cloud_sql_v1::client::SqlInstancesService;
2084    /// use google_cloud_sql_v1::Result;
2085    /// async fn sample(
2086    ///    client: &SqlInstancesService
2087    /// ) -> Result<()> {
2088    ///     let response = client.get_disk_shrink_config()
2089    ///         /* set fields */
2090    ///         .send().await?;
2091    ///     println!("response {:?}", response);
2092    ///     Ok(())
2093    /// }
2094    /// ```
2095    pub fn get_disk_shrink_config(
2096        &self,
2097    ) -> super::builder::sql_instances_service::GetDiskShrinkConfig {
2098        super::builder::sql_instances_service::GetDiskShrinkConfig::new(self.inner.clone())
2099    }
2100
2101    /// Reset Replica Size to primary instance disk size.
2102    ///
2103    /// # Example
2104    /// ```
2105    /// # use google_cloud_sql_v1::client::SqlInstancesService;
2106    /// use google_cloud_sql_v1::Result;
2107    /// async fn sample(
2108    ///    client: &SqlInstancesService
2109    /// ) -> Result<()> {
2110    ///     let response = client.reset_replica_size()
2111    ///         /* set fields */
2112    ///         .send().await?;
2113    ///     println!("response {:?}", response);
2114    ///     Ok(())
2115    /// }
2116    /// ```
2117    pub fn reset_replica_size(&self) -> super::builder::sql_instances_service::ResetReplicaSize {
2118        super::builder::sql_instances_service::ResetReplicaSize::new(self.inner.clone())
2119    }
2120
2121    /// Get Latest Recovery Time for a given instance.
2122    ///
2123    /// # Example
2124    /// ```
2125    /// # use google_cloud_sql_v1::client::SqlInstancesService;
2126    /// use google_cloud_sql_v1::Result;
2127    /// async fn sample(
2128    ///    client: &SqlInstancesService
2129    /// ) -> Result<()> {
2130    ///     let response = client.get_latest_recovery_time()
2131    ///         /* set fields */
2132    ///         .send().await?;
2133    ///     println!("response {:?}", response);
2134    ///     Ok(())
2135    /// }
2136    /// ```
2137    pub fn get_latest_recovery_time(
2138        &self,
2139    ) -> super::builder::sql_instances_service::GetLatestRecoveryTime {
2140        super::builder::sql_instances_service::GetLatestRecoveryTime::new(self.inner.clone())
2141    }
2142
2143    /// Execute SQL statements.
2144    ///
2145    /// # Example
2146    /// ```
2147    /// # use google_cloud_sql_v1::client::SqlInstancesService;
2148    /// use google_cloud_sql_v1::Result;
2149    /// async fn sample(
2150    ///    client: &SqlInstancesService
2151    /// ) -> Result<()> {
2152    ///     let response = client.execute_sql()
2153    ///         /* set fields */
2154    ///         .send().await?;
2155    ///     println!("response {:?}", response);
2156    ///     Ok(())
2157    /// }
2158    /// ```
2159    pub fn execute_sql(&self) -> super::builder::sql_instances_service::ExecuteSql {
2160        super::builder::sql_instances_service::ExecuteSql::new(self.inner.clone())
2161    }
2162
2163    /// Acquire a lease for the setup of SQL Server Reporting Services (SSRS).
2164    ///
2165    /// # Example
2166    /// ```
2167    /// # use google_cloud_sql_v1::client::SqlInstancesService;
2168    /// use google_cloud_sql_v1::Result;
2169    /// async fn sample(
2170    ///    client: &SqlInstancesService
2171    /// ) -> Result<()> {
2172    ///     let response = client.acquire_ssrs_lease()
2173    ///         /* set fields */
2174    ///         .send().await?;
2175    ///     println!("response {:?}", response);
2176    ///     Ok(())
2177    /// }
2178    /// ```
2179    pub fn acquire_ssrs_lease(&self) -> super::builder::sql_instances_service::AcquireSsrsLease {
2180        super::builder::sql_instances_service::AcquireSsrsLease::new(self.inner.clone())
2181    }
2182
2183    /// Release a lease for the setup of SQL Server Reporting Services (SSRS).
2184    ///
2185    /// # Example
2186    /// ```
2187    /// # use google_cloud_sql_v1::client::SqlInstancesService;
2188    /// use google_cloud_sql_v1::Result;
2189    /// async fn sample(
2190    ///    client: &SqlInstancesService
2191    /// ) -> Result<()> {
2192    ///     let response = client.release_ssrs_lease()
2193    ///         /* set fields */
2194    ///         .send().await?;
2195    ///     println!("response {:?}", response);
2196    ///     Ok(())
2197    /// }
2198    /// ```
2199    pub fn release_ssrs_lease(&self) -> super::builder::sql_instances_service::ReleaseSsrsLease {
2200        super::builder::sql_instances_service::ReleaseSsrsLease::new(self.inner.clone())
2201    }
2202
2203    /// Execute MVU Pre-checks
2204    ///
2205    /// # Example
2206    /// ```
2207    /// # use google_cloud_sql_v1::client::SqlInstancesService;
2208    /// use google_cloud_sql_v1::Result;
2209    /// async fn sample(
2210    ///    client: &SqlInstancesService
2211    /// ) -> Result<()> {
2212    ///     let response = client.pre_check_major_version_upgrade()
2213    ///         /* set fields */
2214    ///         .send().await?;
2215    ///     println!("response {:?}", response);
2216    ///     Ok(())
2217    /// }
2218    /// ```
2219    pub fn pre_check_major_version_upgrade(
2220        &self,
2221    ) -> super::builder::sql_instances_service::PreCheckMajorVersionUpgrade {
2222        super::builder::sql_instances_service::PreCheckMajorVersionUpgrade::new(self.inner.clone())
2223    }
2224
2225    /// Point in time restore for an instance managed by Google Cloud Backup and
2226    /// Disaster Recovery.
2227    ///
2228    /// # Example
2229    /// ```
2230    /// # use google_cloud_sql_v1::client::SqlInstancesService;
2231    /// use google_cloud_sql_v1::Result;
2232    /// async fn sample(
2233    ///    client: &SqlInstancesService
2234    /// ) -> Result<()> {
2235    ///     let response = client.point_in_time_restore()
2236    ///         /* set fields */
2237    ///         .send().await?;
2238    ///     println!("response {:?}", response);
2239    ///     Ok(())
2240    /// }
2241    /// ```
2242    pub fn point_in_time_restore(
2243        &self,
2244    ) -> super::builder::sql_instances_service::PointInTimeRestore {
2245        super::builder::sql_instances_service::PointInTimeRestore::new(self.inner.clone())
2246    }
2247}
2248
2249/// Implements a client for the Cloud SQL Admin API.
2250///
2251/// # Example
2252/// ```
2253/// # use google_cloud_sql_v1::client::SqlOperationsService;
2254/// async fn sample(
2255/// ) -> anyhow::Result<()> {
2256///     let client = SqlOperationsService::builder().build().await?;
2257///     let response = client.get()
2258///         /* set fields */
2259///         .send().await?;
2260///     println!("response {:?}", response);
2261///     Ok(())
2262/// }
2263/// ```
2264///
2265/// # Service Description
2266///
2267/// Service to fetch operations for database instances.
2268///
2269/// # Configuration
2270///
2271/// To configure `SqlOperationsService` use the `with_*` methods in the type returned
2272/// by [builder()][SqlOperationsService::builder]. The default configuration should
2273/// work for most applications. Common configuration changes include
2274///
2275/// * [with_endpoint()]: by default this client uses the global default endpoint
2276///   (`https://sqladmin.googleapis.com`). Applications using regional
2277///   endpoints or running in restricted networks (e.g. a network configured
2278///   with [Private Google Access with VPC Service Controls]) may want to
2279///   override this default.
2280/// * [with_credentials()]: by default this client uses
2281///   [Application Default Credentials]. Applications using custom
2282///   authentication may need to override this default.
2283///
2284/// [with_endpoint()]: super::builder::sql_operations_service::ClientBuilder::with_endpoint
2285/// [with_credentials()]: super::builder::sql_operations_service::ClientBuilder::with_credentials
2286/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2287/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2288///
2289/// # Pooling and Cloning
2290///
2291/// `SqlOperationsService` holds a connection pool internally, it is advised to
2292/// create one and reuse it. You do not need to wrap `SqlOperationsService` in
2293/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2294/// already uses an `Arc` internally.
2295#[derive(Clone, Debug)]
2296pub struct SqlOperationsService {
2297    inner: std::sync::Arc<dyn super::stub::dynamic::SqlOperationsService>,
2298}
2299
2300impl SqlOperationsService {
2301    /// Returns a builder for [SqlOperationsService].
2302    ///
2303    /// ```
2304    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2305    /// # use google_cloud_sql_v1::client::SqlOperationsService;
2306    /// let client = SqlOperationsService::builder().build().await?;
2307    /// # Ok(()) }
2308    /// ```
2309    pub fn builder() -> super::builder::sql_operations_service::ClientBuilder {
2310        crate::new_client_builder(super::builder::sql_operations_service::client::Factory)
2311    }
2312
2313    /// Creates a new client from the provided stub.
2314    ///
2315    /// The most common case for calling this function is in tests mocking the
2316    /// client's behavior.
2317    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2318    where
2319        T: super::stub::SqlOperationsService + 'static,
2320    {
2321        Self { inner: stub.into() }
2322    }
2323
2324    pub(crate) async fn new(
2325        config: gaxi::options::ClientConfig,
2326    ) -> crate::ClientBuilderResult<Self> {
2327        let inner = Self::build_inner(config).await?;
2328        Ok(Self { inner })
2329    }
2330
2331    async fn build_inner(
2332        conf: gaxi::options::ClientConfig,
2333    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SqlOperationsService>>
2334    {
2335        if gaxi::options::tracing_enabled(&conf) {
2336            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2337        }
2338        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2339    }
2340
2341    async fn build_transport(
2342        conf: gaxi::options::ClientConfig,
2343    ) -> crate::ClientBuilderResult<impl super::stub::SqlOperationsService> {
2344        super::transport::SqlOperationsService::new(conf).await
2345    }
2346
2347    async fn build_with_tracing(
2348        conf: gaxi::options::ClientConfig,
2349    ) -> crate::ClientBuilderResult<impl super::stub::SqlOperationsService> {
2350        Self::build_transport(conf)
2351            .await
2352            .map(super::tracing::SqlOperationsService::new)
2353    }
2354
2355    /// Retrieves an instance operation that has been performed on an instance.
2356    ///
2357    /// # Example
2358    /// ```
2359    /// # use google_cloud_sql_v1::client::SqlOperationsService;
2360    /// use google_cloud_sql_v1::Result;
2361    /// async fn sample(
2362    ///    client: &SqlOperationsService
2363    /// ) -> Result<()> {
2364    ///     let response = client.get()
2365    ///         /* set fields */
2366    ///         .send().await?;
2367    ///     println!("response {:?}", response);
2368    ///     Ok(())
2369    /// }
2370    /// ```
2371    pub fn get(&self) -> super::builder::sql_operations_service::Get {
2372        super::builder::sql_operations_service::Get::new(self.inner.clone())
2373    }
2374
2375    /// Lists all instance operations that have been performed on the given Cloud
2376    /// SQL instance in the reverse chronological order of the start time.
2377    ///
2378    /// # Example
2379    /// ```
2380    /// # use google_cloud_sql_v1::client::SqlOperationsService;
2381    /// use google_cloud_gax::paginator::ItemPaginator as _;
2382    /// use google_cloud_sql_v1::Result;
2383    /// async fn sample(
2384    ///    client: &SqlOperationsService
2385    /// ) -> Result<()> {
2386    ///     let mut list = client.list()
2387    ///         /* set fields */
2388    ///         .by_item();
2389    ///     while let Some(item) = list.next().await.transpose()? {
2390    ///         println!("{:?}", item);
2391    ///     }
2392    ///     Ok(())
2393    /// }
2394    /// ```
2395    pub fn list(&self) -> super::builder::sql_operations_service::List {
2396        super::builder::sql_operations_service::List::new(self.inner.clone())
2397    }
2398
2399    /// Cancels an instance operation that has been performed on an instance.
2400    ///
2401    /// # Example
2402    /// ```
2403    /// # use google_cloud_sql_v1::client::SqlOperationsService;
2404    /// use google_cloud_sql_v1::Result;
2405    /// async fn sample(
2406    ///    client: &SqlOperationsService
2407    /// ) -> Result<()> {
2408    ///     client.cancel()
2409    ///         /* set fields */
2410    ///         .send().await?;
2411    ///     Ok(())
2412    /// }
2413    /// ```
2414    pub fn cancel(&self) -> super::builder::sql_operations_service::Cancel {
2415        super::builder::sql_operations_service::Cancel::new(self.inner.clone())
2416    }
2417}
2418
2419/// Implements a client for the Cloud SQL Admin API.
2420///
2421/// # Example
2422/// ```
2423/// # use google_cloud_sql_v1::client::SqlSslCertsService;
2424/// async fn sample(
2425/// ) -> anyhow::Result<()> {
2426///     let client = SqlSslCertsService::builder().build().await?;
2427///     let response = client.delete()
2428///         /* set fields */
2429///         .send().await?;
2430///     println!("response {:?}", response);
2431///     Ok(())
2432/// }
2433/// ```
2434///
2435/// # Service Description
2436///
2437/// Service to manage SSL certs for Cloud SQL instances.
2438///
2439/// # Configuration
2440///
2441/// To configure `SqlSslCertsService` use the `with_*` methods in the type returned
2442/// by [builder()][SqlSslCertsService::builder]. The default configuration should
2443/// work for most applications. Common configuration changes include
2444///
2445/// * [with_endpoint()]: by default this client uses the global default endpoint
2446///   (`https://sqladmin.googleapis.com`). Applications using regional
2447///   endpoints or running in restricted networks (e.g. a network configured
2448///   with [Private Google Access with VPC Service Controls]) may want to
2449///   override this default.
2450/// * [with_credentials()]: by default this client uses
2451///   [Application Default Credentials]. Applications using custom
2452///   authentication may need to override this default.
2453///
2454/// [with_endpoint()]: super::builder::sql_ssl_certs_service::ClientBuilder::with_endpoint
2455/// [with_credentials()]: super::builder::sql_ssl_certs_service::ClientBuilder::with_credentials
2456/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2457/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2458///
2459/// # Pooling and Cloning
2460///
2461/// `SqlSslCertsService` holds a connection pool internally, it is advised to
2462/// create one and reuse it. You do not need to wrap `SqlSslCertsService` in
2463/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2464/// already uses an `Arc` internally.
2465#[derive(Clone, Debug)]
2466pub struct SqlSslCertsService {
2467    inner: std::sync::Arc<dyn super::stub::dynamic::SqlSslCertsService>,
2468}
2469
2470impl SqlSslCertsService {
2471    /// Returns a builder for [SqlSslCertsService].
2472    ///
2473    /// ```
2474    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2475    /// # use google_cloud_sql_v1::client::SqlSslCertsService;
2476    /// let client = SqlSslCertsService::builder().build().await?;
2477    /// # Ok(()) }
2478    /// ```
2479    pub fn builder() -> super::builder::sql_ssl_certs_service::ClientBuilder {
2480        crate::new_client_builder(super::builder::sql_ssl_certs_service::client::Factory)
2481    }
2482
2483    /// Creates a new client from the provided stub.
2484    ///
2485    /// The most common case for calling this function is in tests mocking the
2486    /// client's behavior.
2487    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2488    where
2489        T: super::stub::SqlSslCertsService + 'static,
2490    {
2491        Self { inner: stub.into() }
2492    }
2493
2494    pub(crate) async fn new(
2495        config: gaxi::options::ClientConfig,
2496    ) -> crate::ClientBuilderResult<Self> {
2497        let inner = Self::build_inner(config).await?;
2498        Ok(Self { inner })
2499    }
2500
2501    async fn build_inner(
2502        conf: gaxi::options::ClientConfig,
2503    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SqlSslCertsService>>
2504    {
2505        if gaxi::options::tracing_enabled(&conf) {
2506            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2507        }
2508        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2509    }
2510
2511    async fn build_transport(
2512        conf: gaxi::options::ClientConfig,
2513    ) -> crate::ClientBuilderResult<impl super::stub::SqlSslCertsService> {
2514        super::transport::SqlSslCertsService::new(conf).await
2515    }
2516
2517    async fn build_with_tracing(
2518        conf: gaxi::options::ClientConfig,
2519    ) -> crate::ClientBuilderResult<impl super::stub::SqlSslCertsService> {
2520        Self::build_transport(conf)
2521            .await
2522            .map(super::tracing::SqlSslCertsService::new)
2523    }
2524
2525    /// Deletes the SSL certificate. For First Generation instances, the
2526    /// certificate remains valid until the instance is restarted.
2527    ///
2528    /// # Example
2529    /// ```
2530    /// # use google_cloud_sql_v1::client::SqlSslCertsService;
2531    /// use google_cloud_sql_v1::Result;
2532    /// async fn sample(
2533    ///    client: &SqlSslCertsService
2534    /// ) -> Result<()> {
2535    ///     let response = client.delete()
2536    ///         /* set fields */
2537    ///         .send().await?;
2538    ///     println!("response {:?}", response);
2539    ///     Ok(())
2540    /// }
2541    /// ```
2542    pub fn delete(&self) -> super::builder::sql_ssl_certs_service::Delete {
2543        super::builder::sql_ssl_certs_service::Delete::new(self.inner.clone())
2544    }
2545
2546    /// Retrieves a particular SSL certificate.  Does not include the private key
2547    /// (required for usage).  The private key must be saved from the response to
2548    /// initial creation.
2549    ///
2550    /// # Example
2551    /// ```
2552    /// # use google_cloud_sql_v1::client::SqlSslCertsService;
2553    /// use google_cloud_sql_v1::Result;
2554    /// async fn sample(
2555    ///    client: &SqlSslCertsService
2556    /// ) -> Result<()> {
2557    ///     let response = client.get()
2558    ///         /* set fields */
2559    ///         .send().await?;
2560    ///     println!("response {:?}", response);
2561    ///     Ok(())
2562    /// }
2563    /// ```
2564    pub fn get(&self) -> super::builder::sql_ssl_certs_service::Get {
2565        super::builder::sql_ssl_certs_service::Get::new(self.inner.clone())
2566    }
2567
2568    /// Creates an SSL certificate and returns it along with the private key and
2569    /// server certificate authority.  The new certificate will not be usable until
2570    /// the instance is restarted.
2571    ///
2572    /// # Example
2573    /// ```
2574    /// # use google_cloud_sql_v1::client::SqlSslCertsService;
2575    /// use google_cloud_sql_v1::Result;
2576    /// async fn sample(
2577    ///    client: &SqlSslCertsService
2578    /// ) -> Result<()> {
2579    ///     let response = client.insert()
2580    ///         /* set fields */
2581    ///         .send().await?;
2582    ///     println!("response {:?}", response);
2583    ///     Ok(())
2584    /// }
2585    /// ```
2586    pub fn insert(&self) -> super::builder::sql_ssl_certs_service::Insert {
2587        super::builder::sql_ssl_certs_service::Insert::new(self.inner.clone())
2588    }
2589
2590    /// Lists all of the current SSL certificates for the instance.
2591    ///
2592    /// # Example
2593    /// ```
2594    /// # use google_cloud_sql_v1::client::SqlSslCertsService;
2595    /// use google_cloud_sql_v1::Result;
2596    /// async fn sample(
2597    ///    client: &SqlSslCertsService
2598    /// ) -> Result<()> {
2599    ///     let response = client.list()
2600    ///         /* set fields */
2601    ///         .send().await?;
2602    ///     println!("response {:?}", response);
2603    ///     Ok(())
2604    /// }
2605    /// ```
2606    pub fn list(&self) -> super::builder::sql_ssl_certs_service::List {
2607        super::builder::sql_ssl_certs_service::List::new(self.inner.clone())
2608    }
2609}
2610
2611/// Implements a client for the Cloud SQL Admin API.
2612///
2613/// # Example
2614/// ```
2615/// # use google_cloud_sql_v1::client::SqlTiersService;
2616/// async fn sample(
2617/// ) -> anyhow::Result<()> {
2618///     let client = SqlTiersService::builder().build().await?;
2619///     let response = client.list()
2620///         /* set fields */
2621///         .send().await?;
2622///     println!("response {:?}", response);
2623///     Ok(())
2624/// }
2625/// ```
2626///
2627/// # Service Description
2628///
2629/// Service for providing machine types (tiers) for Cloud SQL instances.
2630///
2631/// # Configuration
2632///
2633/// To configure `SqlTiersService` use the `with_*` methods in the type returned
2634/// by [builder()][SqlTiersService::builder]. The default configuration should
2635/// work for most applications. Common configuration changes include
2636///
2637/// * [with_endpoint()]: by default this client uses the global default endpoint
2638///   (`https://sqladmin.googleapis.com`). Applications using regional
2639///   endpoints or running in restricted networks (e.g. a network configured
2640///   with [Private Google Access with VPC Service Controls]) may want to
2641///   override this default.
2642/// * [with_credentials()]: by default this client uses
2643///   [Application Default Credentials]. Applications using custom
2644///   authentication may need to override this default.
2645///
2646/// [with_endpoint()]: super::builder::sql_tiers_service::ClientBuilder::with_endpoint
2647/// [with_credentials()]: super::builder::sql_tiers_service::ClientBuilder::with_credentials
2648/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2649/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2650///
2651/// # Pooling and Cloning
2652///
2653/// `SqlTiersService` holds a connection pool internally, it is advised to
2654/// create one and reuse it. You do not need to wrap `SqlTiersService` in
2655/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2656/// already uses an `Arc` internally.
2657#[derive(Clone, Debug)]
2658pub struct SqlTiersService {
2659    inner: std::sync::Arc<dyn super::stub::dynamic::SqlTiersService>,
2660}
2661
2662impl SqlTiersService {
2663    /// Returns a builder for [SqlTiersService].
2664    ///
2665    /// ```
2666    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2667    /// # use google_cloud_sql_v1::client::SqlTiersService;
2668    /// let client = SqlTiersService::builder().build().await?;
2669    /// # Ok(()) }
2670    /// ```
2671    pub fn builder() -> super::builder::sql_tiers_service::ClientBuilder {
2672        crate::new_client_builder(super::builder::sql_tiers_service::client::Factory)
2673    }
2674
2675    /// Creates a new client from the provided stub.
2676    ///
2677    /// The most common case for calling this function is in tests mocking the
2678    /// client's behavior.
2679    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2680    where
2681        T: super::stub::SqlTiersService + 'static,
2682    {
2683        Self { inner: stub.into() }
2684    }
2685
2686    pub(crate) async fn new(
2687        config: gaxi::options::ClientConfig,
2688    ) -> crate::ClientBuilderResult<Self> {
2689        let inner = Self::build_inner(config).await?;
2690        Ok(Self { inner })
2691    }
2692
2693    async fn build_inner(
2694        conf: gaxi::options::ClientConfig,
2695    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SqlTiersService>> {
2696        if gaxi::options::tracing_enabled(&conf) {
2697            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2698        }
2699        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2700    }
2701
2702    async fn build_transport(
2703        conf: gaxi::options::ClientConfig,
2704    ) -> crate::ClientBuilderResult<impl super::stub::SqlTiersService> {
2705        super::transport::SqlTiersService::new(conf).await
2706    }
2707
2708    async fn build_with_tracing(
2709        conf: gaxi::options::ClientConfig,
2710    ) -> crate::ClientBuilderResult<impl super::stub::SqlTiersService> {
2711        Self::build_transport(conf)
2712            .await
2713            .map(super::tracing::SqlTiersService::new)
2714    }
2715
2716    /// Lists all available machine types (tiers) for Cloud SQL, for example,
2717    /// `db-custom-1-3840`. For more information, see
2718    /// <https://cloud.google.com/sql/pricing>.
2719    ///
2720    /// # Example
2721    /// ```
2722    /// # use google_cloud_sql_v1::client::SqlTiersService;
2723    /// use google_cloud_sql_v1::Result;
2724    /// async fn sample(
2725    ///    client: &SqlTiersService
2726    /// ) -> Result<()> {
2727    ///     let response = client.list()
2728    ///         /* set fields */
2729    ///         .send().await?;
2730    ///     println!("response {:?}", response);
2731    ///     Ok(())
2732    /// }
2733    /// ```
2734    pub fn list(&self) -> super::builder::sql_tiers_service::List {
2735        super::builder::sql_tiers_service::List::new(self.inner.clone())
2736    }
2737}
2738
2739/// Implements a client for the Cloud SQL Admin API.
2740///
2741/// # Example
2742/// ```
2743/// # use google_cloud_sql_v1::client::SqlUsersService;
2744/// async fn sample(
2745/// ) -> anyhow::Result<()> {
2746///     let client = SqlUsersService::builder().build().await?;
2747///     let response = client.delete()
2748///         /* set fields */
2749///         .send().await?;
2750///     println!("response {:?}", response);
2751///     Ok(())
2752/// }
2753/// ```
2754///
2755/// # Service Description
2756///
2757/// Cloud SQL users service.
2758///
2759/// # Configuration
2760///
2761/// To configure `SqlUsersService` use the `with_*` methods in the type returned
2762/// by [builder()][SqlUsersService::builder]. The default configuration should
2763/// work for most applications. Common configuration changes include
2764///
2765/// * [with_endpoint()]: by default this client uses the global default endpoint
2766///   (`https://sqladmin.googleapis.com`). Applications using regional
2767///   endpoints or running in restricted networks (e.g. a network configured
2768///   with [Private Google Access with VPC Service Controls]) may want to
2769///   override this default.
2770/// * [with_credentials()]: by default this client uses
2771///   [Application Default Credentials]. Applications using custom
2772///   authentication may need to override this default.
2773///
2774/// [with_endpoint()]: super::builder::sql_users_service::ClientBuilder::with_endpoint
2775/// [with_credentials()]: super::builder::sql_users_service::ClientBuilder::with_credentials
2776/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2777/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2778///
2779/// # Pooling and Cloning
2780///
2781/// `SqlUsersService` holds a connection pool internally, it is advised to
2782/// create one and reuse it. You do not need to wrap `SqlUsersService` in
2783/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2784/// already uses an `Arc` internally.
2785#[derive(Clone, Debug)]
2786pub struct SqlUsersService {
2787    inner: std::sync::Arc<dyn super::stub::dynamic::SqlUsersService>,
2788}
2789
2790impl SqlUsersService {
2791    /// Returns a builder for [SqlUsersService].
2792    ///
2793    /// ```
2794    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2795    /// # use google_cloud_sql_v1::client::SqlUsersService;
2796    /// let client = SqlUsersService::builder().build().await?;
2797    /// # Ok(()) }
2798    /// ```
2799    pub fn builder() -> super::builder::sql_users_service::ClientBuilder {
2800        crate::new_client_builder(super::builder::sql_users_service::client::Factory)
2801    }
2802
2803    /// Creates a new client from the provided stub.
2804    ///
2805    /// The most common case for calling this function is in tests mocking the
2806    /// client's behavior.
2807    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2808    where
2809        T: super::stub::SqlUsersService + 'static,
2810    {
2811        Self { inner: stub.into() }
2812    }
2813
2814    pub(crate) async fn new(
2815        config: gaxi::options::ClientConfig,
2816    ) -> crate::ClientBuilderResult<Self> {
2817        let inner = Self::build_inner(config).await?;
2818        Ok(Self { inner })
2819    }
2820
2821    async fn build_inner(
2822        conf: gaxi::options::ClientConfig,
2823    ) -> crate::ClientBuilderResult<std::sync::Arc<dyn super::stub::dynamic::SqlUsersService>> {
2824        if gaxi::options::tracing_enabled(&conf) {
2825            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
2826        }
2827        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
2828    }
2829
2830    async fn build_transport(
2831        conf: gaxi::options::ClientConfig,
2832    ) -> crate::ClientBuilderResult<impl super::stub::SqlUsersService> {
2833        super::transport::SqlUsersService::new(conf).await
2834    }
2835
2836    async fn build_with_tracing(
2837        conf: gaxi::options::ClientConfig,
2838    ) -> crate::ClientBuilderResult<impl super::stub::SqlUsersService> {
2839        Self::build_transport(conf)
2840            .await
2841            .map(super::tracing::SqlUsersService::new)
2842    }
2843
2844    /// Deletes a user from a Cloud SQL instance.
2845    ///
2846    /// # Example
2847    /// ```
2848    /// # use google_cloud_sql_v1::client::SqlUsersService;
2849    /// use google_cloud_sql_v1::Result;
2850    /// async fn sample(
2851    ///    client: &SqlUsersService
2852    /// ) -> Result<()> {
2853    ///     let response = client.delete()
2854    ///         /* set fields */
2855    ///         .send().await?;
2856    ///     println!("response {:?}", response);
2857    ///     Ok(())
2858    /// }
2859    /// ```
2860    pub fn delete(&self) -> super::builder::sql_users_service::Delete {
2861        super::builder::sql_users_service::Delete::new(self.inner.clone())
2862    }
2863
2864    /// Retrieves a resource containing information about a user.
2865    ///
2866    /// # Example
2867    /// ```
2868    /// # use google_cloud_sql_v1::client::SqlUsersService;
2869    /// use google_cloud_sql_v1::Result;
2870    /// async fn sample(
2871    ///    client: &SqlUsersService
2872    /// ) -> Result<()> {
2873    ///     let response = client.get()
2874    ///         /* set fields */
2875    ///         .send().await?;
2876    ///     println!("response {:?}", response);
2877    ///     Ok(())
2878    /// }
2879    /// ```
2880    pub fn get(&self) -> super::builder::sql_users_service::Get {
2881        super::builder::sql_users_service::Get::new(self.inner.clone())
2882    }
2883
2884    /// Creates a new user in a Cloud SQL instance.
2885    ///
2886    /// # Example
2887    /// ```
2888    /// # use google_cloud_sql_v1::client::SqlUsersService;
2889    /// use google_cloud_sql_v1::Result;
2890    /// async fn sample(
2891    ///    client: &SqlUsersService
2892    /// ) -> Result<()> {
2893    ///     let response = client.insert()
2894    ///         /* set fields */
2895    ///         .send().await?;
2896    ///     println!("response {:?}", response);
2897    ///     Ok(())
2898    /// }
2899    /// ```
2900    pub fn insert(&self) -> super::builder::sql_users_service::Insert {
2901        super::builder::sql_users_service::Insert::new(self.inner.clone())
2902    }
2903
2904    /// Lists users in the specified Cloud SQL instance.
2905    ///
2906    /// # Example
2907    /// ```
2908    /// # use google_cloud_sql_v1::client::SqlUsersService;
2909    /// use google_cloud_sql_v1::Result;
2910    /// async fn sample(
2911    ///    client: &SqlUsersService
2912    /// ) -> Result<()> {
2913    ///     let response = client.list()
2914    ///         /* set fields */
2915    ///         .send().await?;
2916    ///     println!("response {:?}", response);
2917    ///     Ok(())
2918    /// }
2919    /// ```
2920    pub fn list(&self) -> super::builder::sql_users_service::List {
2921        super::builder::sql_users_service::List::new(self.inner.clone())
2922    }
2923
2924    /// Updates an existing user in a Cloud SQL instance.
2925    ///
2926    /// # Example
2927    /// ```
2928    /// # use google_cloud_sql_v1::client::SqlUsersService;
2929    /// use google_cloud_sql_v1::Result;
2930    /// async fn sample(
2931    ///    client: &SqlUsersService
2932    /// ) -> Result<()> {
2933    ///     let response = client.update()
2934    ///         /* set fields */
2935    ///         .send().await?;
2936    ///     println!("response {:?}", response);
2937    ///     Ok(())
2938    /// }
2939    /// ```
2940    pub fn update(&self) -> super::builder::sql_users_service::Update {
2941        super::builder::sql_users_service::Update::new(self.inner.clone())
2942    }
2943}
2944
2945/// Implements a client for the Cloud SQL Admin API.
2946///
2947/// # Example
2948/// ```
2949/// # use google_cloud_sql_v1::client::SqlWorkloadCapturesService;
2950/// async fn sample(
2951/// ) -> anyhow::Result<()> {
2952///     let client = SqlWorkloadCapturesService::builder().build().await?;
2953///     let response = client.start()
2954///         /* set fields */
2955///         .send().await?;
2956///     println!("response {:?}", response);
2957///     Ok(())
2958/// }
2959/// ```
2960///
2961/// # Service Description
2962///
2963/// Cloud SQL Workload Captures service.
2964///
2965/// # Configuration
2966///
2967/// To configure `SqlWorkloadCapturesService` use the `with_*` methods in the type returned
2968/// by [builder()][SqlWorkloadCapturesService::builder]. The default configuration should
2969/// work for most applications. Common configuration changes include
2970///
2971/// * [with_endpoint()]: by default this client uses the global default endpoint
2972///   (`https://sqladmin.googleapis.com`). Applications using regional
2973///   endpoints or running in restricted networks (e.g. a network configured
2974///   with [Private Google Access with VPC Service Controls]) may want to
2975///   override this default.
2976/// * [with_credentials()]: by default this client uses
2977///   [Application Default Credentials]. Applications using custom
2978///   authentication may need to override this default.
2979///
2980/// [with_endpoint()]: super::builder::sql_workload_captures_service::ClientBuilder::with_endpoint
2981/// [with_credentials()]: super::builder::sql_workload_captures_service::ClientBuilder::with_credentials
2982/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2983/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2984///
2985/// # Pooling and Cloning
2986///
2987/// `SqlWorkloadCapturesService` holds a connection pool internally, it is advised to
2988/// create one and reuse it. You do not need to wrap `SqlWorkloadCapturesService` in
2989/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2990/// already uses an `Arc` internally.
2991#[derive(Clone, Debug)]
2992pub struct SqlWorkloadCapturesService {
2993    inner: std::sync::Arc<dyn super::stub::dynamic::SqlWorkloadCapturesService>,
2994}
2995
2996impl SqlWorkloadCapturesService {
2997    /// Returns a builder for [SqlWorkloadCapturesService].
2998    ///
2999    /// ```
3000    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
3001    /// # use google_cloud_sql_v1::client::SqlWorkloadCapturesService;
3002    /// let client = SqlWorkloadCapturesService::builder().build().await?;
3003    /// # Ok(()) }
3004    /// ```
3005    pub fn builder() -> super::builder::sql_workload_captures_service::ClientBuilder {
3006        crate::new_client_builder(super::builder::sql_workload_captures_service::client::Factory)
3007    }
3008
3009    /// Creates a new client from the provided stub.
3010    ///
3011    /// The most common case for calling this function is in tests mocking the
3012    /// client's behavior.
3013    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
3014    where
3015        T: super::stub::SqlWorkloadCapturesService + 'static,
3016    {
3017        Self { inner: stub.into() }
3018    }
3019
3020    pub(crate) async fn new(
3021        config: gaxi::options::ClientConfig,
3022    ) -> crate::ClientBuilderResult<Self> {
3023        let inner = Self::build_inner(config).await?;
3024        Ok(Self { inner })
3025    }
3026
3027    async fn build_inner(
3028        conf: gaxi::options::ClientConfig,
3029    ) -> crate::ClientBuilderResult<
3030        std::sync::Arc<dyn super::stub::dynamic::SqlWorkloadCapturesService>,
3031    > {
3032        if gaxi::options::tracing_enabled(&conf) {
3033            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
3034        }
3035        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
3036    }
3037
3038    async fn build_transport(
3039        conf: gaxi::options::ClientConfig,
3040    ) -> crate::ClientBuilderResult<impl super::stub::SqlWorkloadCapturesService> {
3041        super::transport::SqlWorkloadCapturesService::new(conf).await
3042    }
3043
3044    async fn build_with_tracing(
3045        conf: gaxi::options::ClientConfig,
3046    ) -> crate::ClientBuilderResult<impl super::stub::SqlWorkloadCapturesService> {
3047        Self::build_transport(conf)
3048            .await
3049            .map(super::tracing::SqlWorkloadCapturesService::new)
3050    }
3051
3052    /// Starts capturing the SQL queries, transactions, and other operations
3053    /// executed on the primary instance. This traffic is securely stored and forms
3054    /// a "captured workload". This workload can be replayed later on a different
3055    /// instance to safely test performance impacts, database upgrades,
3056    /// configuration changes etc. before applying them to production.
3057    ///
3058    /// # Example
3059    /// ```
3060    /// # use google_cloud_sql_v1::client::SqlWorkloadCapturesService;
3061    /// use google_cloud_sql_v1::Result;
3062    /// async fn sample(
3063    ///    client: &SqlWorkloadCapturesService
3064    /// ) -> Result<()> {
3065    ///     let response = client.start()
3066    ///         /* set fields */
3067    ///         .send().await?;
3068    ///     println!("response {:?}", response);
3069    ///     Ok(())
3070    /// }
3071    /// ```
3072    pub fn start(&self) -> super::builder::sql_workload_captures_service::Start {
3073        super::builder::sql_workload_captures_service::Start::new(self.inner.clone())
3074    }
3075
3076    /// Stops capturing the query traffic and related operations executed on the
3077    /// primary instance.
3078    ///
3079    /// # Example
3080    /// ```
3081    /// # use google_cloud_sql_v1::client::SqlWorkloadCapturesService;
3082    /// use google_cloud_sql_v1::Result;
3083    /// async fn sample(
3084    ///    client: &SqlWorkloadCapturesService
3085    /// ) -> Result<()> {
3086    ///     let response = client.stop()
3087    ///         /* set fields */
3088    ///         .send().await?;
3089    ///     println!("response {:?}", response);
3090    ///     Ok(())
3091    /// }
3092    /// ```
3093    pub fn stop(&self) -> super::builder::sql_workload_captures_service::Stop {
3094        super::builder::sql_workload_captures_service::Stop::new(self.inner.clone())
3095    }
3096
3097    /// Starts executing a captured workload on a separate Cloud SQL instance
3098    /// provisioned for workload replay. This target instance simulates the
3099    /// production environment without affecting the primary instance.
3100    ///
3101    /// # Example
3102    /// ```
3103    /// # use google_cloud_sql_v1::client::SqlWorkloadCapturesService;
3104    /// use google_cloud_sql_v1::Result;
3105    /// async fn sample(
3106    ///    client: &SqlWorkloadCapturesService
3107    /// ) -> Result<()> {
3108    ///     let response = client.start_replay()
3109    ///         /* set fields */
3110    ///         .send().await?;
3111    ///     println!("response {:?}", response);
3112    ///     Ok(())
3113    /// }
3114    /// ```
3115    pub fn start_replay(&self) -> super::builder::sql_workload_captures_service::StartReplay {
3116        super::builder::sql_workload_captures_service::StartReplay::new(self.inner.clone())
3117    }
3118
3119    /// Stops an active workload replay on the target Cloud SQL replay instance.
3120    ///
3121    /// # Example
3122    /// ```
3123    /// # use google_cloud_sql_v1::client::SqlWorkloadCapturesService;
3124    /// use google_cloud_sql_v1::Result;
3125    /// async fn sample(
3126    ///    client: &SqlWorkloadCapturesService
3127    /// ) -> Result<()> {
3128    ///     let response = client.stop_replay()
3129    ///         /* set fields */
3130    ///         .send().await?;
3131    ///     println!("response {:?}", response);
3132    ///     Ok(())
3133    /// }
3134    /// ```
3135    pub fn stop_replay(&self) -> super::builder::sql_workload_captures_service::StopReplay {
3136        super::builder::sql_workload_captures_service::StopReplay::new(self.inner.clone())
3137    }
3138
3139    /// Lists all captured workloads associated with the instance.
3140    ///
3141    /// # Example
3142    /// ```
3143    /// # use google_cloud_sql_v1::client::SqlWorkloadCapturesService;
3144    /// use google_cloud_sql_v1::Result;
3145    /// async fn sample(
3146    ///    client: &SqlWorkloadCapturesService
3147    /// ) -> Result<()> {
3148    ///     let response = client.list()
3149    ///         /* set fields */
3150    ///         .send().await?;
3151    ///     println!("response {:?}", response);
3152    ///     Ok(())
3153    /// }
3154    /// ```
3155    pub fn list(&self) -> super::builder::sql_workload_captures_service::List {
3156        super::builder::sql_workload_captures_service::List::new(self.inner.clone())
3157    }
3158}