// Path: vertx-deploy-agent/src/main/java/nl/jpoint/vertx/deploy/agent/request/DeployState.java
// public enum DeployState {
//     WAITING_FOR_AS_DEREGISTER,
//     WAITING_FOR_ELB_DEREGISTER,
//     DEPLOYING_CONFIGS,
//     STOPPING_CONTAINER,
//     DEPLOYING_ARTIFACTS,
//     DEPLOYING_APPLICATIONS,
//     UNKNOWN,
//     FAILED,
//     SUCCESS,
//     CONTINUE,
//     WAITING_FOR_AS_REGISTER,
//     WAITING_FOR_ELB_REGISTER
// }


import com.amazonaws.util.StringUtils;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.netty.handler.codec.http.HttpResponseStatus;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.core.http.HttpServerResponse;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.RoutingContext;
import nl.jpoint.vertx.deploy.agent.request.DeployState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.List;
import java.util.Map;

    private static void respond(HttpServerResponse response, HttpResponseStatus code, JsonObject status) {
        response.setStatusCode(code.code());
        if (status != null) {
            response.end(status.encode());
        } else {
            response.end();
        }
    }

    public static void respondOk(HttpServerRequest request, JsonObject status) {
        respond(request.response(), HttpResponseStatus.OK, status);
    }

    public static void respondOk(HttpServerRequest request) {
        respondOk(request, null);
    }

    public static void respondFailed(HttpServerRequest request, JsonObject status) {
        respond(request.response(), HttpResponseStatus.INTERNAL_SERVER_ERROR, status);
    }

    public static void respondFailed(HttpServerRequest request) {
        respondFailed(request, null);
    }

    public static void respondBadRequest(HttpServerRequest request) {
        respond(request.response(), HttpResponseStatus.BAD_REQUEST, null);
    }

// Path: vertx-deploy-agent/src/main/java/nl/jpoint/vertx/deploy/agent/request/DeployState.java
// public enum DeployState {
//     WAITING_FOR_AS_DEREGISTER,
//     WAITING_FOR_ELB_DEREGISTER,
//     DEPLOYING_CONFIGS,
//     STOPPING_CONTAINER,
//     DEPLOYING_ARTIFACTS,
//     DEPLOYING_APPLICATIONS,
//     UNKNOWN,
//     FAILED,
//     SUCCESS,
//     CONTINUE,
//     WAITING_FOR_AS_REGISTER,
//     WAITING_FOR_ELB_REGISTER
// }


// Path: vertx-deploy-agent/src/main/java/nl/jpoint/vertx/deploy/agent/util/HttpUtils.java
import com.amazonaws.util.StringUtils;
import com.fasterxml.jackson.databind.ObjectMapper;
import io.netty.handler.codec.http.HttpResponseStatus;
import io.vertx.core.buffer.Buffer;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.core.http.HttpServerResponse;
import io.vertx.core.json.JsonArray;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.RoutingContext;
import nl.jpoint.vertx.deploy.agent.request.DeployState;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.List;
import java.util.Map;


    private static void respond(HttpServerResponse response, HttpResponseStatus code, JsonObject status) {
        response.setStatusCode(code.code());
        if (status != null) {
            response.end(status.encode());
        } else {
            response.end();
        }
    }

    public static void respondOk(HttpServerRequest request, JsonObject status) {
        respond(request.response(), HttpResponseStatus.OK, status);
    }

    public static void respondOk(HttpServerRequest request) {
        respondOk(request, null);
    }

    public static void respondFailed(HttpServerRequest request, JsonObject status) {
        respond(request.response(), HttpResponseStatus.INTERNAL_SERVER_ERROR, status);
    }

    public static void respondFailed(HttpServerRequest request) {
        respondFailed(request, null);
    }

    public static void respondBadRequest(HttpServerRequest request) {
        respond(request.response(), HttpResponseStatus.BAD_REQUEST, null);
    }

    public static void respondContinue(HttpServerRequest request, DeployState state) {