All Products
Search
Document Center

Simple Application Server:DescribeCommandInvocations

Last Updated:Oct 30, 2024

Queries the executions and execution status of a Cloud Assistant command.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
swas-open:DescribeCommandInvocationsget
  • All Resources
    *
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

The region ID. You can call the ListRegions operation to query the most recent region list.

cn-hangzhou
InstanceIdstringNo

The ID of the simple application server.

ace0706b2ac4454d984295a94213****
CommandIdstringNo

The command ID. You can call the DescribeCommands operation to query all available command IDs.

c-sh02yh0932w****
InvokeIdstringNo

The execution ID of the command.

t-hz02p9545t6****
CommandNamestringNo

The command name. If both CommandName and InstanceId are specified, CommandName does not take effect.

testName
InvocationStatusstringNo

The overall execution state of the command. The value of this parameter depends on the execution status of the command on all the involved instances. Valid values:

  • Pending: The command is being verified or sent. When the execution state on at least one instance is Pending, the overall execution state is Pending.

  • Running: The command is being run on the instances. When the execution state on at least one instance is Running, the overall execution state is Running.

  • Success: When the execution state on at least one instance is Success and the execution state on other instances is Stopped or Success, the overall execution state is Success.

    • Command that is set to run immediately: The command execution is complete, and the exit code is 0.
  • Failed: When the execution state on all instances is Stopped or Failed, the overall execution state is Failed. When the execution state on an instance is one of the following values, Failed is returned as the overall execution state:

    • Invalid: The command is invalid.
    • Aborted: The command fails to be sent.
    • Failed: The command execution is complete, and the exit code is not 0.
    • Timeout: The command execution times out.
    • Error: An error occurs when the command is being run.
  • Stopping: The command task is being stopped. When the execution state on at least one instance is Stopping, the overall execution state is Stopping.

  • Stopped: The command task is stopped. When the execution state on all instances is Stopped, the overall execution state is Stopped. When the execution state on an instance is one of the following values, Stopped is returned as the overall execution state:

    • Cancelled: The command task is canceled.
    • Terminated: The command task is terminated.
  • PartialFailed: The command execution succeeds on some instances and fails on other instances. When the execution state on some instances is Success and the execution state on other instances is Failed or Stopped, the overall execution state is PartialFailed.

Note The value of the InvokeStatus response parameter is similar to the value of InvocationStatus. We recommend that you ignore InvokeStatus and check the value of InvocationStatus.
Success
CommandTypestringNo

The command type. Valid values:

  • RunBatScript: batch command, applicable to Windows instances
  • RunPowerShellScript: PowerShell command, applicable to Windows instances
  • RunShellScript: shell command, applicable to Linux instances
RunPowerShellScript
PageNumberstringNo

The page number. Pages start from 1. Default value: 1.

1
PageSizestringNo

The number of entries per page.

Maximum value: 50.

Default value: 10.

10

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response

RequestIdstring

The request ID.

30637AD6-D977-4833-A54C-CC89483E****
TotalCountinteger

The total number of entries.

10
PageNumberinteger

The page number.

1
PageSizeinteger

The number of entries per page.

10
CommandInvocationsarray<object>

The command executions.

commandobject
InvokeIdstring

The execution ID of the command.

t-hz0373jyzxt****
CreationTimestring

The time when the command was created.

2023-04-27T10:11:58
CommandIdstring

The command ID.

c-hy0338xh28r****
InvocationStatusstring

The overall execution state of the command. Valid values:

  • Pending: The command is being verified or sent.
  • Invalid: The specified command type or parameter is invalid.
  • Aborted: The command failed to be sent to the instances. To send a command to an instance, make sure that the instance is in the Running state and the command is sent to the instance within 1 minute.
  • Running: The command is being run on the instances.
  • Success: The command execution is complete, and the exit code is 0.
  • Failed: The command execution is complete, and the exit code is not 0.
  • Error: The command execution cannot proceed due to an exception.
  • Timeout: The command execution timed out.
  • Cancelled: The command execution is canceled, and the command is not started.
  • Stopping: The command in the Running state is being stopped.
  • Terminated: The command is terminated when it is being run.
Success
CommandNamestring

The command name.

testCommandName
CommandTypestring

The command type.

RunShellScript
CommandDescriptionstring

The description of the command.

testDescription
Usernamestring

The username that is used to run the command.

root
WorkingDirstring

The working directory of the command.

c:\wwwroot
Timeoutlong

