
# 查询桌面池的脚本执行任务列表 - ShowDesktopPoolsScriptExecTasks
#### 功能介绍
桌面池的脚本执行任务列表。
#### 调试
您可以在[API Explorer](https://console.huaweicloud.com/apiexplorer/#/openapi/Workspace/doc?api=ShowDesktopPoolsScriptExecTasks)中调试该接口，支持自动认证鉴权。API Explorer可以自动生成SDK代码示例，并提供SDK代码示例调试功能。
#### 授权信息
账号具备所有API的调用权限，如果使用账号下的IAM用户调用当前API，该IAM用户需具备调用API所需的权限。
- 如果使用角色与策略授权，具体权限要求请参见[权限和授权项](https://support.huaweicloud.com/api-workspace/workspace_09_0128.html)。
- 如果使用身份策略授权，需具备如下身份策略权限。
  
  | 授权项                                    | 访问级别 | 资源类型（\*为必须）    | 条件键 | 别名 | 依赖的授权项 |
  |:---|:---|:---|:---|:---|:---|
  | workspace:desktopPools:listScriptTasks | List | desktopPool \* | -   | -  | -      |
     
  
 
#### URI
GET /v2/{project_id}/desktop-pools/script-execution-tasks/detail
表1路径参数 
| 参数         | 是否必选 | 参数类型   | 描述    |
|:---|:---|:---|:---|
| project_id | 是    | String | 项目ID。 |
   
表2Query参数 
| 参数                 | 是否必选 | 参数类型             | 描述                                                                   |
|:---|:---|:---|:---|
| desktop_pool_id    | 否    | String           | 桌面池id。                                                               |
| script_id          | 否    | String           | 脚本id。                                                                |
| script_name        | 否    | String           | 脚本名称。                                                                |
| status             | 否    | String           | 执行情况。SUCCESS：成功，FAILED：失败，RUNNING：执行中，WAITING：等待。                    |
| task_type          | 否    | String           | 查询的任务类型。支持SCRIPT、COMMAND。                                            |
| offset             | 否    | Integer          | 用于分页查询，查询的起始记录序号，从0开始。                                               |
| limit              | 否    | Integer          | 用于分页查询，返回桌面数量限制。取值范围0-100，默认值是10。                                    |
| execute_time_start | 否    | String           | 按执行时间查询的起始时间。指定该参数后，返回的结果为此时间之后的所有任务记录。时间格式如："2021-10-01T12:00:00Z"。 |
| execute_time_end   | 否    | String           | 按执行时间查询的终止时间。指定该参数后，返回的结果为此时间之前的所有任务记录。时间格式如："2021-10-01T12:00:00Z"。 |
| task_id            | 否    | Array of strings | 任务id。                                                                |
   
#### 请求参数
无
#### 响应参数
**状态码：200**
表3响应Body参数 
| 参数                     | 参数类型                                                                                                   | 描述        |
|:---|:---|:---|
| script_execution_tasks | Array of [ScriptExecutionTask] objects | 脚本执行任务列表。 |
| total_count            | Integer                                                                                                | 总数。       |
   
 表4ScriptExecutionTask 
| 参数                | 参数类型                                                                         | 描述                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         |
|:---|:---|:---|
| id                | String                                                                       | 任务id。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| desktop_pool_id   | String                                                                       | 桌面池id。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| desktop_pool_name | String                                                                       | 桌面池名称。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
| scripts           | Array of [Script] objects | 脚本信息列表。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| command_content   | String                                                                       | 执行的命令行。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| command_type      | String                                                                       | 命令行类型。 - POWERSHELL：WINDOWS系统使用。   - BAT：WINDOWS系统使用。   - SHELL：LINUX系统使用。                                                                                                                                                                          |
| start_time        | String                                                                       | 任务开始时间，格式为：yyyy-MM-ddTHH:mm:ssZ。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| end_time          | String                                                                       | 任务结束时间，格式为：yyyy-MM-ddTHH:mm:ssZ。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| status            | String                                                                       | 任务状态，值含： - FINISH：已完成。   - FAILED：失败。   - RUNNING：运行中。   - INIT： 初始化。    |
| success_num       | Integer                                                                      | 成功数量。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| failed_num        | Integer                                                                      | 失败数量。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| skip_num          | Integer                                                                      | 跳过数量。                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
   
 表5Script 
| 参数   | 参数类型   | 描述    |
|:---|:---|:---|
| id   | String | 脚本id。 |
| name | String | 脚本名称。 |
   
**状态码：400**
表6响应Body参数 
| 参数                            | 参数类型   | 描述                                                           |
|:---|:---|:---|
| error_code                    | String | 错误码，失败时返回。                                                   |
| error_msg                     | String | 错误描述。                                                        |
| error_detail                  | String | 错误详情。                                                        |
| encoded_authorization_message | String | 加密后的详细拒绝原因，用户可以自行调用STS服务的decode-authorization-message接口进行解密。 |
   
**状态码：401**
表7响应Body参数 
| 参数                            | 参数类型   | 描述                                                           |
|:---|:---|:---|
| error_code                    | String | 错误码，失败时返回。                                                   |
| error_msg                     | String | 错误描述。                                                        |
| error_detail                  | String | 错误详情。                                                        |
| encoded_authorization_message | String | 加密后的详细拒绝原因，用户可以自行调用STS服务的decode-authorization-message接口进行解密。 |
   
**状态码：403**
表8响应Body参数 
| 参数                            | 参数类型   | 描述                                                           |
|:---|:---|:---|
| error_code                    | String | 错误码，失败时返回。                                                   |
| error_msg                     | String | 错误描述。                                                        |
| error_detail                  | String | 错误详情。                                                        |
| encoded_authorization_message | String | 加密后的详细拒绝原因，用户可以自行调用STS服务的decode-authorization-message接口进行解密。 |
   
**状态码：404**
表9响应Body参数 
| 参数                            | 参数类型   | 描述                                                           |
|:---|:---|:---|
| error_code                    | String | 错误码，失败时返回。                                                   |
| error_msg                     | String | 错误描述。                                                        |
| error_detail                  | String | 错误详情。                                                        |
| encoded_authorization_message | String | 加密后的详细拒绝原因，用户可以自行调用STS服务的decode-authorization-message接口进行解密。 |
   
**状态码：500**
表10响应Body参数 
| 参数                            | 参数类型   | 描述                                                           |
|:---|:---|:---|
| error_code                    | String | 错误码，失败时返回。                                                   |
| error_msg                     | String | 错误描述。                                                        |
| error_detail                  | String | 错误详情。                                                        |
| encoded_authorization_message | String | 加密后的详细拒绝原因，用户可以自行调用STS服务的decode-authorization-message接口进行解密。 |
   
#### 请求示例
```
GET /v2/0bec5db98280d2d02fd6c00c2de791ce/desktops-pools/script-execution-tasks/detail
```
#### 响应示例
**状态码：200**
正常。
```
{
  "script_execution_tasks" : [ {
    "id" : "string",
    "desktop_pool_id" : "string",
    "desktop_pool_name" : "string",
    "scripts" : [ {
      "id" : "string",
      "name" : "string"
    } ],
    "command_content" : "string",
    "command_type" : "string",
    "start_time" : "string",
    "end_time" : "string",
    "status" : "string",
    "success_num" : 0,
    "failed_num" : 0,
    "skip_num" : 0
  } ],
  "total_count" : 0
}
```
#### 状态码
| 状态码 | 描述                      |
|:---|:---|
| 200 | 正常。                     |
| 400 | 由于包含语法错误，当前请求无法被服务器理解。  |
| 401 | 鉴权失败。                   |
| 403 | 没有操作权限。                 |
| 404 | 找不到资源。                  |
| 500 | 服务内部错误，具体返回错误码请参见错误码说明。 |
   
#### 错误码
请参见[错误码](https://support.huaweicloud.com/api-workspace/ErrorCode.html)。
