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/// # async fn sample() -> gax::client_builder::Result<()> {
24/// # use google_cloud_sql_v1::client::SqlBackupRunsService;
25/// let client = SqlBackupRunsService::builder().build().await?;
26/// // use `client` to make requests to the Cloud SQL Admin API.
27/// # Ok(()) }
28/// ```
29///
30/// # Service Description
31///
32/// Service for managing database backups.
33///
34/// # Configuration
35///
36/// To configure `SqlBackupRunsService` use the `with_*` methods in the type returned
37/// by [builder()][SqlBackupRunsService::builder]. The default configuration should
38/// work for most applications. Common configuration changes include
39///
40/// * [with_endpoint()]: by default this client uses the global default endpoint
41///   (`https://sqladmin.googleapis.com`). Applications using regional
42///   endpoints or running in restricted networks (e.g. a network configured
43//    with [Private Google Access with VPC Service Controls]) may want to
44///   override this default.
45/// * [with_credentials()]: by default this client uses
46///   [Application Default Credentials]. Applications using custom
47///   authentication may need to override this default.
48///
49/// [with_endpoint()]: super::builder::sql_backup_runs_service::ClientBuilder::with_endpoint
50/// [with_credentials()]: super::builder::sql_backup_runs_service::ClientBuilder::credentials
51/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
52/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
53///
54/// # Pooling and Cloning
55///
56/// `SqlBackupRunsService` holds a connection pool internally, it is advised to
57/// create one and the reuse it.  You do not need to wrap `SqlBackupRunsService` in
58/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
59/// already uses an `Arc` internally.
60#[derive(Clone, Debug)]
61pub struct SqlBackupRunsService {
62    inner: std::sync::Arc<dyn super::stub::dynamic::SqlBackupRunsService>,
63}
64
65impl SqlBackupRunsService {
66    /// Returns a builder for [SqlBackupRunsService].
67    ///
68    /// ```
69    /// # async fn sample() -> gax::client_builder::Result<()> {
70    /// # use google_cloud_sql_v1::client::SqlBackupRunsService;
71    /// let client = SqlBackupRunsService::builder().build().await?;
72    /// # Ok(()) }
73    /// ```
74    pub fn builder() -> super::builder::sql_backup_runs_service::ClientBuilder {
75        gax::client_builder::internal::new_builder(
76            super::builder::sql_backup_runs_service::client::Factory,
77        )
78    }
79
80    /// Creates a new client from the provided stub.
81    ///
82    /// The most common case for calling this function is in tests mocking the
83    /// client's behavior.
84    pub fn from_stub<T>(stub: T) -> Self
85    where
86        T: super::stub::SqlBackupRunsService + 'static,
87    {
88        Self {
89            inner: std::sync::Arc::new(stub),
90        }
91    }
92
93    pub(crate) async fn new(
94        config: gaxi::options::ClientConfig,
95    ) -> gax::client_builder::Result<Self> {
96        let inner = Self::build_inner(config).await?;
97        Ok(Self { inner })
98    }
99
100    async fn build_inner(
101        conf: gaxi::options::ClientConfig,
102    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SqlBackupRunsService>>
103    {
104        if gaxi::options::tracing_enabled(&conf) {
105            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
106        }
107        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
108    }
109
110    async fn build_transport(
111        conf: gaxi::options::ClientConfig,
112    ) -> gax::client_builder::Result<impl super::stub::SqlBackupRunsService> {
113        super::transport::SqlBackupRunsService::new(conf).await
114    }
115
116    async fn build_with_tracing(
117        conf: gaxi::options::ClientConfig,
118    ) -> gax::client_builder::Result<impl super::stub::SqlBackupRunsService> {
119        Self::build_transport(conf)
120            .await
121            .map(super::tracing::SqlBackupRunsService::new)
122    }
123
124    /// Deletes the backup taken by a backup run.
125    pub fn delete(&self) -> super::builder::sql_backup_runs_service::Delete {
126        super::builder::sql_backup_runs_service::Delete::new(self.inner.clone())
127    }
128
129    /// Retrieves a resource containing information about a backup run.
130    pub fn get(&self) -> super::builder::sql_backup_runs_service::Get {
131        super::builder::sql_backup_runs_service::Get::new(self.inner.clone())
132    }
133
134    /// Creates a new backup run on demand.
135    pub fn insert(&self) -> super::builder::sql_backup_runs_service::Insert {
136        super::builder::sql_backup_runs_service::Insert::new(self.inner.clone())
137    }
138
139    /// Lists all backup runs associated with the project or a given instance
140    /// and configuration in the reverse chronological order of the backup
141    /// initiation time.
142    pub fn list(&self) -> super::builder::sql_backup_runs_service::List {
143        super::builder::sql_backup_runs_service::List::new(self.inner.clone())
144    }
145}
146
147/// Implements a client for the Cloud SQL Admin API.
148///
149/// # Example
150/// ```
151/// # async fn sample() -> gax::client_builder::Result<()> {
152/// # use google_cloud_sql_v1::client::SqlBackupsService;
153/// let client = SqlBackupsService::builder().build().await?;
154/// // use `client` to make requests to the Cloud SQL Admin API.
155/// # Ok(()) }
156/// ```
157///
158/// # Service Description
159///
160///
161/// # Configuration
162///
163/// To configure `SqlBackupsService` use the `with_*` methods in the type returned
164/// by [builder()][SqlBackupsService::builder]. The default configuration should
165/// work for most applications. Common configuration changes include
166///
167/// * [with_endpoint()]: by default this client uses the global default endpoint
168///   (`https://sqladmin.googleapis.com`). Applications using regional
169///   endpoints or running in restricted networks (e.g. a network configured
170//    with [Private Google Access with VPC Service Controls]) may want to
171///   override this default.
172/// * [with_credentials()]: by default this client uses
173///   [Application Default Credentials]. Applications using custom
174///   authentication may need to override this default.
175///
176/// [with_endpoint()]: super::builder::sql_backups_service::ClientBuilder::with_endpoint
177/// [with_credentials()]: super::builder::sql_backups_service::ClientBuilder::credentials
178/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
179/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
180///
181/// # Pooling and Cloning
182///
183/// `SqlBackupsService` holds a connection pool internally, it is advised to
184/// create one and the reuse it.  You do not need to wrap `SqlBackupsService` in
185/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
186/// already uses an `Arc` internally.
187#[derive(Clone, Debug)]
188pub struct SqlBackupsService {
189    inner: std::sync::Arc<dyn super::stub::dynamic::SqlBackupsService>,
190}
191
192impl SqlBackupsService {
193    /// Returns a builder for [SqlBackupsService].
194    ///
195    /// ```
196    /// # async fn sample() -> gax::client_builder::Result<()> {
197    /// # use google_cloud_sql_v1::client::SqlBackupsService;
198    /// let client = SqlBackupsService::builder().build().await?;
199    /// # Ok(()) }
200    /// ```
201    pub fn builder() -> super::builder::sql_backups_service::ClientBuilder {
202        gax::client_builder::internal::new_builder(
203            super::builder::sql_backups_service::client::Factory,
204        )
205    }
206
207    /// Creates a new client from the provided stub.
208    ///
209    /// The most common case for calling this function is in tests mocking the
210    /// client's behavior.
211    pub fn from_stub<T>(stub: T) -> Self
212    where
213        T: super::stub::SqlBackupsService + 'static,
214    {
215        Self {
216            inner: std::sync::Arc::new(stub),
217        }
218    }
219
220    pub(crate) async fn new(
221        config: gaxi::options::ClientConfig,
222    ) -> gax::client_builder::Result<Self> {
223        let inner = Self::build_inner(config).await?;
224        Ok(Self { inner })
225    }
226
227    async fn build_inner(
228        conf: gaxi::options::ClientConfig,
229    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SqlBackupsService>>
230    {
231        if gaxi::options::tracing_enabled(&conf) {
232            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
233        }
234        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
235    }
236
237    async fn build_transport(
238        conf: gaxi::options::ClientConfig,
239    ) -> gax::client_builder::Result<impl super::stub::SqlBackupsService> {
240        super::transport::SqlBackupsService::new(conf).await
241    }
242
243    async fn build_with_tracing(
244        conf: gaxi::options::ClientConfig,
245    ) -> gax::client_builder::Result<impl super::stub::SqlBackupsService> {
246        Self::build_transport(conf)
247            .await
248            .map(super::tracing::SqlBackupsService::new)
249    }
250
251    /// Creates a backup for a Cloud SQL instance. This API can be used only to
252    /// create on-demand backups.
253    pub fn create_backup(&self) -> super::builder::sql_backups_service::CreateBackup {
254        super::builder::sql_backups_service::CreateBackup::new(self.inner.clone())
255    }
256
257    /// Retrieves a resource containing information about a backup.
258    pub fn get_backup(&self) -> super::builder::sql_backups_service::GetBackup {
259        super::builder::sql_backups_service::GetBackup::new(self.inner.clone())
260    }
261
262    /// Lists all backups associated with the project.
263    pub fn list_backups(&self) -> super::builder::sql_backups_service::ListBackups {
264        super::builder::sql_backups_service::ListBackups::new(self.inner.clone())
265    }
266
267    /// Updates the retention period and description of the backup. You can use
268    /// this API to update final backups only.
269    pub fn update_backup(&self) -> super::builder::sql_backups_service::UpdateBackup {
270        super::builder::sql_backups_service::UpdateBackup::new(self.inner.clone())
271    }
272
273    /// Deletes the backup.
274    pub fn delete_backup(&self) -> super::builder::sql_backups_service::DeleteBackup {
275        super::builder::sql_backups_service::DeleteBackup::new(self.inner.clone())
276    }
277}
278
279/// Implements a client for the Cloud SQL Admin API.
280///
281/// # Example
282/// ```
283/// # async fn sample() -> gax::client_builder::Result<()> {
284/// # use google_cloud_sql_v1::client::SqlConnectService;
285/// let client = SqlConnectService::builder().build().await?;
286/// // use `client` to make requests to the Cloud SQL Admin API.
287/// # Ok(()) }
288/// ```
289///
290/// # Service Description
291///
292/// Cloud SQL connect service.
293///
294/// # Configuration
295///
296/// To configure `SqlConnectService` use the `with_*` methods in the type returned
297/// by [builder()][SqlConnectService::builder]. The default configuration should
298/// work for most applications. Common configuration changes include
299///
300/// * [with_endpoint()]: by default this client uses the global default endpoint
301///   (`https://sqladmin.googleapis.com`). Applications using regional
302///   endpoints or running in restricted networks (e.g. a network configured
303//    with [Private Google Access with VPC Service Controls]) may want to
304///   override this default.
305/// * [with_credentials()]: by default this client uses
306///   [Application Default Credentials]. Applications using custom
307///   authentication may need to override this default.
308///
309/// [with_endpoint()]: super::builder::sql_connect_service::ClientBuilder::with_endpoint
310/// [with_credentials()]: super::builder::sql_connect_service::ClientBuilder::credentials
311/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
312/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
313///
314/// # Pooling and Cloning
315///
316/// `SqlConnectService` holds a connection pool internally, it is advised to
317/// create one and the reuse it.  You do not need to wrap `SqlConnectService` in
318/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
319/// already uses an `Arc` internally.
320#[derive(Clone, Debug)]
321pub struct SqlConnectService {
322    inner: std::sync::Arc<dyn super::stub::dynamic::SqlConnectService>,
323}
324
325impl SqlConnectService {
326    /// Returns a builder for [SqlConnectService].
327    ///
328    /// ```
329    /// # async fn sample() -> gax::client_builder::Result<()> {
330    /// # use google_cloud_sql_v1::client::SqlConnectService;
331    /// let client = SqlConnectService::builder().build().await?;
332    /// # Ok(()) }
333    /// ```
334    pub fn builder() -> super::builder::sql_connect_service::ClientBuilder {
335        gax::client_builder::internal::new_builder(
336            super::builder::sql_connect_service::client::Factory,
337        )
338    }
339
340    /// Creates a new client from the provided stub.
341    ///
342    /// The most common case for calling this function is in tests mocking the
343    /// client's behavior.
344    pub fn from_stub<T>(stub: T) -> Self
345    where
346        T: super::stub::SqlConnectService + 'static,
347    {
348        Self {
349            inner: std::sync::Arc::new(stub),
350        }
351    }
352
353    pub(crate) async fn new(
354        config: gaxi::options::ClientConfig,
355    ) -> gax::client_builder::Result<Self> {
356        let inner = Self::build_inner(config).await?;
357        Ok(Self { inner })
358    }
359
360    async fn build_inner(
361        conf: gaxi::options::ClientConfig,
362    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SqlConnectService>>
363    {
364        if gaxi::options::tracing_enabled(&conf) {
365            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
366        }
367        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
368    }
369
370    async fn build_transport(
371        conf: gaxi::options::ClientConfig,
372    ) -> gax::client_builder::Result<impl super::stub::SqlConnectService> {
373        super::transport::SqlConnectService::new(conf).await
374    }
375
376    async fn build_with_tracing(
377        conf: gaxi::options::ClientConfig,
378    ) -> gax::client_builder::Result<impl super::stub::SqlConnectService> {
379        Self::build_transport(conf)
380            .await
381            .map(super::tracing::SqlConnectService::new)
382    }
383
384    /// Retrieves connect settings about a Cloud SQL instance.
385    pub fn get_connect_settings(&self) -> super::builder::sql_connect_service::GetConnectSettings {
386        super::builder::sql_connect_service::GetConnectSettings::new(self.inner.clone())
387    }
388
389    /// Generates a short-lived X509 certificate containing the provided public key
390    /// and signed by a private key specific to the target instance. Users may use
391    /// the certificate to authenticate as themselves when connecting to the
392    /// database.
393    pub fn generate_ephemeral_cert(
394        &self,
395    ) -> super::builder::sql_connect_service::GenerateEphemeralCert {
396        super::builder::sql_connect_service::GenerateEphemeralCert::new(self.inner.clone())
397    }
398}
399
400/// Implements a client for the Cloud SQL Admin API.
401///
402/// # Example
403/// ```
404/// # async fn sample() -> gax::client_builder::Result<()> {
405/// # use google_cloud_sql_v1::client::SqlDatabasesService;
406/// let client = SqlDatabasesService::builder().build().await?;
407/// // use `client` to make requests to the Cloud SQL Admin API.
408/// # Ok(()) }
409/// ```
410///
411/// # Service Description
412///
413/// Service to manage databases.
414///
415/// # Configuration
416///
417/// To configure `SqlDatabasesService` use the `with_*` methods in the type returned
418/// by [builder()][SqlDatabasesService::builder]. The default configuration should
419/// work for most applications. Common configuration changes include
420///
421/// * [with_endpoint()]: by default this client uses the global default endpoint
422///   (`https://sqladmin.googleapis.com`). Applications using regional
423///   endpoints or running in restricted networks (e.g. a network configured
424//    with [Private Google Access with VPC Service Controls]) may want to
425///   override this default.
426/// * [with_credentials()]: by default this client uses
427///   [Application Default Credentials]. Applications using custom
428///   authentication may need to override this default.
429///
430/// [with_endpoint()]: super::builder::sql_databases_service::ClientBuilder::with_endpoint
431/// [with_credentials()]: super::builder::sql_databases_service::ClientBuilder::credentials
432/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
433/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
434///
435/// # Pooling and Cloning
436///
437/// `SqlDatabasesService` holds a connection pool internally, it is advised to
438/// create one and the reuse it.  You do not need to wrap `SqlDatabasesService` in
439/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
440/// already uses an `Arc` internally.
441#[derive(Clone, Debug)]
442pub struct SqlDatabasesService {
443    inner: std::sync::Arc<dyn super::stub::dynamic::SqlDatabasesService>,
444}
445
446impl SqlDatabasesService {
447    /// Returns a builder for [SqlDatabasesService].
448    ///
449    /// ```
450    /// # async fn sample() -> gax::client_builder::Result<()> {
451    /// # use google_cloud_sql_v1::client::SqlDatabasesService;
452    /// let client = SqlDatabasesService::builder().build().await?;
453    /// # Ok(()) }
454    /// ```
455    pub fn builder() -> super::builder::sql_databases_service::ClientBuilder {
456        gax::client_builder::internal::new_builder(
457            super::builder::sql_databases_service::client::Factory,
458        )
459    }
460
461    /// Creates a new client from the provided stub.
462    ///
463    /// The most common case for calling this function is in tests mocking the
464    /// client's behavior.
465    pub fn from_stub<T>(stub: T) -> Self
466    where
467        T: super::stub::SqlDatabasesService + 'static,
468    {
469        Self {
470            inner: std::sync::Arc::new(stub),
471        }
472    }
473
474    pub(crate) async fn new(
475        config: gaxi::options::ClientConfig,
476    ) -> gax::client_builder::Result<Self> {
477        let inner = Self::build_inner(config).await?;
478        Ok(Self { inner })
479    }
480
481    async fn build_inner(
482        conf: gaxi::options::ClientConfig,
483    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SqlDatabasesService>>
484    {
485        if gaxi::options::tracing_enabled(&conf) {
486            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
487        }
488        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
489    }
490
491    async fn build_transport(
492        conf: gaxi::options::ClientConfig,
493    ) -> gax::client_builder::Result<impl super::stub::SqlDatabasesService> {
494        super::transport::SqlDatabasesService::new(conf).await
495    }
496
497    async fn build_with_tracing(
498        conf: gaxi::options::ClientConfig,
499    ) -> gax::client_builder::Result<impl super::stub::SqlDatabasesService> {
500        Self::build_transport(conf)
501            .await
502            .map(super::tracing::SqlDatabasesService::new)
503    }
504
505    /// Deletes a database from a Cloud SQL instance.
506    pub fn delete(&self) -> super::builder::sql_databases_service::Delete {
507        super::builder::sql_databases_service::Delete::new(self.inner.clone())
508    }
509
510    /// Retrieves a resource containing information about a database inside a Cloud
511    /// SQL instance.
512    pub fn get(&self) -> super::builder::sql_databases_service::Get {
513        super::builder::sql_databases_service::Get::new(self.inner.clone())
514    }
515
516    /// Inserts a resource containing information about a database inside a Cloud
517    /// SQL instance.
518    ///
519    /// **Note:** You can't modify the default character set and collation.
520    pub fn insert(&self) -> super::builder::sql_databases_service::Insert {
521        super::builder::sql_databases_service::Insert::new(self.inner.clone())
522    }
523
524    /// Lists databases in the specified Cloud SQL instance.
525    pub fn list(&self) -> super::builder::sql_databases_service::List {
526        super::builder::sql_databases_service::List::new(self.inner.clone())
527    }
528
529    /// Partially updates a resource containing information about a database inside
530    /// a Cloud SQL instance. This method supports patch semantics.
531    pub fn patch(&self) -> super::builder::sql_databases_service::Patch {
532        super::builder::sql_databases_service::Patch::new(self.inner.clone())
533    }
534
535    /// Updates a resource containing information about a database inside a Cloud
536    /// SQL instance.
537    pub fn update(&self) -> super::builder::sql_databases_service::Update {
538        super::builder::sql_databases_service::Update::new(self.inner.clone())
539    }
540}
541
542/// Implements a client for the Cloud SQL Admin API.
543///
544/// # Example
545/// ```
546/// # async fn sample() -> gax::client_builder::Result<()> {
547/// # use google_cloud_sql_v1::client::SqlFlagsService;
548/// let client = SqlFlagsService::builder().build().await?;
549/// // use `client` to make requests to the Cloud SQL Admin API.
550/// # Ok(()) }
551/// ```
552///
553/// # Service Description
554///
555/// Service to manage database flags for Cloud SQL instances.
556///
557/// # Configuration
558///
559/// To configure `SqlFlagsService` use the `with_*` methods in the type returned
560/// by [builder()][SqlFlagsService::builder]. The default configuration should
561/// work for most applications. Common configuration changes include
562///
563/// * [with_endpoint()]: by default this client uses the global default endpoint
564///   (`https://sqladmin.googleapis.com`). Applications using regional
565///   endpoints or running in restricted networks (e.g. a network configured
566//    with [Private Google Access with VPC Service Controls]) may want to
567///   override this default.
568/// * [with_credentials()]: by default this client uses
569///   [Application Default Credentials]. Applications using custom
570///   authentication may need to override this default.
571///
572/// [with_endpoint()]: super::builder::sql_flags_service::ClientBuilder::with_endpoint
573/// [with_credentials()]: super::builder::sql_flags_service::ClientBuilder::credentials
574/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
575/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
576///
577/// # Pooling and Cloning
578///
579/// `SqlFlagsService` holds a connection pool internally, it is advised to
580/// create one and the reuse it.  You do not need to wrap `SqlFlagsService` in
581/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
582/// already uses an `Arc` internally.
583#[derive(Clone, Debug)]
584pub struct SqlFlagsService {
585    inner: std::sync::Arc<dyn super::stub::dynamic::SqlFlagsService>,
586}
587
588impl SqlFlagsService {
589    /// Returns a builder for [SqlFlagsService].
590    ///
591    /// ```
592    /// # async fn sample() -> gax::client_builder::Result<()> {
593    /// # use google_cloud_sql_v1::client::SqlFlagsService;
594    /// let client = SqlFlagsService::builder().build().await?;
595    /// # Ok(()) }
596    /// ```
597    pub fn builder() -> super::builder::sql_flags_service::ClientBuilder {
598        gax::client_builder::internal::new_builder(
599            super::builder::sql_flags_service::client::Factory,
600        )
601    }
602
603    /// Creates a new client from the provided stub.
604    ///
605    /// The most common case for calling this function is in tests mocking the
606    /// client's behavior.
607    pub fn from_stub<T>(stub: T) -> Self
608    where
609        T: super::stub::SqlFlagsService + 'static,
610    {
611        Self {
612            inner: std::sync::Arc::new(stub),
613        }
614    }
615
616    pub(crate) async fn new(
617        config: gaxi::options::ClientConfig,
618    ) -> gax::client_builder::Result<Self> {
619        let inner = Self::build_inner(config).await?;
620        Ok(Self { inner })
621    }
622
623    async fn build_inner(
624        conf: gaxi::options::ClientConfig,
625    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SqlFlagsService>>
626    {
627        if gaxi::options::tracing_enabled(&conf) {
628            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
629        }
630        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
631    }
632
633    async fn build_transport(
634        conf: gaxi::options::ClientConfig,
635    ) -> gax::client_builder::Result<impl super::stub::SqlFlagsService> {
636        super::transport::SqlFlagsService::new(conf).await
637    }
638
639    async fn build_with_tracing(
640        conf: gaxi::options::ClientConfig,
641    ) -> gax::client_builder::Result<impl super::stub::SqlFlagsService> {
642        Self::build_transport(conf)
643            .await
644            .map(super::tracing::SqlFlagsService::new)
645    }
646
647    /// Lists all available database flags for Cloud SQL instances.
648    pub fn list(&self) -> super::builder::sql_flags_service::List {
649        super::builder::sql_flags_service::List::new(self.inner.clone())
650    }
651}
652
653/// Implements a client for the Cloud SQL Admin API.
654///
655/// # Example
656/// ```
657/// # async fn sample() -> gax::client_builder::Result<()> {
658/// # use google_cloud_sql_v1::client::SqlInstancesService;
659/// let client = SqlInstancesService::builder().build().await?;
660/// // use `client` to make requests to the Cloud SQL Admin API.
661/// # Ok(()) }
662/// ```
663///
664/// # Service Description
665///
666///
667/// # Configuration
668///
669/// To configure `SqlInstancesService` use the `with_*` methods in the type returned
670/// by [builder()][SqlInstancesService::builder]. The default configuration should
671/// work for most applications. Common configuration changes include
672///
673/// * [with_endpoint()]: by default this client uses the global default endpoint
674///   (`https://sqladmin.googleapis.com`). Applications using regional
675///   endpoints or running in restricted networks (e.g. a network configured
676//    with [Private Google Access with VPC Service Controls]) may want to
677///   override this default.
678/// * [with_credentials()]: by default this client uses
679///   [Application Default Credentials]. Applications using custom
680///   authentication may need to override this default.
681///
682/// [with_endpoint()]: super::builder::sql_instances_service::ClientBuilder::with_endpoint
683/// [with_credentials()]: super::builder::sql_instances_service::ClientBuilder::credentials
684/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
685/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
686///
687/// # Pooling and Cloning
688///
689/// `SqlInstancesService` holds a connection pool internally, it is advised to
690/// create one and the reuse it.  You do not need to wrap `SqlInstancesService` in
691/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
692/// already uses an `Arc` internally.
693#[derive(Clone, Debug)]
694pub struct SqlInstancesService {
695    inner: std::sync::Arc<dyn super::stub::dynamic::SqlInstancesService>,
696}
697
698impl SqlInstancesService {
699    /// Returns a builder for [SqlInstancesService].
700    ///
701    /// ```
702    /// # async fn sample() -> gax::client_builder::Result<()> {
703    /// # use google_cloud_sql_v1::client::SqlInstancesService;
704    /// let client = SqlInstancesService::builder().build().await?;
705    /// # Ok(()) }
706    /// ```
707    pub fn builder() -> super::builder::sql_instances_service::ClientBuilder {
708        gax::client_builder::internal::new_builder(
709            super::builder::sql_instances_service::client::Factory,
710        )
711    }
712
713    /// Creates a new client from the provided stub.
714    ///
715    /// The most common case for calling this function is in tests mocking the
716    /// client's behavior.
717    pub fn from_stub<T>(stub: T) -> Self
718    where
719        T: super::stub::SqlInstancesService + 'static,
720    {
721        Self {
722            inner: std::sync::Arc::new(stub),
723        }
724    }
725
726    pub(crate) async fn new(
727        config: gaxi::options::ClientConfig,
728    ) -> gax::client_builder::Result<Self> {
729        let inner = Self::build_inner(config).await?;
730        Ok(Self { inner })
731    }
732
733    async fn build_inner(
734        conf: gaxi::options::ClientConfig,
735    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SqlInstancesService>>
736    {
737        if gaxi::options::tracing_enabled(&conf) {
738            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
739        }
740        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
741    }
742
743    async fn build_transport(
744        conf: gaxi::options::ClientConfig,
745    ) -> gax::client_builder::Result<impl super::stub::SqlInstancesService> {
746        super::transport::SqlInstancesService::new(conf).await
747    }
748
749    async fn build_with_tracing(
750        conf: gaxi::options::ClientConfig,
751    ) -> gax::client_builder::Result<impl super::stub::SqlInstancesService> {
752        Self::build_transport(conf)
753            .await
754            .map(super::tracing::SqlInstancesService::new)
755    }
756
757    /// Adds a new trusted Certificate Authority (CA) version for the specified
758    /// instance. Required to prepare for a certificate rotation. If a CA version
759    /// was previously added but never used in a certificate rotation, this
760    /// operation replaces that version. There cannot be more than one CA version
761    /// waiting to be rotated in. For instances that have enabled Certificate
762    /// Authority Service (CAS) based server CA, use AddServerCertificate to add a
763    /// new server certificate.
764    pub fn add_server_ca(&self) -> super::builder::sql_instances_service::AddServerCa {
765        super::builder::sql_instances_service::AddServerCa::new(self.inner.clone())
766    }
767
768    /// Add a new trusted server certificate version for the specified instance
769    /// using Certificate Authority Service (CAS) server CA. Required to prepare
770    /// for a certificate rotation. If a server certificate version was previously
771    /// added but never used in a certificate rotation, this operation replaces
772    /// that version. There cannot be more than one certificate version waiting to
773    /// be rotated in. For instances not using CAS server CA, use AddServerCa
774    /// instead.
775    pub fn add_server_certificate(
776        &self,
777    ) -> super::builder::sql_instances_service::AddServerCertificate {
778        super::builder::sql_instances_service::AddServerCertificate::new(self.inner.clone())
779    }
780
781    /// Adds a new Entra ID certificate for the specified instance. If an Entra ID
782    /// certificate was previously added but never used in a certificate rotation,
783    /// this operation replaces that version.
784    pub fn add_entra_id_certificate(
785        &self,
786    ) -> super::builder::sql_instances_service::AddEntraIdCertificate {
787        super::builder::sql_instances_service::AddEntraIdCertificate::new(self.inner.clone())
788    }
789
790    /// Creates a Cloud SQL instance as a clone of the source instance. Using this
791    /// operation might cause your instance to restart.
792    #[allow(clippy::should_implement_trait)]
793    pub fn clone(&self) -> super::builder::sql_instances_service::Clone {
794        super::builder::sql_instances_service::Clone::new(self.inner.clone())
795    }
796
797    /// Deletes a Cloud SQL instance.
798    pub fn delete(&self) -> super::builder::sql_instances_service::Delete {
799        super::builder::sql_instances_service::Delete::new(self.inner.clone())
800    }
801
802    /// Demotes the stand-alone instance to be a Cloud SQL read replica for an
803    /// external database server.
804    pub fn demote_master(&self) -> super::builder::sql_instances_service::DemoteMaster {
805        super::builder::sql_instances_service::DemoteMaster::new(self.inner.clone())
806    }
807
808    /// Demotes an existing standalone instance to be a Cloud SQL read replica
809    /// for an external database server.
810    pub fn demote(&self) -> super::builder::sql_instances_service::Demote {
811        super::builder::sql_instances_service::Demote::new(self.inner.clone())
812    }
813
814    /// Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL
815    /// dump or CSV file.
816    pub fn export(&self) -> super::builder::sql_instances_service::Export {
817        super::builder::sql_instances_service::Export::new(self.inner.clone())
818    }
819
820    /// Initiates a manual failover of a high availability (HA) primary instance
821    /// to a standby instance, which becomes the primary instance. Users are
822    /// then rerouted to the new primary. For more information, see the
823    /// [Overview of high
824    /// availability](https://cloud.google.com/sql/docs/mysql/high-availability)
825    /// page in the Cloud SQL documentation.
826    /// If using Legacy HA (MySQL only), this causes the instance to failover to
827    /// its failover replica instance.
828    pub fn failover(&self) -> super::builder::sql_instances_service::Failover {
829        super::builder::sql_instances_service::Failover::new(self.inner.clone())
830    }
831
832    /// Reencrypt CMEK instance with latest key version.
833    pub fn reencrypt(&self) -> super::builder::sql_instances_service::Reencrypt {
834        super::builder::sql_instances_service::Reencrypt::new(self.inner.clone())
835    }
836
837    /// Retrieves a resource containing information about a Cloud SQL instance.
838    pub fn get(&self) -> super::builder::sql_instances_service::Get {
839        super::builder::sql_instances_service::Get::new(self.inner.clone())
840    }
841
842    /// Imports data into a Cloud SQL instance from a SQL dump  or CSV file in
843    /// Cloud Storage.
844    pub fn import(&self) -> super::builder::sql_instances_service::Import {
845        super::builder::sql_instances_service::Import::new(self.inner.clone())
846    }
847
848    /// Creates a new Cloud SQL instance.
849    pub fn insert(&self) -> super::builder::sql_instances_service::Insert {
850        super::builder::sql_instances_service::Insert::new(self.inner.clone())
851    }
852
853    /// Lists instances under a given project.
854    pub fn list(&self) -> super::builder::sql_instances_service::List {
855        super::builder::sql_instances_service::List::new(self.inner.clone())
856    }
857
858    /// Lists all of the trusted Certificate Authorities (CAs) for the specified
859    /// instance. There can be up to three CAs listed: the CA that was used to sign
860    /// the certificate that is currently in use, a CA that has been added but not
861    /// yet used to sign a certificate, and a CA used to sign a certificate that
862    /// has previously rotated out.
863    pub fn list_server_cas(&self) -> super::builder::sql_instances_service::ListServerCas {
864        super::builder::sql_instances_service::ListServerCas::new(self.inner.clone())
865    }
866
867    /// Lists all versions of server certificates and certificate authorities (CAs)
868    /// for the specified instance. There can be up to three sets of certs listed:
869    /// the certificate that is currently in use, a future that has been added but
870    /// not yet used to sign a certificate, and a certificate that has been rotated
871    /// out. For instances not using Certificate Authority Service (CAS) server CA,
872    /// use ListServerCas instead.
873    pub fn list_server_certificates(
874        &self,
875    ) -> super::builder::sql_instances_service::ListServerCertificates {
876        super::builder::sql_instances_service::ListServerCertificates::new(self.inner.clone())
877    }
878
879    /// Lists all versions of EntraID certificates for the specified instance.
880    /// There can be up to three sets of certificates listed: the certificate that
881    /// is currently in use, a future that has been added but not yet used to sign
882    /// a certificate, and a certificate that has been rotated out.
883    pub fn list_entra_id_certificates(
884        &self,
885    ) -> super::builder::sql_instances_service::ListEntraIdCertificates {
886        super::builder::sql_instances_service::ListEntraIdCertificates::new(self.inner.clone())
887    }
888
889    /// Partially updates settings of a Cloud SQL instance by merging the request
890    /// with the current configuration. This method supports patch semantics.
891    pub fn patch(&self) -> super::builder::sql_instances_service::Patch {
892        super::builder::sql_instances_service::Patch::new(self.inner.clone())
893    }
894
895    /// Promotes the read replica instance to be an independent Cloud SQL
896    /// primary instance.
897    /// Using this operation might cause your instance to restart.
898    pub fn promote_replica(&self) -> super::builder::sql_instances_service::PromoteReplica {
899        super::builder::sql_instances_service::PromoteReplica::new(self.inner.clone())
900    }
901
902    /// Switches over from the primary instance to the DR replica
903    /// instance.
904    pub fn switchover(&self) -> super::builder::sql_instances_service::Switchover {
905        super::builder::sql_instances_service::Switchover::new(self.inner.clone())
906    }
907
908    /// Deletes all client certificates and generates a new server SSL certificate
909    /// for the instance.
910    pub fn reset_ssl_config(&self) -> super::builder::sql_instances_service::ResetSslConfig {
911        super::builder::sql_instances_service::ResetSslConfig::new(self.inner.clone())
912    }
913
914    /// Restarts a Cloud SQL instance.
915    pub fn restart(&self) -> super::builder::sql_instances_service::Restart {
916        super::builder::sql_instances_service::Restart::new(self.inner.clone())
917    }
918
919    /// Restores a backup of a Cloud SQL instance. Using this operation might cause
920    /// your instance to restart.
921    pub fn restore_backup(&self) -> super::builder::sql_instances_service::RestoreBackup {
922        super::builder::sql_instances_service::RestoreBackup::new(self.inner.clone())
923    }
924
925    /// Rotates the server certificate to one signed by the Certificate Authority
926    /// (CA) version previously added with the addServerCA method. For instances
927    /// that have enabled Certificate Authority Service (CAS) based server CA,
928    /// use RotateServerCertificate to rotate the server certificate.
929    pub fn rotate_server_ca(&self) -> super::builder::sql_instances_service::RotateServerCa {
930        super::builder::sql_instances_service::RotateServerCa::new(self.inner.clone())
931    }
932
933    /// Rotates the server certificate version to one previously added with the
934    /// addServerCertificate method. For instances not using Certificate Authority
935    /// Service (CAS) server CA, use RotateServerCa instead.
936    pub fn rotate_server_certificate(
937        &self,
938    ) -> super::builder::sql_instances_service::RotateServerCertificate {
939        super::builder::sql_instances_service::RotateServerCertificate::new(self.inner.clone())
940    }
941
942    /// Rotates the server certificate version to one previously added with the
943    /// addEntraIdCertificate method.
944    pub fn rotate_entra_id_certificate(
945        &self,
946    ) -> super::builder::sql_instances_service::RotateEntraIdCertificate {
947        super::builder::sql_instances_service::RotateEntraIdCertificate::new(self.inner.clone())
948    }
949
950    /// Starts the replication in the read replica instance.
951    pub fn start_replica(&self) -> super::builder::sql_instances_service::StartReplica {
952        super::builder::sql_instances_service::StartReplica::new(self.inner.clone())
953    }
954
955    /// Stops the replication in the read replica instance.
956    pub fn stop_replica(&self) -> super::builder::sql_instances_service::StopReplica {
957        super::builder::sql_instances_service::StopReplica::new(self.inner.clone())
958    }
959
960    /// Truncate MySQL general and slow query log tables
961    /// MySQL only.
962    pub fn truncate_log(&self) -> super::builder::sql_instances_service::TruncateLog {
963        super::builder::sql_instances_service::TruncateLog::new(self.inner.clone())
964    }
965
966    /// Updates settings of a Cloud SQL instance. Using this operation might cause
967    /// your instance to restart.
968    pub fn update(&self) -> super::builder::sql_instances_service::Update {
969        super::builder::sql_instances_service::Update::new(self.inner.clone())
970    }
971
972    /// Generates a short-lived X509 certificate containing the provided public key
973    /// and signed by a private key specific to the target instance. Users may use
974    /// the certificate to authenticate as themselves when connecting to the
975    /// database.
976    pub fn create_ephemeral(&self) -> super::builder::sql_instances_service::CreateEphemeral {
977        super::builder::sql_instances_service::CreateEphemeral::new(self.inner.clone())
978    }
979
980    /// Reschedules the maintenance on the given instance.
981    pub fn reschedule_maintenance(
982        &self,
983    ) -> super::builder::sql_instances_service::RescheduleMaintenance {
984        super::builder::sql_instances_service::RescheduleMaintenance::new(self.inner.clone())
985    }
986
987    /// Verify External primary instance external sync settings.
988    pub fn verify_external_sync_settings(
989        &self,
990    ) -> super::builder::sql_instances_service::VerifyExternalSyncSettings {
991        super::builder::sql_instances_service::VerifyExternalSyncSettings::new(self.inner.clone())
992    }
993
994    /// Start External primary instance migration.
995    pub fn start_external_sync(&self) -> super::builder::sql_instances_service::StartExternalSync {
996        super::builder::sql_instances_service::StartExternalSync::new(self.inner.clone())
997    }
998
999    /// Perform Disk Shrink on primary instance.
1000    pub fn perform_disk_shrink(&self) -> super::builder::sql_instances_service::PerformDiskShrink {
1001        super::builder::sql_instances_service::PerformDiskShrink::new(self.inner.clone())
1002    }
1003
1004    /// Get Disk Shrink Config for a given instance.
1005    pub fn get_disk_shrink_config(
1006        &self,
1007    ) -> super::builder::sql_instances_service::GetDiskShrinkConfig {
1008        super::builder::sql_instances_service::GetDiskShrinkConfig::new(self.inner.clone())
1009    }
1010
1011    /// Reset Replica Size to primary instance disk size.
1012    pub fn reset_replica_size(&self) -> super::builder::sql_instances_service::ResetReplicaSize {
1013        super::builder::sql_instances_service::ResetReplicaSize::new(self.inner.clone())
1014    }
1015
1016    /// Get Latest Recovery Time for a given instance.
1017    pub fn get_latest_recovery_time(
1018        &self,
1019    ) -> super::builder::sql_instances_service::GetLatestRecoveryTime {
1020        super::builder::sql_instances_service::GetLatestRecoveryTime::new(self.inner.clone())
1021    }
1022
1023    /// Execute SQL statements.
1024    pub fn execute_sql(&self) -> super::builder::sql_instances_service::ExecuteSql {
1025        super::builder::sql_instances_service::ExecuteSql::new(self.inner.clone())
1026    }
1027
1028    /// Acquire a lease for the setup of SQL Server Reporting Services (SSRS).
1029    pub fn acquire_ssrs_lease(&self) -> super::builder::sql_instances_service::AcquireSsrsLease {
1030        super::builder::sql_instances_service::AcquireSsrsLease::new(self.inner.clone())
1031    }
1032
1033    /// Release a lease for the setup of SQL Server Reporting Services (SSRS).
1034    pub fn release_ssrs_lease(&self) -> super::builder::sql_instances_service::ReleaseSsrsLease {
1035        super::builder::sql_instances_service::ReleaseSsrsLease::new(self.inner.clone())
1036    }
1037
1038    /// Execute MVU Pre-checks
1039    pub fn pre_check_major_version_upgrade(
1040        &self,
1041    ) -> super::builder::sql_instances_service::PreCheckMajorVersionUpgrade {
1042        super::builder::sql_instances_service::PreCheckMajorVersionUpgrade::new(self.inner.clone())
1043    }
1044
1045    /// Point in time restore for an instance managed by Google Cloud Backup and
1046    /// Disaster Recovery.
1047    pub fn point_in_time_restore(
1048        &self,
1049    ) -> super::builder::sql_instances_service::PointInTimeRestore {
1050        super::builder::sql_instances_service::PointInTimeRestore::new(self.inner.clone())
1051    }
1052}
1053
1054/// Implements a client for the Cloud SQL Admin API.
1055///
1056/// # Example
1057/// ```
1058/// # async fn sample() -> gax::client_builder::Result<()> {
1059/// # use google_cloud_sql_v1::client::SqlOperationsService;
1060/// let client = SqlOperationsService::builder().build().await?;
1061/// // use `client` to make requests to the Cloud SQL Admin API.
1062/// # Ok(()) }
1063/// ```
1064///
1065/// # Service Description
1066///
1067/// Service to fetch operations for database instances.
1068///
1069/// # Configuration
1070///
1071/// To configure `SqlOperationsService` use the `with_*` methods in the type returned
1072/// by [builder()][SqlOperationsService::builder]. The default configuration should
1073/// work for most applications. Common configuration changes include
1074///
1075/// * [with_endpoint()]: by default this client uses the global default endpoint
1076///   (`https://sqladmin.googleapis.com`). Applications using regional
1077///   endpoints or running in restricted networks (e.g. a network configured
1078//    with [Private Google Access with VPC Service Controls]) may want to
1079///   override this default.
1080/// * [with_credentials()]: by default this client uses
1081///   [Application Default Credentials]. Applications using custom
1082///   authentication may need to override this default.
1083///
1084/// [with_endpoint()]: super::builder::sql_operations_service::ClientBuilder::with_endpoint
1085/// [with_credentials()]: super::builder::sql_operations_service::ClientBuilder::credentials
1086/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1087/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1088///
1089/// # Pooling and Cloning
1090///
1091/// `SqlOperationsService` holds a connection pool internally, it is advised to
1092/// create one and the reuse it.  You do not need to wrap `SqlOperationsService` in
1093/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1094/// already uses an `Arc` internally.
1095#[derive(Clone, Debug)]
1096pub struct SqlOperationsService {
1097    inner: std::sync::Arc<dyn super::stub::dynamic::SqlOperationsService>,
1098}
1099
1100impl SqlOperationsService {
1101    /// Returns a builder for [SqlOperationsService].
1102    ///
1103    /// ```
1104    /// # async fn sample() -> gax::client_builder::Result<()> {
1105    /// # use google_cloud_sql_v1::client::SqlOperationsService;
1106    /// let client = SqlOperationsService::builder().build().await?;
1107    /// # Ok(()) }
1108    /// ```
1109    pub fn builder() -> super::builder::sql_operations_service::ClientBuilder {
1110        gax::client_builder::internal::new_builder(
1111            super::builder::sql_operations_service::client::Factory,
1112        )
1113    }
1114
1115    /// Creates a new client from the provided stub.
1116    ///
1117    /// The most common case for calling this function is in tests mocking the
1118    /// client's behavior.
1119    pub fn from_stub<T>(stub: T) -> Self
1120    where
1121        T: super::stub::SqlOperationsService + 'static,
1122    {
1123        Self {
1124            inner: std::sync::Arc::new(stub),
1125        }
1126    }
1127
1128    pub(crate) async fn new(
1129        config: gaxi::options::ClientConfig,
1130    ) -> gax::client_builder::Result<Self> {
1131        let inner = Self::build_inner(config).await?;
1132        Ok(Self { inner })
1133    }
1134
1135    async fn build_inner(
1136        conf: gaxi::options::ClientConfig,
1137    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SqlOperationsService>>
1138    {
1139        if gaxi::options::tracing_enabled(&conf) {
1140            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1141        }
1142        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1143    }
1144
1145    async fn build_transport(
1146        conf: gaxi::options::ClientConfig,
1147    ) -> gax::client_builder::Result<impl super::stub::SqlOperationsService> {
1148        super::transport::SqlOperationsService::new(conf).await
1149    }
1150
1151    async fn build_with_tracing(
1152        conf: gaxi::options::ClientConfig,
1153    ) -> gax::client_builder::Result<impl super::stub::SqlOperationsService> {
1154        Self::build_transport(conf)
1155            .await
1156            .map(super::tracing::SqlOperationsService::new)
1157    }
1158
1159    /// Retrieves an instance operation that has been performed on an instance.
1160    pub fn get(&self) -> super::builder::sql_operations_service::Get {
1161        super::builder::sql_operations_service::Get::new(self.inner.clone())
1162    }
1163
1164    /// Lists all instance operations that have been performed on the given Cloud
1165    /// SQL instance in the reverse chronological order of the start time.
1166    pub fn list(&self) -> super::builder::sql_operations_service::List {
1167        super::builder::sql_operations_service::List::new(self.inner.clone())
1168    }
1169
1170    /// Cancels an instance operation that has been performed on an instance.
1171    pub fn cancel(&self) -> super::builder::sql_operations_service::Cancel {
1172        super::builder::sql_operations_service::Cancel::new(self.inner.clone())
1173    }
1174}
1175
1176/// Implements a client for the Cloud SQL Admin API.
1177///
1178/// # Example
1179/// ```
1180/// # async fn sample() -> gax::client_builder::Result<()> {
1181/// # use google_cloud_sql_v1::client::SqlSslCertsService;
1182/// let client = SqlSslCertsService::builder().build().await?;
1183/// // use `client` to make requests to the Cloud SQL Admin API.
1184/// # Ok(()) }
1185/// ```
1186///
1187/// # Service Description
1188///
1189/// Service to manage SSL certs for Cloud SQL instances.
1190///
1191/// # Configuration
1192///
1193/// To configure `SqlSslCertsService` use the `with_*` methods in the type returned
1194/// by [builder()][SqlSslCertsService::builder]. The default configuration should
1195/// work for most applications. Common configuration changes include
1196///
1197/// * [with_endpoint()]: by default this client uses the global default endpoint
1198///   (`https://sqladmin.googleapis.com`). Applications using regional
1199///   endpoints or running in restricted networks (e.g. a network configured
1200//    with [Private Google Access with VPC Service Controls]) may want to
1201///   override this default.
1202/// * [with_credentials()]: by default this client uses
1203///   [Application Default Credentials]. Applications using custom
1204///   authentication may need to override this default.
1205///
1206/// [with_endpoint()]: super::builder::sql_ssl_certs_service::ClientBuilder::with_endpoint
1207/// [with_credentials()]: super::builder::sql_ssl_certs_service::ClientBuilder::credentials
1208/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1209/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1210///
1211/// # Pooling and Cloning
1212///
1213/// `SqlSslCertsService` holds a connection pool internally, it is advised to
1214/// create one and the reuse it.  You do not need to wrap `SqlSslCertsService` in
1215/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1216/// already uses an `Arc` internally.
1217#[derive(Clone, Debug)]
1218pub struct SqlSslCertsService {
1219    inner: std::sync::Arc<dyn super::stub::dynamic::SqlSslCertsService>,
1220}
1221
1222impl SqlSslCertsService {
1223    /// Returns a builder for [SqlSslCertsService].
1224    ///
1225    /// ```
1226    /// # async fn sample() -> gax::client_builder::Result<()> {
1227    /// # use google_cloud_sql_v1::client::SqlSslCertsService;
1228    /// let client = SqlSslCertsService::builder().build().await?;
1229    /// # Ok(()) }
1230    /// ```
1231    pub fn builder() -> super::builder::sql_ssl_certs_service::ClientBuilder {
1232        gax::client_builder::internal::new_builder(
1233            super::builder::sql_ssl_certs_service::client::Factory,
1234        )
1235    }
1236
1237    /// Creates a new client from the provided stub.
1238    ///
1239    /// The most common case for calling this function is in tests mocking the
1240    /// client's behavior.
1241    pub fn from_stub<T>(stub: T) -> Self
1242    where
1243        T: super::stub::SqlSslCertsService + 'static,
1244    {
1245        Self {
1246            inner: std::sync::Arc::new(stub),
1247        }
1248    }
1249
1250    pub(crate) async fn new(
1251        config: gaxi::options::ClientConfig,
1252    ) -> gax::client_builder::Result<Self> {
1253        let inner = Self::build_inner(config).await?;
1254        Ok(Self { inner })
1255    }
1256
1257    async fn build_inner(
1258        conf: gaxi::options::ClientConfig,
1259    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SqlSslCertsService>>
1260    {
1261        if gaxi::options::tracing_enabled(&conf) {
1262            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1263        }
1264        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1265    }
1266
1267    async fn build_transport(
1268        conf: gaxi::options::ClientConfig,
1269    ) -> gax::client_builder::Result<impl super::stub::SqlSslCertsService> {
1270        super::transport::SqlSslCertsService::new(conf).await
1271    }
1272
1273    async fn build_with_tracing(
1274        conf: gaxi::options::ClientConfig,
1275    ) -> gax::client_builder::Result<impl super::stub::SqlSslCertsService> {
1276        Self::build_transport(conf)
1277            .await
1278            .map(super::tracing::SqlSslCertsService::new)
1279    }
1280
1281    /// Deletes the SSL certificate. For First Generation instances, the
1282    /// certificate remains valid until the instance is restarted.
1283    pub fn delete(&self) -> super::builder::sql_ssl_certs_service::Delete {
1284        super::builder::sql_ssl_certs_service::Delete::new(self.inner.clone())
1285    }
1286
1287    /// Retrieves a particular SSL certificate.  Does not include the private key
1288    /// (required for usage).  The private key must be saved from the response to
1289    /// initial creation.
1290    pub fn get(&self) -> super::builder::sql_ssl_certs_service::Get {
1291        super::builder::sql_ssl_certs_service::Get::new(self.inner.clone())
1292    }
1293
1294    /// Creates an SSL certificate and returns it along with the private key and
1295    /// server certificate authority.  The new certificate will not be usable until
1296    /// the instance is restarted.
1297    pub fn insert(&self) -> super::builder::sql_ssl_certs_service::Insert {
1298        super::builder::sql_ssl_certs_service::Insert::new(self.inner.clone())
1299    }
1300
1301    /// Lists all of the current SSL certificates for the instance.
1302    pub fn list(&self) -> super::builder::sql_ssl_certs_service::List {
1303        super::builder::sql_ssl_certs_service::List::new(self.inner.clone())
1304    }
1305}
1306
1307/// Implements a client for the Cloud SQL Admin API.
1308///
1309/// # Example
1310/// ```
1311/// # async fn sample() -> gax::client_builder::Result<()> {
1312/// # use google_cloud_sql_v1::client::SqlTiersService;
1313/// let client = SqlTiersService::builder().build().await?;
1314/// // use `client` to make requests to the Cloud SQL Admin API.
1315/// # Ok(()) }
1316/// ```
1317///
1318/// # Service Description
1319///
1320/// Service for providing machine types (tiers) for Cloud SQL instances.
1321///
1322/// # Configuration
1323///
1324/// To configure `SqlTiersService` use the `with_*` methods in the type returned
1325/// by [builder()][SqlTiersService::builder]. The default configuration should
1326/// work for most applications. Common configuration changes include
1327///
1328/// * [with_endpoint()]: by default this client uses the global default endpoint
1329///   (`https://sqladmin.googleapis.com`). Applications using regional
1330///   endpoints or running in restricted networks (e.g. a network configured
1331//    with [Private Google Access with VPC Service Controls]) may want to
1332///   override this default.
1333/// * [with_credentials()]: by default this client uses
1334///   [Application Default Credentials]. Applications using custom
1335///   authentication may need to override this default.
1336///
1337/// [with_endpoint()]: super::builder::sql_tiers_service::ClientBuilder::with_endpoint
1338/// [with_credentials()]: super::builder::sql_tiers_service::ClientBuilder::credentials
1339/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1340/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1341///
1342/// # Pooling and Cloning
1343///
1344/// `SqlTiersService` holds a connection pool internally, it is advised to
1345/// create one and the reuse it.  You do not need to wrap `SqlTiersService` in
1346/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1347/// already uses an `Arc` internally.
1348#[derive(Clone, Debug)]
1349pub struct SqlTiersService {
1350    inner: std::sync::Arc<dyn super::stub::dynamic::SqlTiersService>,
1351}
1352
1353impl SqlTiersService {
1354    /// Returns a builder for [SqlTiersService].
1355    ///
1356    /// ```
1357    /// # async fn sample() -> gax::client_builder::Result<()> {
1358    /// # use google_cloud_sql_v1::client::SqlTiersService;
1359    /// let client = SqlTiersService::builder().build().await?;
1360    /// # Ok(()) }
1361    /// ```
1362    pub fn builder() -> super::builder::sql_tiers_service::ClientBuilder {
1363        gax::client_builder::internal::new_builder(
1364            super::builder::sql_tiers_service::client::Factory,
1365        )
1366    }
1367
1368    /// Creates a new client from the provided stub.
1369    ///
1370    /// The most common case for calling this function is in tests mocking the
1371    /// client's behavior.
1372    pub fn from_stub<T>(stub: T) -> Self
1373    where
1374        T: super::stub::SqlTiersService + 'static,
1375    {
1376        Self {
1377            inner: std::sync::Arc::new(stub),
1378        }
1379    }
1380
1381    pub(crate) async fn new(
1382        config: gaxi::options::ClientConfig,
1383    ) -> gax::client_builder::Result<Self> {
1384        let inner = Self::build_inner(config).await?;
1385        Ok(Self { inner })
1386    }
1387
1388    async fn build_inner(
1389        conf: gaxi::options::ClientConfig,
1390    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SqlTiersService>>
1391    {
1392        if gaxi::options::tracing_enabled(&conf) {
1393            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1394        }
1395        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1396    }
1397
1398    async fn build_transport(
1399        conf: gaxi::options::ClientConfig,
1400    ) -> gax::client_builder::Result<impl super::stub::SqlTiersService> {
1401        super::transport::SqlTiersService::new(conf).await
1402    }
1403
1404    async fn build_with_tracing(
1405        conf: gaxi::options::ClientConfig,
1406    ) -> gax::client_builder::Result<impl super::stub::SqlTiersService> {
1407        Self::build_transport(conf)
1408            .await
1409            .map(super::tracing::SqlTiersService::new)
1410    }
1411
1412    /// Lists all available machine types (tiers) for Cloud SQL, for example,
1413    /// `db-custom-1-3840`. For more information, see
1414    /// <https://cloud.google.com/sql/pricing>.
1415    pub fn list(&self) -> super::builder::sql_tiers_service::List {
1416        super::builder::sql_tiers_service::List::new(self.inner.clone())
1417    }
1418}
1419
1420/// Implements a client for the Cloud SQL Admin API.
1421///
1422/// # Example
1423/// ```
1424/// # async fn sample() -> gax::client_builder::Result<()> {
1425/// # use google_cloud_sql_v1::client::SqlUsersService;
1426/// let client = SqlUsersService::builder().build().await?;
1427/// // use `client` to make requests to the Cloud SQL Admin API.
1428/// # Ok(()) }
1429/// ```
1430///
1431/// # Service Description
1432///
1433/// Cloud SQL users service.
1434///
1435/// # Configuration
1436///
1437/// To configure `SqlUsersService` use the `with_*` methods in the type returned
1438/// by [builder()][SqlUsersService::builder]. The default configuration should
1439/// work for most applications. Common configuration changes include
1440///
1441/// * [with_endpoint()]: by default this client uses the global default endpoint
1442///   (`https://sqladmin.googleapis.com`). Applications using regional
1443///   endpoints or running in restricted networks (e.g. a network configured
1444//    with [Private Google Access with VPC Service Controls]) may want to
1445///   override this default.
1446/// * [with_credentials()]: by default this client uses
1447///   [Application Default Credentials]. Applications using custom
1448///   authentication may need to override this default.
1449///
1450/// [with_endpoint()]: super::builder::sql_users_service::ClientBuilder::with_endpoint
1451/// [with_credentials()]: super::builder::sql_users_service::ClientBuilder::credentials
1452/// [Private Google Access with VPC Service Controls]: https://cloud.google.com/vpc-service-controls/docs/private-connectivity
1453/// [Application Default Credentials]: https://cloud.google.com/docs/authentication#adc
1454///
1455/// # Pooling and Cloning
1456///
1457/// `SqlUsersService` holds a connection pool internally, it is advised to
1458/// create one and the reuse it.  You do not need to wrap `SqlUsersService` in
1459/// an [Rc](std::rc::Rc) or [Arc](std::sync::Arc) to reuse it, because it
1460/// already uses an `Arc` internally.
1461#[derive(Clone, Debug)]
1462pub struct SqlUsersService {
1463    inner: std::sync::Arc<dyn super::stub::dynamic::SqlUsersService>,
1464}
1465
1466impl SqlUsersService {
1467    /// Returns a builder for [SqlUsersService].
1468    ///
1469    /// ```
1470    /// # async fn sample() -> gax::client_builder::Result<()> {
1471    /// # use google_cloud_sql_v1::client::SqlUsersService;
1472    /// let client = SqlUsersService::builder().build().await?;
1473    /// # Ok(()) }
1474    /// ```
1475    pub fn builder() -> super::builder::sql_users_service::ClientBuilder {
1476        gax::client_builder::internal::new_builder(
1477            super::builder::sql_users_service::client::Factory,
1478        )
1479    }
1480
1481    /// Creates a new client from the provided stub.
1482    ///
1483    /// The most common case for calling this function is in tests mocking the
1484    /// client's behavior.
1485    pub fn from_stub<T>(stub: T) -> Self
1486    where
1487        T: super::stub::SqlUsersService + 'static,
1488    {
1489        Self {
1490            inner: std::sync::Arc::new(stub),
1491        }
1492    }
1493
1494    pub(crate) async fn new(
1495        config: gaxi::options::ClientConfig,
1496    ) -> gax::client_builder::Result<Self> {
1497        let inner = Self::build_inner(config).await?;
1498        Ok(Self { inner })
1499    }
1500
1501    async fn build_inner(
1502        conf: gaxi::options::ClientConfig,
1503    ) -> gax::client_builder::Result<std::sync::Arc<dyn super::stub::dynamic::SqlUsersService>>
1504    {
1505        if gaxi::options::tracing_enabled(&conf) {
1506            return Ok(std::sync::Arc::new(Self::build_with_tracing(conf).await?));
1507        }
1508        Ok(std::sync::Arc::new(Self::build_transport(conf).await?))
1509    }
1510
1511    async fn build_transport(
1512        conf: gaxi::options::ClientConfig,
1513    ) -> gax::client_builder::Result<impl super::stub::SqlUsersService> {
1514        super::transport::SqlUsersService::new(conf).await
1515    }
1516
1517    async fn build_with_tracing(
1518        conf: gaxi::options::ClientConfig,
1519    ) -> gax::client_builder::Result<impl super::stub::SqlUsersService> {
1520        Self::build_transport(conf)
1521            .await
1522            .map(super::tracing::SqlUsersService::new)
1523    }
1524
1525    /// Deletes a user from a Cloud SQL instance.
1526    pub fn delete(&self) -> super::builder::sql_users_service::Delete {
1527        super::builder::sql_users_service::Delete::new(self.inner.clone())
1528    }
1529
1530    /// Retrieves a resource containing information about a user.
1531    pub fn get(&self) -> super::builder::sql_users_service::Get {
1532        super::builder::sql_users_service::Get::new(self.inner.clone())
1533    }
1534
1535    /// Creates a new user in a Cloud SQL instance.
1536    pub fn insert(&self) -> super::builder::sql_users_service::Insert {
1537        super::builder::sql_users_service::Insert::new(self.inner.clone())
1538    }
1539
1540    /// Lists users in the specified Cloud SQL instance.
1541    pub fn list(&self) -> super::builder::sql_users_service::List {
1542        super::builder::sql_users_service::List::new(self.inner.clone())
1543    }
1544
1545    /// Updates an existing user in a Cloud SQL instance.
1546    pub fn update(&self) -> super::builder::sql_users_service::Update {
1547        super::builder::sql_users_service::Update::new(self.inner.clone())
1548    }
1549}