查询命令助手执行命令的列表和状态。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
swas-open:DescribeCommandInvocations |
get |
*全部资源
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| RegionId |
string |
是 |
地域 ID。您可以调用 ListRegions 查询可用地域。 |
cn-hangzhou |
| InstanceId |
string |
否 |
指定的轻量应用服务器的实例 ID。 |
ace0706b2ac4454d984295a94213**** |
| CommandId |
string |
否 |
命令 ID。您可以通过接口 DescribeCommands 查询所有可用的 CommandId。 |
c-sh02yh0932w**** |
| InvokeId |
string |
否 |
命令执行 ID。 |
t-hz02p9545t6**** |
| CommandName |
string |
否 |
命令名称。如果同时设置了 InstanceId 参数,则该参数不生效。 |
testName |
| InvocationStatus |
string |
否 |
命令执行的总执行状态,总执行状态取决于本次调用的全部实例的共同执行状态,可能值:
说明
返回参数中的 |
Success |
| CommandType |
string |
否 |
命令类型。可能值:
|
RunPowerShellScript |
| PageNumber |
string |
否 |
当前页码。起始值:1。默认值:1。 |
1 |
| PageSize |
string |
否 |
分页查询时设置的每页行数。 最大值:50。 默认值:10。 |
10 |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
Schema of Response |
||
| RequestId |
string |
请求 ID。 |
30637AD6-D977-4833-A54C-CC89483E**** |
| TotalCount |
integer |
总条数。 |
10 |
| PageNumber |
integer |
查询结果的页码。 |
1 |
| PageSize |
integer |
分页查询时设置的每页行数。 |
10 |
| CommandInvocations |
array<object> |
命令执行列表。 |
|
|
array<object> |
命令执行信息结构体。 |
||
| InvokeId |
string |
命令执行 ID。 |
t-hz0373jyzxt**** |
| CreationTime |
string |
命令创建时间,格式为 YYYY-MM-DDThh:mm:ss。 |
2023-04-27T10:11:58 |
| CommandId |
string |
命令 ID。 |
c-hy0338xh28r**** |
| InvocationStatus |
string |
命令执行的状态。可能值:
|
Success |
| CommandName |
string |
命令名称。 |
testCommandName |
| CommandType |
string |
命令类型。 |
RunShellScript |
| CommandDescription |
string |
命令描述。 |
testDescription |
| Username |
string |
执行命令的用户名称。 |
root |
| WorkingDir |
string |
命令执行的路径。 |
c:\wwwroot |
| Timeout |
integer |
超时时间,单位为秒(s)。 |
60 |
| CommandContent |
string |
命令内容。 |
echo 123 |
| Parameters |
string |
命令中包含自定义参数。如果没有参数,默认为{}. |
{} |
| InvokeInstances |
array<object> |
执行目标实例列表。 |
|
|
object |
执行目标实例信息结构体。 |
||
| InstanceId |
string |
轻量应用服务器的实例 ID。 |
2445f4aecdac4b71ba2c7e3a7ccf**** |
| StartTime |
string |
命令在实例中开始执行的时间。时间采用 UTC(Z)时区,格式为 YYYY-MM-DDThh:mm:ssZ。 |
2023-05-09T03:32:24Z |
| FinishTime |
string |
命令进程的结束时间。时间采用 UTC(Z)时区,格式为 YYYY-MM-DDThh:mm:ssZ。 |
2023-04-03T02:42:29Z |
| InvocationStatus |
string |
单台实例的命令进度状态,可能值:
|
Running |
| Output |
string |
命令执行后的输出信息。 |
OutputMsg |
| ExitCode |
integer |
命令的退出码。
|
0 |
| ErrorInfo |
string |
命令的下发失败或执行失败原因的详情,可能值:
|
the specified instance does not exists |
| ErrorCode |
string |
命令的下发失败或执行失败原因的代码,可能值:
|
InstanceNotExists |
示例
正常返回示例
JSON格式
{
"RequestId": "30637AD6-D977-4833-A54C-CC89483E****",
"TotalCount": 10,
"PageNumber": 1,
"PageSize": 10,
"CommandInvocations": [
{
"InvokeId": "t-hz0373jyzxt****",
"CreationTime": "2023-04-27T10:11:58",
"CommandId": "c-hy0338xh28r****",
"InvocationStatus": "Success",
"CommandName": "testCommandName",
"CommandType": "RunShellScript",
"CommandDescription": "testDescription",
"Username": "root",
"WorkingDir": "c:\\wwwroot",
"Timeout": 60,
"CommandContent": "echo 123",
"Parameters": "{}",
"InvokeInstances": [
{
"InstanceId": "2445f4aecdac4b71ba2c7e3a7ccf****",
"StartTime": "2023-05-09T03:32:24Z",
"FinishTime": "2023-04-03T02:42:29Z",
"InvocationStatus": "Running",
"Output": "OutputMsg",
"ExitCode": 0,
"ErrorInfo": "the specified instance does not exists",
"ErrorCode": "InstanceNotExists"
}
]
}
]
}
错误码
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。