[server] - 优化大量代码
This commit is contained in:
@@ -1,17 +1,20 @@
|
||||
package io.wdd.rpc.controller;
|
||||
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.wdd.common.beans.response.R;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static io.wdd.rpc.init.ServerBootUpEnvironment.ALL_AGENT_STATUS_MAP;
|
||||
import static io.wdd.rpc.init.ServerBootUpEnvironment.STATUS_AGENT_LIST_MAP;
|
||||
import static io.wdd.rpc.init.ServerBootUpEnvironment.*;
|
||||
|
||||
|
||||
@RestController
|
||||
@@ -20,18 +23,49 @@ import static io.wdd.rpc.init.ServerBootUpEnvironment.STATUS_AGENT_LIST_MAP;
|
||||
public class StatusController {
|
||||
|
||||
|
||||
@ApiOperation("获取所有Agent的运行状态")
|
||||
@GetMapping("/agentStatus")
|
||||
@ApiOperation("[ Agent-状态 ] Map")
|
||||
@GetMapping("/agent/status")
|
||||
public R<Map> GetAllAgentHealthyStatus() {
|
||||
|
||||
return R.ok(ALL_AGENT_STATUS_MAP);
|
||||
}
|
||||
|
||||
@ApiOperation("获取 状态-Agent Map")
|
||||
@GetMapping("/statusAgent")
|
||||
@ApiOperation("[ 状态-Agent ] Map")
|
||||
@GetMapping("/status/agent")
|
||||
public R<Map> GetHealthyStatusAgentList() {
|
||||
|
||||
return R.ok(STATUS_AGENT_LIST_MAP);
|
||||
}
|
||||
|
||||
@ApiOperation("[ Agent ] - 所有的Agent主机")
|
||||
@PostMapping("/agent/all")
|
||||
public R<List<String>> GetAllAgentTopicNameList() {
|
||||
|
||||
return R.ok(ALL_AGENT_TOPIC_NAME_LIST);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("[ Agent ] - 所有主机String")
|
||||
@PostMapping("/agent/all/string")
|
||||
public R<String> GetAllAgentString() {
|
||||
|
||||
|
||||
String data = ALL_AGENT_TOPIC_NAME_LIST.toString();
|
||||
data.replace("[","");
|
||||
data.replace("]","");
|
||||
return R.ok(
|
||||
data
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("[ Agent ] - 健康的Agent主机")
|
||||
@PostMapping("/agent/healthy")
|
||||
public R<List<String>> GetAllHealthyAgent() {
|
||||
|
||||
return R.ok(ALL_HEALTHY_AGENT_TOPIC_NAME_LIST);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user