Help Center/ ServiceStage/ API Reference/ Application Management V3 APIs/ Component/ Importing a CCE Workload to an Application to Create a Component
Updated on 2026-04-10 GMT+08:00

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.

Authorization Information

Each account has all of the permissions required to call all APIs, but IAM users must have the required permissions specifically assigned.

  • If you are using role/policy-based authorization, see the required permissions in Permissions and Supported Actions.
  • If you are using identity policy-based authorization, the permission listed below is required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    servicestage:app:createComponent

    write

    app *

    servicestage:app:create

    • aom:discoveryRule:list
    • aom:discoveryRule:set
    • as:scalingConfig:create
    • as:scalingConfig:get
    • as:scalingConfig:list
    • as:scalingPolicy:create
    • as:scalingPolicy:get
    • as:scalingPolicy:list
    • cce:cluster:get
    • dcs:instance:get
    • dns:recordset:create
    • dns:recordset:get
    • ecs:cloudServers:get
    • elb:l7policies:create
    • elb:l7policies:get
    • elb:l7policies:list
    • elb:listeners:create
    • elb:listeners:get
    • elb:listeners:list
    • elb:members:create
    • elb:members:get
    • elb:members:list
    • ims:dataImages:create
    • ims:images:create
    • ims:images:get
    • ims:images:list
    • ims:wholeImages:create
    • rds:instance:get
    • servicestage:assembling:create
    • servicestage:assembling:getInfo
    • vpc:addressGroups:get
    • vpc:networks:get
    • vpc:routeTables:get
    • vpc:securityGroupRules:get
    • vpc:securityGroups:get
    • vpc:subnets:get
    • vpc:subnets:get
    • vpc:vpcs:get

URI

POST /v3/{project_id}/cas/applications/{application_id}/components

Table 1 Path parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

Tenant's project ID. See Obtaining a Project ID.

Constraints

N/A

Range

N/A

Default Value

N/A

application_id

Yes

String

Definition

Application ID. See Obtaining All Applications.

Constraints

N/A

Range

N/A

Default Value

N/A

Request

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

Content-Type

Yes

String

Definition

Message body type (or format).

Constraints

N/A

Range

application/json;charset=utf8

Default Value

N/A

X-Auth-Token

Yes

String

Definition

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.

Constraints

N/A

Range

N/A

Default Value

N/A

Table 3 Request body parameter

Parameter

Mandatory

Type

Description

create_mode

Yes

String

Definition

Component creation mode.

Range

To import a workload created on CCE for creating components, set this parameter to import.

Default Value

N/A

name

Yes

String

Definition

Application component name.

Range

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.

Default Value

N/A

workload_name

Yes

String

Definition

Name of the workload created on CCE.

Range

N/A

Default Value

N/A

labels

No

Array of objects

Definition

Label.

For container-based deployment, you can query workloads by label. See Table 4.

runtime_stack

Yes

Object

Definition

Runtime. Fixed value: Docker.

environment_id

Yes

String

Definition

Environment ID.

Range

N/A

Default Value

N/A

description

No

String

Definition

Description.

Range

The value can contain up to 128 characters.

Default Value

N/A

version

Yes

String

Definition

Component version.

Range

The value can contain up to 32 characters. It needs to meet the following rule:

^([0-9]+)(\.[0-9]+){2,3}$

Default Value

N/A

workload_kind

Yes

String

Definition

Workload type.

Range

  • deployment
  • statefulset

Default Value

N/A

refer_resources

Yes

Array of objects

Definition

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

Definition

External access. See Table 7.

Table 4 labels

Parameter

Mandatory

Type

Description

key

Yes

String

Definition

Label name.

Range

The value contains 1 to 36 characters, including digits, letters, underscores (_), or hyphens (-).

NOTE:

The value of Key cannot be the built-in app, casid, or version of the system. Otherwise, an error will be reported during component creation and deployment.

Default Value

N/A

value

Yes

String

Definition

Label value.

Range

The value contains 0 to 43 characters, including digits, letters, underscores (_), periods (.), or hyphens (-).

Default Value

N/A

Table 5 refer_resources

Parameter

Mandatory

Type

Description

id

Yes

String

Definition

Resource ID.

Range

N/A

Default Value

N/A

type

Yes

String

Definition

Resource type.

Range

  • elb
  • cce
  • dcs
  • rds
  • cse: ServiceComb engine
  • nacos: registry/configuration center
  • gaussdb
  • dms_rocketmq
  • pvc
  • css_es: Elasticsearch
  • custom_k8s: custom Kubernetes cluster

Default Value

N/A

parameters

No

Object

Definition

Resource parameters. See Table 6.

Table 6 refer_resource_parameter

Parameter

Mandatory

Type

Description

namespace

No

String

Definition

Namespace.

Range

N/A

Default Value

N/A

Table 7 external_accesses

Parameter

Mandatory

Type

Description

protocol

No

String

Definition

External access type.

Range

  • http
  • https

Default Value

N/A

address

No

String

Definition

External access address.

Range

N/A

Default Value

N/A

forward_port

No

Integer

Definition

External access port.

Range

N/A

Default Value

N/A

Response

Table 8 Response parameters

Parameter

Type

Description

instance_id

String

Definition

Component instance ID.

Range

N/A

component_id

String

Definition

Component ID.

Range

N/A

job_id

String

Definition

Task ID.

Range

N/A

Example Request

Create a stateless component named test-import-deployment by importing the test-deployment workload from the CCE resource whose ID is 1d23eab7-da00-11ee-a1e1-0255ac1001ba.

{
	"name": "test-import-deployment",
	"description": "",
	"version": "2024.0506.16306",
	"environment_id": "9cff7557-4ebb-481b-bc1e-6a6573b5b8d2",
	"workload_name": "test-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

See ServiceStage Error Codes.