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