All Products
Search
Document Center

Resource Orchestration Service:GetTemplateParameterConstraints

Last Updated:Mar 17, 2023

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

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.

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

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

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

NoteThis parameter takes effect only if the TemplateId parameter is specified.
v1
ParametersarrayNo

The name of parameter N in the template.

objectNo
ParameterKeystringYes

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
ParameterValuestringYes

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

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

NoteBy 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
ParameterConstraintsarray

The constraints of the parameters.

object
ParameterKeystring

The name of the parameter.

ZoneInfo
Typestring

The type of the parameter.

String
AllowedValuesarray

The values of the parameter.

string

The values 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.
NoteIf the AllowedValues parameter is not returned, the Behavior and BehaviorReason parameters 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 names of the associated parameters.

InstanceType
IllegalValueByParameterConstraintsarray

The values that do not conform to the parameter constraints.

NoteIf the AllowedValues parameter is returned, the IllegalValueByParameterConstraints and IllegalValueByRules parameters are returned at the same time.
any

The values that do not conform to the parameter constraints.

NoteIf the AllowedValues parameter is returned, the IllegalValueByParameterConstraints and IllegalValueByRules parameters are returned at the same time.
cn-hangzhou-h
IllegalValueByRulesarray

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

NoteIf the AllowedValues parameter is returned, the IllegalValueByParameterConstraints and IllegalValueByRules parameters are returned at the same time.
any

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

NoteIf the AllowedValues parameter is returned, the IllegalValueByParameterConstraints and IllegalValueByRules parameters are returned at the same time.
cn-hangzhou-h
NotSupportResourcesarray

The unsupported resources in the template.

object
ResourceTypestring

The resource type.

You can call the ListResourceTypes operation to query the resource type.

ALIYUN::ECS::InstanceGroup
PropertyNamestring

The name of the resource property.

InstanceName
QueryErrorsarray

The error details that are returned if the request fails.

object
ErrorMessagestring

The error message.

ALIYUN::ECS::InstanceGroup
ResourceNamestring

The name of the resource.

MyECS
ResourceTypestring

The resource type.

InstanceType is needed while query DataDisk

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

Error codes

For a list of error codes, visit the Service error codes.