[server][ executor]- 完成底层的代码 - 1
This commit is contained in:
@@ -206,6 +206,8 @@ public class CommandExecLogCache {
|
|||||||
|
|
||||||
ArrayList<String> commandExecCachedLog = CachedCommandLogMap.get(streamKey);
|
ArrayList<String> commandExecCachedLog = CachedCommandLogMap.get(streamKey);
|
||||||
|
|
||||||
|
commandExecCachedLog.add("");
|
||||||
|
commandExecCachedLog.add("");
|
||||||
commandExecCachedLog.add("--------------- command result are as above --------------------");
|
commandExecCachedLog.add("--------------- command result are as above --------------------");
|
||||||
commandExecCachedLog.add(execTimeCostString);
|
commandExecCachedLog.add(execTimeCostString);
|
||||||
commandExecCachedLog.add(execResultString);
|
commandExecCachedLog.add(execResultString);
|
||||||
|
|||||||
@@ -34,10 +34,12 @@ public class ExecutionController {
|
|||||||
SyncExecutionService syncExecutionService;
|
SyncExecutionService syncExecutionService;
|
||||||
|
|
||||||
@PostMapping("/command/one")
|
@PostMapping("/command/one")
|
||||||
@ApiOperation("[命令] - 手动发送命令")
|
@ApiOperation("[命令] [异步]- 单台主机")
|
||||||
public R<String> patchCommandToAgent(
|
public R<String> patchCommandToAgent(
|
||||||
@RequestParam(value = "topicName") @ApiParam(name = "topicName", value = "目标主机名称") String topicName,
|
@RequestParam(value = "topicName") @ApiParam(name = "topicName", value = "目标主机名称") String topicName,
|
||||||
@RequestParam(value = "commandList", required = false) @Nullable List<String> commandList,
|
@RequestParam(value = "commandList", required = false) @Nullable List<String> commandList,
|
||||||
|
@RequestParam(value = "completeCommandList", required = false)
|
||||||
|
@ApiParam(name = "completeCommandList", value = "完整命令行,优先,可为空") @Nullable List<List<String>> completeCommandList,
|
||||||
@RequestParam(value = "type", required = false) @Nullable String type
|
@RequestParam(value = "type", required = false) @Nullable String type
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@@ -45,47 +47,57 @@ public class ExecutionController {
|
|||||||
.SendCommandToAgent(
|
.SendCommandToAgent(
|
||||||
topicName,
|
topicName,
|
||||||
type,
|
type,
|
||||||
commandList
|
commandList,
|
||||||
|
completeCommandList,
|
||||||
|
false,
|
||||||
|
null,
|
||||||
|
false
|
||||||
);
|
);
|
||||||
|
|
||||||
return R.ok(streamKey);
|
return R.ok(streamKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/command/batch")
|
@PostMapping("/command/batch")
|
||||||
@ApiOperation("[命令] - 批量发送命令")
|
@ApiOperation("[命令] [异步] - 批量主机")
|
||||||
public R<List<String>> patchCommandToAgentList(
|
public R<List<String>> patchCommandToAgentList(
|
||||||
@RequestParam(value = "topicNameList")
|
@RequestParam(value = "topicNameList")
|
||||||
@ApiParam(name = "topicNameList", value = "目标机器列表") List<String> topicNameList,
|
@ApiParam(name = "topicNameList", value = "目标机器列表") List<String> topicNameList,
|
||||||
@RequestParam(value = "commandList", required = false)
|
@RequestParam(value = "commandList", required = false)
|
||||||
@ApiParam(name = "commandList", value = "命令行") @Nullable List<String> commandList,
|
@ApiParam(name = "commandList", value = "命令行") @Nullable List<String> commandList,
|
||||||
|
@RequestParam(value = "completeCommandList", required = false)
|
||||||
|
@ApiParam(name = "completeCommandList", value = "完整命令行,优先,可为空") @Nullable List<List<String>> completeCommandList,
|
||||||
@RequestParam(value = "type", required = false) @Nullable String type
|
@RequestParam(value = "type", required = false) @Nullable String type
|
||||||
) {
|
) {
|
||||||
|
|
||||||
return R.ok(asyncExecutionService.SendCommandToAgent(
|
return R.ok(asyncExecutionService.SendCommandToAgentComplete(
|
||||||
topicNameList,
|
topicNameList,
|
||||||
type,
|
type,
|
||||||
commandList
|
commandList,
|
||||||
|
completeCommandList
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/command/all")
|
@PostMapping("/command/all")
|
||||||
@ApiOperation("[命令] - 发送命令至所有的主机")
|
@ApiOperation("[命令] [异步] - 所有的主机")
|
||||||
public R<List<String>> patchCommandToAllAgent(
|
public R<List<String>> patchCommandToAllAgent(
|
||||||
@RequestParam(value = "commandList", required = false)
|
@RequestParam(value = "commandList", required = false)
|
||||||
@ApiParam(name = "commandList", value = "命令行") @Nullable List<String> commandList,
|
@ApiParam(name = "commandList", value = "命令行") @Nullable List<String> commandList,
|
||||||
|
@RequestParam(value = "completeCommandList", required = false)
|
||||||
|
@ApiParam(name = "completeCommandList", value = "完整命令行,优先,可为空") @Nullable List<List<String>> completeCommandList,
|
||||||
@RequestParam(value = "type", required = false) @Nullable String type
|
@RequestParam(value = "type", required = false) @Nullable String type
|
||||||
) {
|
) {
|
||||||
|
|
||||||
return R.ok(asyncExecutionService.SendCommandToAgent(
|
return R.ok(asyncExecutionService.SendCommandToAgentComplete(
|
||||||
ALL_AGENT_TOPIC_NAME_LIST,
|
ALL_AGENT_TOPIC_NAME_LIST,
|
||||||
type,
|
type,
|
||||||
commandList
|
commandList,
|
||||||
|
completeCommandList
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/command/healthy")
|
@PostMapping("/command/healthy")
|
||||||
@ApiOperation("[命令] - 发送命令至健康的主机")
|
@ApiOperation("[命令] [异步] - 健康的主机")
|
||||||
public R<List<String>> patchCommandToHealthyAgent(
|
public R<List<String>> patchCommandToHealthyAgent(
|
||||||
@RequestParam(value = "commandList", required = false)
|
@RequestParam(value = "commandList", required = false)
|
||||||
@ApiParam(name = "commandList", value = "命令行") @Nullable List<String> commandList,
|
@ApiParam(name = "commandList", value = "命令行") @Nullable List<String> commandList,
|
||||||
|
|||||||
Reference in New Issue
Block a user