额度管理
更新时间:2026-08-11
PutBucketQuota
本接口用来为单个Bucket设置容量上限及object个数上限
注意: 只有bucket的owner且拥有FULL_CONTROL权限才能够进行此请求。
相关参数参见PutBucketQuota接口。
C++
1void put_bucket_quota(Client &client) {
2 PutBucketQuotaRequest request(g_bucket);
3 request.set_bucket_max_object_count(10000);
4 request.set_bucket_max_capacity_mega_bytes(1024);
5 PutBucketQuotaResponse response;
6 client.put_bucket_quota(request, &response);
7 print_common_response(response);
8}
GetBucketQuota
本接口用来获取单个bucket的quota信息
注意: 只有bucket的owner且拥有FULL_CONTROL权限才能够进行此请求。
相关参数参见GetBucketQuota接口。
C++
1void get_bucket_quota(Client &client) {
2 GetBucketQuotaRequest request(g_bucket);
3 GetBucketQuotaResponse response;
4 client.get_bucket_quota(request, &response);
5 print_common_response(response);
6 if (response.is_fail()) {
7 return;
8 }
9
10 const BucketQuotaInfo "a = response.bucket_quota();
11 std::cout << "maxObjectCount: " << quota.max_object_count << std::endl;
12 std::cout << "maxCapacityMegaBytes: "
13 << quota.max_capacity_mega_bytes << std::endl;
14}
DeleteBucketQuota
本接口用来删除特定Bucket的quota配置
注意: 只有bucket的owner且拥有FULL_CONTROL权限才能够进行此请求。
相关参数参见DeleteBucketQuota接口。
C++
1void delete_bucket_quota(Client &client) {
2 DeleteBucketQuotaRequest request(g_bucket);
3 DeleteBucketQuotaResponse response;
4 client.delete_bucket_quota(request, &response);
5 print_common_response(response);
6}
评价此篇文章
