| Crates.io | tencent-sdk |
| lib.rs | tencent-sdk |
| version | 0.1.5 |
| created_at | 2025-02-15 06:26:00.999391+00 |
| updated_at | 2026-01-03 12:44:41.180875+00 |
| description | 📦 Tencent Cloud API SDK written in Rust |
| homepage | https://github.com/lvillis/tencent-sdk-rust |
| repository | https://github.com/lvillis/tencent-sdk-rust |
| max_upload_size | |
| id | 1556459 |
| size | 302,227 |
🇺🇸 English · 🇨🇳 中文 | Table of Contents ↗️
📦 Tencent Cloud API SDK written in Rust
Tencent Cloud API SDK for Rust. Async-first with an optional blocking client, sharing the same service layer, types and error model. Requests are authenticated using TC3-HMAC-SHA256.
[dependencies]
tencent-sdk = "0.1"
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
Blocking-only (no Tokio):
[dependencies]
tencent-sdk = { version = "0.1", default-features = false, features = ["blocking-rustls"] }
use std::time::Duration;
use tencent_sdk::types::{cvm::DescribeInstancesRequest, Filter};
use tencent_sdk::{Auth, Client};
#[tokio::main(flavor = "multi_thread")]
async fn main() -> Result<(), tencent_sdk::Error> {
let secret_id = std::env::var("TENCENT_SECRET_ID").expect("missing TENCENT_SECRET_ID");
let secret_key = std::env::var("TENCENT_SECRET_KEY").expect("missing TENCENT_SECRET_KEY");
let client = Client::builder_tencent_cloud()?
.auth(Auth::tc3(secret_id, secret_key))
.default_region("ap-guangzhou")
.no_system_proxy(true)
.retry(3, Duration::from_millis(200))
.build()?;
let request = DescribeInstancesRequest::new()
.limit(20)
.push_filter(Filter::new("instance-name", ["example"]));
let response = client.cvm().describe_instances(&request).await?;
println!("instances: {:?}", response.response.total_count);
Ok(())
}
The blocking client mirrors the async API (does not require Tokio):
use tencent_sdk::{Auth, BlockingClient};
fn main() -> Result<(), tencent_sdk::Error> {
let secret_id = std::env::var("TENCENT_SECRET_ID").expect("missing TENCENT_SECRET_ID");
let secret_key = std::env::var("TENCENT_SECRET_KEY").expect("missing TENCENT_SECRET_KEY");
let client = BlockingClient::builder_tencent_cloud()?
.auth(Auth::tc3(secret_id, secret_key))
.no_system_proxy(true)
.build()?;
let result = client.billing().describe_account_balance()?;
println!("balance: {:?}", result.response.real_balance);
Ok(())
}
async (default) with TLS backend: rustls (default) or native-tlsblocking via blocking-rustls or blocking-native-tlstracing, metricsClient (async) + BlockingClient (feature gated), sharing the same services and types.Debug output.Error with status / request_id / body snippet and service classification.CVM
Tag
Billing
CDN
DNSPod
SSL