
# 查询OBS容量 - QueryOBSCapacity
#### 功能
支持查询OBS总量、分配量、可用量。
| **SLA项**   | **定义**  |
|:---|:---|
| 请求成功率      | ≥99%    |
| 可用性        | Tier 2  |
| 数据一致性      | 强一致     |
| 吞吐量        | 60 次/分钟 |
| TP50请求时延   | 200 ms  |
| TP99.9请求时延 | 300 ms  |
   
#### 注意事项
无
#### 调用方法
GET
#### URI
/rest/dataapi/homs/open-api/v1/CloudService/capacity
**路径参数**
无
**查询参数**
无
#### 请求
- **请求header参数**
  
  | **参数**          | **是否必选**                                                                    | **类型** | **值域** | **说明**              |
  |:---|:---|:---|:---|:---|
  | X-APIG-Appcode  | 是                                                                           | string | 无      | 由SRE分配的AppCode。     |
  | x-auth-token    | 是                                                                           | string | 无      | 调用方APIG的IAM认证token。 |
  | x-hcso-domainid | 是（HCSO场景） 否（其他场景） | string | 无      | 接入的租户ID。            |
  | x-hcso-appcode  | 是                                                                           | string | 无      | 由SRE分配的AppCode      |
     
  

- **查询参数**
  
  | **参数**       | **是否必选** | **类型** | **值域**  | **说明**         |
  |:---|:---|:---|:---|:---|
  | begin_time   | 是        | int    | 无       | 查询开始时间（毫秒时间戳）。 |
  | end_time     | 是        | int    | 无       | 查询结束时间（毫秒时间戳）。 |
  | service_type | 否        | string | OBS     | 服务类型。          |
  | zone_type    | 否        | string | OBS_POD | OBS专属区。        |
  | page_size    | 是        | int    | 0\~1000 | 页大小。           |
  | offset_value | 是        | int    | 无       | 查询起始值。         |
     
  

- **请求body参数**
  无
  
- **请求示例**
  ```
  GET /rest/dataapi/homs/open-api/v1/CloudService/capacity?service_type=OBS HTTP/1.1 
  Host: example.com
  Content-Type: application/json 
  Accept: application/json
  X-APIG-Appcode: xxx 
  x-auth-token: xxx 
  x-hcso-domainid：xxx 
  x-hcso-appcode：xxx
  ```
  
 
#### 响应
- **响应参数**
  
  | **参数**         | **类型**  | **值域** | **说明**                      |
  |:---|:---|:---|:---|
  | resource_type  | string  | 无      | 资源类型。                       |
  | available      | String  | 无      | 剩余可发放量，xxTB（单位）。            |
  | az_name        | string  | 无      | 可用区域。                       |
  | used           | Float64 | 无      | 已使用量。                       |
  | used_ratio     | Float64 | 无      | 使用率。                        |
  | az_id          | string  | 无      | 可用区域ID。                     |
  | service_type   | String  | 无      | 云服务名，标识资源所属的云服务OBS。         |
  | total          | Integer | 无      | 数据条数。                       |
  | az_name_en     | string  | 无      | 可用区域英文名称。                   |
  | metric_type    | String  | 无      | OBS服务的资源类型；单AZ架构、多AZ架构。     |
  | zone_type      | String  | 无      | OBS为Region全局所用，OBS服务不关联到AZ。 |
  | free           | Float64 | 无      | 剩余量。                        |
  | region         | String  | 无      | 资源所属region中文名。              |
  | resource_count | Float64 | 无      | 资源总量。                       |
  | allocated      | String  | 无      | 已分配发放量，xxTB（单位）。            |
  | timestamp      | Long    | 无      | 时间戳。                        |
     
  

- **响应示例**
  ```
  HTTP/1.1 200  OK 
  Date:Tue,18 Jul 2023 09:58:01 GMT
  Server: example.com
  Content-Type: application/json;charset=UTF8 
  { 
      "total":33, 
      "list":[ 
              { 
              "resource_type": "",
              "available": "13.06640625",
              "az_name": "可用区1",
              "used": "74.2802734375",
              "used_ratio": "0.40409390589222816",
              "az_id": "cn-north-213a",
              "service_type": "OBS",
              "total": "238.96484375",
              "az_name_en": "AZ1",
              "metric_type": "a",
              "zone_type": "MANAGE",
              "free": "109.5390625",
              "region": "cn-north-213",
              "resource_count": "1690",
              "allocated": "225.8984375",
              "timestamp": "1756742400000"
             }
            ]
  }
  ```
  
 
#### 状态码
| **状态码** | **说明**                        |
|:---|:---|
| 200     | 操作成功。                         |
| 400     | 参数错误。                         |
| 401     | token鉴权失败。                    |
| 403     | 鉴权失败。                         |
| 404     | rest接口未找到。                    |
| 500     | 默认ServiceException异常码，应用内部错误。 |
   
