|
|
@@ -2,7 +2,7 @@ package cn.reghao.autodop.dagent.app;
|
|
|
|
|
|
import cn.reghao.autodop.common.amqp.RpcResult;
|
|
|
import cn.reghao.autodop.common.dagent.app.api.data.AppIdArgs;
|
|
|
-import cn.reghao.autodop.common.dagent.app.api.data.AppStatus;
|
|
|
+import cn.reghao.autodop.common.dagent.app.api.data.DeployedAppStatus;
|
|
|
import cn.reghao.autodop.common.dagent.app.api.data.deploy.AppDeployArgs;
|
|
|
import cn.reghao.autodop.common.dagent.app.api.data.deploy.PackerType;
|
|
|
import cn.reghao.autodop.common.dagent.app.api.data.log.AppLogArgs;
|
|
|
@@ -35,22 +35,22 @@ public class App {
|
|
|
AppDeployArgs appDeployArgs = (AppDeployArgs) JsonConverter.jsonToObject(payload, AppDeployArgs.class);
|
|
|
String packerType = appDeployArgs.getPackerType();
|
|
|
|
|
|
- AppStatus appStatus;
|
|
|
+ DeployedAppStatus deployedAppStatus;
|
|
|
switch (PackerType.valueOf(packerType)) {
|
|
|
case docker:
|
|
|
try {
|
|
|
- appStatus = dockerAppServiceImpl.deploy(appDeployArgs);
|
|
|
+ deployedAppStatus = dockerAppServiceImpl.deploy(appDeployArgs);
|
|
|
} catch (DockerException e) {
|
|
|
return RpcResult.fail(ExceptionUtil.errorMsg(e));
|
|
|
}
|
|
|
break;
|
|
|
case zip:
|
|
|
- appStatus = zipAppServiceImpl.deploy(appDeployArgs);
|
|
|
+ deployedAppStatus = zipAppServiceImpl.deploy(appDeployArgs);
|
|
|
break;
|
|
|
default:
|
|
|
return RpcResult.error("打包类型 " + appDeployArgs.getPackerType() + " 不存在");
|
|
|
}
|
|
|
- return RpcResult.success(JsonConverter.objectToJson(appStatus));
|
|
|
+ return RpcResult.success(JsonConverter.objectToJson(deployedAppStatus));
|
|
|
}
|
|
|
|
|
|
public RpcResult log(String payload) {
|
|
|
@@ -89,22 +89,22 @@ public class App {
|
|
|
String appId = appIdArgs.getAppId();
|
|
|
String packerType = appIdArgs.getPackerType();
|
|
|
|
|
|
- AppStatus appStatus;
|
|
|
+ DeployedAppStatus deployedAppStatus;
|
|
|
switch (PackerType.valueOf(packerType)) {
|
|
|
case docker:
|
|
|
try {
|
|
|
- appStatus = dockerAppServiceImpl.status(appId);
|
|
|
+ deployedAppStatus = dockerAppServiceImpl.status(appId);
|
|
|
} catch (DockerException e) {
|
|
|
return RpcResult.fail(ExceptionUtil.errorMsg(e));
|
|
|
}
|
|
|
break;
|
|
|
case zip:
|
|
|
- appStatus = zipAppServiceImpl.status(appId);
|
|
|
+ deployedAppStatus = zipAppServiceImpl.status(appId);
|
|
|
break;
|
|
|
default:
|
|
|
return RpcResult.error("打包类型 " + appIdArgs.getPackerType() + " 不存在");
|
|
|
}
|
|
|
- return RpcResult.success(JsonConverter.objectToJson(appStatus));
|
|
|
+ return RpcResult.success(JsonConverter.objectToJson(deployedAppStatus));
|
|
|
}
|
|
|
|
|
|
public RpcResult restart(String payload) {
|
|
|
@@ -112,22 +112,22 @@ public class App {
|
|
|
String appId = appIdArgs.getAppId();
|
|
|
String packerType = appIdArgs.getPackerType();
|
|
|
|
|
|
- AppStatus appStatus;
|
|
|
+ DeployedAppStatus deployedAppStatus;
|
|
|
switch (PackerType.valueOf(packerType)) {
|
|
|
case docker:
|
|
|
try {
|
|
|
- appStatus = dockerAppServiceImpl.restart(appId);
|
|
|
+ deployedAppStatus = dockerAppServiceImpl.restart(appId);
|
|
|
} catch (DockerException e) {
|
|
|
return RpcResult.fail(ExceptionUtil.errorMsg(e));
|
|
|
}
|
|
|
break;
|
|
|
case zip:
|
|
|
- appStatus = zipAppServiceImpl.restart(appId);
|
|
|
+ deployedAppStatus = zipAppServiceImpl.restart(appId);
|
|
|
break;
|
|
|
default:
|
|
|
return RpcResult.error("打包类型 " + appIdArgs.getPackerType() + " 不存在");
|
|
|
}
|
|
|
- return RpcResult.success(JsonConverter.objectToJson(appStatus));
|
|
|
+ return RpcResult.success(JsonConverter.objectToJson(deployedAppStatus));
|
|
|
}
|
|
|
|
|
|
public RpcResult stop(String payload) {
|
|
|
@@ -135,22 +135,22 @@ public class App {
|
|
|
String appId = appIdArgs.getAppId();
|
|
|
String packerType = appIdArgs.getPackerType();
|
|
|
|
|
|
- AppStatus appStatus;
|
|
|
+ DeployedAppStatus deployedAppStatus;
|
|
|
switch (PackerType.valueOf(packerType)) {
|
|
|
case docker:
|
|
|
try {
|
|
|
- appStatus = dockerAppServiceImpl.stop(appId);
|
|
|
+ deployedAppStatus = dockerAppServiceImpl.stop(appId);
|
|
|
} catch (DockerException e) {
|
|
|
return RpcResult.fail(ExceptionUtil.errorMsg(e));
|
|
|
}
|
|
|
break;
|
|
|
case zip:
|
|
|
- appStatus = zipAppServiceImpl.stop(appId);
|
|
|
+ deployedAppStatus = zipAppServiceImpl.stop(appId);
|
|
|
break;
|
|
|
default:
|
|
|
return RpcResult.error("打包类型 " + appIdArgs.getPackerType() + " 不存在");
|
|
|
}
|
|
|
- return RpcResult.success(JsonConverter.objectToJson(appStatus));
|
|
|
+ return RpcResult.success(JsonConverter.objectToJson(deployedAppStatus));
|
|
|
}
|
|
|
|
|
|
public RpcResult start(String payload) {
|
|
|
@@ -158,21 +158,21 @@ public class App {
|
|
|
String appId = appIdArgs.getAppId();
|
|
|
String packerType = appIdArgs.getPackerType();
|
|
|
|
|
|
- AppStatus appStatus;
|
|
|
+ DeployedAppStatus deployedAppStatus;
|
|
|
switch (PackerType.valueOf(packerType)) {
|
|
|
case docker:
|
|
|
try {
|
|
|
- appStatus = dockerAppServiceImpl.start(appId);
|
|
|
+ deployedAppStatus = dockerAppServiceImpl.start(appId);
|
|
|
} catch (DockerException e) {
|
|
|
return RpcResult.fail(ExceptionUtil.errorMsg(e));
|
|
|
}
|
|
|
break;
|
|
|
case zip:
|
|
|
- appStatus = zipAppServiceImpl.start(appId);
|
|
|
+ deployedAppStatus = zipAppServiceImpl.start(appId);
|
|
|
break;
|
|
|
default:
|
|
|
return RpcResult.error("打包类型 " + appIdArgs.getPackerType() + " 不存在");
|
|
|
}
|
|
|
- return RpcResult.success(JsonConverter.objectToJson(appStatus));
|
|
|
+ return RpcResult.success(JsonConverter.objectToJson(deployedAppStatus));
|
|
|
}
|
|
|
}
|