public UnitActionModule(ITaskExecutor taskExecutor, IAsimovConfig config)
        {
            Post["/action"] = _ =>
            {
                var command = this.Bind<UnitActionCommand>();
                var deployUnit = config.GetUnitByName(command.unitName);
                var action = deployUnit.Actions[command.actionName];
                var asimovUser = new AsimovUser() {UserId = command.userId, UserName = command.userName};

                var task = action.GetTask(deployUnit,asimovUser, command.correlationId);

                if(task != null)
                    taskExecutor.AddTask(task);

                return Response.AsJson(new { OK = true });
            };
        }
        public DeployModule(ITaskExecutor taskExecutor, IAsimovConfig config)
        {
            Post["/deploy/deploy"] = _ =>
            {
                var command = this.Bind<DeployCommand>();
                var deployUnit = config.GetUnitByName(command.unitName);
                var user = new AsimovUser() { UserId = command.userId, UserName = command.userName };

                var packageSource = config.GetPackageSourceFor(deployUnit);
                var version = packageSource.GetVersion(command.versionId, deployUnit.PackageInfo);
                var deployTask = deployUnit.GetDeployTask(version, new ParameterValues(command.parameters), user);

                taskExecutor.AddTask(deployTask);

                return Response.AsJson(new { OK = true });
            };
        }
 public ExecuteUnitAction(UnitAction action, AsimovUser user)
 {
     this.action = action;
     this.user = user;
 }