Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
discovery
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
谢捷峰
discovery
Commits
8bf24e70
Commit
8bf24e70
authored
Jul 31, 2018
by
Nepxion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重构路径
parent
048d6de3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
29 additions
and
25 deletions
+29
-25
discovery-console/src/main/java/com/nepxion/discovery/console/endpoint/ConsoleEndpoint.java
+13
-12
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/ConfigEndpoint.java
+5
-4
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/RouterEndpoint.java
+7
-6
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/VersionEndpoint.java
+4
-3
No files found.
discovery-console/src/main/java/com/nepxion/discovery/console/endpoint/ConsoleEndpoint.java
View file @
8bf24e70
...
@@ -40,6 +40,7 @@ import com.nepxion.discovery.console.rest.VersionClearRestInvoker;
...
@@ -40,6 +40,7 @@ import com.nepxion.discovery.console.rest.VersionClearRestInvoker;
import
com.nepxion.discovery.console.rest.VersionUpdateRestInvoker
;
import
com.nepxion.discovery.console.rest.VersionUpdateRestInvoker
;
@RestController
@RestController
@RequestMapping
(
path
=
"/console"
)
@Api
(
tags
=
{
"控制台接口"
})
@Api
(
tags
=
{
"控制台接口"
})
public
class
ConsoleEndpoint
{
public
class
ConsoleEndpoint
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
ConsoleEndpoint
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
ConsoleEndpoint
.
class
);
...
@@ -53,73 +54,73 @@ public class ConsoleEndpoint {
...
@@ -53,73 +54,73 @@ public class ConsoleEndpoint {
@Autowired
@Autowired
private
RestTemplate
consoleRestTemplate
;
private
RestTemplate
consoleRestTemplate
;
@RequestMapping
(
path
=
"/
console/
services"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/services"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"获取服务注册中心的服务列表"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取服务注册中心的服务列表"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
public
List
<
String
>
services
()
{
public
List
<
String
>
services
()
{
return
getServices
();
return
getServices
();
}
}
@RequestMapping
(
path
=
"/
console/
instances/{serviceId}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/instances/{serviceId}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"获取服务注册中心服务的实例列表"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取服务注册中心服务的实例列表"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
public
List
<
ServiceInstance
>
instances
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
)
{
public
List
<
ServiceInstance
>
instances
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
)
{
return
getInstances
(
serviceId
);
return
getInstances
(
serviceId
);
}
}
@RequestMapping
(
path
=
"/
console/
instance-list/{serviceId}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/instance-list/{serviceId}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"获取服务注册中心服务的实例列表(精简数据)"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取服务注册中心服务的实例列表(精简数据)"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
public
List
<
InstanceEntity
>
instanceList
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
)
{
public
List
<
InstanceEntity
>
instanceList
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
)
{
return
getInstanceList
(
serviceId
);
return
getInstanceList
(
serviceId
);
}
}
@RequestMapping
(
path
=
"/
console/
instance-map"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/instance-map"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"获取服务注册中心的服务和实例的Map(精简数据)"
,
notes
=
""
,
response
=
Map
.
class
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取服务注册中心的服务和实例的Map(精简数据)"
,
notes
=
""
,
response
=
Map
.
class
,
httpMethod
=
"GET"
)
public
Map
<
String
,
List
<
InstanceEntity
>>
instanceMap
()
{
public
Map
<
String
,
List
<
InstanceEntity
>>
instanceMap
()
{
return
getInstanceMap
();
return
getInstanceMap
();
}
}
@RequestMapping
(
path
=
"/
console/
remote-config/update/{group}/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/remote-config/update/{group}/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"推送更新规则配置信息到远程配置中心"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"推送更新规则配置信息到远程配置中心"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
public
ResponseEntity
<?>
remoteConfigUpdate
(
@PathVariable
(
value
=
"group"
)
@ApiParam
(
value
=
"组名"
,
required
=
true
)
String
group
,
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
,
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
public
ResponseEntity
<?>
remoteConfigUpdate
(
@PathVariable
(
value
=
"group"
)
@ApiParam
(
value
=
"组名"
,
required
=
true
)
String
group
,
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
,
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
return
executeRemoteConfigUpdate
(
group
,
serviceId
,
config
);
return
executeRemoteConfigUpdate
(
group
,
serviceId
,
config
);
}
}
@RequestMapping
(
path
=
"/
console/
remote-config/clear/{group}/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/remote-config/clear/{group}/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"清除规则配置信息到远程配置中心"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"清除规则配置信息到远程配置中心"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
public
ResponseEntity
<?>
remoteConfigClear
(
@PathVariable
(
value
=
"group"
)
@ApiParam
(
value
=
"组名"
,
required
=
true
)
String
group
,
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
)
{
public
ResponseEntity
<?>
remoteConfigClear
(
@PathVariable
(
value
=
"group"
)
@ApiParam
(
value
=
"组名"
,
required
=
true
)
String
group
,
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
)
{
return
executeRemoteConfigClear
(
group
,
serviceId
);
return
executeRemoteConfigClear
(
group
,
serviceId
);
}
}
@RequestMapping
(
path
=
"/
console/
remote-config/view/{group}/{serviceId}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/remote-config/view/{group}/{serviceId}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"查看远程配置中心的规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"查看远程配置中心的规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"GET"
)
public
ResponseEntity
<?>
remoteConfigView
(
@PathVariable
(
value
=
"group"
)
@ApiParam
(
value
=
"组名"
,
required
=
true
)
String
group
,
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
)
{
public
ResponseEntity
<?>
remoteConfigView
(
@PathVariable
(
value
=
"group"
)
@ApiParam
(
value
=
"组名"
,
required
=
true
)
String
group
,
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
)
{
return
executeRemoteConfigView
(
group
,
serviceId
);
return
executeRemoteConfigView
(
group
,
serviceId
);
}
}
@RequestMapping
(
path
=
"/con
sole/con
fig/update-async/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/config/update-async/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"批量异步推送更新规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"批量异步推送更新规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
public
ResponseEntity
<?>
configUpdateAsync
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
,
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
public
ResponseEntity
<?>
configUpdateAsync
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
,
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
return
executeConfigUpdate
(
serviceId
,
config
,
true
);
return
executeConfigUpdate
(
serviceId
,
config
,
true
);
}
}
@RequestMapping
(
path
=
"/con
sole/con
fig/update-sync/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/config/update-sync/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"批量同步推送更新规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"批量同步推送更新规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
public
ResponseEntity
<?>
configUpdateSync
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
,
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
public
ResponseEntity
<?>
configUpdateSync
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
,
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
return
executeConfigUpdate
(
serviceId
,
config
,
false
);
return
executeConfigUpdate
(
serviceId
,
config
,
false
);
}
}
@RequestMapping
(
path
=
"/con
sole/con
fig/clear/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/config/clear/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"批量清除更新的规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"批量清除更新的规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
public
ResponseEntity
<?>
configClear
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
)
{
public
ResponseEntity
<?>
configClear
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
)
{
return
executeConfigClear
(
serviceId
);
return
executeConfigClear
(
serviceId
);
}
}
@RequestMapping
(
path
=
"/
console/
version/update/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/version/update/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"批量更新服务的动态版本"
,
notes
=
"根据指定的localVersion更新服务的dynamicVersion。如果输入的localVersion不匹配服务的localVersion,则忽略;如果如果输入的localVersion为空,则直接更新服务的dynamicVersion"
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"批量更新服务的动态版本"
,
notes
=
"根据指定的localVersion更新服务的dynamicVersion。如果输入的localVersion不匹配服务的localVersion,则忽略;如果如果输入的localVersion为空,则直接更新服务的dynamicVersion"
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
public
ResponseEntity
<?>
versionUpdate
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
,
@RequestBody
@ApiParam
(
value
=
"版本号,格式为[dynamicVersion]或者[dynamicVersion];[localVersion]"
,
required
=
true
)
String
version
)
{
public
ResponseEntity
<?>
versionUpdate
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
,
@RequestBody
@ApiParam
(
value
=
"版本号,格式为[dynamicVersion]或者[dynamicVersion];[localVersion]"
,
required
=
true
)
String
version
)
{
return
executeVersionUpdate
(
serviceId
,
version
);
return
executeVersionUpdate
(
serviceId
,
version
);
}
}
@RequestMapping
(
path
=
"/
console/
version/clear/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/version/clear/{serviceId}"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"批量清除服务的动态版本"
,
notes
=
"根据指定的localVersion清除服务的dynamicVersion。如果输入的localVersion不匹配服务的localVersion,则忽略;如果如果输入的localVersion为空,则直接清除服务的dynamicVersion"
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"批量清除服务的动态版本"
,
notes
=
"根据指定的localVersion清除服务的dynamicVersion。如果输入的localVersion不匹配服务的localVersion,则忽略;如果如果输入的localVersion为空,则直接清除服务的dynamicVersion"
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
public
ResponseEntity
<?>
versionClear
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
,
@RequestBody
(
required
=
false
)
@ApiParam
(
value
=
"版本号,指localVersion,可以为空"
)
String
version
)
{
public
ResponseEntity
<?>
versionClear
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"服务名"
,
required
=
true
)
String
serviceId
,
@RequestBody
(
required
=
false
)
@ApiParam
(
value
=
"版本号,指localVersion,可以为空"
)
String
version
)
{
return
executeVersionClear
(
serviceId
,
version
);
return
executeVersionClear
(
serviceId
,
version
);
...
...
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/ConfigEndpoint.java
View file @
8bf24e70
...
@@ -34,6 +34,7 @@ import com.nepxion.discovery.plugin.framework.event.RuleClearedEvent;
...
@@ -34,6 +34,7 @@ import com.nepxion.discovery.plugin.framework.event.RuleClearedEvent;
import
com.nepxion.discovery.plugin.framework.event.RuleUpdatedEvent
;
import
com.nepxion.discovery.plugin.framework.event.RuleUpdatedEvent
;
@RestController
@RestController
@RequestMapping
(
path
=
"/config"
)
@Api
(
tags
=
{
"配置接口"
})
@Api
(
tags
=
{
"配置接口"
})
public
class
ConfigEndpoint
{
public
class
ConfigEndpoint
{
@Autowired
@Autowired
...
@@ -45,19 +46,19 @@ public class ConfigEndpoint {
...
@@ -45,19 +46,19 @@ public class ConfigEndpoint {
@Autowired
@Autowired
private
PluginEventWapper
pluginEventWapper
;
private
PluginEventWapper
pluginEventWapper
;
@RequestMapping
(
path
=
"/
config/
update-async"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/update-async"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"异步推送更新规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"异步推送更新规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
public
ResponseEntity
<?>
updateAsync
(
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
public
ResponseEntity
<?>
updateAsync
(
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
return
update
(
config
,
true
);
return
update
(
config
,
true
);
}
}
@RequestMapping
(
path
=
"/
config/
update-sync"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/update-sync"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"同步推送更新规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"同步推送更新规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
public
ResponseEntity
<?>
updateSync
(
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
public
ResponseEntity
<?>
updateSync
(
@RequestBody
@ApiParam
(
value
=
"规则配置内容,XML格式"
,
required
=
true
)
String
config
)
{
return
update
(
config
,
false
);
return
update
(
config
,
false
);
}
}
@RequestMapping
(
path
=
"/c
onfig/c
lear"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/clear"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"清除更新的规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"清除更新的规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
public
ResponseEntity
<?>
clear
()
{
public
ResponseEntity
<?>
clear
()
{
Boolean
discoveryControlEnabled
=
pluginContextAware
.
isDiscoveryControlEnabled
();
Boolean
discoveryControlEnabled
=
pluginContextAware
.
isDiscoveryControlEnabled
();
...
@@ -75,7 +76,7 @@ public class ConfigEndpoint {
...
@@ -75,7 +76,7 @@ public class ConfigEndpoint {
return
ResponseEntity
.
ok
().
body
(
"OK"
);
return
ResponseEntity
.
ok
().
body
(
"OK"
);
}
}
@RequestMapping
(
path
=
"/
config/
view"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/view"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"查看本地和更新的规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"查看本地和更新的规则配置信息"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"GET"
)
public
ResponseEntity
<
List
<
String
>>
view
()
{
public
ResponseEntity
<
List
<
String
>>
view
()
{
List
<
String
>
ruleList
=
new
ArrayList
<
String
>(
2
);
List
<
String
>
ruleList
=
new
ArrayList
<
String
>(
2
);
...
...
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/RouterEndpoint.java
View file @
8bf24e70
...
@@ -37,6 +37,7 @@ import com.nepxion.discovery.common.exception.DiscoveryException;
...
@@ -37,6 +37,7 @@ import com.nepxion.discovery.common.exception.DiscoveryException;
import
com.nepxion.discovery.plugin.framework.adapter.PluginAdapter
;
import
com.nepxion.discovery.plugin.framework.adapter.PluginAdapter
;
@RestController
@RestController
@RequestMapping
(
path
=
"/router"
)
@Api
(
tags
=
{
"路由接口"
})
@Api
(
tags
=
{
"路由接口"
})
public
class
RouterEndpoint
{
public
class
RouterEndpoint
{
@Autowired
@Autowired
...
@@ -48,37 +49,37 @@ public class RouterEndpoint {
...
@@ -48,37 +49,37 @@ public class RouterEndpoint {
@Autowired
@Autowired
private
DiscoveryClient
discoveryClient
;
private
DiscoveryClient
discoveryClient
;
@RequestMapping
(
path
=
"/
router/
services"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/services"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"获取服务注册中心的服务列表"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取服务注册中心的服务列表"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
public
List
<
String
>
services
()
{
public
List
<
String
>
services
()
{
return
getServices
();
return
getServices
();
}
}
@RequestMapping
(
path
=
"/
router/
instances/{serviceId}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/instances/{serviceId}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"获取本地节点可访问其他节点(根据服务名)的实例列表"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取本地节点可访问其他节点(根据服务名)的实例列表"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
public
List
<
ServiceInstance
>
instances
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"目标服务名"
,
required
=
true
)
String
serviceId
)
{
public
List
<
ServiceInstance
>
instances
(
@PathVariable
(
value
=
"serviceId"
)
@ApiParam
(
value
=
"目标服务名"
,
required
=
true
)
String
serviceId
)
{
return
getInstanceList
(
serviceId
);
return
getInstanceList
(
serviceId
);
}
}
@RequestMapping
(
path
=
"/
router/
info"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/info"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"获取本地节点信息"
,
notes
=
"获取当前节点的简单信息"
,
response
=
RouterEntity
.
class
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取本地节点信息"
,
notes
=
"获取当前节点的简单信息"
,
response
=
RouterEntity
.
class
,
httpMethod
=
"GET"
)
public
RouterEntity
info
()
{
public
RouterEntity
info
()
{
return
getRouterEntity
();
return
getRouterEntity
();
}
}
@RequestMapping
(
path
=
"/route
r/route
/{routeServiceId}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/route/{routeServiceId}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"获取本地节点可访问其他节点(根据服务名)的路由信息列表"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取本地节点可访问其他节点(根据服务名)的路由信息列表"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
public
List
<
RouterEntity
>
route
(
@PathVariable
(
value
=
"routeServiceId"
)
@ApiParam
(
value
=
"目标服务名"
,
required
=
true
)
String
routeServiceId
)
{
public
List
<
RouterEntity
>
route
(
@PathVariable
(
value
=
"routeServiceId"
)
@ApiParam
(
value
=
"目标服务名"
,
required
=
true
)
String
routeServiceId
)
{
return
getRouterEntityList
(
routeServiceId
);
return
getRouterEntityList
(
routeServiceId
);
}
}
@RequestMapping
(
path
=
"/route
r/route
/{routeServiceId}/{routeHost}/{routePort}"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/route/{routeServiceId}/{routeHost}/{routePort}"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"获取指定节点(根据IP和端口)可访问其他节点(根据服务名)的路由信息列表"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"获取指定节点(根据IP和端口)可访问其他节点(根据服务名)的路由信息列表"
,
notes
=
""
,
response
=
List
.
class
,
httpMethod
=
"GET"
)
public
List
<
RouterEntity
>
route
(
@PathVariable
(
value
=
"routeServiceId"
)
@ApiParam
(
value
=
"目标服务名"
,
required
=
true
)
String
routeServiceId
,
@PathVariable
(
value
=
"routeHost"
)
@ApiParam
(
value
=
"目标服务所在机器的IP地址"
,
required
=
true
)
String
routeHost
,
@PathVariable
(
value
=
"routePort"
)
@ApiParam
(
value
=
"目标服务所在机器的端口号"
,
required
=
true
)
int
routePort
)
{
public
List
<
RouterEntity
>
route
(
@PathVariable
(
value
=
"routeServiceId"
)
@ApiParam
(
value
=
"目标服务名"
,
required
=
true
)
String
routeServiceId
,
@PathVariable
(
value
=
"routeHost"
)
@ApiParam
(
value
=
"目标服务所在机器的IP地址"
,
required
=
true
)
String
routeHost
,
@PathVariable
(
value
=
"routePort"
)
@ApiParam
(
value
=
"目标服务所在机器的端口号"
,
required
=
true
)
int
routePort
)
{
return
getRouterEntityList
(
routeServiceId
,
routeHost
,
routePort
);
return
getRouterEntityList
(
routeServiceId
,
routeHost
,
routePort
);
}
}
@RequestMapping
(
path
=
"/route
r/route
s"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/routes"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"获取全路径的路由信息树"
,
notes
=
"参数按调用服务名的前后次序排列,起始节点的服务名不能加上去。如果多个用“;”分隔,不允许出现空格"
,
response
=
RouterEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"获取全路径的路由信息树"
,
notes
=
"参数按调用服务名的前后次序排列,起始节点的服务名不能加上去。如果多个用“;”分隔,不允许出现空格"
,
response
=
RouterEntity
.
class
,
httpMethod
=
"POST"
)
public
RouterEntity
routes
(
@RequestBody
@ApiParam
(
value
=
"例如:service-a;service-b"
,
required
=
true
)
String
routeServiceIds
)
{
public
RouterEntity
routes
(
@RequestBody
@ApiParam
(
value
=
"例如:service-a;service-b"
,
required
=
true
)
String
routeServiceIds
)
{
return
routeTree
(
routeServiceIds
);
return
routeTree
(
routeServiceIds
);
...
...
discovery-plugin-admin-center/src/main/java/com/nepxion/discovery/plugin/admincenter/endpoint/VersionEndpoint.java
View file @
8bf24e70
...
@@ -33,6 +33,7 @@ import com.nepxion.discovery.plugin.framework.event.VersionClearedEvent;
...
@@ -33,6 +33,7 @@ import com.nepxion.discovery.plugin.framework.event.VersionClearedEvent;
import
com.nepxion.discovery.plugin.framework.event.VersionUpdatedEvent
;
import
com.nepxion.discovery.plugin.framework.event.VersionUpdatedEvent
;
@RestController
@RestController
@RequestMapping
(
path
=
"/version"
)
@Api
(
tags
=
{
"版本接口"
})
@Api
(
tags
=
{
"版本接口"
})
public
class
VersionEndpoint
{
public
class
VersionEndpoint
{
@Autowired
@Autowired
...
@@ -44,7 +45,7 @@ public class VersionEndpoint {
...
@@ -44,7 +45,7 @@ public class VersionEndpoint {
@Autowired
@Autowired
private
PluginEventWapper
pluginEventWapper
;
private
PluginEventWapper
pluginEventWapper
;
@RequestMapping
(
path
=
"/
version/
update"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/update"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"更新服务的动态版本"
,
notes
=
"根据指定的localVersion更新服务的dynamicVersion。如果输入的localVersion不匹配服务的localVersion,则忽略;如果如果输入的localVersion为空,则直接更新服务的dynamicVersion"
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"更新服务的动态版本"
,
notes
=
"根据指定的localVersion更新服务的dynamicVersion。如果输入的localVersion不匹配服务的localVersion,则忽略;如果如果输入的localVersion为空,则直接更新服务的dynamicVersion"
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
public
ResponseEntity
<?>
update
(
@RequestBody
@ApiParam
(
value
=
"版本号,格式为[dynamicVersion]或者[dynamicVersion];[localVersion]"
,
required
=
true
)
String
version
)
{
public
ResponseEntity
<?>
update
(
@RequestBody
@ApiParam
(
value
=
"版本号,格式为[dynamicVersion]或者[dynamicVersion];[localVersion]"
,
required
=
true
)
String
version
)
{
Boolean
discoveryControlEnabled
=
pluginContextAware
.
isDiscoveryControlEnabled
();
Boolean
discoveryControlEnabled
=
pluginContextAware
.
isDiscoveryControlEnabled
();
...
@@ -73,7 +74,7 @@ public class VersionEndpoint {
...
@@ -73,7 +74,7 @@ public class VersionEndpoint {
return
ResponseEntity
.
ok
().
body
(
"OK"
);
return
ResponseEntity
.
ok
().
body
(
"OK"
);
}
}
@RequestMapping
(
path
=
"/
version/
clear"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
path
=
"/clear"
,
method
=
RequestMethod
.
POST
)
@ApiOperation
(
value
=
"清除服务的动态版本"
,
notes
=
"根据指定的localVersion清除服务的dynamicVersion。如果输入的localVersion不匹配服务的localVersion,则忽略;如果如果输入的localVersion为空,则直接清除服务的dynamicVersion"
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
@ApiOperation
(
value
=
"清除服务的动态版本"
,
notes
=
"根据指定的localVersion清除服务的dynamicVersion。如果输入的localVersion不匹配服务的localVersion,则忽略;如果如果输入的localVersion为空,则直接清除服务的dynamicVersion"
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"POST"
)
public
ResponseEntity
<?>
clear
(
@RequestBody
(
required
=
false
)
@ApiParam
(
value
=
"版本号,指localVersion,可以为空"
)
String
version
)
{
public
ResponseEntity
<?>
clear
(
@RequestBody
(
required
=
false
)
@ApiParam
(
value
=
"版本号,指localVersion,可以为空"
)
String
version
)
{
Boolean
discoveryControlEnabled
=
pluginContextAware
.
isDiscoveryControlEnabled
();
Boolean
discoveryControlEnabled
=
pluginContextAware
.
isDiscoveryControlEnabled
();
...
@@ -91,7 +92,7 @@ public class VersionEndpoint {
...
@@ -91,7 +92,7 @@ public class VersionEndpoint {
return
ResponseEntity
.
ok
().
body
(
"OK"
);
return
ResponseEntity
.
ok
().
body
(
"OK"
);
}
}
@RequestMapping
(
path
=
"/v
ersion/v
iew"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
path
=
"/view"
,
method
=
RequestMethod
.
GET
)
@ApiOperation
(
value
=
"查看服务的本地版本和动态版本"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"GET"
)
@ApiOperation
(
value
=
"查看服务的本地版本和动态版本"
,
notes
=
""
,
response
=
ResponseEntity
.
class
,
httpMethod
=
"GET"
)
public
ResponseEntity
<
List
<
String
>>
view
()
{
public
ResponseEntity
<
List
<
String
>>
view
()
{
List
<
String
>
versionList
=
new
ArrayList
<
String
>(
2
);
List
<
String
>
versionList
=
new
ArrayList
<
String
>(
2
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment