All Products
Search
Document Center

Resource Orchestration Service:GetTemplateParameterConstraints

Last Updated:Feb 20, 2024

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

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
TemplateBodystringNo

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"}}}
RegionIdstringYes

The region ID of the template.

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

cn-hangzhou
TemplateURLstringNo

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
TemplateIdstringNo

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****
TemplateVersionstringNo

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

The name of parameter N in the template.

ParameterKeystringYes

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
ParameterValuestringYes

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
ParametersKeyFilterarrayNo

The parameters whose values you want to query.

stringNo

The parameters whose values you want to query.

ZoneInfo
ClientTokenstringNo

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****
ParametersOrderarrayNo

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.
stringNo

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"]
StackIdstringNo

The ID of the stack.

c754d2a4-28f1-46df-b557-9586173a****

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

9816785B-BCF8-514D-8B76-C1EC2BC954FC
ParameterConstraintsobject []

The constraints of the parameters.

ParameterKeystring

The name of the parameter.

ZoneInfo
Typestring

The data type of the parameter.

String
AllowedValuesarray

The values of the parameter.

string

The value of the parameter.

cn-hangzhou-h
Behaviorstring

The behavior of the parameter. Valid values:

  • NoLimit: No limit is imposed on the value of this parameter.
  • NotSupport: The value of this parameter cannot be queried.
  • QueryError: This parameter failed to be queried.
Note If AllowedValues is not returned, Behavior and BehaviorReason are returned.
NoLimit
BehaviorReasonstring

The reason why the behavior of the parameter is returned.

No resource property refer to the parameter
AssociationParameterNamesarray

The names of the associated parameters.

string

The name of the associated parameter.

InstanceType
IllegalValueByParameterConstraintsarray

The values that do not conform to the parameter constraints.

Note If AllowedValues is returned, IllegalValueByParameterConstraints and IllegalValueByRules are returned at the same time.
any

The value that does not conform to the parameter constraints.

Note If AllowedValues is returned, IllegalValueByParameterConstraints and IllegalValueByRules are returned at the same time.
cn-hangzhou-h
IllegalValueByRulesarray

The values that do not match the rules in the template.

Note If AllowedValues is returned, IllegalValueByParameterConstraints and IllegalValueByRules are returned at the same time.
any

The value that does not match the rules in the template.

Note If AllowedValues is returned, IllegalValueByParameterConstraints and IllegalValueByRules are returned at the same time.
cn-hangzhou-h
NotSupportResourcesobject []

The unsupported resource in the template.

ResourceTypestring

The resource type.

ALIYUN::ECS::InstanceGroup
PropertyNamestring

The name of the resource property.

InstanceName
QueryErrorsobject []

The error that is returned when the request fails.

ErrorMessagestring

The error message.

ALIYUN::ECS::InstanceGroup
ResourceNamestring

The resource name.

MyECS
ResourceTypestring

The resource type.

InstanceType is needed while query DataDisk
OriginalConstraintsobject []

The original constraint information.

ResourceNamestring

The name of the resource that is defined in the template.

MyECS
AllowedValuesarray

The values of the parameter.

any

The value of the parameter.

cn-hangzhou-a
ResourceTypestring

The resource type.

ALIYUN::ECS::InstanceGroup
PropertyNamestring

The name of the resource property.

ZoneId

Examples

Sample success responses

JSONformat

{
  "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 timeSummary of changesOperation
2023-06-21The internal configuration of the API is changed, but the call is not affectedsee changesets
Change itemChange content
The internal configuration of the API is changed, but the call is not affected.
2023-06-02The response structure of the API has changedsee changesets
Change itemChange content
Output ParametersThe response structure of the API has changed.