服务列表分页结果
接口功能介绍
查询服务列表,可分页获取,可以根据服务名称、服务类型过滤查询
接口约束
无
URI
/cgw/v1/upstream/list
请求方式: GET
Accept: application/json
路径参数
无
Query参数
参数 | 是否必填 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|---|
pageNum | 否 | Integer | 页码,默认为1 | 1 | |
pageSize | 否 | Integer | 每页记录数,默认为10 | 10 | |
instId | 是 | String | 实例Id | 123456074ef6e32e041a2ef124b19e63 | |
serviceName | 否 | String | 服务名称 | test | |
serviceSourceType | 否 | String | 服务来源 | nacos |
请求参数
请求头header参数
参数 | 是否必填 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|---|
regionId | 是 | String | 资源池编码 | 7a2828074ef6e32e041a2ef124b19e63 |
请求体body参数
无
响应参数
参数 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|
statusCode | Integer | 接口状态码 | 2000 | |
code | String | 错误码,异常时非空 | CGW_1001 | |
returnObj | Object | 返回数据 | PageInfo«UpstreamVO» | |
message | String | 异常描述 | success |
表 PageInfo«UpstreamVO»
参数 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|
endRow | Long | |||
hasNextPage | Boolean | |||
hasPreviousPage | Boolean | |||
isFirstPage | Boolean | |||
isLastPage | Boolean | |||
list | Array of Objects | UpstreamVO | ||
navigateFirstPage | Integer | |||
navigateLastPage | Integer | |||
navigatePages | Integer | |||
navigatepageNums | Array of Integer | |||
nextPage | Integer | 下一页 | 2 | |
pageNum | Integer | 页码 | 1 | |
pageSize | Integer | 每页条目数 | 10 | |
pages | Integer | 页数 | 2 | |
prePage | Integer | 前一页 | 1 | |
size | Integer | 总数 | 12 | |
startRow | Long |
表 UpstreamVO
参数 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|
balancerStrategy | Object | 服务负载均衡策略 | BalancerStrategy | |
certFileName | String | 证书文件名 | certFileName | |
certKeyFileName | String | 密钥证书文件名 | certFileKeyName | |
createTime | String | LocalDateTime创建时间 | 2023-10-10 12:12:21 | |
enableMtls | Boolean | 是否开启了双向认证 | false | |
enableWebsocket | Boolean | 是否开启了websocket支持 | false | |
groupName | String | 组名 | default | |
healthCheckConfig | Object | 健康检查配置 | HealthCheckConfigVO | |
id | String | ID | 878da73f7dba36ff0ae80e004a4f28f9 | |
ips | Array of Objects | 固定地址ip列表 | [“1.1.1.1”] | String |
label | Object | 标签map | ||
labelNames | Array of Objects | 标签名列表 | LabelNameDTO | |
name | String | 服务名称 | test | |
namespace | String | 命名空间 | prod | |
namespaceId | String | Nacos命名空间ID | prod | |
retry | Object | 重试配置 | Retry | |
serviceNameInRegistry | String | 注册中心服务名 | demo | |
serviceProtocol | String | 服务协议 | http | |
sourceType | String | 服务来源,VIP:固定地址;NACOS:nacos来源;KUBERNETES:k8s来源 | NACOS | |
timeout | Object | 超时时间配置 | Timeout | |
type | String | 类型,取值:control或Ingress | control | |
typeDesc | String | 类型含义,取值:管控或Ingress | 管控 | |
updateTime | String | LocalDateTime更新时间 | 2023-10-10 13:13:13 |
表 BalancerStrategy
参数 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|
balancerType | String | 服务负载均衡策略,roundrobin、chash、ewma、least_conn,默认值为roundrobin | roundrobin | |
hashOn | String | 哈希位置,支持的类型有 vars(Nginx 内置变量),header(自定义 header),cookie,consumer,默认值为 vars | vars | |
key | String | key,负载均衡类型为chash时,必填。可配置项有:uri, server_name, server_addr, request_uri, remote_port, remote_addr, query_String, host, hostname | uri |
表 HealthCheckConfigVO
参数 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|
active | Object | 服务健康检查-主动健康检查配置 | ActiveHealthCheckDTO | |
passive | Object | 服务健康检查-被动健康检查配置 | PassiveHealthCheckDTO |
表 ActiveHealthCheckDTO
参数 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|
concurrency | Integer | 主动检查时同时检查的目标数,默认值10 | 10 | |
enable | Boolean | 是否开启,开启true,不开启false,默认不开启 | false | |
healthy | Object | ActiveHealthyDTO | ||
httpPath | String | 主动检查的 HTTP 请求路径,默认值"/" | / | |
httpsVerifyCertificate | Boolean | 主动检查使用 HTTPS 类型检查时,是否检查远程主机的SSL证书, 默认值true | true | |
port | Integer | 主动检查的 HTTP 请求主机端口(范围1~6553, 默认值 | 1 | |
reqHeaders | Array of Objects | 主动检查使用 HTTP 或 HTTPS类型检查时,设置额外的请求头信息, 默认值[] | String | |
timeout | Integer | 主动检查的超时时间(单位:秒),默认值1 | 1 | |
type | String | 主动检查的类型配置项:http、https、tcp,默认值http | http | |
unhealthy | Object | ActiveUnhealthyDTO |
表 ActiveHealthyDTO
参数 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|
httpStatuses | Array of Objects | 主动检查(健康节点) HTTP 或 HTTPS 类型检查时,健康节点的HTTP状态码,校验范围200~599,默认值[200, 302] | Integer | |
interval | Integer | 主动检查(健康节点)检查的间隔时间(单位:秒),大于等于1,默认值1 | 1 | |
successes | Integer | 主动检查(健康节点)确定节点健康的次数,校验范围1~254,默认值2 | 1 |
表 ActiveUnhealthyDTO
参数 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|
httpFailures | Integer | 主动检查(非健康节点)HTTP 或 HTTPS 类型检查时,确定节点非健康的次数,校验范围1~254,默认值5 | 5 | |
httpStatuses | Array of Objects | 主动检查(非健康节点) HTTP 或 HTTPS 类型检查时,非健康节点的HTTP状态码,校验范围200~599,默认值[429, 404, 500, 501, 502, 503, 504, 505] | Integer | |
interval | Integer | 主动检查(非健康节点)检查的间隔时间(单位:秒),大于等于1,默认值1 | 1 | |
tcpFailures | Integer | 主动检查(非健康节点)TCP 类型检查时,确定节点非健康的次数,校验范围1~254,默认值2 | 2 | |
timeouts | Integer | 主动检查(非健康节点)确定节点非健康的超时次数,校验范围1~254,默认值3 | 3 |
表 PassiveHealthCheckDTO
参数 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|
enable | Boolean | 是否开启,开启true,不开启false,默认不开启 | false | |
healthy | Object | PassiveHealthyDTO | ||
unhealthy | Object | PassiveUnhealthyDTO |
表 PassiveHealthyDTO
参数 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|
httpStatuses | Array of Objects | 被动检查(健康节点) HTTP 或 HTTPS 类型检查时,健康节点的HTTP状态码,校验范围200~599,默认值[200, 201, 202, 203, 204, 205, 206, 207, 208, 226, 300, 301, 302, 303, 304, 305, 306, 307, 308] | Integer | |
successes | Integer | 被动检查(健康节点)确定节点健康的次数,校验范围0~254,默认值5 | 5 | |
type | String | 被动检查的类型配置项:http、https、tcp,默认值http | http |
表 PassiveUnhealthyDTO
参数 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|
httpFailures | Integer | 被动检查(非健康节点)HTTP 或 HTTPS 类型检查时,确定节点非健康的次数,校验范围0~254,默认值5 | 5 | |
httpStatuses | Array of Objects | 被动检查(非健康节点) HTTP 或 HTTPS 类型检查时,非健康节点的HTTP状态码,校验范围200~599,默认值[429, 500, 503] | Integer | |
tcpFailures | Integer | 被动检查(非健康节点)TCP 类型检查时,确定节点非健康的次数,校验范围0~254,默认值2 | 2 | |
timeouts | Integer | 被动检查(非健康节点)确定节点非健康的超时次数,校验范围0~254,默认值7 | 7 |
表 LabelNameDTO
参数 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|
labelName | String | 标签名原始值。用于传参,和tips展示 | version | |
labelNameVO | String | 标签名别名,用于web展示 | version_vo |
表 Retry
参数 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|
retries | Integer | 重试次数 | 3 | |
retryTimeout | Float | 重试超时时间 | 6 |
表 Timeout
参数 | 参数类型 | 说明 | 示例 | 下级对象 |
---|---|---|---|---|
connect | Float | 连接超时 | 6 | |
read | Float | 读取超时 | 6 | |
send | Float | 发送超时 | 6 |
请求示例
请求url
https://127.0.0.1:8080/cgw/v1/upstream/list?pageNum=1&pageSize=10&instId=String&serviceName=String&serviceSourceType=String
请求头header
{
"regionId": "1234567890"
}
请求体body
响应示例
{
"statusCode": 2000,
"message": "success",
"returnObj": {
"total": 2,
"list": [
{
"id": "00000000000000000050",
"name": "msap.nacos.consumer",
"sourceType": "nacos",
"namespace": "dsxm-cs_jxcs",
"namespaceId": "40cacbb7-321e-4ce0-8ece-da44e14dcd02",
"groupName": "DEFAULT_GROUP",
"serviceNameInRegistry": "msap.nacos.consumer",
"serviceProtocol": "http",
"updateTime": "2023-05-10 16:13:07",
"createTime": "2023-05-10 16:13:07",
"balancerStrategy": {
"balancerType": "roundrobin"
},
"healthCheckConfig": {
"active": {
"enable": false
},
"passive": {
"enable": false
}
},
"timeout": {
"connect": 6,
"read": 6,
"send": 6
},
"retry": {
"retryTimeout": 0
}
},
{
"id": "00000000000000000023",
"name": "apisix",
"sourceType": "VIP",
"ips": [
"127.0.0.1:27151"
],
"namespace": "-",
"groupName": "-",
"serviceNameInRegistry": "-",
"serviceProtocol": "http",
"updateTime": "2023-05-06 08:53:53",
"createTime": "2023-05-06 08:53:53",
"balancerStrategy": {
"balancerType": "roundrobin"
},
"healthCheckConfig": {
"active": {
"enable": false
},
"passive": {
"enable": false
}
},
"timeout": {
"connect": 6,
"read": 6,
"send": 6
},
"retry": {
"retryTimeout": 0
}
}
],
"pageNum": 1,
"pageSize": 10,
"size": 2,
"startRow": 0,
"endRow": 0,
"pages": 0,
"prePage": 0,
"nextPage": 0,
"isFirstPage": false,
"isLastPage": false,
"hasPreviousPage": false,
"hasNextPage": false,
"navigatePages": 0,
"navigateFirstPage": 0,
"navigateLastPage": 0
}
}
状态码
请参考 状态码说明。
错误码
请参考 错误码说明。