|
@@ -1,47 +1,29 @@
|
|
|
package cn.reghao.autodop.dmaster.app3.controller;
|
|
package cn.reghao.autodop.dmaster.app3.controller;
|
|
|
|
|
|
|
|
import cn.reghao.autodop.common.result.WebResult;
|
|
import cn.reghao.autodop.common.result.WebResult;
|
|
|
-import cn.reghao.autodop.dmaster.app3.backup.BackupService;
|
|
|
|
|
-import cn.reghao.autodop.dmaster.app3.entity.App3BakLog;
|
|
|
|
|
-import cn.reghao.autodop.dmaster.common.mongo.MongoManager;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
-import java.util.List;
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* @author reghao
|
|
* @author reghao
|
|
|
* @date 2019-11-15 08:44:50
|
|
* @date 2019-11-15 08:44:50
|
|
|
*/
|
|
*/
|
|
|
-@Api(tags = "第三方应用操作接口")
|
|
|
|
|
|
|
+@Api(tags = "第三方应用备份还原接口")
|
|
|
@RestController
|
|
@RestController
|
|
|
@RequestMapping("/api/app3")
|
|
@RequestMapping("/api/app3")
|
|
|
public class App3OpsController {
|
|
public class App3OpsController {
|
|
|
- private BackupService backupService;
|
|
|
|
|
- private MongoManager mongoManager;
|
|
|
|
|
-
|
|
|
|
|
- public App3OpsController(BackupService backupService, MongoManager mongoManager) {
|
|
|
|
|
- this.backupService = backupService;
|
|
|
|
|
- this.mongoManager = mongoManager;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /*@PostMapping("/bak")
|
|
|
|
|
- public String backup(String jsonData) throws Exception {
|
|
|
|
|
- String scriptPath = "/tmp/test.sh";
|
|
|
|
|
- TextFile.write(new File(scriptPath), app3Bak.getBakScript());
|
|
|
|
|
- app3Bak.setBakScriptPath(scriptPath);
|
|
|
|
|
- backupService.backup(app3Bak);
|
|
|
|
|
|
|
+ @PostMapping("/bak/start/{app3Name}")
|
|
|
|
|
+ public String startBackup(@PathVariable("app3Name") String app3Name) throws Exception {
|
|
|
return WebResult.success("ok");
|
|
return WebResult.success("ok");
|
|
|
- }*/
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- @PostMapping("/restore/{serviceName}")
|
|
|
|
|
- public String restore(@PathVariable("serviceName") String serviceName) throws Exception {
|
|
|
|
|
|
|
+ @PostMapping("/restore/{app3Name}")
|
|
|
|
|
+ public String restore(@PathVariable("app3Name") String app3Name) throws Exception {
|
|
|
return WebResult.success("ok");
|
|
return WebResult.success("ok");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/log/{serviceName}")
|
|
@GetMapping("/log/{serviceName}")
|
|
|
public String bakLog(@PathVariable("serviceName") String serviceName) {
|
|
public String bakLog(@PathVariable("serviceName") String serviceName) {
|
|
|
- List<App3BakLog> list = mongoManager.query(serviceName);
|
|
|
|
|
- return WebResult.success(list);
|
|
|
|
|
|
|
+ return WebResult.success("ok");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|