调用CreateVcoRouteEntry接口为IPsec连接添加目的路由条目。
接口说明
IPsec 连接需已绑定转发路由器实例。具体操作,请参见 CreateTransitRouterVpnAttachment 。
不支持添加目标网段为 0.0.0.0/0 的目的路由。
请勿添加目标网段为 100.64.0.0/10、100.64.0.0/10 下的子网段或者包含 100.64.0.0/10 网段的目的路由,该类路由条目会导致控制台无法显示 IPsec 连接的状态或者导致 IPsec 连接协商失败。
- CreateVcoRouteEntry 接口属于异步接口,即系统先返回一个实例 ID,但该目的路由条目尚未创建成功,系统后台的创建任务仍在进行。您可以调用 DescribeVpnConnection 查询目的路由条目的创建状态:
当 IPsec 连接处于 updating 状态时,表示目的路由条目正在创建中。
当 IPsec 连接处于 attached 状态时,表示目的路由条目创建成功。
CreateVcoRouteEntry 接口不支持在同一 IPsec 连接下并发创建目的路由条目。
调试
您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。
调试
授权信息
|
操作 |
访问级别 |
资源类型 |
条件关键字 |
关联操作 |
|
vpc:CreateVcoRouteEntry |
create |
*VpnConnections
|
无 | 无 |
请求参数
|
名称 |
类型 |
必填 |
描述 |
示例值 |
| RegionId |
string |
是 |
IPsec 连接所属的地域 ID。 您可以通过调用 DescribeRegions 接口获取地域 ID。 |
cn-hangzhou |
| VpnConnectionId |
string |
是 |
IPsec 连接 ID。 |
vco-p0w2jpkhi2eeop6q6**** |
| RouteDest |
string |
是 |
目的路由条目的目标网段。 |
192.168.10.0/24 |
| Weight |
integer |
是 |
目的路由条目的权重值。取值:
|
100 |
| NextHop |
string |
是 |
目的路由条目的下一跳。 |
vco-p0w2jpkhi2eeop6q6**** |
| Description |
string |
否 |
目的路由条目的描述信息。 |
desctest |
| OverlayMode |
string |
否 |
隧道协议。仅取值:Ipsec(默认值),表示 IPsec 隧道协议。 |
Ipsec |
| ClientToken |
string |
否 |
客户端 Token,用于保证请求的幂等性。 从您的客户端生成一个参数值,确保不同请求间该参数值唯一。ClientToken 只支持 ASCII 字符。 说明
若您未指定,则系统自动使用 API 请求的 RequestId 作为 ClientToken 标识。每次 API 请求的 RequestId 不一样。 |
123e4567-e89b-12d3-a456-4266**** |
| DryRun |
boolean |
否 |
是否只预检此次请求。取值:
|
false |
返回参数
|
名称 |
类型 |
描述 |
示例值 |
|
object |
返回结果。 |
||
| VpnConnectionId |
string |
IPsec 连接的 ID。 |
vco-p0w2jpkhi2eeop6q6**** |
| RouteDest |
string |
目的路由条目的目标网段。 |
192.168.10.0/24 |
| NextHop |
string |
目的路由条目的下一跳。 |
vco-p0w2jpkhi2eeop6q6**** |
| Weight |
integer |
目的路由条目的权重值。
|
100 |
| OverlayMode |
string |
隧道协议。 仅取值:Ipsec,表示 IPsec 隧道协议。 |
Ipsec |
| State |
string |
目的路由条目的发布状态。 仅取值:published,表示当前路由条目已发布至转发路由器实例中。 |
published |
| CreateTime |
integer |
创建目的路由条目的时间戳。单位:毫秒。 时间戳的格式采用 Unix 时间戳,表示从格林威治时间 1970 年 01 月 01 日 00 时 00 分 00 秒至创建目的路由条目时的总时长。 |
1658387202664 |
| RequestId |
string |
请求 ID。 |
CFC4D13B-E680-3985-95B1-87AA155481DF |
| Description |
string |
目的路由条目的描述信息。 |
desctest |
示例
正常返回示例
JSON格式
{
"VpnConnectionId": "vco-p0w2jpkhi2eeop6q6****",
"RouteDest": "192.168.10.0/24",
"NextHop": "vco-p0w2jpkhi2eeop6q6****",
"Weight": 100,
"OverlayMode": "Ipsec",
"State": "published",
"CreateTime": 1658387202664,
"RequestId": "CFC4D13B-E680-3985-95B1-87AA155481DF",
"Description": "desctest"
}
错误码
|
HTTP status code |
错误码 |
错误信息 |
描述 |
|---|---|---|---|
| 400 | Resource.QuotaFull | The quota of resource is full | |
| 400 | VpnConnection.Configuring | The specified service is configuring. | 服务正在配置中,请您稍后再试。 |
| 400 | VpnConnection.FinancialLocked | The specified service is financial locked. | 指定的服务欠费锁定。 |
| 400 | VpnRouteEntry.AlreadyExists | The specified route entry is already exist. | 该路由已存在。 |
| 400 | VpnRouteEntry.Conflict | The specified route entry has conflict. | 路由条目存在冲突。 |
| 400 | VpnRouteEntry.ConflictSSL | The specified route entry has conflict with SSL client. | 路由条目与SSL客户端冲突。 |
| 400 | VpnRouteEntry.BackupRoute | Validate backup route entry failed. | 主备路由条目校验失败。 |
| 400 | InvalidNextHop.NotFound | The specified NextHop does not exist. | 路由指定的下一跳不存在 |
| 400 | IllegalParam.RouteDest | The specified RouteDest is invalid | 目的地址不合法。 |
| 400 | OperationFailed.InvalidCidrBlock | Operation failed because the specified network block is invalid. | 网段不合法。 |
| 400 | QuotaExceeded.VpnRouteEntry | The number of route entries to the VPN gateway in the VPC routing table has reached the quota limit. | VPC路由表中指向VPN网关的路由条目已经达到配额限制。 |
| 400 | TaskConflict | The operation is too frequent, please wait a moment and try again. | 操作过于频繁,请稍等一会再重试 |
| 400 | Resource.PbrRouteQuotaFull | The quota of Policy-based route is full. | 策略路由配额超限 |
| 400 | CreatePbrRoutesQuotaFull.QuotaFull | The number of policy routes exceeds the quota limit. | 策略路由数量超过配额限制。 |
| 400 | CreateDbrRoutesQuotaFull.QuotaFull | The number of created destination routes exceeds the quota limit. | 创建目的路由数量超过配额限制。 |
| 400 | DryRunOperation | Request validation has been passed with DryRun flag set. | DryRun校验通过。 |
| 403 | Forbbiden.SubUser | User not authorized to operate on the specified resource. | 用户无权限操作此资源。 |
| 403 | Forbidden | User not authorized to operate on the specified resource. | 您没有权限操作指定资源,请申请权限后再操作。 |
| 404 | InvalidVpnConnectionInstanceId.NotFound | The specified vpn connection instance id does not exist. | 指定的VPN连接不存在,请您检查该VPN连接ID是否正确。 |
访问错误中心查看更多错误码。
变更历史
更多信息,参考变更详情。