
# 弹性资源池扩缩容历史记录 - ListElasticResourcePoolScaleRecords
#### 功能介绍
该API用于查询当前弹性资源池扩缩容历史记录。
#### 调试
您可以在[API Explorer](https://apiexplorer.developer.huaweicloud.com/apiexplorer/doc?product=DLI&api=ListElasticResourcePoolScaleRecords)中调试该接口。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限及授权项说明](https://support.huaweicloud.com/api-dli/dli_02_0375.html)。
- 如果使用身份策略授权，需具备如下身份策略权限。
  
  | 授权项 Action | 访问级别 Access Level | 资源类型（\*为必须） Resource Type (\*: required) | 条件键 Condition Key                                                                                                                                                                                                                                                                                                                 | 别名 Alias | 依赖的授权项 Dependencies |
  |:---|:---|:---|:---|:---|:---|
  | dli:elasticresourcepool:scale           | Write                                           | elasticresourcepool \*                                                 | -                                                                                                                                                                                                                                                                                                                                                              | -                                      | -                                                 |
  | dli:elasticresourcepool:scale           | Write                                           | -                                                                      | - [g:EnterpriseProjectId](https://support.huaweicloud.com/usermanual-iam5/iam_01_1287.html)  - [g:ResourceTag/\<tag-key\>](https://support.huaweicloud.com/usermanual-iam5/iam_01_1287.html)   | -                                      | -                                                 |
     
  
 
#### URI
GET /v3/{project_id}/elastic-resource-pools/{elastic_resource_pool_name}/scale-records
表1路径参数 
| 参数                         | 是否必选 | 参数类型   | 描述                                                                                     |
|:---|:---|:---|:---|
| project_id                 | 是    | String | 项目编号，用于资源隔离。获取方式请参考[获取项目ID](https://support.huaweicloud.com/api-dli/dli_02_0183.html)。 |
| elastic_resource_pool_name | 是    | String | 弹性资源池名称。 长度限制：1\~128个字符。                                 |
   
表2Query参数 
| 参数         | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                 |
|:---|:---|:---|:---|
| start_time | 否    | Long    | start_time用于查询扩缩容历史的开始时间，该时间点需大于当前时间点减30天，必须小于end_time 。时间格式为unix时间戳，单位：毫秒。 - 若start_time为空，则查询end_time前七天到end_time的数据（end_time最大不能大于当前时间30天）。  - 查询当前时间点前15天到当前时间点的数据（start_time和end_time同时为空）。   |
| end_time   | 否    | Long    | end_time用于查询扩缩容历史的结束时间，该时间点不能小于开始时间，不能大于当前时间。时间格式为unix时间戳，单位：毫秒。 - 若end_time为空，则查询start_time到当前时间点的数据。  - 查询当前时间点前15天到当前时间的数据（start_time和end_time同时为空）。                                                      |
| status     | 否    | String  | 弹性资源池扩缩容的状态。 枚举值： - success  - fail                                                                                                                                          |
| offset     | 否    | Integer | 偏移量。 最小值：0                                                                                                                                                                                                                                                                                                                                                            |
| limit      | 否    | Integer | 当前分页条数。 最小值：0 最大值：100                                                                                                                                                                                                                                                                                                                 |
   
#### 请求参数
无
#### 响应参数
表3响应Body参数 
| 参数    | 参数类型            | 描述                                                       |
|:---|:---|:---|
| count | Integer         | 返回数组长度。                                                  |
| items | Array of arrays | 数组中返回的数据。详细说明请参考[表4]。 |
   
 表4items参数 
| 参数          | 参数类型    | 描述            |
|:---|:---|:---|
| max_cu      | Integer | 最大CU。         |
| min_cu      | Integer | 最小CU。         |
| current_cu  | Integer | 扩缩容后CU。       |
| origin_cu   | Integer | 扩缩容前CU。       |
| target_cu   | Integer | 扩缩容预期CU       |
| record_time | Long    | 操作完成时间。       |
| status      | String  | 扩缩容成功或者失败的状态。 |
| fail_reason | String  | 失败原因。         |
   
#### 请求示例
```
GET https://{endpoint}/v3/{project_id}/elastic-resource-pools/{elastic_resource_pool_name}/scale-records?start_time=1650784624000&end_time=1652625304002&status=&limit=20&offset=1
```
#### 响应示例
扩缩容历史记录查询接口查询成功
```
{ 
  "count" : 1, 
  "items" : [ { 
    "max_cu" : 64, 
    "min_cu" : 16, 
    "current_cu" : 16, 
    "target_cu" : 16, 
    "origin_cu" : 16, 
    "record_time" : 1650784624000, 
    "status" : "fail", 
    "fail_reason" : "Internal error, please contact technical support." 
  } ] 
}
```
#### 状态码
| 状态码 | 描述 |
|:---|:---|
| 200 | OK |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-dli/dli_02_0056.html)。
