Updated on 2023-06-25 GMT+08:00

Modifying an Application Component Instance

Function

This API is used to modify an application component instance.

URI

PUT /v2/{project_id}/cas/applications/{application_id}/components/{component_id}/instances/{instance_id}

Table 1 Path parameters

Parameter

Type

Mandatory

Description

project_id

String

Yes

Tenant's project ID.

application_id

String

Yes

Application ID.

component_id

String

Yes

Component ID.

instance_id

String

Yes

Component instance ID.

Request

Table 2 Request parameters

Parameter

Type

Mandatory

Description

version

String

Yes

Application component version that meets version semantics. Example: 1.0.1.

flavor_id

String

No

Resource specifications, which can be obtained by using the API in Obtaining All Supported Flavors of Application Resources.

If you need to customize resource specifications, the format is as follows: CUSTOM-xxG:xxC-xxC:xxGi-xxGi. Where:

  • xxG: storage capacity allocated to a component instance. It is a reserved field. You can set it to a fixed number.
  • xxC-xxC: the maximum and minimum number of CPU cores allocated to a component instance.
  • xxGi-xxGi: the maximum and minimum memory allocated to a component instance.

For example, CUSTOM-10G:0.5C-0.25C:1.6Gi-0.8Gi indicates that the maximum number of CPU cores allocated to a component instance is 0.5, the minimum number of CPU cores is 0.25, the maximum memory is 1.6 Gi, and the minimum memory is 0.8 Gi.

artifacts

Map<String, Object>

No

Artifact. key indicates the component name. In the Docker container scenario, key indicates the container name. See Table 3.

configuration

Map<String, Object>

No

Configuration parameters, such as environment variables, deployment configurations, and O&M monitoring. By default, this parameter is left blank. See Table 3 in Creating an Application Component Instance.

description

String

No

Description.

The value can contain up to 128 characters.

external_accesses

Array of objects

No

Access mode. See Table 4.

refer_resources

Array of objects

No

Deployed resources. See Table 5.

Table 3 artifact parameters

Parameter

Type

Mandatory

Description

storage

String

Yes

Storage mode. Value: swr or obs.

type

String

Yes

Type. Value: package (VM-based deployment) or image (container-based deployment).

url

String

Yes

Software package or image address. For a component deployed on a VM, this parameter is the software package address. For a component deployed based on a container, this parameter is the image address or component name:v${index}. The latter indicates that the component source code or the image automatically built using the software package will be used.

auth

String

Yes

Authentication mode. Value: iam or none. Default value: iam.

version

String

No

Version number.

properties

Map<String,String>

No

Property information.

Table 4 external_accesses parameters

Parameter

Type

Mandatory

Description

protocol

String

No

Protocol. Value: http or https.

address

String

No

Access address. Example: www.example.com.

forward_port

Integer

No

Port for listening to an application component process.

Table 5 refer_resources parameters

Parameter

Type

Mandatory

Description

id

String

Yes

Resource ID.

type

String

Yes

Resource type. Example: dcs.

refer_alias

String

No

Application alias. This parameter is available only when type is set to dcs. Value: "distributed_session", "distributed_cache", or "distributed_session, distributed_cache" (default).

parameters

Map<String,Object>

No

Reference resource parameter.

Response

Table 6 Response parameters

Parameter

Type

Description

job_id

String

Job ID, which is used to query information about the created job.

Example

Example request

{
	"description": "",
	"artifacts": {
		"test-micro": {
			"storage": "swr",
			"type": "image",
			"url": "swr.roma-dev-1.roma.development.com/ns1/examples:v2",
			"auth": "iam",
			"version": "1.0.0",
			"properties": {}
		}
	},
	"refer_resources": [
		{
			"id": "523498f1-36c4-11eb-ae36-0255ac1000c2",
			"type": "cce",
			"parameters": {
				"namespace": "default"
			}
		},
		{
			"id": "default",
			"type": "cse"
		}
	],
	"version": "1.0.2"
}

Example response

{
    "job_id": "JOB66761060-f209-407c-a093-4df6f531b9dc"
}

Status Code

Table 7 Status codes

Status Code

Description

200

OK

400

Bad Request

404

Not Found

500

Internal Server Error

Error Code

Error code must be in the format of SVCSTG.00100.[Error_ID]. Example: SVCSTG.00100400. See Error Codes of Application Management APIs.