Help Center/ Enterprise Switch/ API Reference/ Enterprise Switch/ Querying the Enterprise Switches
Updated on 2025-12-04 GMT+08:00

Querying the Enterprise Switches

Function

This API is used to query the details about all the enterprise switches.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

esw:instance:list

List

-

-

-

-

URI

GET /v3/{project_id}/l2cg/instances

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

  • Definition: ID of the project to which the enterprise switch belongs.

  • Constraints: N/A

  • Range: N/A

  • Default value: N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

id

No

String

  • Definition: ID of an enterprise switch. Each enterprise switch comes with an ID, which uniquely identifies the enterprise switch.

  • Constraints: The value is in the UUID format with hyphens (-).

  • Range: N/A

  • Default value: N/A

name

No

String

  • Definition: Name of the enterprise switch.

  • Constraints:

    • The value can contain 1 to 64 characters.

    • The value can contain letters, digits, underscores (_), hyphens (-), and periods (.).

  • Range: N/A

  • Default value: N/A

project_id

No

String

  • Definition: ID of the project to which the enterprise switch belongs.

  • Constraints: N/A

  • Range: N/A

  • Default value: N/A

description

No

String

  • Definition: Description of the enterprise switch.

  • Constraints:

    • The value can contain 0 to 255 characters.

    • Angle brackets (<>) are not allowed.

  • Range: N/A

  • Default value: N/A

limit

No

Integer

  • Definition: Number of records returned on each page.

  • Constraints: limit must be used together with marker. For details, see the description of marker.

  • Value range: 0 to 2^31 – 1

  • Default value: 2000

marker

No

String

  • Definition: A resource ID for pagination query, indicating that the query starts from the next record of the specified resource ID.

  • Constraints: marker must be used together with limit.

    • If parameters marker and limit are not specified, all resource records on the first page will be returned.

    • If marker is not specified and limit is set to 10, the first 10 resource records will be returned.

    • If marker is set to the resource ID of the tenth record and limit is set to 10, the 11th to 20th resource records will be returned.

    • If marker is set to the resource ID of the tenth record and limit is not specified, the 11th to 2000th resource records will be returned (the default value of limit is 2000).

  • Range: N/A

  • Default value: N/A

Request Parameters

None

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

request_id

String

  • Definition: Unique request ID.

  • Constraints: The value is in the UUID format.

  • Range: N/A

  • Default value: N/A

page_info

PageInfo object

  • Definition: Pagination information.

  • Constraints: N/A

  • Range: N/A

  • Default value: N/A

instances

Array of Instance objects

  • Definition: Response body for querying the instance list.

  • Constraints: N/A

  • Range: N/A

  • Default value: N/A

Table 4 PageInfo

Parameter

Type

Description

next_marker

String

  • Definition: The last record on the current page. The parameter next_marker does not exist on the last page.

  • Constraints: N/A

  • Range: N/A

  • Default value: N/A

previous_marker

String

  • Definition: ID of the resource from which the pagination query starts. If the parameter is left blank, only resources on the first page are queried.

  • Constraints: N/A

  • Range: N/A

  • Default value: N/A

current_count

Integer

  • Definition: Total number of records on the current page.

  • Constraints: N/A

  • Range: N/A

  • Default value: N/A

Table 5 Instance

Parameter

Type

Description

id

String

  • Definition: Unique ID of the enterprise switch.

  • Constraints: The value is in the UUID format with hyphens (-).

  • Range: N/A

  • Default value: N/A

name

String

  • Definition: Name of the enterprise switch.

  • Constraints:

    • The value can contain 1 to 64 characters.

    • The value can contain letters, digits, underscores (_), hyphens (-), and periods (.).

  • Range: N/A

  • Default value: N/A

project_id

String

  • Definition: ID of the project to which the enterprise switch belongs.

  • Constraints: N/A

  • Range: N/A

  • Default value: N/A

region

String

  • Definition: ID of the region where the enterprise switch is created.

  • Constraints: N/A

  • Range: N/A

  • Default value: N/A

flavor_ref

String

  • Definition: Enterprise switch flavors.

  • Constraints: N/A

  • Range: For details, see the response of the flavor list API.

  • Default value: N/A

ha_mode

String

  • Definition: HA mode of the enterprise switch.

  • Constraints: Currently, only ha is supported.

  • Range: ha

  • Default value: N/A

status

String

  • Definition: Status of the enterprise switch.

  • Constraints: N/A

  • Range:

    • active: The enterprise switch is running.

    • failed: Failed to create the enterprise switch.

    • abnormal: The enterprise switch is abnormal.

    • build: The enterprise switch is being created.

    • frozen: The enterprise switch is frozen.

  • Default value: N/A

created_at

String

  • Definition: Time when the enterprise switch was created.

  • Constraints: The value is a UTC time in the format of yyyy-MM-ddTHH:mm:ss.

  • Range: N/A

  • Default value: N/A

updated_at

String

  • Definition: Time when the enterprise switch was updated.

  • Constraints: The value is a UTC time in the format of yyyy-MM-ddTHH:mm:ss.

  • Range: N/A

  • Default value: N/A

description

String

  • Definition: Description of the enterprise switch.

  • Constraints:

    • The value can contain 0 to 255 characters.

    • Angle brackets (<>) are not allowed.

  • Range: N/A

  • Default value: N/A

