调用DescribeInvocations查询云助手脚本的执行列表和状态。

接口说明

  • 当您执行命令后,不代表命令一定成功执行,并且一定有预期的命令效果。您需要通过接口返回值来查看实际执行结果,以实际输出结果为准。
  • 您可以查询最近2周的执行信息,执行信息的保留上限为10万条。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求参数

名称 类型 是否必选 示例值 描述
Action String DescribeInvocations

系统规定参数。取值:DescribeInvocations。

RegionId String cn-hangzhou

地域ID。

InvokeId String t-hz0jdfwd9f****

脚本进程执行ID。

CommandType String RunPowerShellScript

脚本类型。取值范围:

  • RunBatScript
  • RunPowerShellScript
InvokeStatus String Finished

脚本执行的总执行状态。总执行状态取决于创建执行中的一台或多台云桌面的共同执行状态。取值范围:

  • Running:一旦有进行中的脚本进程,总的执行状态就为进行中。
  • Finished:所有云桌面全部完成执行。或者手动停止部分云桌面的脚本进程,其余云桌面全部执行完成。
  • Failed:所有云桌面全部执行失败。
  • PartialFailed:部分云桌面有执行失败的脚本进程,则总执行状态为部分失败。
  • Stopped:停止执行脚本。

默认值:Running。

DesktopId String ecd-7w78ozhjcwa3u****

云桌面ID。如果指定了云桌面,则查询该桌面所有的脚本执行记录。

IncludeOutput Boolean false

是否在结果中返回脚本运行的输出信息。取值范围:

  • true:返回。
  • false:不返回。

默认值:false。

ContentEncoding String PlainText

返回数据的编码方式。取值范围:

  • PlainText:返回原始脚本内容和输出信息。
  • Base64:返回Base64编码后的脚本内容和输出信息。

默认值:Base64。

MaxResults Integer 10

分页查询时每页行数。

默认值:100。

NextToken String AAAAAV3MpHK1AP0pfERHZN5pu6nmB7qrRFJ8vmttjxPL****

查询凭证(Token),取值为上一次API调用返回的NextToken参数值。

返回数据

名称 类型 示例值 描述
Invocations Array of Invocation

脚本执行记录信息集合。

CommandContent String cnBtIC1xYSB8IGdyZXAgdnNm****

脚本内容,以Base64编码后传输。

CommandType String RunPowerShellScript

脚本类型。

CreationTime String 2020-12-19T09:15:46Z

任务的创建时间。

InvocationStatus String Pending

脚本执行的总执行状态,总执行状态取决于本次调用的全部云桌面的共同执行状态,可能值:

  • Pending:系统正在校验或发送命令。存在至少一台云桌面的脚本执行状态为Pending,则总执行状态为Pending。
  • Running:命令正在云桌面上运行。存在至少一台云桌面的脚本执行状态为Running,则总执行状态为Running。
  • Success:各个云桌面上的脚本执行状态均为Stopped或Success,且至少一个云桌面的脚本执行状态是Success,则总执行状态为Success。
  • Failed:各个云桌面上的脚本执行状态均为Stopped或Failed,则总执行状态为Failed。云桌面上的脚本执行状态一项或多项为以下状态时,返回值均为Failed状态:
    • 命令校验失败(Invalid)
    • 命令发送失败(Aborted)
    • 命令执行完成但退出码非0(Failed)
    • 命令执行超时(Timeout)
    • 命令执行异常(Error)
  • Stopping:正在停止任务。存在至少一台实例的脚本执行状态为Stopping,则总执行状态为Stopping。
  • Stopped:任务已停止。所有实例的脚本执行状态是Stopped,则总执行状态为Stopped。实例上的脚本执行状态为以下状态时,返回值均为Stopped状态:
    • 任务已取消(Cancelled)
    • 任务已终止(Terminated)
  • PartialFailed:部分实例执行成功且部分实例执行失败。各个实例的脚本执行状态均为Success、Failed或Stopped,则总执行状态为PartialFailed。
InvokeDesktops Array of InvokeDesktop

执行目标云桌面集合。

CreationTime String 2020-12-20T06:15:54Z

脚本进程的创建时间。

DesktopId String ecd-7w78ozhjcwa3u****

云桌面ID。

Dropped Integer 0

Output字段中文字长度超出24 KB后,截断丢弃的文字长度。

ErrorCode String InstanceNotExists

命令的下发失败或执行失败原因的代码,可能值:

  • 空:命令运行正常。
  • InstanceNotExists:指定的云桌面不存在或已释放。
  • InstanceReleased:执行任务期间,该云桌面被释放。
  • InstanceNotRunning:创建任务时,该云桌面不在运行中。
  • CommandNotApplicable:命令不适用于指定的云桌面。
  • ClientNotRunning:云助手客户端未运行。
  • ClientNotResponse:云助手客户端无响应。
  • ClientIsUpgrading:云助手客户端正在升级中。
  • ClientNeedUpgrade:云助手客户端需要升级。
  • DeliveryTimeout:发送命令超时。
  • ExecutionTimeout:命令运行超时。
  • ExecutionException:命令运行发生异常。
  • ExecutionInterrupted:命令运行任务中断。
  • ExitCodeNonzero:命令执行结束,退出码非0。
