Creating a Component Based on a Component Template
Function
This API is used to create a component based on a component template.
URI
POST /v3/{project_id}/cas/components
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Tenant's project ID. See Obtaining a Project ID. |
Request
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
Content-Type |
Yes |
String |
Message body type (format). Default value: application/json;charset=utf8. |
X-Auth-Token |
Yes |
String |
API calling can be authenticated using a token or AK/SK. If you use a token, this parameter is mandatory and must be set to the token. For details about how to obtain the token, see Authentication. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
environment_id |
No |
String |
Environment ID. See Obtaining All Environments. |
application_id |
No |
String |
Application ID. See Obtaining All Applications. |
template_source |
No |
Object |
Source of the component template package. See Table 4. |
input_values |
No |
Map<String, String> |
Template package input information. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
storage |
Yes |
String |
Storage mode of the component template package.
|
url |
Yes |
String |
Address of the component template package. This parameter is valid only when the component template package storage mode is http. |
http_username |
No |
String |
Username. This parameter is valid only when the component template package storage mode is http and the security authentication mode is username and password authentication. |
http_password |
No |
String |
Password. This parameter is valid only when the component template package storage mode is http and the security authentication mode is username and password authentication. |
http_headers |
No |
Array of objects |
Request header. See Table 5. This parameter is valid only when the component template package storage mode is http and the security authentication mode is custom header authentication. |
Response
Parameter |
Type |
Description |
---|---|---|
component_id |
Integer |
Component ID. |
job_id |
Integer |
Job ID. |
Example Request
Create a container-deployed component based on the component template.
{ "environment_id": "2393eecc-69bc-40a9-9b6c-996a9259618d", "application_id": "dda56ba8-5295-3d0d-b298-72cb1da3f515", "template_source": { "storage": "obs", "url": "obs://apitest/demo-app-package.zip", "http_username": null, "http_password": null, "http_headers": [] }, "input_values": { "config_name": "demo-group/application.yaml", "namespace": "default", "dep_name": "test-demo", "svc_port": 8080, "value": "World", "cce_resource": "ef1b6474-906c-11ef-a773-0255ac1000a3", "elb_resource": "053dcc46-d3fd-4796-bba1-b73650ec0906", "image": "swr.ap-southeast-1.myhuaweicloud.com/ss/demo-app:latest" } }
Example Response
{ "job_id": "string", "component_id": "string" }
Status Code
Status Code |
Description |
---|---|
200 |
OK |
400 |
Bad Request |
404 |
Not Found |
500 |
Internal Server Error |
Error Code
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot