Queries one or more VSwitches.

API description

This action only verifies the validity of parameters and does not verify the dependency relationship between parameters. The returned result is the intersection of all conditions.

Make the API call

You can use OpenAPI Explorer to make API calls, search for API calls, perform debugging, and generate SDK example code.

Request parameters

Parameter Type Required? Example value Description
Action String Yes DescribeVSwitches.

The name of this action. Value: DescribeVSwitches

VpcId String No vpc-25cdvfeq58pl****

The ID of the VPC to which the VSwitch belongs.

VSwitchId String No vsw-23dscddcffvf3****

The ID of the VSwitch to be queried.

ZoneId String No cn-hangzhou-d

The ID of the zone to which the VSwitch belongs. To query the zone ID, call DescribeZones.

RegionId String Yes cn-hangzhou

The ID of the region to which the VSwitch belongs. To query the region ID, call DescribeRegions.

VSwitchName String No VSwitch-1

The name of the VSwitch.

DryRun Boolean No false

Indicates whether to check this request only. Valid values:

  • true: Send a check request without querying the resource status. The system checks whether the AccessKey is valid, whether the RAM user is authorized, and whether the required parameters are set. If the check fails, a corresponding error is returned. If the check succeeds, the error DryRunOperation is returned.
  • false(default): Send a request, return the 2XX HTTP status code after the check, and query the resource status directly.
IsDefault Boolean No true

Indicates whether to query the default VSwitches in the specified region.

  • true (default): Query the default VSwitches in the specified region.
  • false: Do not query the default VSwitches in the specified region.

If you do not specify this parameter, the system queries all VSwitches in the specified region.

RouteTableId String No vtb-bp145q7glnuzdvzu2****

The ID of the route table.

ResourceGroupId String No rg-bp67acfmxazb4ph****

The ID of the resource group to which the VSwitch belongs.

PageNumber Integer No 1

The page number. Default value: 1.

PageSize Integer No 10

The number of rows per page. Maximum value: 50. Default value: 10.

Response parameters

Parameter Type Example value Description
RequestId String 9A572171-4E27-40D1-BD36-D26C9E71E29E

The ID of the request.

TotalCount Integer 1

The total number of entries.

PageNumber Integer 1

The current page number.

PageSize Integer 10

The number of entries per page.

VSwitches Array

Details of VSwitches.

VSwitchId String vsw-25bcdxs7pv1****

The ID of the VSwitch.

VpcId String vpc-257gcdcdq64****

The ID of the VPC to which the VSwitch belongs.

Status String Available

The status of the VSwitch. Valid values:

  • Pending: The VSwitch is being configured.
  • Available: The VSwitch is available.
CidrBlock String 172.16.0.0/24

The IPv4 CIDR block of the VSwitch.

Ipv6CidrBlock String 2408:4004:0:2900::/64

The IPv6 CIDR block of the VSwitch.

ZoneId String cn-hangzhou-b

The zone to which the VSwitch belongs.

AvailableIpAddressCount Long 1

The number of available IP addresses in the VSwitch.

Description String VSwitchDescription

The description of the VSwitch.

VSwitchName String VSwitch-1

The name of the VSwitch.

CreationTime String 2018-01-18T12:43:57Z

The time at which the VSwitch was created.

IsDefault Boolean true

Indicates whether the VSwitch is a default VSwitch.

  • true: The specified VSwitch is a default VSwitch.
  • false: The VSwitch is not a default VSwitch.
ResourceGroupId String rg-acfmxazb4ph6aiy****

The ID of the resource group to which the VSwitch belongs.

NetworkAclId String 111
Tags Array

The tag information of the VSwitch.

Key String department

The tag key associated with the VSwitch.

Value String dev

The tag value associated with the VSwitch.

RouteTable Struct

Details of the route table.

RouteTableId String vrt-bp145q7glnuzdv****

The ID of the route table associated with the VSwitch.

RouteTableType String System

The type of the route table associated with the VSwitch. Valid values:

  • System: System route table
  • Custom: Custom route table

Examples

Request example

http(s)://vpc.aliyuncs.com/? Action=DescribeVSwitches
&RegionId=cn-hangzhou
&<CommonParameters>

Response example

XML format

<DescribeVSwitchesResponse>
    <PageNumber>1</PageNumber>
    <VSwitches>
        <VSwitch>
              <RouteTable>
                    <RouteTableId>vtb-hp3hk68xybfogay8g****</RouteTableId>
                    <RouteTableType>System</RouteTableType>
              </RouteTable>
              <Description></Description>
              <IsDefault>false</IsDefault>
              <AvailableIpAddressCount>252</AvailableIpAddressCount>
              <ResourceGroupId>rg-acfmxazb4ph****</ResourceGroupId>
              <ZoneId>cn-huhehaote-a</ZoneId>
              <VSwitchId>vsw-hp3l11aj1tx5g8qwt****</VSwitchId>
              <NetworkAclId></NetworkAclId>
              <VpcId>vpc-hp37qeafxj2sfs69s****</VpcId>
              <CreationTime>2019-11-11T03:39:17Z</CreationTime>
              <Status>Available</Status>
              <CidrBlock>192.168.0.0/24</CidrBlock>
              <Ipv6CidrBlock>2408:4004:0:a600::/64</Ipv6CidrBlock>
              <VSwitchName>CL-IPv6-VSW</VSwitchName>
        </VSwitch>
    </VSwitches>
    <TotalCount>1</TotalCount>
    <PageSize>10</PageSize>
    <RequestId>95C297E1-E9F7-4EB8-BE42-82C8CEBF994D</RequestId>
</DescribeVSwitchesResponse>

JSON format

{
	"PageNumber": 1,
	"VSwitches": {
		"VSwitch": [
			{
				"RouteTable": {
					"RouteTableId": "vtb-hp3hk68xybfogay8g****",
					"RouteTableType": "System"
				},
				"Description": "",
				"IsDefault": false,
				"AvailableIpAddressCount": 252,
				"ResourceGroupId": "rg-acfmxazb4ph****",
				"ZoneId": "cn-huhehaote-a",
				"VSwitchId": "vsw-hp3l11aj1tx5g8qwt****",
				"NetworkAclId": "",
				"VpcId": "vpc-hp37qeafxj2sfs69s****",
				"CreationTime": "2019-11-11T03:39:17Z",
				"Status": "Available",
				"CidrBlock": "192.168.0.0/24",
				"Ipv6CidrBlock": "2408:4004:0:a600::/64",
				"VSwitchName": "CL-IPv6-VSW"
			}
		]
	},
	"TotalCount": 1,
	"PageSize": 10,
	"RequestId": "95C297E1-E9F7-4EB8-BE42-82C8CEBF994D"
}

Errors

HTTP status code Error code Error message Description
404 InvalidVSwitchId.NotFound VSwitch not exist. The specified VSwitch does not exist.
400 Forbidden.VpcNotFound Specified VPC can not found. The specified VPC does not exist.

For a list of error codes, visit the API Error Center.