• Virtual Private Cloud

vpc
  1. Help Center
  2. Virtual Private Cloud
  3. API Reference
  4. APIs
  5. Virtual Private Cloud
  6. Querying VPCs

Querying VPCs

Function

This interface is used to query VPCs using search criteria and to display the VPCs in a list.

URI

GET /v1/{project_id}/vpcs

Example:
/v1/{project_id}/vpcs?limit=10&marker=13551d6b-755d-4757-b956-536f674975c0
Table 1 Parameter description

Name

Mandatory

Type

Description

project_id

Yes

String

Specifies the project ID.

marker

No

String

Specifies the start resource ID of pagination query. If the parameter is left blank, only resources on the first page are queried.

limit

No

int

  • Specifies the number of records returned on each page.
  • The value ranges from 0 to intmax.

Request Message

  • Request parameter

    None

  • Example request

    None

Response Message

  • Response parameter
    Table 2 Response parameter

    Name

    Type

    Description

    vpcs

    List data structure

    Specifies the VPC list.

    Table 3 Description of the vpcs field

    Name

    Type

    Description

    id

    String

    Specifies a resource ID in UUID format.

    name

    String

    Specifies the VPC name.

    cidr

    String

    Specifies the available IP address ranges for subnets in the VPC.

    status

    String

    • Specifies the VPC status.
    • The value can be CREATING (creating) or OK (successfully created).

    routes

    List

    • Specifies the route information.
    • For details, see the description of the route object.

    enable_shared_snat

    Boolean

    Specifies whether the shared SNAT function is enabled. The value true indicates that the function is enabled, and the value false indicates that the function is not enabled.

    Table 4 Description of the route field

    Name

    Type

    Description

    destination

    String

    • Specifies the destination network segment of a route.
    • The value must be in the CIDR format. Currently, only the value 0.0.0.0/0 is supported.

    nexthop

    String

    • Specifies the next hop of a route.
    • The value must be an IP address and must belong to the subnet in the VPC. Otherwise, this value does not take effect.
  • Example response
    {
        "vpcs": [
            {
                "id": "13551d6b-755d-4757-b956-536f674975c0",
                "name": "default",
                "cidr": "172.16.0.0/16",
                "status": "OK",
                
                "routes": null,
                "enable_shared_snat": false
            },
            {
                "id": "3ec3b33f-ac1c-4630-ad1c-7dba1ed79d85",
                "name": "222",
                "cidr": "192.168.0.0/16",
                "status": "OK",
                
                "routes": null,
                "enable_shared_snat": false
            },
            {
                "id": "99d9d709-8478-4b46-9f3f-2206b1023fd3",
                "name": "vpc",
                "cidr": "192.168.0.0/16",
                "status": "OK",
                
                "routes": null,
                "enable_shared_snat": false
            }
        ]
    }

Status Codes

For details, see section Status Codes.

Error Codes

For details, see section Error Codes.