DescribeSubnets

DescribeSubnets

1. API Description

This API is used to query the details of one or more subnets. You can filter the query results with the subnet ID, VPC ID, zone ID and subnet name.

2. Input Parameters

The following request parameter list only provides API request parameters.

Parameter Name
Required
Type
Description

subnetIds

No

Array of String

Subnet ID(s).

The maximum number of subnets in each request is 100.

cidrBlock

No

String

CIDR block of subnet.

zoneId

No

String

Zone ID to which subnets belong.

subnetStatus

No

String

subnetName

No

String

Name of subnet.

resourceGroupId

No

String

Resource group ID.

If the value is null, then return all the subnets in the authorized resource groups.

vpcId

No

String

VPC ID.

pageSize

No

Integer

Number of items in the current page result.

Default value: 20;

Maximum value: 1000.

pageNum

No

Integer

Number of pages returned.

Default value: 1.

3. Output Parameters

Parameter Name
Type
Description

requestId

String

The unique request ID, which is returned for each request. RequestId is required for locating a problem.

dataSet

Array of SubnetInfo

Information on subnets.

totalCount

Integer

Number of subnets meeting the filtering conditions.

4. Code Example

Query subnets with the CIDR block 10.0.0.0/8.

POST /api/v2/bmc HTTP/1.1
Host: console.zenlayer.com
Content-Type: application/json
X-ZC-Action: DescribeSubnets
<Common Request Params>

Request:
{
  "cidrBlock": "10.0.0.0/8",
  "pageSize": 10,
  "pageNum": 1
}

Response:
{
  "requestId": "T2CF86177-29D1-41C0-91E7-542C38C194D7",
  "response": {
    "requestId": "T2CF86177-29D1-41C0-91E7-542C38C194D7",
    "totalCount": 8,
    "dataSet": [
      {
        "subnetId": "669986345980014296",
        "subnetName": "Subnet-LAX3B-Default",
        "zoneId": "LAX-B",
        "availableIpCount": "16777213",
        "cidrBlock": "10.0.0.0/8",
        "subnetStatus": "AVAILABLE",
        "createTime": "2022-07-13T09:43:16Z",
        "vpcSubnetStatus": "BINDED",
        "vpcId": null,
        "vpcName": null,
        "resourceGroupId": "5a4f6519-2977-47cb-b3fc-150fd2b4de71",
        "resourceGroupName": "Default Resource Group",
        "subnetInstanceSet": null
      },
      {
        "subnetId": "669998042870457304",
        "subnetName": "Subnet-LAX3B-Default",
        "zoneId": "LAX-B",
        "availableIpCount": "16777213",
        "cidrBlock": "10.0.0.0/8",
        "subnetStatus": "AVAILABLE",
        "createTime": "2022-07-13T10:06:31Z",
        "vpcSubnetStatus": "BINDED",
        "vpcId": null,
        "vpcName": null,
        "resourceGroupId": "5a4f6519-2977-47cb-b3fc-150fd2b4de71",
        "resourceGroupName": "Default Resource Group",
        "subnetInstanceSet": null
      },
      {
        "subnetId": "670074179940261592",
        "subnetName": "Subnet-SIN4E-Default",
        "zoneId": "SIN-E",
        "availableIpCount": "16777213",
        "cidrBlock": "10.0.0.0/8",
        "subnetStatus": "AVAILABLE",
        "createTime": "2022-07-13T12:37:47Z",
        "vpcSubnetStatus": "BINDED",
        "vpcId": null,
        "vpcName": null,
        "resourceGroupId": "5a4f6519-2977-47cb-b3fc-150fd2b4de71",
        "resourceGroupName": "Default Resource Group",
        "subnetInstanceSet": null
      },
      {
        "subnetId": "675574042144543192",
        "subnetName": "Subnet-HKG5A-Deafault",
        "zoneId": "HKG-A",
        "availableIpCount": "16777213",
        "cidrBlock": "10.0.0.0/8",
        "subnetStatus": "AVAILABLE",
        "createTime": "2022-07-21T02:45:02Z",
        "vpcSubnetStatus": "BINDED",
        "vpcId": "675574041725115352",
        "vpcName": "VPC-HKG-A-Default",
        "resourceGroupId": "5a4f6519-2977-47cb-b3fc-150fd2b4de71",
        "resourceGroupName": "Default Resource Group",
        "subnetInstanceSet": null
      },
      {
        "subnetId": "706839622444915160",
        "subnetName": "Subnet-TYO2A-Default",
        "zoneId": "TYO-A",
        "availableIpCount": "16777213",
        "cidrBlock": "10.0.0.0/8",
        "subnetStatus": "CREATING",
        "createTime": "2022-09-02T06:04:09Z",
        "vpcSubnetStatus": "BINDING",
        "vpcId": "706839622411361496",
        "vpcName": "VPC-TYO-A-Default",
        "resourceGroupId": "5a4f6519-2977-47cb-b3fc-150fd2b4de71",
        "resourceGroupName": "Default Resource Group",
        "subnetInstanceSet": null
      },
      {
        "subnetId": "736091361970760152",
        "subnetName": "Subnet-AMS-C-Default",
        "zoneId": "AMS-C",
        "availableIpCount": "16777213",
        "cidrBlock": "10.0.0.0/8",
        "subnetStatus": "CREATING",
        "createTime": "2022-10-12T14:42:08Z",
        "vpcSubnetStatus": "BINDING",
        "vpcId": "736091361115114712",
Disconnected from the target VM, address: '127.0.0.1:56971', transport: 'socket'
        "vpcName": "VPC-AMS-C-Default",
        "resourceGroupId": "5a4f6519-2977-47cb-b3fc-150fd2b4de71",
        "resourceGroupName": "Default Resource Group",
        "subnetInstanceSet": null
      },
      {
        "subnetId": "750526252527395288",
        "subnetName": "Subnet-FRA-B-Default",
        "zoneId": "FRA-B",
        "availableIpCount": "16777213",
        "cidrBlock": "10.0.0.0/8",
        "subnetStatus": "CREATING",
        "createTime": "2022-11-01T12:41:41Z",
        "vpcSubnetStatus": "BINDING",
        "vpcId": "750526251764025304",
        "vpcName": "VPC-FRA-B_D_E-Default",
        "resourceGroupId": "5a4f6519-2977-47cb-b3fc-150fd2b4de71",
        "resourceGroupName": "Default Resource Group",
        "subnetInstanceSet": null
      },
      {
        "subnetId": "786474054390385368",
        "subnetName": "Subnet-LAX-C-Default",
        "zoneId": "LAX-C",
        "availableIpCount": "16777213",
        "cidrBlock": "10.0.0.0/8",
        "subnetStatus": "CREATING",
        "createTime": "2022-12-21T03:03:33Z",
        "vpcSubnetStatus": "BINDING",
        "vpcId": "786474054256176856",
        "vpcName": "VPC-LAX-C-Default",
        "resourceGroupId": "5a4f6519-2977-47cb-b3fc-150fd2b4de71",
        "resourceGroupName": "Default Resource Group",
        "subnetInstanceSet": null
      }
    ]
  }
}

5. Developer Resources

Zenlayer Cloud API 2.0 integrates SDKs to make it easier for you to call APIs. More programming languages will be supported.

6. Error Codes

No error codes related to the API business logic. For other error codes, see Common Error Codes.​

Last updated