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