All Products
Search
Document Center

Simple Application Server:CreateCommand

Last Updated:Apr 17, 2024

Creates a Cloud Assistant command.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

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
Tagobject []No

The tags of the command.

KeystringNo

The key of tag N to be added to the command. Valid values of N: 1 to 20.

TestKey
ValuestringNo

The value of tag N to be added to the command. Valid values of N: 1 to 20.

TestValue

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-02-20The request parameters of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: Tag