You can call this operation to create a configuration template based on an existing deployment environment.
Debugging
Request headers
This operation uses common request headers, instead of special request headers. For more information, see the "Common request headers" section in "Common request and response headers."
Request syntax
POST /pop/v1/wam/configTemplate HTTP/1.1
Request parameters
Parameter | Type | Required? | Example | Description |
---|---|---|---|---|
AppId | String | No | wa-5d1d9d8c85c7f86e2efb**** |
The ID of the application to which the configuration template to be created belongs. |
OptionSettings | String | No | [{"path":"resources.ecs.autoScaling", "name":"instanceNum","value":"10"}, {"path":"application.option", "name":"port","value":"8081"}] |
The custom configuration item data, in the format of a JSON array. The array contains the following fields:
|
PkgVersionId | String | No | wp-5d1daece08350d1dd948**** |
The ID of the deployment package version. |
ProfileName | String | No | HighAvailability |
The type of the initial configuration. Valid values:
|
SourceEnvId | String | No | we-5d1dac8e08350d1dd948**** |
The ID of the source deployment environment used to create the new configuration template. |
SourceTemplateId | String | No | wct-5d1ec2813c940d1bf45b**** |
The ID of the source configuration template based on which the new configuration template is to be created. |
StackId | String | No | ws-6c937c98a9c0296d0c482**** |
The ID of the technology stack. |
TemplateDescription | String | No | this is an new template |
The description of the new configuration template. |
TemplateName | String | No | new-template-name |
The name of the new configuration template. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
Code | String | OK |
The response code. The value is OK if the request is successful. |
ConfigTemplate |
The information about the configuration template. |
||
AppId | String | wa-5d1d9d8c85c7f86e2ef***** |
The ID of the application. |
AppName | String | app1 |
The name of the application. |
CreateTime | Long | 1562589211442 |
The time when the configuration template was created. |
PkgVersionId | String | wp-5d1daece08350d1dd94***** |
The ID of the deployment package version. |
PkgVersionLabel | String | 20190726.135654 |
The label of the deployment package version. |
StackId | String | ws-6c937c98a9c0296d0c48***** |
The ID of the technology stack. |
StackName | String | Java 8 / Aliyun Linux 2.1903 |
The name of the technology stack. |
TemplateDescription | String | this is an new template |
The description of the configuration template. |
TemplateId | String | wct-5d1ec866d56beb722b7***** |
The ID of the configuration template. |
TemplateName | String | new-template-name |
The name of the configuration template. |
TemplateType | String | web |
The type of the configuration template. |
UpdateTime | Long | 1562298470970 |
The time when the configuration template was last updated. |
Message | String | success |
The response message. The value is success if the request is successful. |
RequestId | String | 7C8AA286-14EA-4713-B81D-859BECF1**** |
The ID of the request. |
Examples
Sample request
http://webplus.cn-hangzhou.aliyuncs.com/pop/v1/wam/configTemplate?ServiceCode=webx&<Common request parameters>
{
"TemplateName","new-template-name",
"TemplateDescription","this is an new template",
"AppId","wa-5d1d9d8c85c7f86e2efb****",
"StackId","ws-6c937c98a9c0296d0c482****",
"SourceTemplateId","wct-5d1ec2813c940d1bf45b****",
"SourceEnvId","we-5d1dac8e08350d1dd948****",
"ProfileName","HighAvailability",
"PkgVersionId","wp-5d1daece08350d1dd948****",
"OptionSettings","[{"path":"resources.ecs.autoScaling", "name":"instanceNum","value":"10"}, {"path":"application.option", "name":"port","value":"8081"}]",
}
Sample success response
XML
format
<CreateConfigTemplateResponse>
<ConfigTemplate>
<TemplateName>new-template-name</TemplateName>
<TemplateDescription>this is an new template</TemplateDescription>
<Type>web</Type>
<StackId>ws-6c937c98a9c0296d0c482****</StackId>
<CreateTime>1562298470970</CreateTime>
<AppId>wa-5d1d9d8c85c7f86e2efb****</AppId>
<UpdateTime>1562298470970</UpdateTime>
<AppName>app1</AppName>
<TemplateId>wct-5d1ec866d56beb722b77****</TemplateId>
<PkgVersionId>wp-5d1daece08350d1dd948****</PkgVersionId>
<StackName>Tomcat 8.5 / Java 8 / Aliyun Linux 2.1903</StackName>
</ConfigTemplate>
<Message>success</Message>
<RequestId>7C8AA286-14EA-4713-B81D-859BECF1****</RequestId>
<Code>OK</Code>
</CreateConfigTemplateResponse>
JSON
format
{
"Message":"success",
"RequestId":"02DE47B1-68AE-4F15-AC0B-94166D4F****",
"ConfigTemplate":{
"TemplateType":"web",
"TemplateName":"template-name",
"TemplateDescription":"this is an new template",
"StackId":"ws-6c937c98a9c0296d0c482****",
"CreateTime":1564384554840,
"PkgVersionLabel":"20190726.135654",
"AppId":"wa-5d1af9c802470221ab7d****",
"UpdateTime":1564384554840,
"AppName":"app1",
"PkgVersionId":"wp-5d3a963b5802611c4ddc****",
"StackName":"Java 8 / Aliyun Linux 2.1903",
"TemplateId":"wct-5d3e9d2a2977ca5251e0****"
},
"Code":"OK"
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
403 | ResourceAuthFailed | The specified resource does not exist or it does not belong to this Alibaba Cloud account. | The error message returned because the specified resource does not exist or it does not belong to your Alibaba Cloud account. |
400 | AppNotExist | A corresponding application was not found based on the application ID. | The error message returned because the application of the specified ID does not exist. |
400 | DuplicatedTemplateName | An error occurred while generating an environment configuration template. The specified template name already exists in the application. | The error message returned because an error occurred while generating a configuration template. Use a unique template name in the application. |
400 | AppCategoryNotMatchWithStacks | The application type declared in the application does not match the type of the software stack. Please make sure that the types are consistent and then try again. | The error message returned because the platform type specified for the application is different from that in the technology stack. Use a consistent platform type and try again. |
404 | StackNotExists | The declared software stack information does not exist. | The error message returned because the declared technology stack information does not exist when you create or update a deployment environment for an application. |
400 | StackContainsNoConfigOption | An error occurred while modifying the configuration. The corresponding software stack does not contain any configuration items. | The error message returned because an error occurred while updating the configuration. The specified technology stack does not contain any configuration items. |
404 | ConfigOptionNotExists | An error occurred while updating the configuration. The system did not locate the configuration item declared by the key. | The error message returned because an error occurred while updating the configuration. The system did not locate the configuration item declared by the key. |
400 | ChangingAReadonlyConfig | An error occurred while modifying the configuration. You cannot modify a read-only configuration. | The error message returned because an error occurred while updating the configuration. You cannot modify a read-only configuration item. |
400 | ConfigValueInvalid | An error occurred while resolving the configuration values. Please make sure the value type and constraints is consistent with the declared type. Types currently supported by WebPlus are: String, Integer, List, Boolean, Float, Json. | The error message returned because an error occurred while resolving the values of configuration items. Ensure that the value types of configuration items are the same as the declared value types. Currently, Web+ supports the following value types: String, Integer, List, Boolean, Float, and JSON. |
404 | AppPackageNotExists | An application deployment package is required to create or update a deployment environment. For the first time of using WebPlus, we recommend that you use a sample project. | The error message returned because you did not use a real application deployment package when creating or updating a deployment environment. If you are using Web+ for the first time, we recommend that you use the sample project. |
400 | AppPackageOwnedByOthers | The version of the application package used must be consistent with the application to which the environment belongs. | The error message returned because the deployment package version used to create or update a deployment environment for an application does not belong to the application. |
400 | ConfigParsingFailed | An error occurred while extracting the corresponding item from the configuration. Please check the configuration and try again. | The error message returned because an error occurred while resolving the settings of parameters. Verify that the settings are correct and try again. |
400 | ProfileNameInvalid | The specified cluster type in the template is invalid. Valid values: Default, StandAlone, and HighAvailability. | The error message returned because the cluster type specified in the launch template is invalid. Valid values of a cluster type include Default, StandAlone, and HighAvailability. |
For more information about error codes, see API Error Center.