package nl.jpoint.vertx.mod.cluster.request;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;
import java.util.UUID;

@JsonIgnoreProperties(ignoreUnknown = true)
public class DeployRequest {
    private final UUID id = UUID.randomUUID();
    private final List<DeployModuleRequest> modules;
    private final List<DeployConfigRequest> configs;
    private final List<DeployArtifactRequest> artifacts;
    private final boolean elb;
    private final boolean autoScaling;
    private final boolean decrementDesiredCapacity;
    private final String autoScalingGroup;

    private final String instanceId;
    private final boolean restart;
    private DeployState state;

    @JsonCreator
    public DeployRequest(@JsonProperty("modules") List<DeployModuleRequest> modules,
                         @JsonProperty("artifacts") List<DeployArtifactRequest> artifacts,
                         @JsonProperty("configs") List<DeployConfigRequest> configs,
                         @JsonProperty("with_elb") boolean elb,
                         @JsonProperty("with_as") boolean autoScaling,
                         @JsonProperty("as_decrement_desired_capacity") boolean decrementDesiredCapacity,
                         @JsonProperty("as_group_id") String autoScalingGroup,
                         @JsonProperty("instance_id") String instanceId,
                         @JsonProperty("restart") boolean restart) {
        this.modules = modules;
        this.artifacts = artifacts;
        this.configs = configs;
        this.elb = elb;
        this.autoScaling = autoScaling;
        this.decrementDesiredCapacity = decrementDesiredCapacity;
        this.autoScalingGroup = autoScalingGroup;
        this.instanceId = instanceId;
        this.restart = restart;
    }

    public List<DeployArtifactRequest> getArtifacts() {
        return artifacts;
    }

    public List<DeployModuleRequest> getModules() {
        return modules;
    }

    public List<DeployConfigRequest> getConfigs() {
        return configs;
    }

    public UUID getId() {
        return id;
    }

    public String getAutoScalingGroup() {
        return autoScalingGroup;
    }

    public String getInstanceId() {
        return instanceId;
    }

    public boolean withElb() {
        return elb;
    }

    public boolean withAutoScaling() {
        return elb && autoScaling;
    }

    public boolean withRestart() {
        return restart;
    }

    public void setState(DeployState state) {
        this.state = state;
    }

    public DeployState getState() {
        return this.state;
    }

    public boolean isDecrementDesiredCapacity() {
        return decrementDesiredCapacity;
    }
}

@@ -613,38 +613,32 @@
 ng;%0A    private 
-final 
 boolean decremen
@@ -649,24 +649,31 @@
 iredCapacity
+ = true
 ;%0A    privat
@@ -1227,114 +1227,8 @@
 ng,%0A
-                         @JsonProperty(%22as_decrement_desired_capacity%22) boolean decrementDesiredCapacity,%0A
     
@@ -1612,74 +1612,8 @@
 ng;%0A
-        this.decrementDesiredCapacity = decrementDesiredCapacity;%0A
     
@@ -2596,24 +2596,24 @@
 apacity() %7B%0A
-
         retu
@@ -2646,11 +2646,215 @@
 y;%0A    %7D
+%0A%0A    @JsonProperty(%22as_decrement_desired_capacity%22)%0A    public void setDecrementDesiredCapacity(boolean decrementDesiredCapacity) %7B%0A        this.decrementDesiredCapacity = decrementDesiredCapacity;%0A    %7D
 %0A%7D%0A

Make sure decrementDesiredCapacity defaults to true if its missing in json request (cherry picked from commit ebeef76)