Creating an Application Component Instance
Function
This API is used to create an application component instance.
URI
POST /v2/{project_id}/cas/applications/{application_id}/components/{component_id}/instances
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| project_id | String | Yes | Tenant's project ID. |
| application_id | String | Yes | Application ID. |
| component_id | String | Yes | Component ID. |
Request Parameters
Request parameters
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| name | String | Yes | Component instance name. |
| environment_id | String | Yes | Environment ID. |
| replica | Integer | Yes | Number of instance replicas. |
| flavor_id | String | Yes | Resource flavor, which can be obtained by using the API in Obtaining All Supported Flavors of Application Resources. |
| artifacts | Map<String, Object> | Yes | Artifact. key indicates the component name. See Table 3. |
| version | String | Yes | Application component version that meets version semantics. Example: 1.0.0. |
| configuration | Map<String, Object> | No | Application configurations and environment variables. Example: {"env": [{"name": "log-level": "warn"}]}. By default, this parameter is left blank. |
| description | String | No | Description. |
| external_accesses | Array of objects | No | External network access. See Table 4. |
| refer_resources | Array of objects | Yes | Deployed resources. See Table 5. |
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| storage | String | Yes | Storage mode. Value: swr, obs, or devcloud. |
| type | String | Yes | Type. Value: package (VM deployment) or image (container deployment). |
| url | String | Yes | Software package or image address. For the image which is automatically generated using the component source code or software package, the format is "Component name:v${index}". |
| auth | String | Yes | Authentication mode. Value: iam or none. Default value: iam. |
| version | String | No | Version number. |
| properties | Map<String, Object> | No | Property information. |
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| protocol | String | Yes | Protocol. Value: http or https. |
| address | String | Yes | Access address. |
| forward_port | Integer | Yes | Port number. |
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
| id | String | Yes | Resource ID. |
| type | String | Yes | Basic resources: Cloud Container Engine (CCE), Cloud Container Instance (CCI), Elastic Cloud Server (ECS), and Auto Scaling (AS). Optional resources: Relational Database Service (RDS), Distributed Cache Service (DCS), Elastic Load Balance (ELB), and other services. |
| refer_alias | String | No | Application alias, which is provided only in DCS scenario. Value: "distributed_session", "distributed_cache", "distributed_session, distributed_cache". Default value: "distributed_session, distributed_cache". |
| parameters | Map<String,String> | No | Reference resource parameter. |
Response Parameters
Response parameters
| Parameter | Type | Description |
|---|---|---|
| job_id | String | Job ID, which is used to query information about the created job. |
| instance_id | String | Component instance ID. |
Example
Example request
{
"name": "component-instance-name",
"environment_id": "6e763000-9128-4a9d-adea-34c42cc5344d",
"flavor_id": "MICRO-5G:0.5C:1G",
"replica": 1,
"artifacts": {
"container-name": {
"storage": "swr",
"type": "image",
"url": "{IP}:20202/xxxxxxxx/junit-platformstest:1.0",
"auth": "iam"
}
},
"version": 1,
"description": "instance desc",
"configuration": {
"env": [
{
"name": "log-level",
"value": "warn"
}
]
},
"refer_resources": [
{
"id": "b6862a62-d916-11e9-bdf1-0255ac101fd9",
"type": "cce",
"parameters": {
"namespace": "default"
}
},
{
"id": "8c0a45cc-626f-4d65-8257-507ee059aa9a",
"type": "elb"
}
]
} Example response
{
"instance_id": "89f5baf5-efe4-4f12-9c0d-734d2af5a184",
"job_id": "JOB66761060-f209-407c-a093-4df6f531b9dc"
} Status Code
| HTTP Status Code | Description |
|---|---|
| 200 | OK |
| 400 | Bad Request |
| 404 | Not Found |
| 500 | Internal Server Error |
Error code must be in the format of SVCSTG.00100.[Error_ID]. Example: SVCSTG.00100400. See Error Codes of Application Management APIs.
Last Article: Instances
Next Article: Obtaining All Instances of a Component
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.