RunAppInstanceCommand

Updated at:

Issues Cloud Assistant commands to persistent sessions in WUYING Workspace delivery groups, supports batch issuance to a single delivery group or multiple delivery groups in the same region, and returns the command execution ID.

Operation description

Issues Cloud Assistant commands to persistent sessions in WUYING Workspace delivery groups. Currently, ProductType supports only WuyingServer and CommandType supports only CloudAssistantCmd. Specifying other values returns a parameter error.

The delivery scope supports two methods:

  • Single delivery group: Specify the delivery group by using AppInstanceGroupId. You can also specify persistent sessions in the delivery group by using AppInstancePersistentId or AppInstancePersistentIds.

  • Multiple delivery groups in the same region: Specify a list of delivery groups by using AppInstanceGroupIds. The command is executed on all persistent sessions in each delivery group in the list. All delivery groups must belong to the same region. Otherwise, InvalidRegion.NotMatch is returned. If any delivery group does not exist or none of the delivery groups have persistent sessions, InvalidAppInstanceGroup.NotFound is returned.

You must specify at least one of AppInstanceGroupIds and AppInstanceGroupId. If both are specified, AppInstanceGroupIds takes precedence.

This operation only issues commands, which are executed asynchronously in sessions. Regardless of whether the command is issued to one or multiple delivery groups, only one command execution ID (InvocationId) is returned. You can use this ID to call ListCommandInvocationResults to query the execution status and output on each session.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

appstreaming:RunAppInstanceCommand

none

*All Resource

*

None None

Request syntax

GET  HTTP/1.1

Request parameters

Parameter

Type

Required

Description

Example

ProductType

string

Yes

The product type. Currently, only WuyingServer (WUYING Workspace) is supported. Specifying other values returns a parameter error.

WuyingServer

AppInstanceGroupId

string

No

The ID of the delivery group, which is used to execute commands in a single delivery group. You can call ListAppInstanceGroup to obtain the ID. This parameter is required if AppInstanceGroupIds is not specified. Otherwise, a parameter error is returned. This parameter does not take effect if AppInstanceGroupIds is specified.

aig-9ciijz60n4xsv****

AppInstanceGroupIds

array

No

The list of delivery group IDs, which is used to issue commands in batches to multiple delivery groups in the same region. The commands are executed on all persistent sessions in each delivery group in the list, and only one command execution ID is returned. A maximum of 100 delivery group IDs are supported, and duplicate IDs are deduplicated. All delivery groups must belong to the same region. Otherwise, InvalidRegion.NotMatch is returned. If any delivery group does not exist, InvalidAppInstanceGroup.NotFound is returned. When this parameter is specified, AppInstanceGroupId and AppInstancePersistentIds do not take effect.

string

No

The ID of the delivery group. It cannot be an empty string.

aig-9ciijz60n4xsv****

AppInstancePersistentId

string

No

The ID of the persistent session, which is used to select a single persistent session in the delivery group specified by AppInstanceGroupId to execute commands. The session must belong to the specified delivery group. Otherwise, an error is returned.

p-0cc7s3mw2fg4j****

CommandType

string

Yes

The command type. Currently, only CloudAssistantCmd (Cloud Assistant command) is supported. Specifying other values returns a parameter error.

CloudAssistantCmd

Description

string

No

The command description, which is used to describe the purpose of the issued command for subsequent identification.

Clean up temporary files

CommandContent

string

Yes

The command content, which is the script content executed in the session. It must match the script type specified by RunScriptType.

echo hello

CommandParam

string

No

The command parameters, which are passed through to the session execution end along with the command content. Whether to pass them and the specific format depend on the command content. You can leave this parameter empty if it is not required.

{"name":"value"}

AppInstancePersistentIds

array

No

The list of persistent session IDs, which is used to select multiple persistent sessions in the delivery group specified by AppInstanceGroupId to execute commands. A maximum of 100 IDs are supported. This parameter does not take effect when AppInstanceGroupIds is specified, and the commands are executed on all persistent sessions in each delivery group.

string

No

The ID of the persistent session. It cannot be an empty string.

p-0cc7s3mw2fg4j****

RunScriptType

string

No

The type of the script to execute. Valid values:

  • RunBatScript: bat script

  • RunPowerShellScript: PowerShell script

  • RunShellScript: shell script

  • RunAIAgentScript: AI Agent script

RunShellScript

Timeout

integer

No

The timeout period for command execution, in seconds. Default value: 60.

60

Response elements

Element

Type

Description

Example

object

Schema of Response

RequestId

string

The request ID.

1CBAFFAB-B697-4049-A9B1-67E1FC5F****

CommandResultModel

object

The command issuance result.

InvocationId

string

The command execution ID. Only one execution ID is returned even when commands are issued in batches to multiple delivery groups. You can use this ID to call ListCommandInvocationResults to query the command execution results on each session.

t-hz0jdfwd9f****

Examples

Success response

JSON format

{
  "RequestId": "1CBAFFAB-B697-4049-A9B1-67E1FC5F****",
  "CommandResultModel": {
    "InvocationId": "t-hz0jdfwd9f****"
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.