[server][ executor]- 完成底层的代码 - 1

This commit is contained in:
zeaslity
2023-02-28 21:39:33 +08:00
parent c183b3c474
commit a47ede755f
2 changed files with 23 additions and 9 deletions

View File

@@ -34,10 +34,12 @@ public class ExecutionController {
SyncExecutionService syncExecutionService;
@PostMapping("/command/one")
@ApiOperation("[命令] - 手动发送命令")
@ApiOperation("[命令] [异步]- 单台主机")
public R<String> patchCommandToAgent(
@RequestParam(value = "topicName") @ApiParam(name = "topicName", value = "目标主机名称") String topicName,
@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
) {
@@ -45,47 +47,57 @@ public class ExecutionController {
.SendCommandToAgent(
topicName,
type,
commandList
commandList,
completeCommandList,
false,
null,
false
);
return R.ok(streamKey);
}
@PostMapping("/command/batch")
@ApiOperation("[命令] - 批量发送命令")
@ApiOperation("[命令] [异步] - 批量主机")
public R<List<String>> patchCommandToAgentList(
@RequestParam(value = "topicNameList")
@ApiParam(name = "topicNameList", value = "目标机器列表") List<String> topicNameList,
@RequestParam(value = "commandList", required = false)
@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
) {
return R.ok(asyncExecutionService.SendCommandToAgent(
return R.ok(asyncExecutionService.SendCommandToAgentComplete(
topicNameList,
type,
commandList
commandList,
completeCommandList
));
}
@PostMapping("/command/all")
@ApiOperation("[命令] - 发送命令至所有的主机")
@ApiOperation("[命令] [异步] - 所有的主机")
public R<List<String>> patchCommandToAllAgent(
@RequestParam(value = "commandList", required = false)
@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
) {
return R.ok(asyncExecutionService.SendCommandToAgent(
return R.ok(asyncExecutionService.SendCommandToAgentComplete(
ALL_AGENT_TOPIC_NAME_LIST,
type,
commandList
commandList,
completeCommandList
));
}
@PostMapping("/command/healthy")
@ApiOperation("[命令] - 发送命令至健康的主机")
@ApiOperation("[命令] [异步] - 健康的主机")
public R<List<String>> patchCommandToHealthyAgent(
@RequestParam(value = "commandList", required = false)
@ApiParam(name = "commandList", value = "命令行") @Nullable List<String> commandList,