Help Center> ServiceStage> API Reference> Application Management APIs> Instances> Obtaining All Instances of a Component

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 queried. Value range: 0–100. Default value: 1000, indicating that a maximum of 1000 records can be queried and all records are displayed on the same page.

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 Parameters

Request parameters

None

Response Parameters

Response parameters

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.

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

version

String

Component version.

creator

String

Creator.

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 or obs.

type

String

Type. Value: package (VM deployment) or image (container 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

id

String

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

Example

Example request

None

Example response

{
  "count": 10,
  "instances": [
    {
      "id": "string",
      "application_id": "string",
      "application_name": "string",
      "component_id": "string",
      "component_name": "string",
      "name": "string",
      "environment_id": "string",
      "environment_name": "string",
      "platform_type": "string",
      "version": "string",
      "external_accesses": [
        {
          "id": "xxx",
          "protocol": "HTTP",
          "address": "string",
          "forward_port": 80,
          "type": "AUTO_GENERATED",
          "status": "NORMAL",
          "create_time": 1571626146765,
          "update_time": 1571626146765
        }
      ],
      "artifacts": {
        "container-name": {
          "storage": "swr",
          "type": "image",
          "url": "{IP}:20202/xxxxxxxx/junit-platformstest:1.0",
          "auth": "iam"
        }
      },
      "creator": "string",
      "create_time": 0,
      "update_time": 0,
      "status_detail": {
	    "enterprise_project_id": "0",
        "status": "RUNNING",
        "available_replica": 1,
        "replica": 1,
        "fail_detail": "cluster_deleted",
        "last_job_id": "xxx"
      }
    }
  ]
}

Status Code

Table 8 Status codes

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.