All Products
Search
Document Center

Virtual Private Cloud:DescribeVSwitches

Last Updated:Mar 22, 2024

Queries the information about available vSwitches that are used for an internal network.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
vpc:DescribeVSwitchesList
  • VSwitch
    acs:vpc:{#regionId}:{#accountId}:vswitch/*
  • vpc:VPC
none

Request parameters

ParameterTypeRequiredDescriptionExample
VpcIdstringNo

The ID of the virtual private cloud (VPC) to which the vSwitches belong.

Note You must set at least one of RegionId and VpcId.
vpc-25cdvfeq58pl****
VSwitchIdstringNo

The ID of the vSwitch that you want to query.

vsw-23dscddcffvf3****
ZoneIdstringNo

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

cn-hangzhou-d
RegionIdstringNo

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 RegionId and VpcId.
cn-hangzhou
VSwitchNamestringNo

The vSwitch name.

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

vSwitch
DryRunbooleanNo

Specifies whether to perform 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.
true
IsDefaultbooleanNo

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

  • true
  • false

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

true
RouteTableIdstringNo

The ID of the route table.

vtb-bp145q7glnuzdvzu2****
ResourceGroupIdstringNo

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

rg-bp67acfmxazb4ph****
PageNumberintegerNo

The number of the page to return. Default value: 1.

1
PageSizeintegerNo

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

10
VSwitchOwnerIdlongNo

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

2546073170691****
Tagobject []No

The tags.

KeystringNo

The tag key. 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://.

FinanceDept
ValuestringNo

The tag value. 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:.

FinanceJoshua

Response parameters

ParameterTypeDescriptionExample
object

The response parameters.

PageSizeinteger

The number of entries returned per page.

10
RequestIdstring

The request ID.

9A572171-4E27-40D1-BD36-D26C9E71E29E
PageNumberinteger

The number of the returned page.

1
TotalCountinteger

The total number of entries returned.

1
VSwitchesobject []

The details about the vSwitch.

VpcIdstring

The ID of the VPC to which the vSwitch belongs.

vpc-257gcdcdq64****
Statusstring

The status of the vSwitch. Valid values:

  • Pending
  • Available
Available
CreationTimestring

The time when the vSwitch was created.

2022-01-18T12:43:57Z
IsDefaultboolean

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

  • true
  • false
true
AvailableIpAddressCountlong

The number of available IP addresses in the vSwitch.

1
NetworkAclIdstring

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

nacl-a2do9e413e0spzasx****
OwnerIdlong

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

253460731706911258
VSwitchIdstring

The vSwitch ID.

vsw-25bcdxs7pv1****
CidrBlockstring

The IPv4 CIDR block of the vSwitch.

172.16.0.0/24
Descriptionstring

The description of the vSwitch.

VSwitchDescription
ResourceGroupIdstring

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

rg-acfmxazb4ph6aiy****
ZoneIdstring

The ID of the zone to which the vSwitch belongs.

cn-hangzhou-d
Ipv6CidrBlockstring

The IPv6 CIDR block of the vSwitch.

2408:4002:10c4:4e03::/64
VSwitchNamestring

The vSwitch name.

vSwitch
ShareTypestring

Indicates whether the vSwitch is shared.

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

Indicates whether IPv6 is enabled for the vSwitch. If you enable IPv6, you must configure an IPv6 CIDR block for the vSwitch. Valid values:

  • true
  • false
true
Tagsobject []

The tags of the vSwitch.

Keystring

The tag key.

department
Valuestring

The tag value.

dev
RouteTableobject

The information about the route table.

RouteTableIdstring

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

vrt-bp145q7glnuzdv****
RouteTableTypestring

The type of the route table. Valid values:

  • System
  • Custom
System

Examples

Sample success responses

JSONformat

{
  "PageSize": 10,
  "RequestId": "9A572171-4E27-40D1-BD36-D26C9E71E29E",
  "PageNumber": 1,
  "TotalCount": 1,
  "VSwitches": {
    "VSwitch": [
      {
        "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": {
          "Tag": [
            {
              "Key": "department",
              "Value": "dev"
            }
          ]
        },
        "RouteTable": {
          "RouteTableId": "vrt-bp145q7glnuzdv****",
          "RouteTableType": "System"
        }
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400Forbidden.VpcNotFoundSpecified VPC can not found.The specified VPC does not exist.
400InvalidTagKeyThe tag keys are not valid.The tag index is invalid.
400InvalidTagValueThe tag values are not valid.The tag value is invalid.
400IellgalParameter.OwnerAccountThe specified parameter OwnerAccount is not valid.-
400IllegalParam.OwnerIdThe specified parameter VSwitchOwnerId is not valid.-
404InvalidVSwitchId.NotFoundVSwitch not exist.The error message returned because the specified vSwitch does not exist. Check whether the specified vSwitch ID is valid.
404InvalidVpcIdNumber.NotSupportedThe number of vpcIds exceeds the limit.The value of the vpcId parameter has reached the upper limit.
404InvalidVSwitchIdNumber.NotSupportedThe number of vSwitchIds exceeds the limit.-

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-07-26The Error code has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 404
2023-07-26The Error code has changed. The request parameters of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 404
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: Tag
2023-07-05The Error code has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 404
Output ParametersThe response structure of the API has changed.
2023-05-22The Error code has changed. The response structure of the API has changedsee changesets
Change itemChange content
Error CodesThe Error code has changed.
    delete Error Codes: 400
    delete Error Codes: 404
Output ParametersThe response structure of the API has changed.