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(
25/// ) -> anyhow::Result<()> {
26///     let client = SqlBackupRunsService::builder().build().await?;
27///     let response = client.delete()
28///         /* set fields */
29///         .send().await?;
30///     println!("response {:?}", response);
31///     Ok(())
32/// }
33/// ```
34///
35/// # Service Description
36///
37/// Service for managing database backups.
38///
39/// # Configuration
40///
41/// To configure `SqlBackupRunsService` use the `with_*` methods in the type returned
42/// by [builder()][SqlBackupRunsService::builder]. The default configuration should
43/// work for most applications. Common configuration changes include
44///
45/// * [with_endpoint()]: by default this client uses the global default endpoint
46///   (`https://sqladmin.googleapis.com`). Applications using regional
47///   endpoints or running in restricted networks (e.g. a network configured
48//    with [Private Google Access with VPC Service Controls]) may want to
49///   override this default.
50/// * [with_credentials()]: by default this client uses
51///   [Application Default Credentials]. Applications using custom
52///   authentication may need to override this default.
53///
54/// [with_endpoint()]: super::builder::sql_backup_runs_service::ClientBuilder::with_endpoint
55/// [with_credentials()]: super::builder::sql_backup_runs_service::ClientBuilder::with_credentials
56/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
57/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
58///
59/// # Pooling and Cloning
60///
61/// `SqlBackupRunsService` holds a connection pool internally, it is advised to
62/// create one and reuse it. You do not need to wrap `SqlBackupRunsService` in
63/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
64/// already uses an `Arc` internally.
65#[derive(Clone, Debug)]
66pub struct SqlBackupRunsService {
67    inner: std::sync::Arc<dyn super::stub::dynamic::SqlBackupRunsService>,
68}
69
70impl SqlBackupRunsService {
71    /// Returns a builder for [SqlBackupRunsService].
72    ///
73    /// ```
74    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
75    /// # use google_cloud_sql_v1::client::SqlBackupRunsService;
76    /// let client = SqlBackupRunsService::builder().build().await?;
77    /// # Ok(()) }
78    /// ```
79    pub fn builder() -> super::builder::sql_backup_runs_service::ClientBuilder {
80        crate::new_client_builder(super::builder::sql_backup_runs_service::client::Factory)
81    }
82
83    /// Creates a new client from the provided stub.
84    ///
85    /// The most common case for calling this function is in tests mocking the
86    /// client's behavior.
87    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
88    where
89        T: super::stub::SqlBackupRunsService + 'static,
90    {
91        Self { inner: stub.into() }
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(
218///    project_id: &str,
219/// ) -> anyhow::Result<()> {
220///     let client = SqlBackupsService::builder().build().await?;
221///     let mut list = client.list_backups()
222///         .set_parent(format!("projects/{project_id}"))
223///         .by_item();
224///     while let Some(item) = list.next().await.transpose()? {
225///         println!("{:?}", item);
226///     }
227///     Ok(())
228/// }
229/// ```
230///
231/// # Service Description
232///
233///
234/// # Configuration
235///
236/// To configure `SqlBackupsService` use the `with_*` methods in the type returned
237/// by [builder()][SqlBackupsService::builder]. The default configuration should
238/// work for most applications. Common configuration changes include
239///
240/// * [with_endpoint()]: by default this client uses the global default endpoint
241///   (`https://sqladmin.googleapis.com`). Applications using regional
242///   endpoints or running in restricted networks (e.g. a network configured
243//    with [Private Google Access with VPC Service Controls]) may want to
244///   override this default.
245/// * [with_credentials()]: by default this client uses
246///   [Application Default Credentials]. Applications using custom
247///   authentication may need to override this default.
248///
249/// [with_endpoint()]: super::builder::sql_backups_service::ClientBuilder::with_endpoint
250/// [with_credentials()]: super::builder::sql_backups_service::ClientBuilder::with_credentials
251/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
252/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
253///
254/// # Pooling and Cloning
255///
256/// `SqlBackupsService` holds a connection pool internally, it is advised to
257/// create one and reuse it. You do not need to wrap `SqlBackupsService` in
258/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
259/// already uses an `Arc` internally.
260#[derive(Clone, Debug)]
261pub struct SqlBackupsService {
262    inner: std::sync::Arc<dyn super::stub::dynamic::SqlBackupsService>,
263}
264
265impl SqlBackupsService {
266    /// Returns a builder for [SqlBackupsService].
267    ///
268    /// ```
269    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
270    /// # use google_cloud_sql_v1::client::SqlBackupsService;
271    /// let client = SqlBackupsService::builder().build().await?;
272    /// # Ok(()) }
273    /// ```
274    pub fn builder() -> super::builder::sql_backups_service::ClientBuilder {
275        crate::new_client_builder(super::builder::sql_backups_service::client::Factory)
276    }
277
278    /// Creates a new client from the provided stub.
279    ///
280    /// The most common case for calling this function is in tests mocking the
281    /// client's behavior.
282    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
283    where
284        T: super::stub::SqlBackupsService + 'static,
285    {
286        Self { inner: stub.into() }
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, project_id: &str, backup_id: &str
349    /// ) -> Result<()> {
350    ///     let response = client.get_backup()
351    ///         .set_name(format!("projects/{project_id}/backups/{backup_id}"))
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, project_id: &str
370    /// ) -> Result<()> {
371    ///     let mut list = client.list_backups()
372    ///         .set_parent(format!("projects/{project_id}"))
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, project_id: &str, backup_id: &str
413    /// ) -> Result<()> {
414    ///     let response = client.delete_backup()
415    ///         .set_name(format!("projects/{project_id}/backups/{backup_id}"))
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(
432/// ) -> anyhow::Result<()> {
433///     let client = SqlConnectService::builder().build().await?;
434///     let response = client.get_connect_settings()
435///         /* set fields */
436///         .send().await?;
437///     println!("response {:?}", response);
438///     Ok(())
439/// }
440/// ```
441///
442/// # Service Description
443///
444/// Cloud SQL connect service.
445///
446/// # Configuration
447///
448/// To configure `SqlConnectService` use the `with_*` methods in the type returned
449/// by [builder()][SqlConnectService::builder]. The default configuration should
450/// work for most applications. Common configuration changes include
451///
452/// * [with_endpoint()]: by default this client uses the global default endpoint
453///   (`https://sqladmin.googleapis.com`). Applications using regional
454///   endpoints or running in restricted networks (e.g. a network configured
455//    with [Private Google Access with VPC Service Controls]) may want to
456///   override this default.
457/// * [with_credentials()]: by default this client uses
458///   [Application Default Credentials]. Applications using custom
459///   authentication may need to override this default.
460///
461/// [with_endpoint()]: super::builder::sql_connect_service::ClientBuilder::with_endpoint
462/// [with_credentials()]: super::builder::sql_connect_service::ClientBuilder::with_credentials
463/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
464/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
465///
466/// # Pooling and Cloning
467///
468/// `SqlConnectService` holds a connection pool internally, it is advised to
469/// create one and reuse it. You do not need to wrap `SqlConnectService` in
470/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
471/// already uses an `Arc` internally.
472#[derive(Clone, Debug)]
473pub struct SqlConnectService {
474    inner: std::sync::Arc<dyn super::stub::dynamic::SqlConnectService>,
475}
476
477impl SqlConnectService {
478    /// Returns a builder for [SqlConnectService].
479    ///
480    /// ```
481    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
482    /// # use google_cloud_sql_v1::client::SqlConnectService;
483    /// let client = SqlConnectService::builder().build().await?;
484    /// # Ok(()) }
485    /// ```
486    pub fn builder() -> super::builder::sql_connect_service::ClientBuilder {
487        crate::new_client_builder(super::builder::sql_connect_service::client::Factory)
488    }
489
490    /// Creates a new client from the provided stub.
491    ///
492    /// The most common case for calling this function is in tests mocking the
493    /// client's behavior.
494    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
495    where
496        T: super::stub::SqlConnectService + 'static,
497    {
498        Self { inner: stub.into() }
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(
584/// ) -> anyhow::Result<()> {
585///     let client = SqlDatabasesService::builder().build().await?;
586///     let response = client.delete()
587///         /* set fields */
588///         .send().await?;
589///     println!("response {:?}", response);
590///     Ok(())
591/// }
592/// ```
593///
594/// # Service Description
595///
596/// Service to manage databases.
597///
598/// # Configuration
599///
600/// To configure `SqlDatabasesService` use the `with_*` methods in the type returned
601/// by [builder()][SqlDatabasesService::builder]. The default configuration should
602/// work for most applications. Common configuration changes include
603///
604/// * [with_endpoint()]: by default this client uses the global default endpoint
605///   (`https://sqladmin.googleapis.com`). Applications using regional
606///   endpoints or running in restricted networks (e.g. a network configured
607//    with [Private Google Access with VPC Service Controls]) may want to
608///   override this default.
609/// * [with_credentials()]: by default this client uses
610///   [Application Default Credentials]. Applications using custom
611///   authentication may need to override this default.
612///
613/// [with_endpoint()]: super::builder::sql_databases_service::ClientBuilder::with_endpoint
614/// [with_credentials()]: super::builder::sql_databases_service::ClientBuilder::with_credentials
615/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
616/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
617///
618/// # Pooling and Cloning
619///
620/// `SqlDatabasesService` holds a connection pool internally, it is advised to
621/// create one and reuse it. You do not need to wrap `SqlDatabasesService` in
622/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
623/// already uses an `Arc` internally.
624#[derive(Clone, Debug)]
625pub struct SqlDatabasesService {
626    inner: std::sync::Arc<dyn super::stub::dynamic::SqlDatabasesService>,
627}
628
629impl SqlDatabasesService {
630    /// Returns a builder for [SqlDatabasesService].
631    ///
632    /// ```
633    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
634    /// # use google_cloud_sql_v1::client::SqlDatabasesService;
635    /// let client = SqlDatabasesService::builder().build().await?;
636    /// # Ok(()) }
637    /// ```
638    pub fn builder() -> super::builder::sql_databases_service::ClientBuilder {
639        crate::new_client_builder(super::builder::sql_databases_service::client::Factory)
640    }
641
642    /// Creates a new client from the provided stub.
643    ///
644    /// The most common case for calling this function is in tests mocking the
645    /// client's behavior.
646    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
647    where
648        T: super::stub::SqlDatabasesService + 'static,
649    {
650        Self { inner: stub.into() }
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(
817/// ) -> anyhow::Result<()> {
818///     let client = SqlFlagsService::builder().build().await?;
819///     let response = client.list()
820///         /* set fields */
821///         .send().await?;
822///     println!("response {:?}", response);
823///     Ok(())
824/// }
825/// ```
826///
827/// # Service Description
828///
829/// Service to manage database flags for Cloud SQL instances.
830///
831/// # Configuration
832///
833/// To configure `SqlFlagsService` use the `with_*` methods in the type returned
834/// by [builder()][SqlFlagsService::builder]. The default configuration should
835/// work for most applications. Common configuration changes include
836///
837/// * [with_endpoint()]: by default this client uses the global default endpoint
838///   (`https://sqladmin.googleapis.com`). Applications using regional
839///   endpoints or running in restricted networks (e.g. a network configured
840//    with [Private Google Access with VPC Service Controls]) may want to
841///   override this default.
842/// * [with_credentials()]: by default this client uses
843///   [Application Default Credentials]. Applications using custom
844///   authentication may need to override this default.
845///
846/// [with_endpoint()]: super::builder::sql_flags_service::ClientBuilder::with_endpoint
847/// [with_credentials()]: super::builder::sql_flags_service::ClientBuilder::with_credentials
848/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
849/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
850///
851/// # Pooling and Cloning
852///
853/// `SqlFlagsService` holds a connection pool internally, it is advised to
854/// create one and reuse it. You do not need to wrap `SqlFlagsService` in
855/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
856/// already uses an `Arc` internally.
857#[derive(Clone, Debug)]
858pub struct SqlFlagsService {
859    inner: std::sync::Arc<dyn super::stub::dynamic::SqlFlagsService>,
860}
861
862impl SqlFlagsService {
863    /// Returns a builder for [SqlFlagsService].
864    ///
865    /// ```
866    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
867    /// # use google_cloud_sql_v1::client::SqlFlagsService;
868    /// let client = SqlFlagsService::builder().build().await?;
869    /// # Ok(()) }
870    /// ```
871    pub fn builder() -> super::builder::sql_flags_service::ClientBuilder {
872        crate::new_client_builder(super::builder::sql_flags_service::client::Factory)
873    }
874
875    /// Creates a new client from the provided stub.
876    ///
877    /// The most common case for calling this function is in tests mocking the
878    /// client's behavior.
879    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
880    where
881        T: super::stub::SqlFlagsService + 'static,
882    {
883        Self { inner: stub.into() }
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(
943/// ) -> anyhow::Result<()> {
944///     let client = SqlInstancesService::builder().build().await?;
945///     let response = client.add_server_ca()
946///         /* set fields */
947///         .send().await?;
948///     println!("response {:?}", response);
949///     Ok(())
950/// }
951/// ```
952///
953/// # Service Description
954///
955///
956/// # Configuration
957///
958/// To configure `SqlInstancesService` use the `with_*` methods in the type returned
959/// by [builder()][SqlInstancesService::builder]. The default configuration should
960/// work for most applications. Common configuration changes include
961///
962/// * [with_endpoint()]: by default this client uses the global default endpoint
963///   (`https://sqladmin.googleapis.com`). Applications using regional
964///   endpoints or running in restricted networks (e.g. a network configured
965//    with [Private Google Access with VPC Service Controls]) may want to
966///   override this default.
967/// * [with_credentials()]: by default this client uses
968///   [Application Default Credentials]. Applications using custom
969///   authentication may need to override this default.
970///
971/// [with_endpoint()]: super::builder::sql_instances_service::ClientBuilder::with_endpoint
972/// [with_credentials()]: super::builder::sql_instances_service::ClientBuilder::with_credentials
973/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
974/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
975///
976/// # Pooling and Cloning
977///
978/// `SqlInstancesService` holds a connection pool internally, it is advised to
979/// create one and reuse it. You do not need to wrap `SqlInstancesService` in
980/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
981/// already uses an `Arc` internally.
982#[derive(Clone, Debug)]
983pub struct SqlInstancesService {
984    inner: std::sync::Arc<dyn super::stub::dynamic::SqlInstancesService>,
985}
986
987impl SqlInstancesService {
988    /// Returns a builder for [SqlInstancesService].
989    ///
990    /// ```
991    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
992    /// # use google_cloud_sql_v1::client::SqlInstancesService;
993    /// let client = SqlInstancesService::builder().build().await?;
994    /// # Ok(()) }
995    /// ```
996    pub fn builder() -> super::builder::sql_instances_service::ClientBuilder {
997        crate::new_client_builder(super::builder::sql_instances_service::client::Factory)
998    }
999
1000    /// Creates a new client from the provided stub.
1001    ///
1002    /// The most common case for calling this function is in tests mocking the
1003    /// client's behavior.
1004    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
1005    where
1006        T: super::stub::SqlInstancesService + 'static,
1007    {
1008        Self { inner: stub.into() }
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(
1993/// ) -> anyhow::Result<()> {
1994///     let client = SqlOperationsService::builder().build().await?;
1995///     let response = client.get()
1996///         /* set fields */
1997///         .send().await?;
1998///     println!("response {:?}", response);
1999///     Ok(())
2000/// }
2001/// ```
2002///
2003/// # Service Description
2004///
2005/// Service to fetch operations for database instances.
2006///
2007/// # Configuration
2008///
2009/// To configure `SqlOperationsService` use the `with_*` methods in the type returned
2010/// by [builder()][SqlOperationsService::builder]. The default configuration should
2011/// work for most applications. Common configuration changes include
2012///
2013/// * [with_endpoint()]: by default this client uses the global default endpoint
2014///   (`https://sqladmin.googleapis.com`). Applications using regional
2015///   endpoints or running in restricted networks (e.g. a network configured
2016//    with [Private Google Access with VPC Service Controls]) may want to
2017///   override this default.
2018/// * [with_credentials()]: by default this client uses
2019///   [Application Default Credentials]. Applications using custom
2020///   authentication may need to override this default.
2021///
2022/// [with_endpoint()]: super::builder::sql_operations_service::ClientBuilder::with_endpoint
2023/// [with_credentials()]: super::builder::sql_operations_service::ClientBuilder::with_credentials
2024/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2025/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2026///
2027/// # Pooling and Cloning
2028///
2029/// `SqlOperationsService` holds a connection pool internally, it is advised to
2030/// create one and reuse it. You do not need to wrap `SqlOperationsService` in
2031/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2032/// already uses an `Arc` internally.
2033#[derive(Clone, Debug)]
2034pub struct SqlOperationsService {
2035    inner: std::sync::Arc<dyn super::stub::dynamic::SqlOperationsService>,
2036}
2037
2038impl SqlOperationsService {
2039    /// Returns a builder for [SqlOperationsService].
2040    ///
2041    /// ```
2042    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2043    /// # use google_cloud_sql_v1::client::SqlOperationsService;
2044    /// let client = SqlOperationsService::builder().build().await?;
2045    /// # Ok(()) }
2046    /// ```
2047    pub fn builder() -> super::builder::sql_operations_service::ClientBuilder {
2048        crate::new_client_builder(super::builder::sql_operations_service::client::Factory)
2049    }
2050
2051    /// Creates a new client from the provided stub.
2052    ///
2053    /// The most common case for calling this function is in tests mocking the
2054    /// client's behavior.
2055    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2056    where
2057        T: super::stub::SqlOperationsService + 'static,
2058    {
2059        Self { inner: stub.into() }
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(
2163/// ) -> anyhow::Result<()> {
2164///     let client = SqlSslCertsService::builder().build().await?;
2165///     let response = client.delete()
2166///         /* set fields */
2167///         .send().await?;
2168///     println!("response {:?}", response);
2169///     Ok(())
2170/// }
2171/// ```
2172///
2173/// # Service Description
2174///
2175/// Service to manage SSL certs for Cloud SQL instances.
2176///
2177/// # Configuration
2178///
2179/// To configure `SqlSslCertsService` use the `with_*` methods in the type returned
2180/// by [builder()][SqlSslCertsService::builder]. The default configuration should
2181/// work for most applications. Common configuration changes include
2182///
2183/// * [with_endpoint()]: by default this client uses the global default endpoint
2184///   (`https://sqladmin.googleapis.com`). Applications using regional
2185///   endpoints or running in restricted networks (e.g. a network configured
2186//    with [Private Google Access with VPC Service Controls]) may want to
2187///   override this default.
2188/// * [with_credentials()]: by default this client uses
2189///   [Application Default Credentials]. Applications using custom
2190///   authentication may need to override this default.
2191///
2192/// [with_endpoint()]: super::builder::sql_ssl_certs_service::ClientBuilder::with_endpoint
2193/// [with_credentials()]: super::builder::sql_ssl_certs_service::ClientBuilder::with_credentials
2194/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2195/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2196///
2197/// # Pooling and Cloning
2198///
2199/// `SqlSslCertsService` holds a connection pool internally, it is advised to
2200/// create one and reuse it. You do not need to wrap `SqlSslCertsService` in
2201/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2202/// already uses an `Arc` internally.
2203#[derive(Clone, Debug)]
2204pub struct SqlSslCertsService {
2205    inner: std::sync::Arc<dyn super::stub::dynamic::SqlSslCertsService>,
2206}
2207
2208impl SqlSslCertsService {
2209    /// Returns a builder for [SqlSslCertsService].
2210    ///
2211    /// ```
2212    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2213    /// # use google_cloud_sql_v1::client::SqlSslCertsService;
2214    /// let client = SqlSslCertsService::builder().build().await?;
2215    /// # Ok(()) }
2216    /// ```
2217    pub fn builder() -> super::builder::sql_ssl_certs_service::ClientBuilder {
2218        crate::new_client_builder(super::builder::sql_ssl_certs_service::client::Factory)
2219    }
2220
2221    /// Creates a new client from the provided stub.
2222    ///
2223    /// The most common case for calling this function is in tests mocking the
2224    /// client's behavior.
2225    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2226    where
2227        T: super::stub::SqlSslCertsService + 'static,
2228    {
2229        Self { inner: stub.into() }
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(
2355/// ) -> anyhow::Result<()> {
2356///     let client = SqlTiersService::builder().build().await?;
2357///     let response = client.list()
2358///         /* set fields */
2359///         .send().await?;
2360///     println!("response {:?}", response);
2361///     Ok(())
2362/// }
2363/// ```
2364///
2365/// # Service Description
2366///
2367/// Service for providing machine types (tiers) for Cloud SQL instances.
2368///
2369/// # Configuration
2370///
2371/// To configure `SqlTiersService` use the `with_*` methods in the type returned
2372/// by [builder()][SqlTiersService::builder]. The default configuration should
2373/// work for most applications. Common configuration changes include
2374///
2375/// * [with_endpoint()]: by default this client uses the global default endpoint
2376///   (`https://sqladmin.googleapis.com`). Applications using regional
2377///   endpoints or running in restricted networks (e.g. a network configured
2378//    with [Private Google Access with VPC Service Controls]) may want to
2379///   override this default.
2380/// * [with_credentials()]: by default this client uses
2381///   [Application Default Credentials]. Applications using custom
2382///   authentication may need to override this default.
2383///
2384/// [with_endpoint()]: super::builder::sql_tiers_service::ClientBuilder::with_endpoint
2385/// [with_credentials()]: super::builder::sql_tiers_service::ClientBuilder::with_credentials
2386/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2387/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2388///
2389/// # Pooling and Cloning
2390///
2391/// `SqlTiersService` holds a connection pool internally, it is advised to
2392/// create one and reuse it. You do not need to wrap `SqlTiersService` in
2393/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2394/// already uses an `Arc` internally.
2395#[derive(Clone, Debug)]
2396pub struct SqlTiersService {
2397    inner: std::sync::Arc<dyn super::stub::dynamic::SqlTiersService>,
2398}
2399
2400impl SqlTiersService {
2401    /// Returns a builder for [SqlTiersService].
2402    ///
2403    /// ```
2404    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2405    /// # use google_cloud_sql_v1::client::SqlTiersService;
2406    /// let client = SqlTiersService::builder().build().await?;
2407    /// # Ok(()) }
2408    /// ```
2409    pub fn builder() -> super::builder::sql_tiers_service::ClientBuilder {
2410        crate::new_client_builder(super::builder::sql_tiers_service::client::Factory)
2411    }
2412
2413    /// Creates a new client from the provided stub.
2414    ///
2415    /// The most common case for calling this function is in tests mocking the
2416    /// client's behavior.
2417    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2418    where
2419        T: super::stub::SqlTiersService + 'static,
2420    {
2421        Self { inner: stub.into() }
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(
2483/// ) -> anyhow::Result<()> {
2484///     let client = SqlUsersService::builder().build().await?;
2485///     let response = client.delete()
2486///         /* set fields */
2487///         .send().await?;
2488///     println!("response {:?}", response);
2489///     Ok(())
2490/// }
2491/// ```
2492///
2493/// # Service Description
2494///
2495/// Cloud SQL users service.
2496///
2497/// # Configuration
2498///
2499/// To configure `SqlUsersService` use the `with_*` methods in the type returned
2500/// by [builder()][SqlUsersService::builder]. The default configuration should
2501/// work for most applications. Common configuration changes include
2502///
2503/// * [with_endpoint()]: by default this client uses the global default endpoint
2504///   (`https://sqladmin.googleapis.com`). Applications using regional
2505///   endpoints or running in restricted networks (e.g. a network configured
2506//    with [Private Google Access with VPC Service Controls]) may want to
2507///   override this default.
2508/// * [with_credentials()]: by default this client uses
2509///   [Application Default Credentials]. Applications using custom
2510///   authentication may need to override this default.
2511///
2512/// [with_endpoint()]: super::builder::sql_users_service::ClientBuilder::with_endpoint
2513/// [with_credentials()]: super::builder::sql_users_service::ClientBuilder::with_credentials
2514/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
2515/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
2516///
2517/// # Pooling and Cloning
2518///
2519/// `SqlUsersService` holds a connection pool internally, it is advised to
2520/// create one and reuse it. You do not need to wrap `SqlUsersService` in
2521/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
2522/// already uses an `Arc` internally.
2523#[derive(Clone, Debug)]
2524pub struct SqlUsersService {
2525    inner: std::sync::Arc<dyn super::stub::dynamic::SqlUsersService>,
2526}
2527
2528impl SqlUsersService {
2529    /// Returns a builder for [SqlUsersService].
2530    ///
2531    /// ```
2532    /// # async fn sample() -> google_cloud_gax::client_builder::Result<()> {
2533    /// # use google_cloud_sql_v1::client::SqlUsersService;
2534    /// let client = SqlUsersService::builder().build().await?;
2535    /// # Ok(()) }
2536    /// ```
2537    pub fn builder() -> super::builder::sql_users_service::ClientBuilder {
2538        crate::new_client_builder(super::builder::sql_users_service::client::Factory)
2539    }
2540
2541    /// Creates a new client from the provided stub.
2542    ///
2543    /// The most common case for calling this function is in tests mocking the
2544    /// client's behavior.
2545    pub fn from_stub<T>(stub: impl Into<std::sync::Arc<T>>) -> Self
2546    where
2547        T: super::stub::SqlUsersService + 'static,
2548    {
2549        Self { inner: stub.into() }
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}