Queries the values of one or more template parameters.

Usage notes

In this example, the value of the ZoneInfo parameter of a template in the China (Hangzhou) region is queried. The template contains the following information:{"Parameters":{"ZoneInfo":{"Type": "String"},"InstanceType": {"Type": "String"}},"ROSTemplateFormatVersion": "2015-09-01","Resources":{"ECS":{"Properties":{"ZoneId":{"Ref": "ZoneInfo"},"InstanceType": {"Ref": "InstanceType"}},"Type": "ALIYUN::ECS::Instance"}}}.

The following section describes the requirements of parameters and template content that can be queried by calling the GetTemplateParameterConstraints operation.

  • The following table lists the parameters that can be queried.

    Resource type

    Parameter

    ALIYUN::CS::KubernetesCluster

    MasterInstanceTypes, MasterSystemDiskCategory, WorkerInstanceTypes, WorkerSystemDiskCategory, WorkerVSwitchIds, PodVswitchIds, and the Category fields in the MasterDataDisks and WorkerDataDisks parameters

    ALIYUN::CS::ManagedKubernetesCluster

    WorkerInstanceTypes, WorkerSystemDiskCategory, VSwitchIds, PodVswitchIds, and the Category field in the WorkerDataDisks parameter

    ALIYUN::CS::ManagedEdgeKubernetesCluster

    WorkerInstanceTypes, WorkerSystemDiskCategory, WorkerDataDiskCategory, VSwitchIds, and the Category field in the WorkerDataDisks parameter

    ALIYUN::ECS::Instance

    ZoneId, SystemDiskCategory, InstanceType, and the Category field in the DiskMappings parameter

    ALIYUN::ECS::InstanceGroup

    ZoneId, SystemDiskCategory, InstanceType, and the Category field in the DiskMappings parameter

    ALIYUN::ECS::VSwitch

    ZoneId

    ALIYUN::RDS::DBInstance

    ZoneId, EngineVersion, Category, DBInstanceStorageType, and DBInstanceClass

    ALIYUN::RDS::PrepayDBInstance

    ZoneId, EngineVersion, Category, DBInstanceStorageType, and DBInstanceClass

    ALIYUN::POLARDB::DBCluster

    ZoneId and DBNodeClass

    ALIYUN::REDIS::Instance

    ZoneId, EngineVersion, and InstanceClass

    ALIYUN::REDIS::PrepayInstance

    ZoneId, EngineVersion, and InstanceClass

    ALIYUN::VPC::NatGateway

    ZoneId

    ALIYUN::ADB::DBCluster

    ZoneId

  • The template whose parameters you want to query must contain the Parameters section.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes GetTemplateParameterConstraints

The operation that you want to perform. Set the value to GetTemplateParameterConstraints.

TemplateBody String No null

The structure that contains the template body.

The template body must be 1 to 524,288 bytes in length. If the template body exceeds the maximum length, we recommend that you add parameters to the HTTP POST request body to prevent request failures caused by extremely long URLs.

Note You must specify only one of the TemplateBody, TemplateURL, and TemplateId parameters.
RegionId String Yes cn-hangzhou

The region ID of the instance.

You can call the DescribeRegions operation to query the most recent region list.

TemplateURL String No oss://ros-template/demo

The URL of the file that contains the template body. The URL must point to a template located in an HTTP or HTTPS web server or an Alibaba Cloud OSS bucket. Examples: oss://ros/stack-policy/demo and oss://ros/stack-policy/demo?RegionId=cn-hangzhou. The template can be up to 524,288 bytes in length. If you do not specify RegionId in the URL, the value of the RegionId parameter is used.

Note You must specify only one of the TemplateBody, TemplateURL, and TemplateId parameters.
TemplateId String No 5ecd1e10-b0e9-4389-a565-e4c15efc****

The ID of the template. This parameter applies to shared and private templates.

Note You must specify only one of the TemplateBody, TemplateURL, and TemplateId parameters.
TemplateVersion String No v1

The version of the template. If you do not specify a version, the latest version is used.

Note This parameter takes effect only when the TemplateId parameter is specified.
ParametersKeyFilter Array of String No ZoneInfo

The array of the keys of the parameters that you want to query.

ClientToken String No 123e4567-e89b-12d3-a456-42665544****

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 token is globally unique. The token can be up to 64 characters in length, and can contain letters, digits, hyphens (-), and underscores (_).

For more information, see How to ensure idempotence.

Parameters.N.ParameterKey String Yes ZoneInfo

The key of parameter N that is defined in the template.

Note The Parameters parameter is optional. If you specify the Parameters parameter, you must specify the Parameters.N.ParameterKey parameter.
Parameters.N.ParameterValue String Yes cn-hangzhou-h

The value of parameter N that is defined in the template.

Note The Parameters parameter is optional. If you specify the Parameters parameter, you must specify the Parameters.N.ParameterValue parameter.

Response parameters

Parameter Type Example Description
RequestId String 9816785B-BCF8-514D-8B76-C1EC2BC954FC

The ID of the request.

ParameterConstraints Array of ParameterConstraint

The array of the constraints of the template parameters.

ParameterKey String ZoneInfo

The name of the parameter.

Type String String

The type of the parameter.

AllowedValues Array of String cn-hangzhou-h

The values of the parameter.

Behavior String NoLimit

The reason why AllowedValues is not returned. Valid values:

  • NoLimit: The value of this parameter is not limited.
  • NotSupport: The value of this parameter cannot be queried.
  • QueryError: The query failed.
Note If the AllowedValues parameter is not returned, the Behavior and BehaviorReason parameters are returned.
BehaviorReason String No resource property refer to the parameter

Details about the reason why AllowedValues is not returned.

AssociationParameterNames Array of String InstanceType

The list of the associated parameters.

Examples

Sample requests

http(s)://ros.aliyuncs.com/?Action=GetTemplateParameterConstraints
&TemplateBody={"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=cn-hangzhou
&ParametersKeyFilter=["ZoneInfo"]
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<GetTemplateParameterConstraintsResponse>
    <RequestId>9816785B-BCF8-514D-8B76-C1EC2BC954FC</RequestId>
    <ParameterConstraints>
        <Type>String</Type>
        <AllowedValues>cn-hangzhou-h</AllowedValues>
        <AllowedValues>cn-hangzhou-i</AllowedValues>
        <AllowedValues>cn-hangzhou-j</AllowedValues>
        <AllowedValues>cn-hangzhou-k</AllowedValues>
        <AllowedValues>cn-hangzhou-e</AllowedValues>
        <AllowedValues>cn-hangzhou-f</AllowedValues>
        <AllowedValues>cn-hangzhou-g</AllowedValues>
        <AllowedValues>cn-hangzhou-b</AllowedValues>
        <AssociationParameterNames>InstanceType</AssociationParameterNames>
        <ParameterKey>ZoneInfo</ParameterKey>
    </ParameterConstraints>
</GetTemplateParameterConstraintsResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "9816785B-BCF8-514D-8B76-C1EC2BC954FC",
  "ParameterConstraints" : [ {
    "Type" : "String",
    "AllowedValues" : [ "cn-hangzhou-h", "cn-hangzhou-i", "cn-hangzhou-j", "cn-hangzhou-k", "cn-hangzhou-e", "cn-hangzhou-f", "cn-hangzhou-g", "cn-hangzhou-b" ],
    "AssociationParameterNames" : [ "InstanceType" ],
    "ParameterKey" : "ZoneInfo"
  } ]
}

Error codes

For a list of error codes, visit the API Error Center.