接口功能介绍
无
接口约束
无
URI
GET /cgw/v1/route/list
路径参数
无
Query参数
| 参数 | 是否必填 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| pageNum | 否 | Integer | 页码,默认为1 | | |
| pageSize | 否 | Integer | 每页记录数,默认为10 | | |
| instId | 是 | String | 实例Id | 7a2828074ef6e32e041a2ef124b19e63 | |
| routeName | 否 | String | 路由名称 | | |
| routeStatus | 否 | String | 路由状态 | | |
| type | 否 | String | 来源类型 | msgc | |
| destinationType | 否 | String | 目标服务类型 | single | |
请求参数
请求头header参数
| 参数 | 是否必填 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| regionId | 是 | String | 资源池编码 | 7a2828074ef6e32e041a2ef124b19e63 | |
请求体body参数
无
响应参数
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| statusCode | Integer | 接口状态码 | 2000 | |
| code | String | 错误码,异常时非空 | CGW_1001 | |
| returnObj | Object | 返回数据 | | PageInfo«RouteVO» |
| message | String | 异常描述 | success | |
| 表 PageInfo«RouteVO» | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| endRow | Long | 当前页面最后一个元素在数据库中的行号 | | |
| hasNextPage | Boolean | 是否有下一页 | | |
| hasPreviousPage | Boolean | 是否有前一页 | | |
| isFirstPage | Boolean | 是否为第一页 | | |
| isLastPage | Boolean | 是否为最后一页 | | |
| list | Array of Objects | 路由列表 | | RouteVO |
| navigateFirstPage | Integer | 导航条上的第一页 | | |
| navigateLastPage | Integer | 导航条上的最后一页 | | |
| navigatePages | Integer | 导航页码数 | | |
| navigatepageNums | Array of Integers | 所有导航页号 | | |
| nextPage | Integer | 下一页 | 2 | |
| pageNum | Integer | 页码 | 1 | |
| pageSize | Integer | 每页条目数 | 10 | |
| pages | Integer | 页数 | 2 | |
| prePage | Integer | 前一页 | 1 | |
| size | Integer | 总数 | 12 | |
| startRow | Long | 当前页面第一个元素在数据库中的行号 | | |
| 表 RouteVO | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| code | String | 路由唯一code | 7a2828074ef6e32e041a2ef124b19e63 | |
| corsVO | Object | 跨域策略 | | CorsVO |
| countLimitVO | Object | 限流策略 | | CountLimitVO |
| createTime | String | 创建时间 | | |
| description | String | 路由描述 | | |
| destinationType | String | 目标服务类型:single:单服务;multiple:多服务;version_oriented:标签路由;mock: Mock路由, redirect: 重定向,dubbo_proxy:dubbo代理 | single | |
| dubboProxy | Object | dubbo代理路由配置 | | DubboProxyDTO |
| forwardAuthVO | Object | 外部身份认证策略 | | ForwardAuthVO |
| headerRewriteVO | Object | header设置策略 | | HeaderRewriteVO |
| hosts | Array of Strings | 域名列表 | ["test.com"] | |
| httpRewrite | Object | http重写策略 | | HttpRewrite |
| id | String | ID | 7a2828074ef6e32e041a2ef124b19e63 | |
| uri | String | 请求路径 | /app/a | |
| uris | Array of Strings | 请求路径列表 | ["/app/a", "/app/b"] | |
| methods | Array of Strings | HTTP方法 | ["GET", "PUT"] | |
| mockResponse | Object | Mock路由响应体 | | MockResponseVO |
| name | String | 名称 | test | |
| predicates | String | 路由规则(String) | | |
| priority | Integer | 优先级 | 100 | |
| proxyCookieVO | Object | proxy-cookie策略 | | ProxyCookieVO |
| queryRewriteVO | Object | query参数设置策略 | | QueryRewriteVO |
| redirect | Object | 重定向 | | RedirectVO |
| routeAuthType | String | 认证方式 | | |
| routeAuthTypeName | String | 认证方式名称 | | |
| routePredicate | Object | 路由规则 | | RoutePredicate |
| routeTagNormalize | Object | 路由参数规整化 | | RouteTagNormalizeDTO |
| routeTagNormalizedFlag | Boolean | 是否启用路由参数规整化处理 | false | |
| status | Integer | 状态,1:已发布;0:未发布 | 0 | |
| type | String | 路由配置类型:control、ingress | | |
| typeDesc | String | 路由配置类型描述:管控、Ingress | | |
| updateTime | Long | 更新时间 | 2023-10-01 12:12:12 | |
| upstreamList | Array of Objects | 目标服务 | | DestinationUpstreamVO |
| apiBreakerVO | Object | API熔断策略 | | ApiBreakerVO |
| isBind | Boolean | 是否绑定插件 | | |
| 表 CorsVO | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| allowCredential | Boolean | 是否允许携带凭证,默认为false | false | |
| allowHeaders | String | 允许的请求头部,回车分隔;使用 * 来表示所有 header 均允许通过,默认为* | * | |
| allowMethods | String | 允许的请求方法,逗号分隔;使用 * 来表示所有 method均允许通过,默认为* | GET,POST | |
| allowOrigins | String | 允许的访问来源,回车分隔;使用 * 来表示所有 Origin 均允许通过,默认为* | * | |
| enable | Boolean | 开启状态 true:开启,false:关闭,默认为false | false | |
| exposeHeaders | String | 允许的响应头部,回车分隔;使用 * 来表示所有 header 均允许通过,默认为* | * | |
| maxAge | Integer | 预检的过期时间 | 5 | |
| timeType | String | 预检的过期时间单位, d、h、m、s | s | |
| 表 CountLimitVO | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| count | Integer | 限制请求次数 limit | 10 | |
| enable | Boolean | 开启状态 true:开启,false:关闭 | false | |
| timeUnit | String | 时间窗口单位 TimeUnit,天:d,时:h,分:m,秒:s | s | |
| time_window | Integer | 时间窗口 UnitNum | 60 | |
| 表 DubboProxyDTO | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| method | String | dubbo服务方法,调用的dubbo方法名。路由为dubbo代理类型时不可为空 | dubboMethod | |
| serviceName | String | dubbo服务名,传入服务完整包名。路由为dubbo代理类型时不可为空 | com.test.a.dubbo.service | |
| serviceVersion | String | dubbo服务版本。默认值:"0.0.0" | 0.0.0 | |
| 表 ForwardAuthVO | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| enable | Boolean | 开启状态 true:开启,false:关闭,默认false | | |
| uri | String | 设置认证服务的地址 | | |
| sslVerify | Boolean | 当设置为true时,验证SSL证书,默认为true | | |
| requestMethod | String | 客户端向认证服务发送请求的方法。当设置为POST时,会将request body转发至认证服务。默认为GET | | |
| requestHeaders | Array of Strings | 设置需要由客户端转发到认证服务的请求头。如果没有设置,则只发送CGW提供的headers | | |
| upstreamHeaders | Array of Strings | 认证通过时,设置认证服务转发至upstream的请求头。如果不设置则不转发任何请求头。 | | |
| clientHeaders | Array of Strings | 认证失败时,由认证服务向client发送的响应头。如果不设置则不转发任何响应头。 | | |
| timeout | Integer | 认证服务请求超时时间,默认为3000ms | | |
| keepalive | Boolean | HTTP长连接,默认开启 | | |
| keepaliveTimeout | Integer | 长连接超时时间。默认60000ms | | |
| keepalivePool | Integer | 长连接池大小,默认5 | | |
| 表 HeaderRewriteVO | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| enable | Boolean | 开启状态 true:开启,false:关闭 | false | |
| headerParameters | Array of Objects | 规则列表 | | HeaderParameter |
| 表 HeaderParameter | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| headerKey | String | header key头部名 | name | |
| headerType | String | header类型, 请求(request)、响应(response) | request | |
| headerValue | String | header value头部值, String 或者 number | tom | |
| optionType | String | 操作类型,新增(add)、修改(update)、删除(delete) | add | |
| 表 HttpRewrite | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| enable | Boolean | 是否启用 true:启用,false:停用 | false | |
| originHost | String | 原主机域,从路由配置host中读取 | test.com | |
| originPath | String | 原路径,从路由配置uri中读取 | /app/a | |
| originType | String | 原类型,从路由配置中读取 | | |
| pathMatchType | String | 重写路径匹配类型, 前缀匹配:PRE, 精确匹配:EQUAL, 正则匹配:REGEX | EQUAL | |
| prefixMatchPattern | String | 前缀匹配类型时待匹配的路径 | | |
| regexMatchPattern | String | 正则匹配时提供的正则表达式 | | |
| rewriteHost | String | 重写主机域 | hello.com | |
| rewritePath | String | 重写路径 | /app/c | |
| 表 MockResponseVO | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| code | Integer | 自定义响应code | 302 | |
| responseJson | String | 自定义响应信息 | {"name": "tom"} | |
| 表 ProxyCookieVO | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| domain | Object | proxy_cookie_domain配置信息 | | ProxyCookieInfo |
| enable | Boolean | 开启状态 true:开启,false:关闭 | false | |
| path | Object | proxy_cookie_path配置信息 | | ProxyCookieInfo |
| 表 ProxyCookieInfo | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| regex | String | 匹配规则,use为true时,不可为空 | /test | |
| replacement | String | 替换值,use为true时,不可为空 | /test/app | |
| use | Boolean | 是否启用属性,true为启用,默认为false | true | |
| 表 QueryRewriteVO | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| domain | Object | proxy_cookie_domain配置信息 | | ProxyCookieInfo |
| enable | Boolean | 开启状态 true:开启,false:关闭 | false | |
| path | Object | proxy_cookie_path配置信息 | | ProxyCookieInfo |
| 表 RedirectVO | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| code | Integer | 自定义code | 329 | |
| uri | String | 自定义重定向路径 | /redirect | |
| 表 routePredicate | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| cookiePredicates | Array of Objects | cookie匹配参数 | | Predicate |
| headerPredicates | Array of Objects | http匹配参数 | | Predicate |
| queryPredicates | Array of Objects | query匹配参数 | | Predicate |
| 表 Predicate | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| key | String | KEY | id | |
| type | String | 匹配类型,==:等于,~~=:不等于,>:大于,>=:大于等于,<:小于,<=:小于等于,~~:正则匹配,~~*:正则匹配(不区分大小写),IN:存在于,HAS:包含,!:非 | == | |
| value | String | 值 | 1 | |
| 表 RouteTagNormalizeDTO | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| hashFlag | Boolean | 是否进行hash | false | |
| moduloOperationValue | Integer | 取模数值 | 100 | |
| paramLocation | String | 参数位置,支持header, query, cookie | header | |
| paramName | String | 参数名称 | id | |
| tagExactValues | Array of Integers | 精确型标记取值,传入匹配值 | [1,2] | |
| tagRangeValueList | Array of Objects | 范围型标记取值,传入最大和最小值。支持传入多组范围,多组范围之间是或关系 | | TagRangeDTO |
| tagType | String | 标记类型。范围:range,0-3000;精确:exact: 0,1,2 | exact | |
| 表 TagRangeDTO | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| includeMax | Boolean | 是否包含最大值 | false | |
| includeMin | Boolean | 是否包含最小值 | false | |
| max | Integer | 范围上限 | 1000 | |
| min | Integer | 范围下限 | 1 | |
| 表 DestinationUpstreamVO | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| groupName | String | 分组名 | DEFAULT | |
| namespace | String | 命名空间 | prod | |
| namespaceId | String | 命名空间ID | prod | |
| sourceType | String | 来源类型 | nacos | |
| upstreamId | String | 服务id | 123456789 | |
| upstreamName | String | 服务名 | svc-test | |
| versionId | String | 服务版本id | | |
| versionName | String | 服务版本名 | | |
| versions | Array of Objects | 服务版本列表 | | UpstreamVersionVO |
| weight | Integer | 权重 | | |
| 表 UpstreamVersionVO | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| id | String | 服务版本内部id | 34526187329 | |
| instNum | Integer | 实例数 | 1 | |
| instNumPercent | String | 实例比例% | 100% | |
| labelName | String | 标签名 | name | |
| labelValue | String | 标签值 | | |
| upstreamId | String | 服务内部id | 78965423445 | |
| versionName | String | 服务版本名称 | version-test | |
| 表 ApiBreakerVO | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| enable | Boolean | 开启状态 true:开启,false:关闭,默认false | | |
| breakResponseCode | Integer | 当上游服务处于不健康状态时返回的 HTTP 错误码 | | |
| unhealthy | Object | 上游服务不健康属性 | | Unhealthy |
| healthy | Object | 上游服务健康属性 | | Healthy |
| maxBreakerSec | Integer | 上游服务熔断的最大持续时间,以秒为单位,默认300 | | |
| breakResponseBody | String | 当上游服务处于不健康状态时返回的 HTTP 响应体信息 | | |
| breakResponseHeaders | Array of Objects | 当上游服务处于不健康状态时返回的 HTTP 响应头信息。该字段仅在配置了 break_response_body 属性时生效 | | KeyValue |
| 表 Unhealthy | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| httpStatuses | Array of Integers | 上游服务处于不健康状态时的 HTTP 状态码,默认[500] | | |
| failures | Integer | 上游服务在一定时间内触发不健康状态的异常请求次数,默认3 | | |
| 表 Healthy | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| httpStatuses | Array of Integers | 上游服务处于健康状态时的 HTTP 状态码,默认[200] | | |
| successes | Integer | 上游服务触发健康状态的连续正常请求次数,默认3 | | |
| 表 KeyValue | | | | |
| 参数 | 参数类型 | 说明 | 示例 | 下级对象 |
|---|
| key | String | 响应头名称,键值对存在时成对设置且不能为空串、空格 | header_name | |
| value | String | 响应头值,键值对存在时成对设置且不能为空串、空格 | can contain Nginx $var | |
枚举参数
无
请求示例
请求url
https://127.0.0.1:8080/cgw/v1/route/list?pageNum=1&pageSize=10&instId=String&routeName=String&routeStatus=String
请求头header
{
"regionId": "1234567890"
}
请求体body
无
响应示例
{
"statusCode": 2000,
"message": "success",
"returnObj": {
"total": 1,
"list": [
{
"id": "00000000000000000020",
"name": "test",
"status": 1,
"uri": "/test",
"destinationType": "mock",
"methods": [
"GET",
"PUT",
"POST",
"DELETE",
"PATCH",
"HEAD",
"OPTIONS",
"CONNECT",
"TRACE"
],
"priority": 0,
"updateTime": "2023-05-10 20:40:06",
"createTime": "2023-05-05 19:54:21",
"mockResponse": {
"statusCode": 2000,
"responseJson": "ok"
}
}
],
"pageNum": 1,
"pageSize": 10,
"size": 1,
"startRow": 0,
"endRow": 0,
"pages": 0,
"prePage": 0,
"nextPage": 0,
"isFirstPage": false,
"isLastPage": false,
"hasPreviousPage": false,
"hasNextPage": false,
"navigatePages": 0,
"navigateFirstPage": 0,
"navigateLastPage": 0
}
}
状态码
请参考 状态码
错误码
请参考 错误码