Queries vSwitches.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes DescribeVSwitches

The operation that you want to perform. Set the value to DescribeVSwitches.

VpcId String No vpc-25cdvfeq58pl****

The ID of the VPC to which the vSwitches belong.

Note You must set at least one of the RegionId and VpcId parameters.
VSwitchId String No vsw-23dscddcffvf3****

The ID of the vSwitch that you want to query.

ZoneId String No cn-hangzhou-d

The ID of the zone to which the vSwitch belongs. You can call the DescribeZones operation to query the most recent zone list.

RegionId String No cn-hangzhou

The region ID of the vSwitch. You can call the DescribeRegions operation to query the most recent region list.

Note You must set at least one of the RegionId and VpcId parameters.
VSwitchName String No vSwitch

The name of the vSwitch.

The name must be 1 to 128 characters in length, and cannot start with http:// or https://.

DryRun Boolean No true

Specifies whether to check the request without performing the operation. Valid values:

  • true: checks the request without performing the operation. The system checks the required parameters, request syntax, and limits. If the request fails check, an error message is returned. If the request passes the check, the DryRunOperation error code is returned.
  • false: sends the request. If the request passes the precheck, an HTTP 2xx status code is returned and the operation is performed. This is the default value.
IsDefault Boolean No true

Specifies whether to query the default vSwitch in the specified region. Valid values:

  • true: queries the default vSwitch in the specified region.
  • false: does not query the default vSwitch in the specified region.

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

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 number of the page to return. Default value: 1.

PageSize Integer No 10

The number of entries to return on each page. Maximum value: 50. Default value: 10.

VSwitchOwnerId Long No 2546073170691****

The ID of the Alibaba Cloud account to which the resource belongs.

Response parameters

Parameter Type Example Description
PageSize Integer 10

The number of entries returned per page.

RequestId String 9A572171-4E27-40D1-BD36-D26C9E71E29E

The ID of the request.

PageNumber Integer 1

The page number of the returned page.

TotalCount Integer 1

The total number of entries returned.

VSwitches Array of VSwitch

The details about the vSwitch.

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.
CreationTime String 2022-01-18T12:43:57Z

The time when the vSwitch was created.

IsDefault Boolean true

Indicates whether the vSwitch is the default vSwitch. Valid values:

  • true: The vSwitch is the default vSwitch.
  • false: The vSwitch is not the default vSwitch.
AvailableIpAddressCount Long 1

The number of available IP addresses in the vSwitch.

NetworkAclId String nacl-a2do9e413e0spzasx****

The ID of the network access control list (ACL).

OwnerId Long 253460731706911258

The ID of the Alibaba Cloud account to which the resource belongs.

VSwitchId String vsw-25bcdxs7pv1****

The ID of the vSwitch.

CidrBlock String 172.16.0.0/24

The IPv4 CIDR block of the vSwitch.

Description String VSwitchDescription

The description of the vSwitches.

ResourceGroupId String rg-acfmxazb4ph6aiy****

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

ZoneId String cn-hangzhou-d

The ID of the zone to which the vSwitch belongs.

Ipv6CidrBlock String 2408:4002:10c4:4e03::/64

The IPv6 CIDR block of the vSwitch.

VSwitchName String vSwitch

The name of the vSwitch.

Tags Array of Tag

The tag information about the vSwitch.

Tag
Key String department

The key of the tag that is added to the vSwitch.

Value String dev

The value of the tag that is added to the vSwitch.

RouteTable Object

The information about the route table.

RouteTableId String vrt-bp145q7glnuzdv****

The ID of the route table that is associated with the vSwitch.

RouteTableType String System

The type of the route table that is associated with the vSwitch. Valid values:

  • System: system route table
  • Custom: custom route table

Examples

Sample requests