The timeout period. Unit: seconds.

60
CommandContentstring

The content of the command.

echo 123
Parametersstring

The custom parameters in the command. If no custom parameter exists in the command, the default value is {}.

{}
InvokeInstancesarray<object>

The instances on which the command is run.

invokeInstanceobject
InstanceIdstring

The ID of the simple application server.

2445f4aecdac4b71ba2c7e3a7ccf****
StartTimestring

The beginning of the time range during which the command is run on the instance.

2023-05-09T03:32:24Z
FinishTimestring

The end of the time range during which the command is run on the instance.

2023-04-03T02:42:29Z
InvocationStatusstring

The execution state of the command on a single instance. Valid values:

  • Pending: The command is being verified or sent.

  • Invalid: The specified command type or parameter is invalid.

  • Aborted: The command failed to be sent to the instance. To send a command to an instance, make sure that the instance is in the Running state and the command is sent to the instance within 1 minute.

  • Running: The command is being run on the instance.

  • Success:

    • Command that is set to run only once: The command execution is complete, and the exit code is 0.
    • Command that is set to run on a schedule: The previous command execution is complete, the exit code is 0, and the specified cycle ends.
  • Failed:

    • Command that is set to run only once: The command execution is complete, and the exit code is not 0.
    • Command that is set to run on a schedule: The previous command execution is complete, the exit code is not 0, and the specified cycle is about to end.
  • Error: The command execution cannot proceed due to an exception.

  • Timeout: The command execution timed out.

  • Cancelled: The command execution is canceled, and the command is not started.

  • Stopping: The command task is being stopped.

  • Terminated: The command is terminated when it is being run.

Running
Outputstring

The command output.

OutputMsg
ExitCodelong

The exit code of the command.

  • For Linux instances, the exit code is the exit code of the shell command.
  • For Windows instances, the exit code is the exit code of the batch or PowerShell command.
0
ErrorInfostring

The error message returned if the command failed to be sent or run. Valid values:

  • null: The command is run as expected.
  • the specified instance does not exists: The specified instance does not exist or is released.
  • the instance has released when create task: The instance is released when the command is being run.
  • the instance is not running when create task: The instance is not in the Running state when the command is being run.
  • the command is not applicable: The command is not applicable to the specified instance.
  • the specified account does not exists: The specified account does not exist.
  • the specified directory does not exists: The specified directory does not exist.
  • the cron job expression is invalid: The specified CRON expression for the execution schedule is invalid.
  • the aliyun service is not running on the instance: Cloud Assistant Agent is not running.
  • the aliyun service in the instance does not response: Cloud Assistant Agent does not respond to your request.
  • the aliyun service in the instance is upgrading now: Cloud Assistant Agent is being updated.
  • the aliyun service in the instance need upgrade: Cloud Assistant Agent needs to be updated.
  • the command delivery has been timeout: The request to send the command timed out.
  • the command execution has been timeout: The command execution timed out.
  • the command execution got an exception: An exception occurred when the command was being run.
  • the command execution has been interrupted: The command execution is interrupted.
  • the command execution exit code is not zero: The command execution is complete, and the exit code is not 0.
the specified instance does not exists
ErrorCodestring

The error code returned if the command failed to be sent or run.

  • null: The command is run as expected.
  • InstanceNotExists: The specified instance does not exist or is released.
  • InstanceReleased: The instance is released when the command is being run.
  • InstanceNotRunning: The instance is not in the Running state when the command is being run.
  • CommandNotApplicable: The command is not applicable to the specified instance.
  • AccountNotExists: The specified account does not exist.
  • DirectoryNotExists: The specified directory does not exist.
  • BadCronExpression: The specified CRON expression for the execution schedule is invalid.
  • ClientNotRunning: Cloud Assistant Agent is not running.
  • ClientNotResponse: Cloud Assistant Agent does not respond to your request.
  • ClientIsUpgrading: Cloud Assistant Agent is being updated.
  • ClientNeedUpgrade: Cloud Assistant Agent needs to be updated.
  • DeliveryTimeout: The request to send the command timed out.
  • ExecutionTimeout: The command execution timed out.
  • ExecutionException: An exception occurred when the command was being run.
  • ExecutionInterrupted: The command execution is interrupted.
  • ExitCodeNonzero: The command execution is complete, and the exit code is not 0.
InstanceNotExists

Examples

Sample success responses

JSONformat

{
  "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"
        }
      ]
    }
  ]
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history