pub struct SqlInstancesService { /* private fields */ }Expand description
Implements a client for the Cloud SQL Admin API.
§Example
let client = SqlInstancesService::builder().build().await?;
let response = client.add_server_ca()
/* set fields */
.send().await?;
println!("response {:?}", response);§Service Description
§Configuration
To configure SqlInstancesService use the with_* methods in the type returned
by builder(). The default configuration should
work for most applications. Common configuration changes include
- with_endpoint(): by default this client uses the global default endpoint
(
https://sqladmin.googleapis.com). Applications using regional endpoints or running in restricted networks (e.g. a network configured override this default. - with_credentials(): by default this client uses Application Default Credentials. Applications using custom authentication may need to override this default.
§Pooling and Cloning
SqlInstancesService holds a connection pool internally, it is advised to
create one and reuse it. You do not need to wrap SqlInstancesService in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl SqlInstancesService
impl SqlInstancesService
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for SqlInstancesService.
let client = SqlInstancesService::builder().build().await?;Sourcepub fn from_stub<T>(stub: T) -> Selfwhere
T: SqlInstancesService + 'static,
pub fn from_stub<T>(stub: T) -> Selfwhere
T: SqlInstancesService + 'static,
Creates a new client from the provided stub.
The most common case for calling this function is in tests mocking the client’s behavior.
Sourcepub fn add_server_ca(&self) -> AddServerCa
pub fn add_server_ca(&self) -> AddServerCa
Adds a new trusted Certificate Authority (CA) version for the specified instance. Required to prepare for a certificate rotation. If a CA version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one CA version waiting to be rotated in. For instances that have enabled Certificate Authority Service (CAS) based server CA, use AddServerCertificate to add a new server certificate.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.add_server_ca()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn add_server_certificate(&self) -> AddServerCertificate
pub fn add_server_certificate(&self) -> AddServerCertificate
Add a new trusted server certificate version for the specified instance using Certificate Authority Service (CAS) server CA. Required to prepare for a certificate rotation. If a server certificate version was previously added but never used in a certificate rotation, this operation replaces that version. There cannot be more than one certificate version waiting to be rotated in. For instances not using CAS server CA, use AddServerCa instead.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.add_server_certificate()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn add_entra_id_certificate(&self) -> AddEntraIdCertificate
pub fn add_entra_id_certificate(&self) -> AddEntraIdCertificate
Adds a new Entra ID certificate for the specified instance. If an Entra ID certificate was previously added but never used in a certificate rotation, this operation replaces that version.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.add_entra_id_certificate()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn clone(&self) -> Clone
pub fn clone(&self) -> Clone
Creates a Cloud SQL instance as a clone of the source instance. Using this operation might cause your instance to restart.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.clone()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn delete(&self) -> Delete
pub fn delete(&self) -> Delete
Deletes a Cloud SQL instance.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.delete()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn demote_master(&self) -> DemoteMaster
pub fn demote_master(&self) -> DemoteMaster
Demotes the stand-alone instance to be a Cloud SQL read replica for an external database server.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.demote_master()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn demote(&self) -> Demote
pub fn demote(&self) -> Demote
Demotes an existing standalone instance to be a Cloud SQL read replica for an external database server.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.demote()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn export(&self) -> Export
pub fn export(&self) -> Export
Exports data from a Cloud SQL instance to a Cloud Storage bucket as a SQL dump or CSV file.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.export()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn failover(&self) -> Failover
pub fn failover(&self) -> Failover
Initiates a manual failover of a high availability (HA) primary instance to a standby instance, which becomes the primary instance. Users are then rerouted to the new primary. For more information, see the Overview of high availability page in the Cloud SQL documentation. If using Legacy HA (MySQL only), this causes the instance to failover to its failover replica instance.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.failover()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn reencrypt(&self) -> Reencrypt
pub fn reencrypt(&self) -> Reencrypt
Reencrypt CMEK instance with latest key version.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.reencrypt()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn get(&self) -> Get
pub fn get(&self) -> Get
Retrieves a resource containing information about a Cloud SQL instance.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.get()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn import(&self) -> Import
pub fn import(&self) -> Import
Imports data into a Cloud SQL instance from a SQL dump or CSV file in Cloud Storage.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.import()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn insert(&self) -> Insert
pub fn insert(&self) -> Insert
Creates a new Cloud SQL instance.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.insert()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn list(&self) -> List
pub fn list(&self) -> List
Lists instances under a given project.
§Example
use google_cloud_gax::paginator::ItemPaginator as _;
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let mut list = client.list()
/* set fields */
.by_item();
while let Some(item) = list.next().await.transpose()? {
println!("{:?}", item);
}
Ok(())
}Sourcepub fn list_server_cas(&self) -> ListServerCas
pub fn list_server_cas(&self) -> ListServerCas
Lists all of the trusted Certificate Authorities (CAs) for the specified instance. There can be up to three CAs listed: the CA that was used to sign the certificate that is currently in use, a CA that has been added but not yet used to sign a certificate, and a CA used to sign a certificate that has previously rotated out.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.list_server_cas()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn list_server_certificates(&self) -> ListServerCertificates
pub fn list_server_certificates(&self) -> ListServerCertificates
Lists all versions of server certificates and certificate authorities (CAs) for the specified instance. There can be up to three sets of certs listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out. For instances not using Certificate Authority Service (CAS) server CA, use ListServerCas instead.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.list_server_certificates()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn list_entra_id_certificates(&self) -> ListEntraIdCertificates
pub fn list_entra_id_certificates(&self) -> ListEntraIdCertificates
Lists all versions of EntraID certificates for the specified instance. There can be up to three sets of certificates listed: the certificate that is currently in use, a future that has been added but not yet used to sign a certificate, and a certificate that has been rotated out.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.list_entra_id_certificates()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn patch(&self) -> Patch
pub fn patch(&self) -> Patch
Partially updates settings of a Cloud SQL instance by merging the request with the current configuration. This method supports patch semantics.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.patch()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn promote_replica(&self) -> PromoteReplica
pub fn promote_replica(&self) -> PromoteReplica
Promotes the read replica instance to be an independent Cloud SQL primary instance. Using this operation might cause your instance to restart.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.promote_replica()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn switchover(&self) -> Switchover
pub fn switchover(&self) -> Switchover
Switches over from the primary instance to the DR replica instance.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.switchover()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn reset_ssl_config(&self) -> ResetSslConfig
pub fn reset_ssl_config(&self) -> ResetSslConfig
Deletes all client certificates and generates a new server SSL certificate for the instance.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.reset_ssl_config()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn restart(&self) -> Restart
pub fn restart(&self) -> Restart
Restarts a Cloud SQL instance.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.restart()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn restore_backup(&self) -> RestoreBackup
pub fn restore_backup(&self) -> RestoreBackup
Restores a backup of a Cloud SQL instance. Using this operation might cause your instance to restart.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.restore_backup()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn rotate_server_ca(&self) -> RotateServerCa
pub fn rotate_server_ca(&self) -> RotateServerCa
Rotates the server certificate to one signed by the Certificate Authority (CA) version previously added with the addServerCA method. For instances that have enabled Certificate Authority Service (CAS) based server CA, use RotateServerCertificate to rotate the server certificate.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.rotate_server_ca()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn rotate_server_certificate(&self) -> RotateServerCertificate
pub fn rotate_server_certificate(&self) -> RotateServerCertificate
Rotates the server certificate version to one previously added with the addServerCertificate method. For instances not using Certificate Authority Service (CAS) server CA, use RotateServerCa instead.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.rotate_server_certificate()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn rotate_entra_id_certificate(&self) -> RotateEntraIdCertificate
pub fn rotate_entra_id_certificate(&self) -> RotateEntraIdCertificate
Rotates the server certificate version to one previously added with the addEntraIdCertificate method.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.rotate_entra_id_certificate()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn start_replica(&self) -> StartReplica
pub fn start_replica(&self) -> StartReplica
Starts the replication in the read replica instance.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.start_replica()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn stop_replica(&self) -> StopReplica
pub fn stop_replica(&self) -> StopReplica
Stops the replication in the read replica instance.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.stop_replica()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn truncate_log(&self) -> TruncateLog
pub fn truncate_log(&self) -> TruncateLog
Truncate MySQL general and slow query log tables MySQL only.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.truncate_log()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn update(&self) -> Update
pub fn update(&self) -> Update
Updates settings of a Cloud SQL instance. Using this operation might cause your instance to restart.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.update()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn create_ephemeral(&self) -> CreateEphemeral
pub fn create_ephemeral(&self) -> CreateEphemeral
Generates a short-lived X509 certificate containing the provided public key and signed by a private key specific to the target instance. Users may use the certificate to authenticate as themselves when connecting to the database.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.create_ephemeral()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn reschedule_maintenance(&self) -> RescheduleMaintenance
pub fn reschedule_maintenance(&self) -> RescheduleMaintenance
Reschedules the maintenance on the given instance.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.reschedule_maintenance()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn verify_external_sync_settings(&self) -> VerifyExternalSyncSettings
pub fn verify_external_sync_settings(&self) -> VerifyExternalSyncSettings
Verify External primary instance external sync settings.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.verify_external_sync_settings()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn start_external_sync(&self) -> StartExternalSync
pub fn start_external_sync(&self) -> StartExternalSync
Start External primary instance migration.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.start_external_sync()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn perform_disk_shrink(&self) -> PerformDiskShrink
pub fn perform_disk_shrink(&self) -> PerformDiskShrink
Perform Disk Shrink on primary instance.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.perform_disk_shrink()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn get_disk_shrink_config(&self) -> GetDiskShrinkConfig
pub fn get_disk_shrink_config(&self) -> GetDiskShrinkConfig
Get Disk Shrink Config for a given instance.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.get_disk_shrink_config()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn reset_replica_size(&self) -> ResetReplicaSize
pub fn reset_replica_size(&self) -> ResetReplicaSize
Reset Replica Size to primary instance disk size.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.reset_replica_size()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn get_latest_recovery_time(&self) -> GetLatestRecoveryTime
pub fn get_latest_recovery_time(&self) -> GetLatestRecoveryTime
Get Latest Recovery Time for a given instance.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.get_latest_recovery_time()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn execute_sql(&self) -> ExecuteSql
pub fn execute_sql(&self) -> ExecuteSql
Execute SQL statements.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.execute_sql()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn acquire_ssrs_lease(&self) -> AcquireSsrsLease
pub fn acquire_ssrs_lease(&self) -> AcquireSsrsLease
Acquire a lease for the setup of SQL Server Reporting Services (SSRS).
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.acquire_ssrs_lease()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn release_ssrs_lease(&self) -> ReleaseSsrsLease
pub fn release_ssrs_lease(&self) -> ReleaseSsrsLease
Release a lease for the setup of SQL Server Reporting Services (SSRS).
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.release_ssrs_lease()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn pre_check_major_version_upgrade(&self) -> PreCheckMajorVersionUpgrade
pub fn pre_check_major_version_upgrade(&self) -> PreCheckMajorVersionUpgrade
Execute MVU Pre-checks
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.pre_check_major_version_upgrade()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn point_in_time_restore(&self) -> PointInTimeRestore
pub fn point_in_time_restore(&self) -> PointInTimeRestore
Point in time restore for an instance managed by Google Cloud Backup and Disaster Recovery.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlInstancesService
) -> Result<()> {
let response = client.point_in_time_restore()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Trait Implementations§
Source§impl Clone for SqlInstancesService
impl Clone for SqlInstancesService
Source§fn clone(&self) -> SqlInstancesService
fn clone(&self) -> SqlInstancesService
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more