pub struct TencentCloudClient {
pub secret_id: String,
pub secret_key: String,
pub token: Option<String>,
}
Expand description
Tencent Cloud SDK Client
This client is used to send authenticated requests to Tencent Cloud APIs. It internally builds the canonical request string, computes the TC3-HMAC-SHA256 signature, sets the appropriate headers, and sends an HTTPS POST request.
Fieldsยง
ยงsecret_id: String
Your Tencent Cloud SecretId.
secret_key: String
Your Tencent Cloud SecretKey.
token: Option<String>
Optional token.
Implementationsยง
Sourceยงimpl TencentCloudClient
impl TencentCloudClient
Sourcepub fn new(secret_id: &str, secret_key: &str, token: Option<&str>) -> Self
pub fn new(secret_id: &str, secret_key: &str, token: Option<&str>) -> Self
Creates a new TencentCloudClient.
ยงArguments
secret_id
- Your Tencent Cloud SecretId.secret_key
- Your Tencent Cloud SecretKey.token
- An optional token.
Sourcepub async fn request(
&self,
service: &str,
host: &str,
region: Option<&str>,
version: &str,
action: &str,
payload: &str,
) -> Result<String, Box<dyn Error>>
pub async fn request( &self, service: &str, host: &str, region: Option<&str>, version: &str, action: &str, payload: &str, ) -> Result<String, Box<dyn Error>>
Asynchronous general request function.
This method constructs the canonical request, computes the TC3-HMAC-SHA256 signature, builds the Authorization header, and sends an HTTPS POST request.
ยงArguments
service
- The service name (e.g., โcvmโ).host
- The request host (e.g., โcvm.tencentcloudapi.comโ).region
- Optional region string.version
- API version (e.g., โ2017-03-12โ).action
- API action name (e.g., โDescribeInstancesโ).payload
- The request body as a JSON string.
ยงReturns
A Result
containing the response text on success, or a boxed error on failure.
Auto Trait Implementationsยง
impl Freeze for TencentCloudClient
impl RefUnwindSafe for TencentCloudClient
impl Send for TencentCloudClient
impl Sync for TencentCloudClient
impl Unpin for TencentCloudClient
impl UnwindSafe for TencentCloudClient
Blanket Implementationsยง
Sourceยงimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Sourceยงfn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more