调用DescribeCommands查询您手动创建的云助手命令或者阿里云提供的公共命令。
接口说明
只输入参数Action
和RegionId
,不输入其他任何请求参数,则默认查询您手动创建的所有可用的命令(CommandId
)。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
请求参数
名称 |
类型 |
是否必选 |
示例值 |
描述 |
Action | String | 是 | DescribeCommands | 系统规定参数。取值:DescribeCommands。 |
RegionId | String | 是 | cn-hangzhou | 地域ID。您可以调用DescribeRegions查看最新的阿里云地域列表。 |
Provider | String | 否 | AlibabaCloud | 公共命令的提供者。参数值的具体说明如下:
|
CommandId | String | 否 | c-hz01272yr52**** | 命令ID。 |
Name | String | 否 | testName | 命令的名称。当指定了 |
Description | String | 否 | testDescription | 公共命令的描述。仅当指定了 |
Type | String | 否 | RunShellScript | 命令的类型。取值范围:
|
ContentEncoding | String | 否 | PlainText | 设置返回数据中
默认值为Base64。 |
PageNumber | Long | 否 | 1 | 当前页码。 起始值为1。 默认值为1。 |
PageSize | Long | 否 | 10 | 分页查询时设置的每页行数。 最大值为50。 默认值为10。 |
Latest | Boolean | 否 | true | 若查询结果包含公共命令,是否只查询最新版本的公共命令。该参数不影响私有命令的查询。
默认值:false。 |
ResourceGroupId | String | 否 | rg-123****** | 命令所属的资源组ID。 |
Tag.N.Key | String | 否 | TestKey | 命令的标签键。N的取值范围为1~20。一旦传入该值,则不允许为空字符串。 使用一个标签过滤资源,查询到该标签下的资源数量不能超过1000个;使用多个标签过滤资源,查询到同时绑定了多个标签的资源数量不能超过1000个。如果资源数量超过1000个,您需要使用ListTagResources接口进行查询。 最多支持64个字符,不能以 |
Tag.N.Value | String | 否 | TestValue | 命令的标签值。N的取值范围为1~20。该值可以为空字符串。 最多支持128个字符,不能包含 |
返回数据
名称 |
类型 |
示例值 |
描述 |
PageSize | Long | 10 | 每页行数。 |
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** | 请求ID。 |
PageNumber | Long | 1 | 命令列表页码。 |
TotalCount | Long | 5 | 命令总个数。 |
Commands | Array of Command | 命令数据集类型。 |
|
Command | |||
CreationTime | String | 2020-11-17T06:52Z | 命令创建时间。 |
Type | String | RunShellScript | 命令类型。 |
Timeout | Long | 3600 | 超时时间,单位:秒。 |
InvokeTimes | Integer | 2 | 使用该命令创建的任务数。 |
CommandId | String | c-hz01272yr52**** | 命令ID。 |
WorkingDir | String | /home/ | 执行路径。 |
Description | String | testDescription | 命令描述。 |
Version | Integer | 1 | 公共命令的版本。如果多个命令属于同一个 |
Provider | String | AlibabaCloud.ECS.GuestOS | 公共命令的提供者。 |
CommandContent | String | Y2QgL3Jvb3Q= | 命令内容,以Base64编码后传输。
|
Category | String | “” | 公共命令的类目。 |
Latest | Boolean | true | 公共命令是否是最新版本。如果多个命令属于同一个 |
Name | String | testName | 命令名称。 |
EnableParameter | Boolean | true | 该命令是否启用自定义参数。 |
ResourceGroupId | String | rg-123****** | 命令所属的资源组ID。 |
ParameterNames | Array of String | ['parameter1','parameter2'] | 通过创建命令时的CommandContent解析出的自定义参数名列表,以列表(List)的形式返回。如未使用自定义参数功能,则返回空值列表。 |
ParameterDefinitions | Array of ParameterDefinition | 自定义参数详细信息列表。 |
|
ParameterDefinition | |||
Required | Boolean | true | 该自定义参数是否必填。
默认值:false。 |
Description | String | 云助手Agent安装包路径 | 自定义参数描述。 |
DefaultValue | String | https://aliyun-client-assist.oss-accelerate.aliyuncs.com/linux/aliyun_assist_latest.rpm | 自定义参数的默认值。 |
ParameterName | String | DownloadUrl | 自定义参数名称。 |
PossibleValues | Array of String | "Linux","Windows" | 枚举类型自定义参数的可选值。 |
Tags | Array of Tag | 命令的标签信息。 |
|
Tag | |||
TagKey | String | owner | 命令的标签键。 |
TagValue | String | zhangsan | 命令的标签值。 |
示例
请求示例
http(s)://ecs.aliyuncs.com/?Action=DescribeCommands
&RegionId=cn-hangzhou
&CommandId=c-hz01272yr52****
&PageNumber=1
&PageSize=10
&公共请求参数
正常返回示例
XML
格式
HTTP/1.1 200 OK
Content-Type:application/xml
<DescribeCommandsResponse>
<PageSize>10</PageSize>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
<PageNumber>1</PageNumber>
<TotalCount>5</TotalCount>
<Commands>
<CreationTime>2020-11-17T06:52Z</CreationTime>
<Type>RunShellScript</Type>
<Timeout>3600</Timeout>
<InvokeTimes>2</InvokeTimes>
<CommandId>c-hz01272yr52****</CommandId>
<WorkingDir>/home/</WorkingDir>
<Description>testDescription</Description>
<Version>1</Version>
<Provider>AlibabaCloud.ECS.GuestOS</Provider>
<CommandContent>Y2QgL3Jvb3Q=</CommandContent>
<Category>“”</Category>
<Latest>true</Latest>
<Name>testName</Name>
<EnableParameter>true</EnableParameter>
<ParameterNames>['parameter1','parameter2']</ParameterNames>
<ParameterDefinitions>
<Required>true</Required>
<Description>云助手Agent安装包路径</Description>
<DefaultValue>https://aliyun-client-assist.oss-accelerate.aliyuncs.com/linux/aliyun_assist_latest.rpm</DefaultValue>
<ParameterName>DownloadUrl</ParameterName>
<PossibleValues>"Linux","Windows"</PossibleValues>
</ParameterDefinitions>
<Tags>
<TagKey>owner</TagKey>
<TagValue>zhangsan</TagValue>
</Tags>
</Commands>
</DescribeCommandsResponse>
JSON
格式
HTTP/1.1 200 OK
Content-Type:application/json
{
"PageSize" : 10,
"RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
"PageNumber" : 1,
"TotalCount" : 5,
"Commands" : [ {
"CreationTime" : "2020-11-17T06:52Z",
"Type" : "RunShellScript",
"Timeout" : 3600,
"InvokeTimes" : 2,
"CommandId" : "c-hz01272yr52****",
"WorkingDir" : "/home/",
"Description" : "testDescription",
"Version" : 1,
"Provider" : "AlibabaCloud.ECS.GuestOS",
"CommandContent" : "Y2QgL3Jvb3Q=",
"Category" : "“”",
"Latest" : true,
"Name" : "testName",
"EnableParameter" : true,
"ParameterNames" : [ "['parameter1','parameter2']" ],
"ParameterDefinitions" : [ {
"Required" : true,
"Description" : "云助手Agent安装包路径",
"DefaultValue" : "https://aliyun-client-assist.oss-accelerate.aliyuncs.com/linux/aliyun_assist_latest.rpm",
"ParameterName" : "DownloadUrl",
"PossibleValues" : [ "\"Linux\",\"Windows\"" ]
} ],
"Tags" : [ {
"TagKey" : "owner",
"TagValue" : "zhangsan"
} ]
} ]
}
错误码
HttpCode |
错误码 |
错误信息 |
描述 |
400 | RegionId.ApiNotSupported | The api is not supported in this region. | 指定地域下不支持调用 API。请检查 RegionId 参数取值是否正确。 |
400 | Duplicate.TagKey | The Tag.N.Key contain duplicate key. | 标签中存在重复的键,请保持键的唯一性。 |
400 | InvalidTagKey.Malformed | The specified Tag.n.Key is not valid. | 指定的标签键参数有误。 |
400 | InvalidTagValue.Malformed | The specified Tag.n.Value is not valid. | 指定的标签值参数有误。 |
400 | MissingParameter.TagKey | You must specify Tag.N.Key. | 请指定标签键。 |
400 | InvalidParam.PageNumber | The specified parameter is invalid. | 指定的 PageNumber 参数无效。 |
400 | InvalidParam.PageSize | The specified parameter is invalid. | 指定的 PageSize 参数无效。 |
403 | Operation.Forbidden | The operation is not permitted. | 该操作是不被允许的。 |
500 | InternalError.Dispatch | An error occurred when you dispatched the request. | 发送请求时发生错误,请稍后重试。 |
500 | ServiceUnavailable | The request has failed due to a temporary failure of the server. | 请求后端超时。 |
500 | InternalError | The request processing has failed due to some unknown error. | 内部错误,请重试。 |
访问错误中心查看更多错误码。