
# 查询迁移任务列表 - ListTasks
#### 功能介绍
在设置目的端后，主机迁移服务会自动创建迁移任务，使用该接口可以查询迁移任务列表。
#### 调用方法
请参见[如何调用API](https://support.huaweicloud.com/api-sms/sms_api_0007.html)。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-sms/sms_api_8001.html)。
- 如果使用身份策略授权，需具备如下身份策略权限。
  
  | 授权项                 | 访问级别 | 资源类型（\*为必须） | 条件键                   | 别名                     | 依赖的授权项 |
  |:---|:---|:---|:---|:---|:---|
  | sms:server:listTask | List | server \*   | -                     | sms:server:queryServer | -      |
  | sms:server:listTask | List | -           | g:EnterpriseProjectId | sms:server:queryServer | -      |
     
  
 
#### URI
GET /v3/tasks
表1Query参数 
| 参数                    | 是否必选 | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
|:---|:---|:---|:---|
| state                 | 否    | String  | 迁移任务状态 READY:准备就绪 RUNNING:迁移中 SYNCING:同步中 MIGRATE_SUCCESS:迁移成功 MIGRATE_FAIL:迁移失败 ABORTING:中止中 ABORT:中止 DELETING::删除中 SYNC_F_ROLLBACKING:同步失败回滚中 SYNC_F_ROLLBACK_SUCCESS:同步失败回滚成功 枚举值： - **READY**   - **RUNNING**   - **SYNCING**   - **MIGRATE_SUCCESS**   - **MIGRATE_FAIL**   - **ABORTING**   - **ABORT**   - **DELETING**   - **SYNC_F_ROLLBACKING**   - **SYNC_F_ROLLBACK_SUCCESS**    |
| name                  | 否    | String  | 任务的名称 最小长度：**0** 最大长度：**255**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| id                    | 否    | String  | 任务的ID 最小长度：**1** 最大长度：**36**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| source_server_id      | 否    | String  | 源端服务器的ID 最小长度：**1** 最大长度：**36**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| limit                 | 否    | Integer | 每一页记录的任务数量 最小值：**0** 最大值：**200** 缺省值：**100**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| offset                | 否    | Integer | 偏移量 最小值：**0** 最大值：**65535** 缺省值：**0**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| enterprise_project_id | 否    | String  | 需要查询的企业项目ID 最小长度：**0** 最大长度：**255**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
   
#### 请求参数
表2请求Header参数 
| 参数           | 是否必选 | 参数类型   | 描述                                                                                                                                                                         |
|:---|:---|:---|:---|
| X-Auth-Token | 是    | String | 用户Token。 通过调用IAM服务获取用户Token接口获取(响应消息头中X-Subject-Token的值)。 最小长度：**1** 最大长度：**16384** |
   
#### 响应参数
**状态码：200**
表3响应Body参数 
| 参数    | 参数类型                                                                         | 描述                                                                                                      |
|:---|:---|:---|
| count | Integer                                                                      | 符合要求的任务数量，不受分页影响 最小值：**0** 最大值：**2147483647** |
| tasks | Array of [TasksResponseBody] objects | 查询到的任务列表 数组长度：**0 - 65535**                                                |
   
 表4TasksResponseBody 
| 参数                     | 参数类型                                                                                         | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
|:---|:---|:---|
| id                     | String                                                                                       | 迁移任务ID 最小长度：**0** 最大长度：**255**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| name                   | String                                                                                       | 任务名称（用户自定义） 最小长度：**0** 最大长度：**255**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| type                   | String                                                                                       | 任务类型，创建时必选，更新时可选 MIGRATE_FILE:文件级迁移 MIGRATE_BLOCK:块级迁移 最小长度：**0** 最大长度：**255** 枚举值： - **MIGRATE_FILE**   - **MIGRATE_BLOCK**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| os_type                | String                                                                                       | 操作系统类型，分为WINDOWS和LINUX，创建时必选，更新时可选 最小长度：**0** 最大长度：**255** 枚举值： - **WINDOWS**   - **LINUX**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| state                  | String                                                                                       | 迁移任务状态 READY: 准备就绪 RUNNING: 迁移中 SYNCING: 同步中 MIGRATE_SUCCESS: 迁移成功 SYNC_SUCCESS: 同步成功 MIGRATE_FAIL: 失败 SYNC_FAIL: 同步失败 ABORTING: 中止中 ABORT: 中止 SKIPPING: 跳过中 DELETING: 删除中 RESETING: 回滚中 枚举值： - **READY**   - **RUNNING**   - **SYNCING**   - **MIGRATE_SUCCESS**   - **SYNC_SUCCESS**   - **MIGRATE_FAIL**   - **SYNC_FAIL**   - **ABORTING**   - **ABORT**   - **SKIPPING**   - **DELETING**   - **RESETING**    |
| estimate_complete_time | Long                                                                                         | 预估完成时间 最小值：**0** 最大值：**9223372036854775807**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| create_date            | Long                                                                                         | 任务创建时间 最小值：**0** 最大值：**9223372036854775807**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| priority               | Integer                                                                                      | 进程优先级 0：低 1：标准 2：高 最小值：**0** 最大值：**2** 枚举值： - **0**   - **1**   - **2**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| speed_limit            | Integer                                                                                      | 迁移限速 最小值：**0** 最大值：**65535**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| migrate_speed          | Double                                                                                       | 迁移速率，单位：Mbit/s 最小值：**0** 最大值：**10000**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| compress_rate          | Double                                                                                       | 压缩率 最小值：**0** 最大值：**10000**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| start_target_server    | Boolean                                                                                      | 迁移完成后是否启动目的端服务器 true：启动 false：停止 缺省值：**false**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| error_json             | String                                                                                       | 错误信息 最小长度：**0** 最大长度：**1024**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| total_time             | Long                                                                                         | 任务总耗时 最小值：**0** 最大值：**9223372036854775807**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| migration_ip           | String                                                                                       | 目的端服务器的IP地址。 公网迁移时请填写弹性IP地址 专线迁移时请填写私有IP地址 最小长度：**0** 最大长度：**255**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| sub_tasks              | Array of [SubTaskAssociatedWithTask] objects | 任务关联的子任务信息 数组长度：**0 - 65535**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| source_server          | [SourceServerAssociatedWithTask] object | 任务关联的源端信息                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| enterprise_project_id  | String                                                                                       | 迁移项目ID 最小长度：**0** 最大长度：**255**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| target_server          | [TargetServerAssociatedWithTask] object | 任务关联的目的端信息                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| log_collect_status     | String                                                                                       | 日志收集状态 INIT:就绪 UPLOADING:上传中 UPLOAD_FAIL:上传失败 UPLOADED:已上传 枚举值： - **INIT**   - **UPLOADING**   - **UPLOAD_FAIL**   - **UPLOADED**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| clone_server           | [CloneServerBrief] object                             | 克隆服务器基本信息                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
| syncing                | Boolean                                                                                      | 是否同步                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| network_check_info     | [NetworkCheckInfoRequestBody] object       | 网络检测相关信息                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| special_config         | Array of [ConfigBody] objects                               | 特殊配置项配置信息 数组长度：**0 - 1000**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| total_cpu_usage        | Double                                                                                       | 主机的CPU使用率，单位是百分比 最小值：**0** 最大值：**100**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| agent_cpu_usage        | Double                                                                                       | Agent的CPU使用率，单位是百分比 最小值：**0** 最大值：**100**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| total_mem_usage        | Double                                                                                       | 主机的内存使用值，单位是MB 最小值：**0** 最大值：**1048576.0**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| agent_mem_usage        | Double                                                                                       | Agent的内存使用值，单位是MB 最小值：**0** 最大值：**1048576.0**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| total_disk_io          | Double                                                                                       | 主机的磁盘I/O值，单位是Mbit/s 最小值：**0** 最大值：**10000.0**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| agent_disk_io          | Double                                                                                       | Agent的磁盘I/O值，单位是Mbit/s 最小值：**0** 最大值：**10000.0**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| need_migration_test    | Boolean                                                                                      | 是否开启迁移演练                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| subtask_info           | String                                                                                       | 当前子任务及进度 最小长度：**0** 最大长度：**255**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
   
 表5SubTaskAssociatedWithTask 
| 参数            | 参数类型    | 描述                                                                                                                      |
|:---|:---|:---|
| id            | Long    | 子任务ID 最小值：**0** 最大值：**9223372036854775807**                   |
| name          | String  | 子任务名称 最小长度：**0** 最大长度：**255**                                 |
| progress      | Integer | 子任务的进度，取值为0-100之间的整数 最小值：**0** 最大值：**100**                    |
| start_date    | Long    | 子任务开始时间 最小值：**0** 最大值：**9223372036854775807**                 |
| end_date      | Long    | 子任务结束时间（如果子任务还没有结束，则为空） 最小值：**0** 最大值：**9223372036854775807** |
| process_trace | String  | 迁移或同步时，具体的迁移详情 最小长度：**0** 最大长度：**2048**                       |
   
 表6SourceServerAssociatedWithTask 
| 参数         | 参数类型    | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
|:---|:---|:---|
| id         | String  | 源端在SMS数据库中的ID 最小长度：**0** 最大长度：**255**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ip         | String  | 源端服务器ip，注册源端时必选，更新非必选 最小长度：**0** 最大长度：**255**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| name       | String  | 用来区分不同源端服务器的名称 最小长度：**0** 最大长度：**255**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| os_type    | String  | 源端服务器的OS类型，分为Windows和Linux，注册必选，更新非必选 最小长度：**0** 最大长度：**255** 枚举值： - **WINDOWS**   - **LINUX**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          |
| os_version | String  | 操作系统版本，注册必选，更新非必选 最小长度：**0** 最大长度：**255**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| oem_system | Boolean | 是否是OEM操作系统(Windows)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| state      | String  | 当前源端服务器状态 unavailable：环境校验不通过 waiting：等待 initialize：初始化 replicate：复制 syncing：持续同步 stopping：暂停中 stopped：已暂停 skipping：跳过中 deleting：删除中 clearing: 清理快照资源中 cleared：清理快照资源完成 clearfailed：清理快照资源失败 premigready：迁移演练就绪 premiged：迁移演练完成 premigfailed：迁移演练失败 cloning：等待克隆完成 cutovering：启动目的端中 finished：启动目的端完成 error：错误 枚举值： - **unavailable**   - **waiting**   - **initialize**   - **replicate**   - **syncing**   - **stopping**   - **stopped**   - **skipping**   - **deleting**   - **clearing**   - **cleared**   - **clearfailed**   - **premigready**   - **premiged**   - **premigfailed**   - **cloning**   - **cutovering**   - **finished**   - **error**    |
   
 表7TargetServerAssociatedWithTask 
| 参数         | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
|:---|:---|:---|
| id         | String | 目的端在SMS数据库中的ID 最小长度：**0** 最大长度：**255**                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| vm_id      | String | 目的端虚机ID 最小长度：**0** 最大长度：**255**                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| name       | String | 目的端服务器名称 最小长度：**0** 最大长度：**255**                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ip         | String | 目的端服务器IP 最小长度：**0** 最大长度：**255**                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| os_type    | String | 目的端服务器的OS类型 WINDOWS:WINDOWS系统 LINUX:LINUX系统 最小长度：**0** 最大长度：**255** 枚举值： - **WINDOWS**   - **LINUX**    |
| os_version | String | 操作系统版本 最小长度：**0** 最大长度：**255**                                                                                                                                                                                                                                                                                                                                                                                                                                             |
   
 表8CloneServerBrief 
| 参数    | 参数类型   | 描述                                                                                         |
|:---|:---|:---|
| vm_id | String | 克隆服务器ID 最小长度：**0** 最大长度：**255**  |
| name  | String | 克隆虚拟机的名称 最小长度：**0** 最大长度：**255** |
   
 表9NetworkCheckInfoRequestBody 
| 参数                       | 参数类型    | 描述                                                                                             |
|:---|:---|:---|
| domain_connectivity      | Boolean | 域名连通性                                                                                          |
| destination_connectivity | Boolean | 目的端连通性                                                                                         |
| network_delay            | Double  | 网络时延（ms） 最小值：**0** 最大值：**10000.0**   |
| network_jitter           | Double  | 网络抖动（ms） 最小值：**0** 最大值：**10000**     |
| migration_speed          | Double  | 带宽速率（Mbit/s） 最小值：**0** 最大值：**10000** |
| loss_percentage          | Double  | 丢包率（%） 最小值：**0** 最大值：**100**         |
| cpu_usage                | Double  | CPU占用率（%） 最小值：**0** 最大值：**100**      |
| mem_usage                | Double  | 内存占用率（%） 最小值：**0** 最大值：**100**       |
| evaluation_result        | String  | 评估结果 最小长度：**5** 最大长度：**9**           |
   
 表10ConfigBody 
| 参数            | 参数类型   | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             |
|:---|:---|:---|
| config_key    | String | 配置类型 MIGRATE_EXCLUDE_DIR: 迁移时设定的不迁移目录 SYNC_EXCLUDE_DIR: 同步时设定的不同步目录 ONLY_SYNC_DIR: 同步时设定的同步目录 CONSISTENCY_DIR: 一致性校验的目录 CONSISTENCY_DIR_ILLEGAL: 一致性校验后非法目录 LINUX_BLOCK_COMPRESS_THREAD_NUM: linux块迁移压缩线程个数 MIGRATE_DST_IP: 迁移目的ip LINUX_BLOCK_CACHE_SIZE: linux块迁移缓存大小 LINUX_CPU_LIMIT: linux的cpu限制 LINUX_MEM_LIMIT: linux的内存限制 LINUX_IO_LIMIT: linux的IO限制 NUM_PROCESS_MIGRATE: 迁移进程数 NUM_PROCESS_SYNC: 同步进程数 CONSISTENCY_RECHECK: 一致性校验再检 CONSISTENCY_MODE: 一致性校验模式 DYNAMIC_PORT: 动态端口 INSTALL_PWD_AGENT: 是否安装密码重置插件，取值"true"表示安装，默认为"true" 枚举值： - **MIGRATE_EXCLUDE_DIR**   - **SYNC_EXCLUDE_DIR**   - **ONLY_SYNC_DIR**   - **CONSISTENCY_DIR**   - **CONSISTENCY_DIR_ILLEGAL**   - **LINUX_BLOCK_COMPRESS_THREAD_NUM**   - **MIGRATE_DST_IP**   - **LINUX_BLOCK_CACHE_SIZE**   - **LINUX_CPU_LIMIT**   - **LINUX_MEM_LIMIT**   - **LINUX_IO_LIMIT**   - **NUM_PROCESS_MIGRATE**   - **NUM_PROCESS_SYNC**   - **CONSISTENCY_RECHECK**   - **CONSISTENCY_MODE**   - **DYNAMIC_PORT**    |
| config_value  | String | 具体配置参数字段，保存于数据库，最终在agent端进行解析 最小长度：**0** 最大长度：**1024**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               |
| config_status | String | 描述配置状态的保留字段 最小长度：**0** 最大长度：**255**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  |
   
**状态码：403**
表11响应Body参数 
| 参数                            | 参数类型                                                     | 描述                                                                                                                                    |
|:---|:---|:---|
| error_code                    | String                                                   | 错误代码 最小长度：**0** 最大长度：**255**                                                |
| error_msg                     | String                                                   | 错误信息 最小长度：**0** 最大长度：**255**                                                |
| encoded_authorization_message | String                                                   | 加密授权信息 最小长度：**0** 最大长度：**65535**                                            |
| error_param                   | Array of strings                                         | 错误参数 最小长度：**0** 最大长度：**65535** 数组长度：**1 - 20** |
| details                       | Array of [details] objects | 详细错误信息 数组长度：**1 - 20**                                                                                   |
   
 表12details 
| 参数         | 参数类型   | 描述                                                                                          |
|:---|:---|:---|
| error_code | String | SMS错误代码 最小长度：**0** 最大长度：**65535** |
| error_msg  | String | SMS错误信息 最小长度：**0** 最大长度：**65535** |
   
#### 请求示例
查询迁移任务列表
```
GET https://{endpoint}/v3/tasks
```
#### 响应示例
**状态码：200**
查询迁移任务列表成功
```
{
  "count" : 3,
  "tasks" : [ {
    "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
    "name" : "sms_task_lxxxx11",
    "type" : "MIGRATE_FILE",
    "os_type" : "LINUX",
    "state" : "MIGRATE_SUCCESS",
    "estimate_complete_time" : null,
    "create_date" : 1585139506000,
    "priority" : 1,
    "speed_limit" : 0,
    "migrate_speed" : 0,
    "start_target_server" : true,
    "error_json" : "",
    "total_time" : 3878000,
    "migration_ip" : "",
    "source_server" : {
      "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "ip" : "192.168.*.107",
      "name" : "xxx-linux-1",
      "os_type" : "LINUX",
      "os_version" : "CENTOS_7_6_64BIT",
      "oem_system" : false,
      "state" : "waiting"
    },
    "target_server" : {
      "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "vm_id" : "",
      "name" : "",
      "ip" : null,
      "os_type" : "LINUX",
      "os_version" : null
    },
    "log_collect_status" : "INIT"
  }, {
    "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
    "name" : "sms_task_xxx22",
    "type" : "MIGRATE_BLOCK",
    "os_type" : "WINDOWS",
    "state" : "MIGRATE_SUCCESS",
    "estimate_complete_time" : null,
    "create_date" : 1585138569000,
    "priority" : 1,
    "speed_limit" : 0,
    "migrate_speed" : 0,
    "start_target_server" : true,
    "error_json" : "",
    "total_time" : 10824000,
    "migration_ip" : "",
    "source_server" : {
      "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "ip" : "192.168.*.245",
      "name" : "xxx-windows-2",
      "os_type" : "WINDOWS",
      "os_version" : "WINDOWS2012_R2_64BIT",
      "oem_system" : false,
      "state" : "waiting"
    },
    "target_server" : {
      "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "vm_id" : "",
      "name" : "",
      "ip" : null,
      "os_type" : "WINDOWS",
      "os_version" : "WINDOWS2012_R2_64BIT"
    },
    "log_collect_status" : "INIT"
  }, {
    "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
    "name" : "sms_task_leddesktop",
    "type" : "MIGRATE_BLOCK",
    "os_type" : "WINDOWS",
    "state" : "MIGRATE_SUCCESS",
    "estimate_complete_time" : null,
    "create_date" : 1566130392000,
    "priority" : 1,
    "speed_limit" : 200,
    "migrate_speed" : 0,
    "start_target_server" : true,
    "error_json" : "",
    "total_time" : 882000,
    "migration_ip" : "192.168.1.201",
    "source_server" : null,
    "target_server" : {
      "id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "vm_id" : "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx0001",
      "name" : "xxx-sms-target",
      "ip" : null,
      "os_type" : "WINDOWS",
      "os_version" : "WINDOWS2008_R2_64BIT"
    },
    "log_collect_status" : "INIT"
  } ]
}
```
**状态码：403**
鉴权失败
```
{
  "error_code" : "SMS.9004",
  "error_msg" : "The current account does not have the permission to execute policy. You do not have permission to perform action XXX on resource XXX.",
  "encoded_authorization_message" : "XXXXXX",
  "error_param" : [ "You do not have permission to perform action XXX on resource XXX." ],
  "details" : [ {
    "error_code" : "SMS.9004",
    "error_msg" : "You do not have permission to perform action XXX on resource XXX."
  } ]
}
```
#### SDK代码示例
SDK代码示例如下。
- [Java]
  ```
  package com.huaweicloud.sdk.test;
  import com.huaweicloud.sdk.core.auth.ICredential;
  import com.huaweicloud.sdk.core.auth.GlobalCredentials;
  import com.huaweicloud.sdk.core.exception.ConnectionException;
  import com.huaweicloud.sdk.core.exception.RequestTimeoutException;
  import com.huaweicloud.sdk.core.exception.ServiceResponseException;
  import com.huaweicloud.sdk.sms.v3.region.SmsRegion;
  import com.huaweicloud.sdk.sms.v3.*;
  import com.huaweicloud.sdk.sms.v3.model.*;
  public class ListTasksSolution {
      public static void main(String[] args) {
          // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
          // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
          String ak = System.getenv("CLOUD_SDK_AK");
          String sk = System.getenv("CLOUD_SDK_SK");
          ICredential auth = new GlobalCredentials()
                  .withAk(ak)
                  .withSk(sk);
          SmsClient client = SmsClient.newBuilder()
                  .withCredential(auth)
                  .withRegion(SmsRegion.valueOf("<YOUR REGION>"))
                  .build();
          ListTasksRequest request = new ListTasksRequest();
          try {
              ListTasksResponse response = client.listTasks(request);
              System.out.println(response.toString());
          } catch (ConnectionException e) {
              e.printStackTrace();
          } catch (RequestTimeoutException e) {
              e.printStackTrace();
          } catch (ServiceResponseException e) {
              e.printStackTrace();
              System.out.println(e.getHttpStatusCode());
              System.out.println(e.getRequestId());
              System.out.println(e.getErrorCode());
              System.out.println(e.getErrorMsg());
          }
      }
  }
  ```
- [Python]
  ```
  # coding: utf-8
  import os
  from huaweicloudsdkcore.auth.credentials import GlobalCredentials
  from huaweicloudsdksms.v3.region.sms_region import SmsRegion
  from huaweicloudsdkcore.exceptions import exceptions
  from huaweicloudsdksms.v3 import *
  if __name__ == "__main__":
      # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
      # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
      ak = os.environ["CLOUD_SDK_AK"]
      sk = os.environ["CLOUD_SDK_SK"]
      credentials = GlobalCredentials(ak, sk)
      client = SmsClient.new_builder() \
          .with_credentials(credentials) \
          .with_region(SmsRegion.value_of("<YOUR REGION>")) \
          .build()
      try:
          request = ListTasksRequest()
          response = client.list_tasks(request)
          print(response)
      except exceptions.ClientRequestException as e:
          print(e.status_code)
          print(e.request_id)
          print(e.error_code)
          print(e.error_msg)
  ```
- [Go]
  ```
  package main
  import (
  "fmt"
  "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/global"
      sms "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/sms/v3"
  "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/sms/v3/model"
      region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/sms/v3/region"
  )
  func main() {
      // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security.
      // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment
      ak := os.Getenv("CLOUD_SDK_AK")
      sk := os.Getenv("CLOUD_SDK_SK")
      auth, err := global.NewCredentialsBuilder().
          WithAk(ak).
          WithSk(sk).
          SafeBuild()
      if err != nil {
          fmt.Println(err)
          return
      }
      hcClient, err := sms.SmsClientBuilder().
           WithRegion(region.ValueOf("<YOUR REGION>")).
           WithCredential(auth).
           SafeBuild()
      if err != nil {
          fmt.Println(err)
          return
      }
      client := sms.NewSmsClient(hcClient)
      request := &model.ListTasksRequest{}
  response, err := client.ListTasks(request)
  if err == nil {
          fmt.Printf("%+v\n", response)
      } else {
          fmt.Println(err)
      }
  }
  ```
- [更多]
  更多编程语言的SDK代码示例，请参见[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/SMS/sdk?api=ListTasks)的代码示例页签，可生成自动对应的SDK代码示例。
#### 状态码
| 状态码 | 描述         |
|:---|:---|
| 200 | 查询迁移任务列表成功 |
| 403 | 鉴权失败       |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-sms/ErrorCode.html)。
