
# 查询VPN容量 - QueryVPNCapacity
#### 功能
查询VPN虚拟私有网服务，即查询VPN专线条数、VPN连接网关的总数等。
| **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 | VPN     | 服务类型。          |
  | zone_type    | 否        | string | VPN_POD | VPN专属区。        |
  | page_size    | 是        | int    | 0\~1000 | 页大小。           |
  | offset_value | 是        | int    | 无       | 查询起始值。         |
     
  

- **请求body参数**
  无
  
- **请求示例**
  ```
  GET /rest/dataapi/homs/open-api/v1/CloudService/capacity?service_type=VPN 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  | 无      | 剩余量，xx条（Connection线路数），xx个（Gateway网关数）。    |
  | az_name        | string  | 无      | 可用区域。                                      |
  | used           | Float64 | 无      | 已使用量。                                      |
  | used_ratio     | Float64 | 无      | 使用率。                                       |
  | az_id          | string  | 无      | 可用区域ID。                                    |
  | service_type   | String  | 无      | 云服务名，标识资源所属的云服务VPN虚拟专用网络。                  |
  | total          | Integer | 无      | 可用总量，xx条（Connection线路数），xx个（Gateway网关数）。   |
  | az_name_en     | string  | 无      | 可用区域英文名称。                                  |
  | metric_type    | String  | 无      | VPN服务资源规格容量指标（Connection线路数；Gateway网关数）。   |
  | zone_type      | String  | 无      | 资源所属的区域类型：VPN_POD租户区用。                     |
  | free           | Float64 | 无      | 剩余量。                                       |
  | region         | String  | 无      | 资源所属region中文名。                             |
  | resource_count | Float64 | 无      | 资源总量。                                      |
  | allocated      | String  | 无      | 已分配使用量，xx条（Connection线路数），xx个（Gateway网关数）。 |
  | 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": 2, 
      "list": [ 
               { 
               "service_type": "VPN", 
               "total": "0", 
               "available": "0", 
               "metric_type": "connection", 
               "zone_type": "VPN_POD", 
               "used": "0", 
               "free": "0", 
               "used_ratio": "0", 
               "region": "cn-east-264", 
               "resource_count": "0", 
               "allocated": "0", 
               "timestamp": "1650211200000" 
                }, 
               { 
               "service_type": "VPN", 
               "total": "5", 
               "available": "5", 
               "metric_type": "gateway", 
               "zone_type": "VPN_POD", 
               "used": "0", 
               "free": "0", 
               "used_ratio": "0", 
               "region": "cn-east-264", 
               "resource_count": "0", 
               "allocated": "0", 
               "timestamp": "1650211200000" 
                } 
              ] 
  }
  ```
  
 
#### 状态码
| **状态码** | **说明**                        |
|:---|:---|
| 200     | 操作成功。                         |
| 400     | 参数错误。                         |
| 401     | token鉴权失败。                    |
| 403     | 鉴权失败。                         |
| 404     | rest接口未找到。                    |
| 500     | 默认ServiceException异常码，应用内部错误。 |
   