http(s)://[Endpoint]/?Action=DescribeVSwitches
&VpcId=vpc-25cdvfeq58pl****
&VSwitchId=vsw-23dscddcffvf3****
&ZoneId=cn-hangzhou-d
&RegionId=cn-hangzhou
&VSwitchName=vSwitch
&DryRun=true
&IsDefault=true
&RouteTableId=vtb-bp145q7glnuzdvzu2****
&ResourceGroupId=rg-bp67acfmxazb4ph****
&PageNumber=1
&PageSize=10
&Common request parameters

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeVSwitchesResponse>
    <PageSize>10</PageSize>
    <RequestId>9A572171-4E27-40D1-BD36-D26C9E71E29E</RequestId>
    <PageNumber>1</PageNumber>
    <TotalCount>1</TotalCount>
    <VSwitches>
        <VpcId>vpc-257gcdcdq64****</VpcId>
        <Status>Available</Status>
        <CreationTime>2022-01-18T12:43:57Z</CreationTime>
        <IsDefault>true</IsDefault>
        <AvailableIpAddressCount>1</AvailableIpAddressCount>
        <NetworkAclId>nacl-a2do9e413e0spzasx****</NetworkAclId>
        <OwnerId>253460731706911260</OwnerId>
        <VSwitchId>vsw-25bcdxs7pv1****</VSwitchId>
        <CidrBlock>172.16.0.0/24</CidrBlock>
        <Description>VSwitchDescription</Description>
        <ResourceGroupId>rg-acfmxazb4ph6aiy****</ResourceGroupId>
        <ZoneId>cn-hangzhou-d</ZoneId>
        <Ipv6CidrBlock>2408:4002:10c4:4e03::/64</Ipv6CidrBlock>
        <VSwitchName>vSwitch</VSwitchName>
        <Tags>
            <Key>department</Key>
            <Value>dev</Value>
        </Tags>
        <RouteTable>
            <RouteTableId>vrt-bp145q7glnuzdv****</RouteTableId>
            <RouteTableType>System</RouteTableType>
        </RouteTable>
    </VSwitches>
</DescribeVSwitchesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "PageSize" : 10,
  "RequestId" : "9A572171-4E27-40D1-BD36-D26C9E71E29E",
  "PageNumber" : 1,
  "TotalCount" : 1,
  "VSwitches" : [ {
    "VpcId" : "vpc-257gcdcdq64****",
    "Status" : "Available",
    "CreationTime" : "2022-01-18T12:43:57Z",
    "IsDefault" : true,
    "AvailableIpAddressCount" : 1,
    "NetworkAclId" : "nacl-a2do9e413e0spzasx****",
    "OwnerId" : 253460731706911260,
    "VSwitchId" : "vsw-25bcdxs7pv1****",
    "CidrBlock" : "172.16.0.0/24",
    "Description" : "VSwitchDescription",
    "ResourceGroupId" : "rg-acfmxazb4ph6aiy****",
    "ZoneId" : "cn-hangzhou-d",
    "Ipv6CidrBlock" : "2408:4002:10c4:4e03::/64",
    "VSwitchName" : "vSwitch",
    "Tags" : [ {
      "Key" : "department",
      "Value" : "dev"
    } ],
    "RouteTable" : {
      "RouteTableId" : "vrt-bp145q7glnuzdv****",
      "RouteTableType" : "System"
    }
  } ]
}

Error codes

HTTP status code Error code Error message Description
400 Forbidden.VpcNotFound Specified VPC can not found. The error message returned because the specified VPC does not exist. Check whether the specified VPC is valid.
400 InvalidTagKey The tag keys are not valid. The error message returned because the tag key is invalid.
400 InvalidTagValue The tag values are not valid. The error message returned because the tag value is invalid.
404 InvalidVSwitchId.NotFound VSwitch not exist. The error message returned because the specified vSwitch does not exist. Check whether the specified vSwitch ID is valid.
404 InvalidVpcIdNumber.NotSupported The number of vpcIds exceeds the limit. The error message returned because the number of VPC IDs exceeds the limit.

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