All Products
Search
Document Center

Simple Application Server:CreateCommand

更新時間:Oct 30, 2024

Creates 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:CreateCommandcreate
  • Command
    acs:swas-open:{#regionId}:{#accountId}:command/*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringYes

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

cn-hangzhou
NamestringYes

The name of the command. The name supports all character sets and can be up to 128 characters in length.

testName
DescriptionstringNo

The description of the command. The description supports all character sets and can be up to 512 characters in length.

test
TypestringYes

The language type of the command. Valid values:

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

The command content. When you specify this parameter, take note of the following items:

  • When EnableParameter is set to true, the custom parameter feature is enabled, and you can configure custom parameters in the command based on the following rules:
  • Define custom parameters in the {{}} format. Within {{}}, the spaces and line feeds before and after the parameter names are ignored.
  • You can specify up to 20 custom parameters.
  • The name of a custom parameter can contain only letters, digits, underscores (_), and hyphens (-). The name is case-insensitive.
  • The name of a custom parameter cannot exceed 64 bytes in length.
ifconfig -s
WorkingDirstringNo

The working directory of the command on the ECS instance.

Default values:

  • For a Linux instance, the default value is the home directory of the root user, which is the /root directory.
  • For a Windows instance, the default value is the directory where the Cloud Assistant client process resides. Example: C:\Windows\System32.
/root/
TimeoutlongNo

The timeout period for the command execution on the instance.

If a command execution task times out, Command Assistant forcefully terminates the task process. Valid values: 10 to 86400. Unit: seconds. The period of 86400 seconds is equal to 24 hours.

Default value: 60.

60
EnableParameterbooleanNo

Specifies whether to use custom parameters in the command.

Default value: false.

false
Tagarray<object>No

The tags that you want to add to the command. You can specify up to 20 tags.

objectNo

The tags of the command.

KeystringNo

The key of tag N that you want to add to the command. Valid values of N: 1 to 20.

The tag key cannot be an empty string. The tag key can be up to 64 characters in length and cannot contain http:// or https://. The tag key cannot start with acs: or aliyun.

TestKey
ValuestringNo

The value of tag N that you want to add to the command. Valid values of N: 1 to 20.

The tag value can be an empty string. The tag value can be up to 64 characters in length and cannot contain http:// or https://.

TestValue
ResourceGroupIdstringNo

The ID of the resource group.

rg-aek2bti7cf7****

Response parameters

ParameterTypeDescriptionExample
object

Schema of Response.

RequestIdstring

The request ID.

20758A-585D-4A41-A9B2-28DA8F4****
CommandIdstring

The command ID.

c-sh02yh0932w****

Examples

Sample success responses

JSONformat

{
  "RequestId": "20758A-585D-4A41-A9B2-28DA8F4****",
  "CommandId": "c-sh02yh0932w****"
}

Error codes

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

Change history

Change timeSummary of changesOperation
2024-05-29The request parameters of the API has changedView Change Details
2024-02-20The request parameters of the API has changedView Change Details