Querying ECS Groups

Function

This API is used to query ECS groups.

URI

GET /v2.1/{project_id}/os-server-groups

Table 1 describes the parameters in the URI.
Table 1 Parameter description

Parameter

Mandatory

Description

project_id

Yes

Specifies the project ID.

For details about how to obtain the ID, see Obtaining a Project ID.

Parameters in the following table can be used as URI parameters to filter query results.

Usage: /v2/{project_id}/os-server-groups?

  • Tenants can query only their server_group lists. A maximum of 1000 query results can be returned.

Request

None

Response

Table 2 describes the response parameters.

Table 2 Response parameters

Parameter

Mandatory

Type

Description

server_groups

Yes

Array of objects

Specifies ECS groups.

Table 3 server_groups parameter information

Parameter

Mandatory

Type

Description

id

Yes

String

Specifies the ECS group UUID.

name

Yes

String

Specifies the ECS group name.

members

Yes

Array of strings

Specifies the ECSs in an ECS group.

metadata

Yes

Object

Specifies the ECS group metadata.

project_id

Yes

String

Specifies the tenant ID in UUID format for the ECS group.

This field is newly added in version 2.13.

policies

Yes

Array of strings

Specifies the policies associated with the ECS group. Options:
  • anti-affinity: ECSs in this group must be deployed on different hosts.
  • affinity: ECSs in this group must be deployed on the same host.
  • soft-anti-affinity: ECSs in this group are deployed on different hosts if possible. If the ECSs cannot be deployed on different hosts, deploy them based on the actual condition for successful ECS creation.
  • soft-affinity: ECSs in this group are deployed on the same host if possible. If the ECSs cannot be deployed on the same host, deploy them based on the actual condition for successful ECS creation.
    NOTE:

    Only the anti-affinity policy is supported.

user_id

Yes

String

Specifies the user ID in UUID format for the ECS group.

This field is newly added in version 2.13.

Example Request

GET https://{endpoint}/v2.1/9c53a566cb3443ab910cf0daebca90c4/os-server-groups

Example Response

{
    "server_groups": [
        {
            "id": "616fb98f-46ca-475e-917e-2563e5a8cd19",
            "name": "test",
            "policies": ["anti-affinity"],
            "members": [],
            "metadata": {},
            "project_id": "9c53a566cb3443ab910cf0daebca90c4"
        }
    ]
}