ErrorInfo String the specified instance does not exists

命令的下发失败或执行失败原因的详情,可能值:

  • 空:命令运行正常。
  • the specified instance does not exists:指定的云桌面不存在或已释放。
  • the instance has released when create task:执行任务期间,该云桌面被释放。
  • the instance is not running when create task:创建任务时,该云桌面不在运行中。
  • the command is not applicable:命令不适用于指定的云桌面。
  • the aliyun service is not running on the instance:云助手客户端未运行。
  • the aliyun service in the instance does not response:云助手客户端无响应。
  • the aliyun service in the instance is upgrading now:云助手客户端正在升级中。
  • the aliyun service in the instance need upgrade:云助手客户端需要升级。
  • the command delivery has been timeout:发送命令超时。
  • the command execution has been timeout:命令运行超时。
  • the command execution got an exception:命令运行发生异常。
  • the command execution has been interrupted:命令运行任务中断。
  • the command execution exit code is not zero:命令执行结束,退出码非0。
ExitCode Long 0

脚本进程的退出代码。

FinishTime String 2020-12-20T06:15:56Z

脚本进程的结束时间。

InvocationStatus String Success

单台云桌面的脚本进度状态。

Output String OutPutTestmsg

脚本进程的输出信息。

Repeats Integer 0

命令在该桌面上执行的次数。

StartTime String 2020-12-20T06:15:55Z

脚本进程在桌面中开始执行的时间。

StopTime String 2020-12-25T09:15:47Z

如果调用了stopInvocation,表示调用的时间。

UpdateTime String 2020-12-25T06:15:56Z

任务状态的更新时间。

InvokeId String t-hz0jdfwd9f****

执行ID。

NextToken String AAAAAV3MpHK1AP0pfERHZN5pu6nmB7qrRFJ8vmttjxPL****

本次调用返回的查询凭证值。

RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

请求ID。

示例

请求示例

https://ecd.cn-hangzhou.aliyuncs.com/?Action=DescribeInvocations
&RegionId=cn-hangzhou
&<公共请求参数>

正常返回示例

XML 格式

<DescribeInvocationsResponse>
      <NextToken>AAAAAV3MpHK1AP0pfERHZN5pu6nmB7qrRFJ8vmttjxPL****</NextToken>
      <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
      <Invocations>
            <CreationTime>2020-12-19T09:15:46Z</CreationTime>
            <CommandContent>cnBtIC1xYSB8IGdyZXAgdnNm****</CommandContent>
            <InvocationStatus>Pending</InvocationStatus>
            <CommandType>RunPowerShellScript</CommandType>
            <InvokeId>t-hz0jdfwd9f****</InvokeId>
      </Invocations>
      <Invocations>
            <InvokeDesktops>
                  <Dropped>0</Dropped>
                  <InvocationStatus>Success</InvocationStatus>
                  <ErrorInfo>the specified instance does not exists</ErrorInfo>
                  <ExitCode>0</ExitCode>
                  <StartTime>2020-12-20T06:15:55Z</StartTime>
                  <DesktopId>ecd-7w78ozhjcwa3u****</DesktopId>
                  <Repeats>0</Repeats>
                  <FinishTime>2020-12-20T06:15:56Z</FinishTime>
                  <Output>OutPutTestmsg</Output>
                  <UpdateTime>2020-12-25T06:15:56Z</UpdateTime>
                  <CreationTime>2020-12-20T06:15:54Z</CreationTime>
                  <ErrorCode>InstanceNotExists</ErrorCode>
                  <StopTime>2020-12-25T09:15:47Z</StopTime>
            </InvokeDesktops>
      </Invocations>
</DescribeInvocationsResponse>

JSON 格式

{
	"NextToken": "AAAAAV3MpHK1AP0pfERHZN5pu6nmB7qrRFJ8vmttjxPL****",
	"RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
	"Invocations": [{
		"CreationTime": "2020-12-19T09:15:46Z",
		"CommandContent": "cnBtIC1xYSB8IGdyZXAgdnNm****",
		"InvocationStatus": "Pending",
		"CommandType": "RunPowerShellScript",
		"InvokeId": "t-hz0jdfwd9f****"
	}, {
		"InvokeDesktops": [{
			"Dropped": "0",
			"InvocationStatus": "Success",
			"ErrorInfo": "the specified instance does not exists",
			"ExitCode": "0",
			"StartTime": "2020-12-20T06:15:55Z",
			"DesktopId": "ecd-7w78ozhjcwa3u****",
			"Repeats": "0",
			"FinishTime": "2020-12-20T06:15:56Z",
			"Output": "OutPutTestmsg",
			"UpdateTime": "2020-12-25T06:15:56Z",
			"CreationTime": "2020-12-20T06:15:54Z",
			"ErrorCode": "InstanceNotExists",
			"StopTime": "2020-12-25T09:15:47Z"
		}]
	}]
}

错误码

访问错误中心查看更多错误码。