• Elastic Cloud Server

ecs
  1. Help Center
  2. Elastic Cloud Server
  3. API Reference
  4. OpenStack Nova APIs
  5. ECS Group Management
  6. Querying ECS Groups

Querying ECS Groups

Function Description

This interface is used to query ECS groups.

URI

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

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.

Request

Request parameters

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

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

Table 2 describes the request parameters.

Table 2 Request parameters

Parameter

Type

Mandatory

Description

all_projects

Boolean

No

Determines whether to query ECSs of all tenants.

The ECSs of all tenants can be queried only if this parameter is used, even if its value is not True.

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

Response

Response parameters

Table 3 describes the response parameters.

Table 3 Response parameters

Parameter

Type

Mandatory

Description

server_groups

List(Dict)

Yes

Specifies an ECS group.

Table 4 server_groups parameter information

Parameter

Type

Mandatory

Description

id

String

Yes

Specifies an ECS group UUID.

name

String

Yes

Specifies an ECS group name.

members

List(String)

Yes

Specifies the ECSs in an ECS group.

metadata

Dict

Yes

Specifies ECS group metadata.

project_id

String

Yes

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

This field is newly added in version 2.13.

policies

List

Yes

Specifies the policies associated with an 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

String

Yes

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

This field is newly added in version 2.13.

Examples

  • Example request
    GET /v2/9c53a566cb3443ab910cf0daebca90c4/os-server-groups
    GET /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"
            }
        ]
    }

Returned Values

See General Request Returned Values.