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.
Debugging
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.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ros:GetTemplateParameterConstraints | get |
|
| none |
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. Note
You 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. Note
You 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. Note
You 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. Note
This parameter takes effect only if the TemplateId parameter is specified.
| v1 |
Parameters | array<object> | No | The name of parameter N in the template. | |
object | No | |||
ParameterKey | string | Yes | The name of parameter N in the template. Note
The 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. Note
The 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. Note
By 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. Note
By 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"
}
],
"OriginalConstraints": [
{
"ResourceName": "MyECS",
"AllowedValues": [
"cn-hangzhou-a"
],
"ResourceType": "ALIYUN::ECS::InstanceGroup\n",
"PropertyName": "ZoneId"
}
]
}
]
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2024-07-18 | The response structure of the API has changed | View Change Details |
2023-06-21 | The internal configuration of the API is changed, but the call is not affected | View Change Details |
2023-06-02 | The response structure of the API has changed | View Change Details |