Updated on 2026-01-13 GMT+08:00

Obtaining the VPC Subnet List

Function

This API is used to obtain the list of subnets in a VPC. Information about all the subnets in a specified VPC is returned.

Calling Method

For details, see Calling APIs.

URI

GET /v1/{project_id}/sdg/asset/vpc/{vpc_id}/subnet

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID, which is used to identify a specific project.

vpc_id

Yes

String

VPC ID, which is used to identify a specific VPC.

Request Parameters

None

Response Parameters

Status code: 200

Table 2 Response body parameters

Parameter

Type

Description

subnet

Subnet object

Information about a single subnet, including the subnet's basic attributes and network configuration.

subnets

Array of Subnet objects

Subnet information list, which contains all subnets that meet the specified criteria.

Table 3 Subnet

Parameter

Type

Description

availability_zone

String

AZ where a subnet resides.

cidr

String

IPv4 address range of a subnet, which is specified using CIDR notation.

cidr_v6

String

IPv6 address range of a subnet, which is specified using CIDR notation.

dhcp_enable

Boolean

Whether to enable the DHCP service. It specifies whether the subnet supports automatic IP address allocation.

dns_list

Array of strings

DNS server address list of a subnet. It specifies the DNS servers of the subnet.

gateway_ip

String

Default IPv4 gateway address of a subnet.

gateway_ip_v6

String

Default IPv6 gateway address of a subnet.

id

String

Unique identifier of a subnet.

ipv6_enable

Boolean

Whether a subnet supports IPv6 addresses.

name

String

Name of a subnet.

network_id

String

Unique identifier of a network that a subnet belongs to.

neutron_subnet_id

String

Unique identifier of a Neutron subnet. It uniquely identifies a subnet on the OpenStack network.

neutron_subnet_id_v6

String

Unique IPv6 identifier of a Neutron subnet. It uniquely identifies an IPv6 subnet on the OpenStack network.

primary_dns

String

Primary DNS server address of a subnet.

secondary_dns

String

Standby DNS server address of a subnet.

status

String

Subnet status. For example, ACTIVE indicates the active state.

vpc_id

String

Unique identifier of the VPC that a subnet belongs to.

Example Requests

None

Example Responses

None

Status Codes

Status Code

Description

200

The VPC subnet list is obtained.

401

Unauthorized access. The request is rejected.

403

Unauthorized operation. The request is rejected.

404

The specified VPC or project does not exist. Retrieval failed.

Error Codes

See Error Codes.