package cn.reghao.bnt.common.agent.app.iface.impl;

import cn.reghao.bnt.common.agent.app.iface.AppDeploy;
import cn.reghao.bnt.common.msg.constant.PackType;
import cn.reghao.bnt.common.msg.event.EvtAppDeploy;
import cn.reghao.bnt.common.msg.event.EvtAppStatResult;

/**
 * @author reghao
 * @date 2023-03-06 16:21:30
 */
public class AppDeployImpl implements AppDeploy {
    private final DockerApp dockerApp;

    public AppDeployImpl(DockerApp dockerApp) {
        this.dockerApp = dockerApp;
    }

    @Override
    public EvtAppStatResult deploy(EvtAppDeploy deployParam) throws Exception {
        String packType = deployParam.getPackType();
        if (packType.equals(PackType.docker.name())) {
            return dockerApp.deploy(deployParam);
        } else {
            throw new Exception("zip 打包没有实现");
        }
    }
}
