|
|
@@ -1,19 +1,19 @@
|
|
|
package cn.reghao.autodop.dagent.app;
|
|
|
|
|
|
-import cn.reghao.autodop.common.dagent.app.AppIdArgs;
|
|
|
+import cn.reghao.autodop.common.dagent.app.AppIdParam;
|
|
|
import cn.reghao.autodop.common.dagent.app.AppStatus;
|
|
|
import cn.reghao.autodop.common.dagent.app.DeployResult;
|
|
|
-import cn.reghao.autodop.common.dagent.app.deploy.AppDeployArgs;
|
|
|
-import cn.reghao.autodop.common.dagent.app.deploy.PackType;
|
|
|
+import cn.reghao.autodop.common.dagent.app.DeployParam;
|
|
|
+import cn.reghao.autodop.common.dagent.app.PackType;
|
|
|
import cn.reghao.autodop.common.dagent.app.log.AppLogArgs;
|
|
|
import cn.reghao.autodop.common.dagent.app.log.LogConfig;
|
|
|
import cn.reghao.autodop.common.dagent.app.log.LogFile;
|
|
|
import cn.reghao.autodop.common.docker.exception.DockerException;
|
|
|
import cn.reghao.autodop.common.message.CallResult;
|
|
|
-import cn.reghao.util.result.Result;
|
|
|
-import cn.reghao.util.result.ResultStatus;
|
|
|
+import cn.reghao.jdkutil.result.Result;
|
|
|
+import cn.reghao.jdkutil.result.ResultStatus;
|
|
|
import cn.reghao.autodop.common.util.ExceptionUtil;
|
|
|
-import cn.reghao.util.text.JsonConverter;
|
|
|
+import cn.reghao.jdkutil.serializer.JsonConverter;
|
|
|
import cn.reghao.autodop.dagent.spring.DagentLifecycle;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.stereotype.Component;
|
|
|
@@ -37,9 +37,9 @@ public class App {
|
|
|
}
|
|
|
|
|
|
public DeployResult deploy(String payload) {
|
|
|
- AppDeployArgs appDeployArgs = JsonConverter.jsonToObject(payload, AppDeployArgs.class);
|
|
|
- String buildLogId = appDeployArgs.getBuildLogId();
|
|
|
- String packType = appDeployArgs.getPackType();
|
|
|
+ DeployParam deployParam = JsonConverter.jsonToObject(payload, DeployParam.class);
|
|
|
+ String buildLogId = deployParam.getBuildLogId();
|
|
|
+ String packType = deployParam.getPackType();
|
|
|
|
|
|
AppStatus appStatus;
|
|
|
DeployResult deployResult = new DeployResult(buildLogId,
|
|
|
@@ -47,7 +47,7 @@ public class App {
|
|
|
switch (PackType.valueOf(packType)) {
|
|
|
case docker:
|
|
|
try {
|
|
|
- appStatus = dockerAppServiceImpl.deploy(appDeployArgs);
|
|
|
+ appStatus = dockerAppServiceImpl.deploy(deployParam);
|
|
|
deployResult.setResult(Result.result(ResultStatus.SUCCESS));
|
|
|
deployResult.setAppStatus(appStatus);
|
|
|
} catch (DockerException e) {
|
|
|
@@ -55,12 +55,12 @@ public class App {
|
|
|
}
|
|
|
break;
|
|
|
case zip:
|
|
|
- appStatus = zipAppServiceImpl.deploy(appDeployArgs);
|
|
|
+ appStatus = zipAppServiceImpl.deploy(deployParam);
|
|
|
deployResult.setResult(Result.result(ResultStatus.SUCCESS));
|
|
|
deployResult.setAppStatus(appStatus);
|
|
|
break;
|
|
|
default:
|
|
|
- String msg = "打包类型 " + appDeployArgs.getPackType() + " 不存在";
|
|
|
+ String msg = "打包类型 " + deployParam.getPackType() + " 不存在";
|
|
|
deployResult.setResult(Result.result(ResultStatus.ERROR, msg));
|
|
|
}
|
|
|
return deployResult;
|
|
|
@@ -98,9 +98,9 @@ public class App {
|
|
|
}
|
|
|
|
|
|
public CallResult<AppStatus> status(String payload) {
|
|
|
- AppIdArgs appIdArgs = JsonConverter.jsonToObject(payload, AppIdArgs.class);
|
|
|
- String appId = appIdArgs.getAppId();
|
|
|
- String packerType = appIdArgs.getPackerType();
|
|
|
+ AppIdParam appIdParam = JsonConverter.jsonToObject(payload, AppIdParam.class);
|
|
|
+ String appId = appIdParam.getAppId();
|
|
|
+ String packerType = appIdParam.getPackerType();
|
|
|
|
|
|
AppStatus appStatus;
|
|
|
switch (PackType.valueOf(packerType)) {
|
|
|
@@ -115,15 +115,15 @@ public class App {
|
|
|
appStatus = zipAppServiceImpl.status(appId);
|
|
|
break;
|
|
|
default:
|
|
|
- return CallResult.error("打包类型 " + appIdArgs.getPackerType() + " 不存在");
|
|
|
+ return CallResult.error("打包类型 " + appIdParam.getPackerType() + " 不存在");
|
|
|
}
|
|
|
return CallResult.success(appStatus);
|
|
|
}
|
|
|
|
|
|
public CallResult<AppStatus> restart(String payload) {
|
|
|
- AppIdArgs appIdArgs = JsonConverter.jsonToObject(payload, AppIdArgs.class);
|
|
|
- String appId = appIdArgs.getAppId();
|
|
|
- String packerType = appIdArgs.getPackerType();
|
|
|
+ AppIdParam appIdParam = JsonConverter.jsonToObject(payload, AppIdParam.class);
|
|
|
+ String appId = appIdParam.getAppId();
|
|
|
+ String packerType = appIdParam.getPackerType();
|
|
|
|
|
|
AppStatus appStatus;
|
|
|
switch (PackType.valueOf(packerType)) {
|
|
|
@@ -138,15 +138,15 @@ public class App {
|
|
|
appStatus = zipAppServiceImpl.restart(appId);
|
|
|
break;
|
|
|
default:
|
|
|
- return CallResult.error("打包类型 " + appIdArgs.getPackerType() + " 不存在");
|
|
|
+ return CallResult.error("打包类型 " + appIdParam.getPackerType() + " 不存在");
|
|
|
}
|
|
|
return CallResult.success(appStatus);
|
|
|
}
|
|
|
|
|
|
public CallResult<AppStatus> stop(String payload) {
|
|
|
- AppIdArgs appIdArgs = JsonConverter.jsonToObject(payload, AppIdArgs.class);
|
|
|
- String appId = appIdArgs.getAppId();
|
|
|
- String packerType = appIdArgs.getPackerType();
|
|
|
+ AppIdParam appIdParam = JsonConverter.jsonToObject(payload, AppIdParam.class);
|
|
|
+ String appId = appIdParam.getAppId();
|
|
|
+ String packerType = appIdParam.getPackerType();
|
|
|
|
|
|
AppStatus appStatus;
|
|
|
switch (PackType.valueOf(packerType)) {
|
|
|
@@ -161,15 +161,15 @@ public class App {
|
|
|
appStatus = zipAppServiceImpl.stop(appId);
|
|
|
break;
|
|
|
default:
|
|
|
- return CallResult.error("打包类型 " + appIdArgs.getPackerType() + " 不存在");
|
|
|
+ return CallResult.error("打包类型 " + appIdParam.getPackerType() + " 不存在");
|
|
|
}
|
|
|
return CallResult.success(appStatus);
|
|
|
}
|
|
|
|
|
|
public CallResult<AppStatus> start(String payload) {
|
|
|
- AppIdArgs appIdArgs = JsonConverter.jsonToObject(payload, AppIdArgs.class);
|
|
|
- String appId = appIdArgs.getAppId();
|
|
|
- String packerType = appIdArgs.getPackerType();
|
|
|
+ AppIdParam appIdParam = JsonConverter.jsonToObject(payload, AppIdParam.class);
|
|
|
+ String appId = appIdParam.getAppId();
|
|
|
+ String packerType = appIdParam.getPackerType();
|
|
|
|
|
|
AppStatus appStatus;
|
|
|
switch (PackType.valueOf(packerType)) {
|
|
|
@@ -184,7 +184,7 @@ public class App {
|
|
|
appStatus = zipAppServiceImpl.start(appId);
|
|
|
break;
|
|
|
default:
|
|
|
- return CallResult.error("打包类型 " + appIdArgs.getPackerType() + " 不存在");
|
|
|
+ return CallResult.error("打包类型 " + appIdParam.getPackerType() + " 不存在");
|
|
|
}
|
|
|
return CallResult.success(appStatus);
|
|
|
}
|