Validates a template that you want to use to create a stack.
This topic provides an example on how to validate a template that you want to use to create a stack. In this example, 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 located on an HTTP or HTTPS web server or in an Object Storage Service (OSS) bucket, such as oss://ros/template/demo or 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 ID of the OSS bucket, the value of the RegionId parameter is used. You can specify only one of the TemplateBody and TemplateURL parameters. The URL can be up to 1,024 bytes in length. |
RegionId | String | No | cn-hangzhou | The ID of the region where the template resides. You can call the DescribeRegions operation to query the most recent region list. |
TemplateBody | String | No | {"ROSTemplateFormatVersion":"2015-09-01"} | 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. You can specify only one of the TemplateBody and TemplateURL 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 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. |
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 parameters in the Parameters section of the template. The Parameters section contains the parameters that you must specify when you use the template to create a stack. You can use the parameters to specify the stack details, such as the username, the password, and the Elastic Compute Service (ECS) instance type in the specified region. |
RequestId | String | B288A0BE-D927-4888-B0F7-B35EF84B6E6F | The ID of the request. |
Outputs | Array of Output | The output items of the template. | |
OutputKey | String | instance_id | The name of the output item. |
Description | String | The instance ID of my ECS. | The description of the output item. |
Label | String | Instance ID | The alias of the output item. |
ResourceTypes | Object | The resource types that are used in the template. | |
Resources | Array of String | ALIYUN::ECS::InstanceGroup | The regular resource types. |
DataSources | Array of String | DATASOURCE::VPC::Vpcs | The DataSource resource types. |
Resources | Array of Resource | The regular resources that are defined in the template. Note
| |
ResourceType | String | ALIYUN::ECS::InstanceGroup | The regular resource type. |
ResourcePath | String | server | The path of the regular resource. In most cases, the path of a regular resource is the same as the resource name. |
LogicalResourceIdPattern | String | server | The pattern in which the logical IDs of regular resources are formed. If resources are defined in an ROS template, the following rules apply:
If resources and modules are defined in a Terraform template, the following rules apply:
Examples of the LogicalResourceIdPattern parameter for resources in a Terraform template:
|
UpdateInfo | Object | The update information about the stack. | |
ParametersAllowedToBeModified | Array of String | param1 | The parameters that can be modified. If you change only values of the parameters in a stack template and use the template to update the stack, no validation errors are caused. |
ParametersCauseInterruptionIfModified | Array of String | param1 | The parameters whose changes cause service interruptions. If you change only values of the parameters in a stack template and use the template to update the stack, service interruptions are caused. Note
|
ParametersConditionallyAllowedToBeModified | Array of String | param2 | The parameters that can be modified under specific conditions. If you change only values of the parameters in a stack template and use the template to update the stack, the new values of the parameters determine whether validation errors are caused. |
ParametersConditionallyCauseInterruptionIfModified | Array of String | param2 | The parameters whose changes cause service interruptions under specific conditions. If you change only values of the parameters in a stack template and use the template to update the stack, the new values and the update type determine whether service interruptions are caused. Note
|
ParametersNotAllowedToBeModified | Array of String | param3 | The parameters that cannot be modified. If you change only values of the parameters in a stack template and use the template to update the stack, validation errors are caused. |
ParametersUncertainlyAllowedToBeModified | Array of String | param4 | The parameters that can be modified under uncertain conditions. If you change only values of the parameters in a stack template and use the template to update the stack, the actual running environment determines whether validation errors are caused. |
ParametersUncertainlyCauseInterruptionIfModified | Array of String | param4 | The parameters whose changes cause service interruptions under uncertain conditions. If you change only values of the parameters in a stack template and use the template to update the stack, the actual running environment determines whether service interruptions are caused. Note
|
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>No description</Description>
<Parameters>
<Description/>
<Label>param_integer</Label>
<NoEcho>false</NoEcho>
<ParameterKey>param_integer</ParameterKey>
<Type>Number</Type>
</Parameters>
<Parameters>
<Description/>
<Label>param_float</Label>
<NoEcho>false</NoEcho>
<ParameterKey>param_float</ParameterKey>
<Type>Number</Type>
</Parameters>
<RequestId>B288A0BE-D927-4888-B0F7-B35EF84B6E6F</RequestId>
<Outputs>
<OutputKey>instance_id</OutputKey>
<Description>The instance ID of my ECS.</Description>
</Outputs>
<ResourceTypes>
<Resources>ALIYUN::ECS::InstanceGroup</Resources>
<DataSources>DATASOURCE::VPC::Vpcs</DataSources>
</ResourceTypes>
</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"
} ],
"RequestId" : "B288A0BE-D927-4888-B0F7-B35EF84B6E6F",
"Outputs" : {
"OutputKey" : "instance_id",
"Description" : "The instance ID of my ECS."
},
"ResourceTypes" : {
"Resources" : "ALIYUN::ECS::InstanceGroup",
"DataSources" : "DATASOURCE::VPC::Vpcs"
}
}
Error codes
For a list of error codes, see Service error codes.
Error code | Error message | HTTP status code | Description |
---|---|---|---|
InvalidTemplate | {reason}. | 400 | The error message returned because the specified template is invalid. reason indicates the cause of the error. |
IInvalidParameter | {reason}. | 400 | The error message returned because the specified parameter in the template is invalid. reason indicates the cause of the error. |