|
|
@@ -1,4 +1,4 @@
|
|
|
-package cn.reghao.autodop.dmaster.app.controller;
|
|
|
+package cn.reghao.autodop.dmaster.app.controller.config;
|
|
|
|
|
|
import cn.reghao.autodop.dmaster.app.model.dto.DeployConfigs;
|
|
|
import cn.reghao.autodop.dmaster.app.model.po.config.build.PackerConfig;
|
|
|
@@ -7,10 +7,8 @@ import cn.reghao.jdkutil.result.Result;
|
|
|
import cn.reghao.jdkutil.result.ResultStatus;
|
|
|
import cn.reghao.autodop.dmaster.app.model.vo.NewApp;
|
|
|
import cn.reghao.autodop.dmaster.app.model.po.config.AppConfig;
|
|
|
-import cn.reghao.autodop.dmaster.app.model.po.config.ProjConfig;
|
|
|
import cn.reghao.autodop.dmaster.notification.model.po.NotifyGroup;
|
|
|
import cn.reghao.autodop.dmaster.app.db.crud.config.AppConfigCrud;
|
|
|
-import cn.reghao.autodop.dmaster.app.db.crud.config.ProjCrudService;
|
|
|
import cn.reghao.jdkutil.result.WebBody;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
@@ -29,22 +27,19 @@ import java.util.List;
|
|
|
@Slf4j
|
|
|
@Api(tags = "应用配置 CRUD 接口")
|
|
|
@RestController
|
|
|
-@RequestMapping("/api/app/config")
|
|
|
+@RequestMapping("/api/app/config/app")
|
|
|
public class AppConfigController {
|
|
|
private final AppConfigCrud appConfigCrud;
|
|
|
- private final ProjCrudService projCrudService;
|
|
|
private MachineHostQuery hostQuery;
|
|
|
|
|
|
- public AppConfigController(AppConfigCrud appConfigCrud, ProjCrudService projCrudService,
|
|
|
- MachineHostQuery hostQuery) {
|
|
|
+ public AppConfigController(AppConfigCrud appConfigCrud, MachineHostQuery hostQuery) {
|
|
|
this.appConfigCrud = appConfigCrud;
|
|
|
- this.projCrudService = projCrudService;
|
|
|
this.hostQuery = hostQuery;
|
|
|
}
|
|
|
|
|
|
/* 应用编排 */
|
|
|
@ApiOperation(value = "添加/修改应用编排")
|
|
|
- @PostMapping(value = "/app", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ @PostMapping(produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public ResponseEntity<String> addAppOrchestration(@Validated AppConfig app) {
|
|
|
Result result;
|
|
|
try {
|
|
|
@@ -59,7 +54,7 @@ public class AppConfigController {
|
|
|
|
|
|
// TODO 使用 @PathVariable 注解时会自动填充实体
|
|
|
@ApiOperation(value = "复制应用编排")
|
|
|
- @PostMapping(value = "/app/copy/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ @PostMapping(value = "/copy/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public ResponseEntity<String> copyAppOrchestration(@PathVariable("id") AppConfig app,
|
|
|
@Validated NewApp newApp) {
|
|
|
Result result;
|
|
|
@@ -73,7 +68,7 @@ public class AppConfigController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "设置应用通知")
|
|
|
- @PostMapping(value = "/app/notify", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ @PostMapping(value = "/notify", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public ResponseEntity<String> appNotify(@RequestParam("id") AppConfig app,
|
|
|
@RequestParam("groupId") List<NotifyGroup> notifyGroups) {
|
|
|
app.setNotifyGroups(notifyGroups);
|
|
|
@@ -82,14 +77,14 @@ public class AppConfigController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "删除应用编排")
|
|
|
- @DeleteMapping(value = "/app/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ @DeleteMapping(value = "/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public ResponseEntity<String> deleteAppOrchestration(@PathVariable("id") AppConfig app) {
|
|
|
Result result = appConfigCrud.delete(app);
|
|
|
return ResponseEntity.ok().body(WebBody.result(result));
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "应用部署配置")
|
|
|
- @PostMapping(value = "/app/deploy", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
+ @PostMapping(value = "/deploy", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
public ResponseEntity<String> appDeploy(@RequestParam("id") AppConfig app,
|
|
|
@Validated DeployConfigs deployConfigs) {
|
|
|
PackerConfig packerConfig = app.getPackerConfig();
|
|
|
@@ -104,27 +99,4 @@ public class AppConfigController {
|
|
|
app.setDeployConfigs(deployConfigs.getDeployConfigs());
|
|
|
return ResponseEntity.ok().body(WebBody.success());
|
|
|
}
|
|
|
-
|
|
|
- /* 项目编排 */
|
|
|
- @ApiOperation(value = "添加/修改项目编排")
|
|
|
- @PostMapping(value = "/proj", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
- public ResponseEntity<String> addProjOrchestration(@Validated ProjConfig proj) {
|
|
|
- Result result = projCrudService.insertOrUpdate(proj);
|
|
|
- return ResponseEntity.ok().body(WebBody.result(result));
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "复制项目编排")
|
|
|
- @PostMapping(value = "/proj/copy/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
- public ResponseEntity<String> copyProjOrchestration(@PathVariable("id") ProjConfig proj,
|
|
|
- @Validated NewApp newApp) {
|
|
|
- Result result = projCrudService.copy(proj, newApp);
|
|
|
- return ResponseEntity.ok().body(WebBody.result(result));
|
|
|
- }
|
|
|
-
|
|
|
- @ApiOperation(value = "删除项目编排")
|
|
|
- @DeleteMapping(value = "/proj/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
|
|
- public ResponseEntity<String> deleteProjOrchestration(@PathVariable("id") ProjConfig proj) {
|
|
|
- Result result = projCrudService.delete(proj);
|
|
|
- return ResponseEntity.ok().body(WebBody.result(result));
|
|
|
- }
|
|
|
}
|