用户额度管理
更新时间:2026-06-08
put_user_quota
此接口用来设置用户的额度,额度包括总的bucket数及各个region总的存储容量,当前总的Bucket数最大值不能超过100,注意该接口只能被主用户调用。
| 参数 | 是否必须 | 描述 |
|---|---|---|
| max_bucket_count | 是 | 最大可以创建的bucket数,若为-1,则表示不设置 |
| max_capacity_mega_bytes | 是 | 单位为MB,表示最大的存储容量,若为-1或者0,表示不设置存储容量额度限制,即无上限 |
C++
1void put_user_quota(Client &client)
2 PutUserQuotaRequest request;
3 request.set_max_bucket_count(88);
4 request.set_max_capacity_mega_bytes(1024000); // 1024GB
5 PutUserQuotaResponse response;
6 client.put_user_quota(request, &response);
7}
get_user_quota
此接口用来查看用户的额度设置,注意该接口只能被主用户调用。
C++
1void get_user_quota(Client &client) {
2 GetUserQuotaRequest request;
3 GetUserQuotaResponse response;
4 client.get_user_quota(request, &response);
5 if (response.is_ok()) {
6 std::cout << "maxBucketCount: " << response.user_quota().max_bucket_count << std::endl;
7 std::cout << "maxCapacityMegaBytes: " << response.user_quota().max_capacity_mega_bytes << std::endl;
8 }
9}
delete_user_quota
此接口用来删除额度设置,注意该接口只能被主用户调用。
C++
1void delete_user_quota(Client &client) {
2 DeleteUserQuotaRequest request;
3 DeleteUserQuotaResponse response;
4 client.delete_user_quota(request, &response);
5}
评价此篇文章
