pub struct SqlWorkloadCapturesService { /* private fields */ }Expand description
Implements a client for the Cloud SQL Admin API.
§Example
async fn sample(
) -> anyhow::Result<()> {
let client = SqlWorkloadCapturesService::builder().build().await?;
let response = client.start()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}§Service Description
Cloud SQL Workload Captures service.
§Configuration
To configure SqlWorkloadCapturesService 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 with Private Google Access with VPC Service Controls) may want to 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
SqlWorkloadCapturesService holds a connection pool internally, it is advised to
create one and reuse it. You do not need to wrap SqlWorkloadCapturesService in
an Rc or Arc to reuse it, because it
already uses an Arc internally.
Implementations§
Source§impl SqlWorkloadCapturesService
impl SqlWorkloadCapturesService
Sourcepub fn builder() -> ClientBuilder
pub fn builder() -> ClientBuilder
Returns a builder for SqlWorkloadCapturesService.
let client = SqlWorkloadCapturesService::builder().build().await?;Sourcepub fn from_stub<T>(stub: impl Into<Arc<T>>) -> Selfwhere
T: SqlWorkloadCapturesService + 'static,
pub fn from_stub<T>(stub: impl Into<Arc<T>>) -> Selfwhere
T: SqlWorkloadCapturesService + '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 start(&self) -> Start
pub fn start(&self) -> Start
Starts capturing the SQL queries, transactions, and other operations executed on the primary instance. This traffic is securely stored and forms a “captured workload”. This workload can be replayed later on a different instance to safely test performance impacts, database upgrades, configuration changes etc. before applying them to production.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlWorkloadCapturesService
) -> Result<()> {
let response = client.start()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn stop(&self) -> Stop
pub fn stop(&self) -> Stop
Stops capturing the query traffic and related operations executed on the primary instance.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlWorkloadCapturesService
) -> Result<()> {
let response = client.stop()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn start_replay(&self) -> StartReplay
pub fn start_replay(&self) -> StartReplay
Starts executing a captured workload on a separate Cloud SQL instance provisioned for workload replay. This target instance simulates the production environment without affecting the primary instance.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlWorkloadCapturesService
) -> Result<()> {
let response = client.start_replay()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn stop_replay(&self) -> StopReplay
pub fn stop_replay(&self) -> StopReplay
Stops an active workload replay on the target Cloud SQL replay instance.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlWorkloadCapturesService
) -> Result<()> {
let response = client.stop_replay()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}Sourcepub fn list(&self) -> List
pub fn list(&self) -> List
Lists all captured workloads associated with the instance.
§Example
use google_cloud_sql_v1::Result;
async fn sample(
client: &SqlWorkloadCapturesService
) -> Result<()> {
let response = client.list()
/* set fields */
.send().await?;
println!("response {:?}", response);
Ok(())
}