All Products
Search
Document Center

Virtual Private Cloud:DescribeRouteTables

更新時間:Dec 20, 2024

Queries route tables.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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:DescribeRouteTableslist
*RouteTable
acs:vpc:{#regionId}:{#accountId}:routetable/{#RouteTableId}
  • vpc:VBR
  • vpc:VRouter
none

Request parameters

ParameterTypeRequiredDescriptionExample
RegionIdstringNo

The region ID of the VPC to which the route table belongs.

You can call the DescribeRegions operation to query the most recent region list.

cn-hangzhou
VRouterIdstringNo

The ID of the vRouter.

vtb-bp1krxxzp0c29fmon****
RouteTableIdstringNo

The ID of the route table that you want to query.

rtb-bp12mw1f8k3jgygk9****
RouterTypestringNo

The type of the router to which the route table belongs. Valid values:

  • VRouter (default)
  • VBR
VRouter
RouterIdstringNo

The ID of the router to which the route table belongs.

vtb-bp1krxxzp0c29fmon****
TypestringNo

The route type. Valid values:

  • Custom
  • System
  • BGP
  • CEN
custom
RouteTableNamestringNo

The name of the route table that you want to query.

The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-).

RouteTable-1
ResourceGroupIdstringNo

The ID of the resource group to which the route table to be queried belongs.

rg-acfmxazccb4ph****
PageNumberintegerNo

The page number. Default value: 1.

1
PageSizeintegerNo

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

10

Response parameters

ParameterTypeDescriptionExample
object

The number of entries per page.

PageSizeinteger

The number of entries per page.

10
RequestIdstring

The request ID.

DC668356-BCB4-42FD-9BC3-FA2B2E04B634
PageNumberinteger

The page number.

1
TotalCountinteger

The total number of entries returned.

1
RouteTablesarray<object>

The detailed information about the route tables.

RouteTableobject
CreationTimestring

The time when the route table was created.

The time is displayed in the YYYY-MM-DDThh:mm:ssZ format in UTC.

2017-08-22T10:40:25Z
Statusstring

The status of the route table. Valid values:

  • Pending
  • Available
Available
VRouterIdstring

The vRouter ID.

vrt-bp1lhl0taikrteen8****
RouteTableTypestring

The type of the route table. Valid values:

  • Custom
  • System
System
ResourceGroupIdstring

The ID of the resource group to which the route table belongs.

rg-acfmxazb4ph****
RouteTableIdstring

The ID of the route table.

vtb-bp145q7glnuzdvzu2****
RouteEntrysarray<object>

The information about the route.

RouteEntryobject
Typestring

The route type. Valid values:

  • Custom
  • System
  • BGP
  • CEN
System
Statusstring

The route status. Valid values:

  • Pending
  • Available
  • Modifying
Pending
NextHopTypestring

The type of the next hop. Valid values:

  • Instance (default): an Elastic Compute Service (ECS) instance
  • HaVip: a high-availability virtual IP address (HAVIP).
  • VpnGateway: a VPN gateway
  • NatGateway: a NAT gateway
  • NetworkInterface: a secondary elastic network interface (ENI)
  • RouterInterface: a router interface
  • IPv6Gateway: an IPv6 gateway
  • Attachment: a transit router
local
RouteEntryNamestring

The route name.

The name must be 2 to 128 characters in length, and can contain letters, digits, periods (.), underscores (_), and hyphens (-).

test
RouteEntryIdstring

The ID of the route.

rte-bp1mnnr2al0naomnpxxx
InstanceIdstring

The ID of the instance associated with the next hop.

ri-2zeo3xzyf38r4urzd****
RouteTableIdstring

The route table ID.

vtb-bp145q7glnuzdvzu2****
Descriptionstring

The description of the route. The description must be 2 to 256 characters in length. It must start with a letter but cannot start with http:// or https://.

RouteEntryDescription
DestinationCidrBlockstring

The destination CIDR block of the route. The destination CIDR block supports IPv4 and IPv6. Make sure that the destination CIDR block meets the following requirements:

  • The destination CIDR block is not 100.64.0.0/10 or a subset of 100.64.0.0/10.
  • The destination CIDR block of each route in the route table is unique.
192.168.0.1/24
NextHopsarray<object>

The information about the next hop.

NextHopobject
NextHopIdstring

The ID of the next hop.

ri-2zeo3xzyf38r4urzdpvqw
Weightinteger

The weight of the route.

80
NextHopTypestring

The type of the next hop. Valid values:

  • Instance: an ECS instance
  • HaVip: an HAVIP
  • VpnGateway: a VPN gateway
  • NatGateway: a NAT gateway
  • NetworkInterface: a secondary ENI
  • RouterInterface: a router interface
  • IPv6Gateway: an IPv6 gateway
  • Attachment: a transit router
HaVip
Enabledinteger

Indicates whether the route is available. Valid values:

  • 0: unavailable
  • 1: available
0
VSwitchIdsarray

The vSwitch ID.

VSwitchIdstring

The vSwitch ID.

vsw-bp14cagpfysr29fe****

Examples

Sample success responses

JSONformat

{
  "PageSize": 10,
  "RequestId": "DC668356-BCB4-42FD-9BC3-FA2B2E04B634",
  "PageNumber": 1,
  "TotalCount": 1,
  "RouteTables": {
    "RouteTable": [
      {
        "CreationTime": "2017-08-22T10:40:25Z",
        "Status": "Available",
        "VRouterId": "vrt-bp1lhl0taikrteen8****",
        "RouteTableType": "System",
        "ResourceGroupId": "rg-acfmxazb4ph****",
        "RouteTableId": "vtb-bp145q7glnuzdvzu2****",
        "RouteEntrys": {
          "RouteEntry": [
            {
              "Type": "System",
              "Status": "Pending",
              "NextHopType": "local",
              "RouteEntryName": "test",
              "RouteEntryId": "rte-bp1mnnr2al0naomnpxxx",
              "InstanceId": "ri-2zeo3xzyf38r4urzd****",
              "RouteTableId": "vtb-bp145q7glnuzdvzu2****",
              "Description": "RouteEntryDescription",
              "DestinationCidrBlock": "192.168.0.1/24",
              "NextHops": {
                "NextHop": [
                  {
                    "NextHopId": "ri-2zeo3xzyf38r4urzdpvqw",
                    "Weight": 80,
                    "NextHopType": "HaVip",
                    "Enabled": 0
                  }
                ]
              }
            }
          ]
        },
        "VSwitchIds": {
          "VSwitchId": [
            "vsw-bp14cagpfysr29fe****"
          ]
        }
      }
    ]
  }
}

Error codes

HTTP status codeError codeError messageDescription
400InvalidVRouterId.NotFoundSpecified virtual router does not exist.The specified vRouter does not exist. Check whether the specified vRouter is valid.
400OperationFailed.DescribeCenRouteAn error occurred while querying the CEN route entry.CEN routes are abnormal.
400OperationFailed.VRouterNotExistOperation failed because the VRouter does not exist.Operation failed because the VRouter does not exist.

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

Change history

Change timeSummary of changesOperation
2024-06-12The API operation is deprecated. The Error code has changedView Change Details
2023-09-25The Error code has changedView Change Details
2023-09-06The Error code has changedView Change Details
2023-08-09API Description UpdateView Change Details