Validates a template.
In this example, a template that is used to create stacks is validated. The TemplateURL
parameter is set to oss://ros/template/demo
.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | ValidateTemplate |
The operation that you want to perform. Set the value to ValidateTemplate. |
TemplateURL | String | No | oss://ros/template/demo |
The URL of the file that contains the template body. The URL must point to a template that is stored on an HTTP web server or in an Object Storage Service (OSS) bucket, for example, oss://ros/template/demo and oss://ros/template/demo?RegionId=cn-hangzhou. The template body can be up to 524,288 bytes in length. Note If you do not specify the region of the OSS bucket, the region ID of the stack is
used.
You can specify the TemplateBody or TemplateURL parameter, but not both parameters. The URL can be up to 1,024 bytes in length. |
RegionId | String | No | cn-hangzhou |
The region ID of the template. You can call the DescribeRegions operation to query the most recent region list. |
TemplateBody | String | No | {"ROSTemplateFormatVersion":"2015-09-01"} |
The structure of 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. You can specify the TemplateBody or TemplateURL parameter, but not both parameters. |
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 it 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. |
ValidationOption | String | No | None |
Specifies whether to enable additional validation for the template. Default value: None. Valid values:
|
For more information about common request parameters, see Common parameters.
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Description | String | No description |
The description of the template. |
Parameters | Array of Object | [{"Description": "", "Label": "param_integer", "NoEcho": "false", "ParameterKey": "param_integer", "Type": "Number"},{ "Description": "", "Label": "param_float", "NoEcho": "false", "ParameterKey": "param_float", "Type": "Number"}] |
The input parameters of the template. The input parameters define the parameters that you must specify when you use the template to create stacks. These parameters specify the stack details, such as the username, password, and Elastic Compute Service (ECS) instance type that you can use based on the region of the stack. |
RequestId | String | B288A0BE-D927-4888-B0F7-B35EF84B6E6F |
The ID of the request. |
Outputs | Array of Output |
The template outputs. |
|
OutputKey | String | instance_id |
The name of the template output. |
Description | String | The instance ID of my ECS. |
The description of the template output. |
Examples
Sample requests
http(s)://ros.aliyuncs.com/?Action=ValidateTemplate
&TemplateURL=oss://ros/template/demo
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<ValidateTemplateResponse>
<Description type="string">No description</Description>
<Parameters class="array">
<Parameter class="object">
<Description type="string"></Description>
<Label type="string">param_integer</Label>
<NoEcho type="string">false</NoEcho>
<ParameterKey type="string">param_integer</ParameterKey>
<Type type="string">Number</Type>
</Parameter>
<Parameter class="object">
<Description type="string"></Description>
<Label type="string">param_float</Label>
<NoEcho type="string">false</NoEcho>
<ParameterKey type="string">param_float</ParameterKey>
<Type type="string">Number</Type>
</Parameter>
<Parameter class="object">
<Description type="string"></Description>
<Label type="string">param_bool</Label>
<NoEcho type="string">false</NoEcho>
<ParameterKey type="string">param_bool</ParameterKey>
<Type type="string">Boolean</Type>
</Parameter>
<Parameter class="object">
<Description type="string"></Description>
<Label type="string">param_json_list</Label>
<NoEcho type="string">false</NoEcho>
<ParameterKey type="string">param_json_list</ParameterKey>
<Type type="string">Json</Type>
</Parameter>
<Parameter class="object">
<Default class="object">
<c class="array"></c>
</Default>
<Description type="string"></Description>
<Label type="string">param_has_default</Label>
<NoEcho type="string">false</NoEcho>
<ParameterKey type="string">param_has_default</ParameterKey>
<Type type="string">Json</Type>
</Parameter>
<Parameter class="object">
<Description type="string"></Description>
<Label type="string">UpdateVersion</Label>
<NoEcho type="string">false</NoEcho>
<ParameterKey type="string">UpdateVersion</ParameterKey>
<Type type="string">Number</Type>
</Parameter>
<Parameter class="object">
<Description type="string"></Description>
<Label type="string">param_str</Label>
<NoEcho type="string">false</NoEcho>
<ParameterKey type="string">param_str</ParameterKey>
<Type type="string">String</Type>
</Parameter>
<Parameter class="object">
<Description type="string"></Description>
<Label type="string">param_list</Label>
<NoEcho type="string">false</NoEcho>
<ParameterKey type="string">param_list</ParameterKey>
<Type type="string">CommaDelimitedList</Type>
</Parameter>
<Parameter class="object">
<Description type="string"></Description>
<Label type="string">param_json_dict</Label>
<NoEcho type="string">false</NoEcho>
<ParameterKey type="string">param_json_dict</ParameterKey>
<Type type="string">Json</Type>
</Parameter>
</Parameters>
<Outputs class="array">
<Output class="object">
<Description type="string">The instance ID of my ECS.</Description>
<ParameterKey type="string">instance_id</ParameterKey>
</Output>
</Outputs>
<RequestId type="string">B288A0BE-D927-4888-B0F7-B35EF84B6E6F</RequestId>
</ValidateTemplateResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"Description" : "No description",
"Parameters" : [ {
"Description" : "",
"Label" : "param_integer",
"NoEcho" : "false",
"ParameterKey" : "param_integer",
"Type" : "Number"
}, {
"Description" : "",
"Label" : "param_float",
"NoEcho" : "false",
"ParameterKey" : "param_float",
"Type" : "Number"
}, {
"Description" : "",
"Label" : "param_bool",
"NoEcho" : "false",
"ParameterKey" : "param_bool",
"Type" : "Boolean"
}, {
"Description" : "",
"Label" : "param_json_list",
"NoEcho" : "false",
"ParameterKey" : "param_json_list",
"Type" : "Json"
}, {
"Default" : {
"c" : [ ]
},
"Description" : "",
"Label" : "param_has_default",
"NoEcho" : "false",
"ParameterKey" : "param_has_default",
"Type" : "Json"
}, {
"Description" : "",
"Label" : "UpdateVersion",
"NoEcho" : "false",
"ParameterKey" : "UpdateVersion",
"Type" : "Number"
}, {
"Description" : "",
"Label" : "param_str",
"NoEcho" : "false",
"ParameterKey" : "param_str",
"Type" : "String"
}, {
"Description" : "",
"Label" : "param_list",
"NoEcho" : "false",
"ParameterKey" : "param_list",
"Type" : "CommaDelimitedList"
}, {
"Description" : "",
"Label" : "param_json_dict",
"NoEcho" : "false",
"ParameterKey" : "param_json_dict",
"Type" : "Json"
} ],
"Outputs" : [ {
"Description" : "The instance ID of my ECS.",
"OutputKey" : "instance_id"
} ],
"RequestId" : "B288A0BE-D927-4888-B0F7-B35EF84B6E6F"
}
Error codes
For a list of error codes, visit the API Error Center.
Error code |
Error message |
HTTP status code |
Description |
---|---|---|---|
InvalidTemplate |
{reason}. |
400 |
The error message returned because the specified template is invalid. reason indicates the specific reason. |
IInvalidParameter |
{reason}. |
400 |
The error message returned because the specified parameter in the template is invalid. reason indicates the specific reason. |