Updated on 2024-10-16 GMT+08:00

Obtaining All Component Instances

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

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.

component_id

Yes

String

Component ID. See Obtaining All Components of an Application.

Table 2 Query parameters

Parameter

Mandatory

Type

Description

maxWaitTime

No

int

User-defined overall startup time.

limit

No

Integer

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

No

Integer

Offset.

order_by

No

String

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

Enumerated values: create_time, name, version, and update_time.

order

No

String

Sorting order.

  • desc (default)
  • asc

Request

Table 3 Request header parameters

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 a token, see Obtaining a User Token.

Response

Table 4 Response parameters

Parameter

Type

Description

count

Integer

Total number of instances.

instances

Array of objects

Instance parameters. See Table 5.

Table 5 instance

Parameter

Type

Description

id

String

Component instance ID.

application_id

String

Application ID.

application_name

String

Application name.

component_id

String

Component ID.

component_name

String

Component name.

name

String

Component instance name.

environment_id

String

Component environment ID.

environment_name

String

Environment name.

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 6.

creator

String

Creator.

version

String

Component version.

create_time

Integer

Creation time.

update_time

Integer

Update time.

external_accesses

Array of objects

Access mode. See Table 7.

status_detail

Object

Status details. See Table 8.

Table 6 artifact

Parameter

Type

Description

storage

String

Storage mode. Value: swr (software repository), swr (image), obs, or codearts.

type

String

Type.

  • VM-based deployment supports package.
  • Container-based deployment supports package and image.

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 7 external_accesses

Parameter

Type

Description

id

String

Access type ID.

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 8 status_detail

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 Request

None

Example Response

{
	"instances": [
		{
			"id": "11eddb33-140b-4e51-b1e2-6ec265373ca3",
			"application_id": "4d92833a-fa05-4fc0-a761-e67620022310",
			"application_name": "test-app",
			"component_id": "1cfdda6f-84cd-4ead-8e09-628fabf662e2",
			"component_name": "test-com",
			"name": "test-micro-test-env-7iafjk",
			"environment_id": "61b81021-21d5-42f3-b80e-0b6bd10dbf7d",
			"environment_name": "test-env",
			"platform_type": "cce",
			"version": "1.0.0",
			"artifacts": {
				"test-micro": {
					"storage": "obs",
					"type": "package",
                                        "url": "obs://myapp/demo.jar",
	                                "properties": {
				            "bucket": "myapp",
				            "key": "demo.jar",
				            "endpoint": "https://obs.region_id.external_domain_name.com"
			                 },
					"auth": "iam",
					"version": "1.0.0",					
				}
			},
			"create_time": 1610331819996,
			"update_time": 1610331830398,
			"creator": "test_user",
			"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

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.