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

Obtaining All Instances of a Component

Function

This API is used to obtain all instances of a component.

URI

GET /v2/{project_id}/cas/applications/{application_id}/components/{component_id}/instances

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.

Table 2 Query parameters

Parameter

Type

Mandatory

Description

limit

Integer

No

Number of records to be displayed. The value is 1000 or ranges from 0 to 100. If the specified value is not within the range, value 10 is assigned. In the non-pagination scenario, the value is 1000. In the pagination scenario, the value ranges from 0 to 100.

offset

Integer

No

Offset.

order_by

String

No

Sorting field. By default, query results are sorted by creation time.

The following enumerated values are supported: create_time, name, version, and update_time.

order

String

No

Descending or ascending order. Default value: desc.

Request

None

Response

Table 3 Response parameters

Parameter

Type

Description

count

Integer

Total number of instances.

instances

Array of objects

Instance parameters. See Table 4.

Table 4 instance parameters

Parameter

Type

Description

id

String

Component instance ID.

application_id

String

Application ID.

component_id

String

Component ID.

name

String

Component instance name.

environment_id

String

Component environment ID.

platform_type

String

Platform type.

Value: cce or vmapp.

artifacts

Map<String, Object>

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

version

String

Component version.

create_time

Integer

Creation time.

update_time

Integer

Update time.

external_accesses

Array of objects

Access mode. See Table 6.

status_detail

Object

Status details. See Table 7.

Table 5 artifact parameters

Parameter

Type

Description

storage

String

Storage mode. Value: swr, devcloud, or obs.

type

String

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

url

String

Software package or image address.

auth

String

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

version

String

Version number.

properties

Map<String,String>

Property information.

Table 6 external_accesses parameters

Parameter

Type

Description

protocol

String

Protocol.

address

String

Access address.

forward_port

Integer

Port for listening to an application component process.

type

String

Type.

status

String

Status.

create_time

Integer

Creation time.

update_time

Integer

Update time.

Table 7 status_detail parameters

Parameter

Type

Description

enterprise_project_id

String

Enterprise project ID.

status

String

Instance status.

available_replica

Integer

Number of normal instance replicas.

replica

Integer

Number of instance replicas.

fail_detail

String

Failure description.

last_job_id

String

Latest job ID.

last_job_status

String

Latest job status.

Example

Example request

None

Example response

{
	"instances": [
		{
			"id": "11eddb33-140b-4e51-b1e2-6ec265373ca3",
			"application_id": "4d92833a-fa05-4fc0-a761-e67620022310",
			"component_id": "1cfdda6f-84cd-4ead-8e09-628fabf662e2",
			"name": "test-micro-test-env-7iafjk",
			"environment_id": "61b81021-21d5-42f3-b80e-0b6bd10dbf7d",
			"platform_type": "cce",
			"version": "1.0.0",
			"artifacts": {
				"test-micro": {
					"storage": "swr",
					"type": "image",
					"url": "swr.region_id.development.com/ns/examples:v1",
					"auth": "iam",
					"version": "1.0.0",
					"properties": {}
				}
			},
			"create_time": 1610331819996,
			"update_time": 1610331830398,
			"status_detail": {
				"status": "RUNNING",
				"replica": 1,
				"available_replica": 1,
				"fail_detail": null,
				"last_job_id": "JOB7bc0366c-dc43-41f9-b65f-8d6078038488",
				"last_job_status": "SUCCEEDED",
				"enterprise_project_id": "0"
			}
		}
	],
	"count": 1
}

Status Code

Table 8 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.