|
|
@@ -1,6 +1,7 @@
|
|
|
package cn.reghao.bnt.web.devops.deployer.controller;
|
|
|
|
|
|
-import cn.reghao.bnt.web.devops.deployer.model.dto.RemoteMachine;
|
|
|
+import cn.reghao.bnt.web.devops.deployer.model.dto.UpdateApp;
|
|
|
+import cn.reghao.bnt.web.devops.deployer.model.po.RemoteHost;
|
|
|
import cn.reghao.bnt.web.devops.deployer.service.DeployApp;
|
|
|
import cn.reghao.jutil.web.WebResult;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
@@ -8,10 +9,9 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.http.MediaType;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
-import org.springframework.web.bind.annotation.PostMapping;
|
|
|
-import org.springframework.web.bind.annotation.RequestBody;
|
|
|
-import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
-import org.springframework.web.bind.annotation.RestController;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
|
|
|
/**
|
|
|
* @author reghao
|
|
|
@@ -29,21 +29,30 @@ public class DeployerController {
|
|
|
}
|
|
|
|
|
|
@Operation(summary = "添加节点", description = "N")
|
|
|
- @PostMapping(value = "/remote_host", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
- public String addRemoteHost(@RequestBody @Validated RemoteMachine remoteMachine) {
|
|
|
+ @PostMapping(value = "/remote_host/add", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ public String addRemoteHost(@RequestBody @Validated RemoteHost remoteHost) {
|
|
|
+ deployApp.addRemoteHost(remoteHost);
|
|
|
return WebResult.success();
|
|
|
}
|
|
|
|
|
|
- @Operation(summary = "部署 devops-mgr", description = "N")
|
|
|
- @PostMapping(value = "/mgr", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
- public String deployMgr(@RequestBody @Validated RemoteMachine remoteMachine) {
|
|
|
+ @Operation(summary = "删除节点", description = "N")
|
|
|
+ @PostMapping(value = "/remote_host/delete", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ public String deleteRemoteHost(@RequestBody String host) {
|
|
|
+ deployApp.deleteRemoteHost(host);
|
|
|
return WebResult.success();
|
|
|
}
|
|
|
|
|
|
- @Operation(summary = "部署 devops-agent", description = "N")
|
|
|
- @PostMapping(value = "/agent", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
- public String deployAgent(String host) {
|
|
|
- deployApp.deployApp(host);
|
|
|
+ @Operation(summary = "获取节点", description = "N")
|
|
|
+ @GetMapping(value = "/remote_host/list", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ public String getRemoteHosts(@RequestParam("nodeType") String nodeType) {
|
|
|
+ List<RemoteHost> list = deployApp.getRemoteHosts(nodeType);
|
|
|
+ return WebResult.success(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Operation(summary = "部署 devops-mgr", description = "N")
|
|
|
+ @PostMapping(value = "/update", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ public String deployMgr(@RequestBody UpdateApp updateApp) {
|
|
|
+ //deployApp.deployApp(host);
|
|
|
return WebResult.success();
|
|
|
}
|
|
|
}
|