Queries the values of one or more parameters in a template.
Operation Description
This topic provides an example on how to query the values of a parameter. In this example, the values of the ZoneInfo
parameter in a template that is created in the China (Hangzhou) region are queried. The template body is {"Parameters":{"ZoneInfo":{"Type": "String"},"InstanceType": {"Type": "String"}},"ROSTemplateFormatVersion": "2015-09-01","Resources":{"ECS":{"Properties":{"ZoneId":{"Ref": "ZoneInfo"},"InstanceType": {"Ref": "InstanceType"}},"Type": "ALIYUN::ECS::Instance"}}}
.
For more information about the template parameters whose values you can query by calling this operation and the sample code of the template, see Query the constraints of parameters.
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
TemplateBody | string | No | The structure that contains the template body. The template body must be 1 to 524,288 bytes in length. If the length of the template body exceeds the upper limit, we recommend that you add parameters to the HTTP POST request body to prevent request failures caused by excessively long URLs. NoteYou must specify only one of the following parameters: TemplateBody, TemplateURL, and TemplateId. | {"Parameters":{"ZoneInfo":{"Type": "String"},"InstanceType": {"Type": "String"}},"ROSTemplateFormatVersion": "2015-09-01","Resources":{"ECS":{"Properties":{"ZoneId":{"Ref": "ZoneInfo"},"InstanceType": {"Ref": "InstanceType"}},"Type": "ALIYUN::ECS::Instance"}}} |
RegionId | string | Yes | The region ID of the template. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
TemplateURL | string | No | The URL of the file that contains the template body. The URL must point to a template that is located on an HTTP or HTTPS web server or in an Object Storage Service (OSS) bucket, such as oss://ros/stack-policy/demo or oss://ros/stack-policy/demo?RegionId=cn-hangzhou. The template body can be up to 524,288 bytes in length. If you do not specify the region ID of the OSS bucket, the value of the RegionId parameter is used. NoteYou must specify only one of the following parameters: TemplateBody, TemplateURL, and TemplateId. | oss://ros-template/demo |
TemplateId | string | No | The ID of the template. This parameter applies to shared and private templates. NoteYou must specify only one of the following parameters: TemplateBody, TemplateURL, and TemplateId. | 5ecd1e10-b0e9-4389-a565-e4c15efc**** |
TemplateVersion | string | No | The version of the template. If you do not specify this parameter, the latest version is used. NoteThis parameter takes effect only if the TemplateId parameter is specified. | v1 |
Parameters | array | No | The name of parameter N in the template. | |
object | No | |||
ParameterKey | string | Yes | The name of parameter N in the template. NoteThe Parameters parameter is optional. If you specify the Parameters parameter, you must specify the Parameters.N.ParameterKey parameter. | ZoneInfo |
ParameterValue | string | Yes | The value of parameter N in the template. NoteThe Parameters parameter is optional. If you specify the Parameters parameter, you must specify the Parameters.N.ParameterValue parameter. | cn-hangzhou-h |
ParametersKeyFilter | array | No | The parameters whose values you want to query. | |
string | No | The parameters whose values you want to query. | ZoneInfo | |
ClientToken | string | No | The client token that is used to ensure the idempotence of the request. You can use the client to generate the value, but you must make sure that the value is unique among different requests. The token can be up to 64 characters in length, and can contain letters, digits, hyphens (-), and underscores (_). For more information, see Ensure idempotence. | 123e4567-e89b-12d3-a456-42665544**** |
ParametersOrder | array | No | The order in which associated parameters are arranged. NoteBy default, the order of the associated parameters specified in the Metadata section of the template is used. | |
string | No | The order in which associated parameters are arranged. NoteBy default, the order of the associated parameters specified in the Metadata section of the template is used. | ["ZoneId", "InstanceType"] | |
StackId | string | No | The ID of the stack. | c754d2a4-28f1-46df-b557-9586173a**** |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "9816785B-BCF8-514D-8B76-C1EC2BC954FC",
"ParameterConstraints": [
{
"ParameterKey": "ZoneInfo",
"Type": "String",
"AllowedValues": [
"cn-hangzhou-h"
],
"Behavior": "NoLimit",
"BehaviorReason": "No resource property refer to the parameter",
"AssociationParameterNames": [
"InstanceType"
],
"IllegalValueByParameterConstraints": [
"cn-hangzhou-h"
],
"IllegalValueByRules": [
"cn-hangzhou-h"
],
"NotSupportResources": [
{
"ResourceType": "ALIYUN::ECS::InstanceGroup",
"PropertyName": "InstanceName"
}
],
"QueryErrors": [
{
"ErrorMessage": "ALIYUN::ECS::InstanceGroup",
"ResourceName": "MyECS",
"ResourceType": "InstanceType is needed while query DataDisk"
}
]
}
]
}
Error codes
For a list of error codes, visit the Service error codes.