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