// Path: vertx-deploy-agent/src/main/java/nl/jpoint/vertx/deploy/agent/util/LogConstants.java
// public final class LogConstants {
//     public static final String ERROR_EXECUTING_REQUEST = "Error executing request {}.";
//     public static final String REQUEST_ALREADY_REGISTERED = "[{} - {}]: Request already registered.";
//     public static final String REQUEST_NOT_REGISTERED = "[{} - {}]: Request not registered.";
// 
// 
//     public static final String INVOKE_CONTAINER = "InvokeContainer";
//     public static final String CONSOLE_COMMAND = "ConsoleCommand";
//     public static final String CLUSTER_MANAGER = "ClusterManager";
//     public static final String DEPLOY_REQUEST = "DeployRequest";
//     public static final String DEPLOY_CONFIG_REQUEST = "DeployConfigRequest";
//     public static final String DEPLOY_ARTIFACT_REQUEST = "DeployArtifactRequest";
//     public static final String AWS_ELB_REQUEST = "ConfigureAwsElb";
//     public static final String AWS_AS_REQUEST = "ConfigureAwsAutoScaling";
//     public static final String STARTUP = "Startup";
// 
//     private LogConstants() {
//         // hide
//     }
// }


import io.netty.handler.codec.http.HttpResponseStatus;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.http.HttpServer;
import io.vertx.ext.web.Router;
import nl.jpoint.vertx.deploy.agent.handler.*;
import nl.jpoint.vertx.deploy.agent.service.*;
import nl.jpoint.vertx.deploy.agent.util.LogConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;

        if (deployconfig.isAwsEnabled()) {
            awsService = new AwsService(getVertx(), deployconfig);
            autoDiscoverDeployService = new AutoDiscoverDeployService(deployconfig, defaultDeployService, getVertx());
        }

        Router router = Router.router(getVertx());
        router.post("/deploy/deploy").handler(new RestDeployHandler(defaultDeployService, awsService, deployconfig.getAuthToken()));
        router.post("/deploy/module*").handler(new RestDeployModuleHandler(deployApplicationService));
        router.post("/deploy/artifact*").handler(new RestDeployArtifactHandler(deployArtifactService));
        router.get("/deploy/update*").handler(new StatusUpdateHandler(deployApplicationService));

        if (deployconfig.isAwsEnabled()) {
            router.get("/deploy/status/:id").handler(new RestDeployStatusHandler(awsService, deployApplicationService));
        }

        router.get("/status").handler(event -> {
            if (initiated) {
                event.response().setStatusCode(HttpResponseStatus.FORBIDDEN.code());
            } else {
                event.response().setStatusCode(HttpResponseStatus.INTERNAL_SERVER_ERROR.code());
            }
            event.response().end();
            event.response().close();
        });

        HttpServer server = vertx.createHttpServer().requestHandler(router::accept);

        server.listen(deployconfig.getHttpPort());
        initiated = true;
// Path: vertx-deploy-agent/src/main/java/nl/jpoint/vertx/deploy/agent/util/LogConstants.java
// public final class LogConstants {
//     public static final String ERROR_EXECUTING_REQUEST = "Error executing request {}.";
//     public static final String REQUEST_ALREADY_REGISTERED = "[{} - {}]: Request already registered.";
//     public static final String REQUEST_NOT_REGISTERED = "[{} - {}]: Request not registered.";
// 
// 
//     public static final String INVOKE_CONTAINER = "InvokeContainer";
//     public static final String CONSOLE_COMMAND = "ConsoleCommand";
//     public static final String CLUSTER_MANAGER = "ClusterManager";
//     public static final String DEPLOY_REQUEST = "DeployRequest";
//     public static final String DEPLOY_CONFIG_REQUEST = "DeployConfigRequest";
//     public static final String DEPLOY_ARTIFACT_REQUEST = "DeployArtifactRequest";
//     public static final String AWS_ELB_REQUEST = "ConfigureAwsElb";
//     public static final String AWS_AS_REQUEST = "ConfigureAwsAutoScaling";
//     public static final String STARTUP = "Startup";
// 
//     private LogConstants() {
//         // hide
//     }
// }


// Path: vertx-deploy-agent/src/main/java/nl/jpoint/vertx/deploy/agent/AwsDeployApplication.java
import io.netty.handler.codec.http.HttpResponseStatus;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.http.HttpServer;
import io.vertx.ext.web.Router;
import nl.jpoint.vertx.deploy.agent.handler.*;
import nl.jpoint.vertx.deploy.agent.service.*;
import nl.jpoint.vertx.deploy.agent.util.LogConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;


        if (deployconfig.isAwsEnabled()) {
            awsService = new AwsService(getVertx(), deployconfig);
            autoDiscoverDeployService = new AutoDiscoverDeployService(deployconfig, defaultDeployService, getVertx());
        }

        Router router = Router.router(getVertx());
        router.post("/deploy/deploy").handler(new RestDeployHandler(defaultDeployService, awsService, deployconfig.getAuthToken()));
        router.post("/deploy/module*").handler(new RestDeployModuleHandler(deployApplicationService));
        router.post("/deploy/artifact*").handler(new RestDeployArtifactHandler(deployArtifactService));
        router.get("/deploy/update*").handler(new StatusUpdateHandler(deployApplicationService));

        if (deployconfig.isAwsEnabled()) {
            router.get("/deploy/status/:id").handler(new RestDeployStatusHandler(awsService, deployApplicationService));
        }

        router.get("/status").handler(event -> {
            if (initiated) {
                event.response().setStatusCode(HttpResponseStatus.FORBIDDEN.code());
            } else {
                event.response().setStatusCode(HttpResponseStatus.INTERNAL_SERVER_ERROR.code());
            }
            event.response().end();
            event.response().close();
        });

        HttpServer server = vertx.createHttpServer().requestHandler(router::accept);

        server.listen(deployconfig.getHttpPort());
        initiated = true;
        LOG.info("{}: Instantiated module.", LogConstants.CLUSTER_MANAGER);