All Products
Search
Document Center

:DescribeVSwitches

最終更新日:Aug 25, 2023

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 vSwitch belongs.

Note Specify at least one of RegionId and VpcId.
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 ID of the region to which the vSwitch belongs. You can call the DescribeRegions operation to query the most recent region list.

Note Specify at least one of RegionId and VpcId.
VSwitchName String No vSwitch

The name of the vSwitch.

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

DryRun Boolean No true

Specifies whether to perform only a dry run, without performing the actual request. Valid values:

  • true: performs only a dry run. The system checks the request for potential issues, including missing parameter values, incorrect request syntax, and service limits. If the request fails the dry run, an error message is returned. If the request passes the dry run, the DryRunOperation error code is returned.
  • false (default): performs a dry run and performs the actual request. If the request passes the dry run, a 2xx HTTP status code is returned and the operation is performed.
IsDefault Boolean No true

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

  • true
  • false

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 per page. Maximum value: 50. Default value: 10.

VSwitchOwnerId Long No 2546073170691****

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

Tag.N.Key String No FinanceDept

The key of tag N to add to the resource. You can specify at most 20 tag keys. The tag key cannot be an empty string.

The tag key can be up to 128 characters in length. It cannot start with aliyun or acs:, and cannot contain http:// or https://.

Tag.N.Value String No FinanceJoshua

The value of tag N to add to the resource. You can specify at most 20 tag values. The tag value can be an empty string.

The tag value can be up to 128 characters in length, and cannot contain http:// or https://. The tag value cannot start with aliyun or acs:.

Response parameters

Parameter Type Example Description
PageSize Integer 10

The number of entries per page.

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

The request ID.

PageNumber Integer 1

The page number of the returned page.

TotalCount Integer 1

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

The time when the vSwitch was created.

IsDefault Boolean true

Indicates whether the default vSwitch in the region where the stack is deployed is queried. Valid values:

  • true
  • false
AvailableIpAddressCount Long 1

The number of available IP addresses in the vSwitch.

NetworkAclId String nacl-a2do9e413e0spzasx****

The ID of the network ACL.

OwnerId Long 253460731706911258

The ID of the Alibaba Cloud account to which the vSwitch 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 vSwitch.

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.

ShareType String Shared

Indicates whether the vSwitch is shared.

  • If no value is returned, the vSwitch is a regular vSwitch.
  • If Shared is returned, the vSwitch is a shared vSwitch.
  • If Sharing is returned, the vSwitch is being shared.
EnabledIpv6 Boolean true

Specify whether to enable IPv6 for the vSwitch. If you enable IPv6, you must configure the IPv6 CIDR block of the vSwitch. Valid values:

  • true
  • false
Tags Array of Tag

The tag information about the vSwitch.

Tag
Key String department

The key of tag N.

Value String dev

The value of tag N.

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
  • Custom

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
&Tag=[{"Key":"FinanceDept","Value":"FinanceJoshua"}]
&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>
        <ShareType>Shared</ShareType>
        <EnabledIpv6>true</EnabledIpv6>
        <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",
    "ShareType" : "Shared",
    "EnabledIpv6" : true,
    "Tags" : [ {
      "Key" : "department",
      "Value" : "dev"
    } ],
    "RouteTable" : {
      "RouteTableId" : "vrt-bp145q7glnuzdv****",
      "RouteTableType" : "System"
    }
  } ]
}

Error codes

HttpCode Error code Error message Description
400 Forbidden.VpcNotFound Specified VPC can not found. The specified VPC does not exist.
400 InvalidTagKey The tag keys are not valid. The tag index is invalid.
400 InvalidTagValue The tag values are not valid. The tag value is invalid.
404 InvalidVSwitchId.NotFound VSwitch not exist. 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 number of VPC IDs exceeds the limit.

For a list of error codes, see Service error codes.