pub async fn get_federation_token(
secret_id: &str,
secret_key: &str,
region: &str,
policy: Policy,
duration_secs: u64,
) -> ApiResult<TempCredentials>Expand description
调用 STS GetFederationToken 获取临时密钥
使用腾讯云主密钥换取联合身份临时凭证, 前端凭此凭证在有效期内直接访问 COS。
§参数
secret_id: 腾讯云主账号 SecretIdsecret_key: 腾讯云主账号 SecretKeyregion: COS 区域policy: 权限策略(由build_put_policy或build_get_policy生成)duration_secs: 临时凭证有效期(秒)
§返回值
返回包含临时密钥和 SessionToken 的 TempCredentials。
§Errors
AppError::Oss— SecretId/SecretKey 为空或 STS 接口调用失败
§Panics
不 panic。所有错误通过 ApiResult 返回。