Importing a CCE Workload to an Application to Create a Component
Function
In CCE, a workload is a set of pods that work together in a certain mode to complete a specific application or service.
This API is used to import a workload created on CCE to an application for creating a component.
URI
POST /v3/{project_id}/cas/applications/{application_id}/components
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
project_id |
Yes |
String |
Tenant's project ID. See Obtaining a Project ID. |
application_id |
Yes |
String |
Application ID. See Obtaining All Applications. |
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 |
---|---|---|---|
create_mode |
Yes |
String |
Component creation mode. To import a workload created on CCE for creating components, set this parameter to import. |
name |
Yes |
String |
Application component name. The value contains 2 to 64 characters consisting of letters, digits, hyphens (-), and underscores (_). It starts with a letter and ends with a letter or digit. |
workload_name |
Yes |
String |
Name of the workload created on CCE. |
labels |
No |
Array of objects |
Label. For container-based deployment, you can query workloads by label. See Table 4. |
runtime_stack |
Yes |
Object |
Runtime. Fixed value: Docker. |
environment_id |
Yes |
String |
Environment ID. |
description |
No |
String |
Description. The value can contain up to 128 characters. |
version |
Yes |
String |
Component version number. The value can contain up to 32 characters. It needs to meet the following rule: ^([0-9]+)(.[0-9]+){2,3}$ |
workload_kind |
Yes |
String |
Workload type.
|
refer_resources |
Yes |
Array of objects |
Associated resource. See Table 5. If the imported workload requires microservice dark launch, association with the ServiceComb or Nacos engine is needed. |
external_accesses |
No |
Array of Objects |
External access. See Table 7. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
key |
Yes |
String |
Label name. |
value |
Yes |
String |
Label value. |
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
id |
Yes |
String |
Resource ID. |
type |
Yes |
String |
Resource type.
|
parameters |
No |
Object |
Resource parameters. See Table 6. |
Response
Parameter |
Type |
Description |
---|---|---|
instance_id |
String |
Component instance ID. |
Example Request
Create a stateless component named testcyf-import-deployment by importing the test-cyf-deployment workload from the CCE resource whose ID is 1d23eab7-da00-11ee-a1e1-0255ac1001ba.
{ "name": "testcyf-import-deployment", "description": "", "labels": [], "version": "2024.0506.16306", "environment_id": "9cff7557-4ebb-481b-bc1e-6a6573b5b8d2", "application_id": "563cab6a-53fb-4f5d-8921-de1bfe36db00", "enterprise_project_id": "0", "workload_name": "test-cyf-deployment", "workload_kind": "deployment", "runtime_stack": { "name": "Docker", "version": "", "type": "Docker", "deploy_mode": "container" }, "refer_resources": [{ "id": "1d23eab7-da00-11ee-a1e1-0255ac1001ba", "type": "cce", "parameters": { "namespace": "default" } }], "create_mode": "import" }
Example Response
{ "instance_id": "7897df44-e9c3-486f-9406-7a55e9aa55e2" }
Status Code
Status Code |
Description |
---|---|
200 |
OK |
400 |
Bad Request |
404 |
Not Found |
500 |
Internal Server Error |
Error Code
The error code format is SVCSTG.00100.[Error_ID], for example, SVCSTG.00100400. For details, see ServiceStage Error Codes.
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