tunnel_info

TunnelInfoResult object

  • Definition: Local tunnel information.

  • Constraints: N/A

  • Range: N/A

  • Default value: N/A

charge_infos

PostPaidChargeInfos object

  • Definition: Billing information.

  • Constraints: N/A

  • Range: N/A

  • Default value: N/A

availability_zones

AvailabilityZones object

  • Definition: AZ where the enterprise switch node is located.

  • Constraints: N/A

  • Range: AZs in the current region.

  • Default value: N/A

Table 6 TunnelInfoResult

Parameter

Type

Description

vpc_id

String

  • Definition: ID of the VPC where the enterprise switch is created.

  • Constraints:

    • You need to use the IDs of the VPCs that you can manage.

    • The value is in the UUID format with hyphens (-).

  • Range: N/A

  • Default value: N/A

virsubnet_id

String

  • Definition: ID of the tunnel subnet where the enterprise switch is located.

  • Constraints:

    • You need to use the IDs of the subnets that you can manage. The ID is the network ID in the subnet details.

    • The value is in the UUID format with hyphens (-).

  • Range: N/A

  • Default value: N/A

tunnel_ip

String

  • Definition: Local tunnel IP address of the enterprise switch.

  • Constraints: The value cannot conflict with an existing subnet IP address.

  • Range: A standard IPv4 address, for example, 192.168.1.1.

  • Default value: N/A

tunnel_port

Integer

  • Definition: Tunnel port of the enterprise switch.

  • Constraints: N/A

  • Range: 4789

  • Default value: N/A

tunnel_type

String

  • Definition: The tunnel protocol type of the enterprise switch.

  • Constraints: N/A

  • Range: vxlan

  • Default value: N/A

Table 7 PostPaidChargeInfos

Parameter

Type

Description

charge_mode

String

  • Definition: Billing mode.

  • Constraints: N/A

  • Range: postPaid, indicates the pay-per-use billing mode.

  • Default value: N/A

Table 8 AvailabilityZones

Parameter

Type

Description

primary

String

  • Definition: AZ where the default active node of the enterprise switch is located.

  • Constraints: The value can contain 1 to 128 characters.

  • Range: ID of the AZ in the current region.

  • Default value: N/A

standby

String

  • Definition: AZ where the default standby node of the enterprise switch is located.

  • Constraints: The value can contain 1 to 128 characters.

  • Range: ID of the AZ in the current region.

  • Default value: N/A

Example Requests

GET https://{endpoint}/v3/88104fcc62a640bfa0a0bf687607621c/l2cg/instances

Example Responses

Status code: 200

The GET operation is successful. For more status codes, see Status Codes.

{
  "request_id" : "ca8bd3285faf5a0e600cc9e66032b4b9",
  "instances" : [ {
    "name" : "esw-offline-inter",
    "id" : "a14aa233-3ac1-4218-8d85-b168a6c1b6df",
    "region" : "cn-southwest-242",
    "status" : "active",
    "description" : null,
    "created_at" : "2025-05-27T09:12:50Z",
    "updated_at" : "2025-07-26T04:57:15Z",
    "project_id" : "88104fcc62a640bfa0a0bf687607621c",
    "flavor_ref" : "l2cg.small.ha",
    "ha_mode" : "ha",
    "availability_zones" : {
      "standby" : "cn-southwest-242a",
      "primary" : "cn-southwest-242a"
    },
    "charge_infos" : {
      "charge_mode" : "postPaid"
    },
    "tunnel_info" : {
      "vpc_id" : "a36e12f4-b490-4b85-bf41-dc61f8f4f4d7",
      "virsubnet_id" : "fb9dee2e-88eb-4fa8-b698-e089d29a56ee",
      "tunnel_ip" : "192.168.4.202",
      "tunnel_port" : 4789,
      "tunnel_type" : "vxlan"
    }
  }, {
    "name" : "esw-online-update",
    "id" : "16b2eea7-5935-445d-8410-083b7064b939",
    "region" : "cn-southwest-242",
    "status" : "active",
    "description" : null,
    "created_at" : "2025-05-20T07:51:52Z",
    "updated_at" : "2025-07-28T08:29:14Z",
    "project_id" : "88104fcc62a640bfa0a0bf687607621c",
    "flavor_ref" : "l2cg.small.ha",
    "ha_mode" : "ha",
    "availability_zones" : {
      "standby" : "cn-southwest-242a",
      "primary" : "cn-southwest-242a"
    },
    "charge_infos" : {
      "charge_mode" : "postPaid"
    },
    "tunnel_info" : {
      "vpc_id" : "41829b5e-66c0-4928-a3d4-f4570ce81d8f",
      "virsubnet_id" : "71f74174-c3fb-4929-9207-a4256b19e280",
      "tunnel_ip" : "192.168.0.76",
      "tunnel_port" : 4789,
      "tunnel_type" : "vxlan"
    }
  } ],
  "page_info" : {
    "previous_marker" : "a14aa233-3ac1-4218-8d85-b168a6c1b6df",
    "current_count" : 2
  }
}

Status Codes

Status Code

Description

200

The GET operation is successful. For more status codes, see Status Codes.

Error Codes

See Error Codes.