org.cloudfoundry.client.v2.applications.UpdateApplicationRequest Maven / Gradle / Ivy
package org.cloudfoundry.client.v2.applications;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.cloudfoundry.Nullable;
import org.immutables.value.Generated;
/**
* The request payload for the v2 Update Application request
*/
@Generated(from = "_UpdateApplicationRequest", generator = "Immutables")
@SuppressWarnings({"all", "deprecation", "removal"})
@javax.annotation.Generated("org.immutables.processor.ProxyProcessor")
public final class UpdateApplicationRequest
extends org.cloudfoundry.client.v2.applications._UpdateApplicationRequest {
private final String applicationId;
private final @Nullable String buildpack;
private final @Nullable String command;
private final @Nullable Boolean console;
private final @Nullable String debug;
private final @Nullable Boolean diego;
private final @Nullable Integer diskQuota;
private final @Nullable DockerCredentials dockerCredentials;
private final @Nullable String dockerImage;
private final @Nullable Boolean enableSsh;
private final @Nullable Map environmentJsons;
private final @Nullable String healthCheckHttpEndpoint;
private final @Nullable Integer healthCheckTimeout;
private final @Nullable String healthCheckType;
private final @Nullable Integer instances;
private final @Nullable Integer memory;
private final @Nullable String name;
private final @Nullable List ports;
private final @Nullable String production;
private final @Nullable String spaceId;
private final @Nullable String stackId;
private final @Nullable String state;
private UpdateApplicationRequest(UpdateApplicationRequest.Builder builder) {
this.applicationId = builder.applicationId;
this.buildpack = builder.buildpack;
this.command = builder.command;
this.console = builder.console;
this.debug = builder.debug;
this.diego = builder.diego;
this.diskQuota = builder.diskQuota;
this.dockerCredentials = builder.dockerCredentials;
this.dockerImage = builder.dockerImage;
this.enableSsh = builder.enableSsh;
this.environmentJsons = builder.environmentJsons == null ? null : createUnmodifiableMap(false, false, builder.environmentJsons);
this.healthCheckHttpEndpoint = builder.healthCheckHttpEndpoint;
this.healthCheckTimeout = builder.healthCheckTimeout;
this.healthCheckType = builder.healthCheckType;
this.instances = builder.instances;
this.memory = builder.memory;
this.name = builder.name;
this.ports = builder.ports == null ? null : createUnmodifiableList(true, builder.ports);
this.production = builder.production;
this.spaceId = builder.spaceId;
this.stackId = builder.stackId;
this.state = builder.state;
}
/**
* The application id
*/
@JsonProperty("applicationId")
@JsonIgnore
@Override
public String getApplicationId() {
return applicationId;
}
/**
* Buildpack to build the application
*/
@JsonProperty("buildpack")
@Override
public @Nullable String getBuildpack() {
return buildpack;
}
/**
* The command to start the application after it is staged
*/
@JsonProperty("command")
@Override
public @Nullable String getCommand() {
return command;
}
/**
* Open the console port for the application (at {@code $CONSOLE_PORT})
*/
@JsonProperty("console")
@Deprecated
@Override
public @Nullable Boolean getConsole() {
return console;
}
/**
* Open the debug port for the application (at {@code $DEBUG_PORT})
*/
@JsonProperty("debug")
@Deprecated
@Override
public @Nullable String getDebug() {
return debug;
}
/**
* Use diego to stage and to run when available
*/
@JsonProperty("diego")
@Override
public @Nullable Boolean getDiego() {
return diego;
}
/**
* The maximum amount of disk available to an instance of an application. In megabytes.
*/
@JsonProperty("disk_quota")
@Override
public @Nullable Integer getDiskQuota() {
return diskQuota;
}
/**
* Docker credentials for pulling docker image
*/
@JsonProperty("docker_credentials")
@Override
public @Nullable DockerCredentials getDockerCredentials() {
return dockerCredentials;
}
/**
* Name of the Docker image containing the application
*/
@JsonProperty("docker_image")
@Override
public @Nullable String getDockerImage() {
return dockerImage;
}
/**
* Enable SSH for the application
*/
@JsonProperty("enable_ssh")
@Override
public @Nullable Boolean getEnableSsh() {
return enableSsh;
}
/**
* Key/value pairs of all the environment variables to run in your application. Does not include any system or service variables.
*/
@JsonProperty("environment_json")
@Override
public @Nullable Map getEnvironmentJsons() {
return environmentJsons;
}
/**
* The HTTP endpoint to check for health
*/
@JsonProperty("health_check_http_endpoint")
@Override
public @Nullable String getHealthCheckHttpEndpoint() {
return healthCheckHttpEndpoint;
}
/**
* Timeout for health checking of an staged application when starting up
*/
@JsonProperty("health_check_timeout")
@Override
public @Nullable Integer getHealthCheckTimeout() {
return healthCheckTimeout;
}
/**
* Type of health check to perform
*/
@JsonProperty("health_check_type")
@Override
public @Nullable String getHealthCheckType() {
return healthCheckType;
}
/**
* The number of instances of the application to run. To ensure optimal availability, ensure there are at least 2 instances.
*/
@JsonProperty("instances")
@Override
public @Nullable Integer getInstances() {
return instances;
}
/**
* The amount of memory each instance should have. In megabytes.
*/
@JsonProperty("memory")
@Override
public @Nullable Integer getMemory() {
return memory;
}
/**
* The name of the application
*/
@JsonProperty("name")
@Override
public @Nullable String getName() {
return name;
}
/**
* The ports on which the application may listen
*/
@JsonProperty("ports")
@Override
public @Nullable List getPorts() {
return ports;
}
/**
* Whether the application is production
*/
@JsonProperty("production")
@Deprecated
@Override
public @Nullable String getProduction() {
return production;
}
/**
* The id of the associated space
*/
@JsonProperty("space_guid")
@Override
public @Nullable String getSpaceId() {
return spaceId;
}
/**
* The id of the associated stack
*/
@JsonProperty("stack_guid")
@Override
public @Nullable String getStackId() {
return stackId;
}
/**
* The current desired state of the application
*/
@JsonProperty("state")
@Override
public @Nullable String getState() {
return state;
}
/**
* This instance is equal to all instances of {@code UpdateApplicationRequest} that have equal attribute values.
* @return {@code true} if {@code this} is equal to {@code another} instance
*/
@Override
public boolean equals(Object another) {
if (this == another) return true;
return another instanceof UpdateApplicationRequest
&& equalTo(0, (UpdateApplicationRequest) another);
}
private boolean equalTo(int synthetic, UpdateApplicationRequest another) {
return applicationId.equals(another.applicationId)
&& Objects.equals(buildpack, another.buildpack)
&& Objects.equals(command, another.command)
&& Objects.equals(console, another.console)
&& Objects.equals(debug, another.debug)
&& Objects.equals(diego, another.diego)
&& Objects.equals(diskQuota, another.diskQuota)
&& Objects.equals(dockerCredentials, another.dockerCredentials)
&& Objects.equals(dockerImage, another.dockerImage)
&& Objects.equals(enableSsh, another.enableSsh)
&& Objects.equals(environmentJsons, another.environmentJsons)
&& Objects.equals(healthCheckHttpEndpoint, another.healthCheckHttpEndpoint)
&& Objects.equals(healthCheckTimeout, another.healthCheckTimeout)
&& Objects.equals(healthCheckType, another.healthCheckType)
&& Objects.equals(instances, another.instances)
&& Objects.equals(memory, another.memory)
&& Objects.equals(name, another.name)
&& Objects.equals(ports, another.ports)
&& Objects.equals(production, another.production)
&& Objects.equals(spaceId, another.spaceId)
&& Objects.equals(stackId, another.stackId)
&& Objects.equals(state, another.state);
}
/**
* Computes a hash code from attributes: {@code applicationId}, {@code buildpack}, {@code command}, {@code console}, {@code debug}, {@code diego}, {@code diskQuota}, {@code dockerCredentials}, {@code dockerImage}, {@code enableSsh}, {@code environmentJsons}, {@code healthCheckHttpEndpoint}, {@code healthCheckTimeout}, {@code healthCheckType}, {@code instances}, {@code memory}, {@code name}, {@code ports}, {@code production}, {@code spaceId}, {@code stackId}, {@code state}.
* @return hashCode value
*/
@Override
public int hashCode() {
int h = 5381;
h += (h << 5) + applicationId.hashCode();
h += (h << 5) + Objects.hashCode(buildpack);
h += (h << 5) + Objects.hashCode(command);
h += (h << 5) + Objects.hashCode(console);
h += (h << 5) + Objects.hashCode(debug);
h += (h << 5) + Objects.hashCode(diego);
h += (h << 5) + Objects.hashCode(diskQuota);
h += (h << 5) + Objects.hashCode(dockerCredentials);
h += (h << 5) + Objects.hashCode(dockerImage);
h += (h << 5) + Objects.hashCode(enableSsh);
h += (h << 5) + Objects.hashCode(environmentJsons);
h += (h << 5) + Objects.hashCode(healthCheckHttpEndpoint);
h += (h << 5) + Objects.hashCode(healthCheckTimeout);
h += (h << 5) + Objects.hashCode(healthCheckType);
h += (h << 5) + Objects.hashCode(instances);
h += (h << 5) + Objects.hashCode(memory);
h += (h << 5) + Objects.hashCode(name);
h += (h << 5) + Objects.hashCode(ports);
h += (h << 5) + Objects.hashCode(production);
h += (h << 5) + Objects.hashCode(spaceId);
h += (h << 5) + Objects.hashCode(stackId);
h += (h << 5) + Objects.hashCode(state);
return h;
}
/**
* Prints the immutable value {@code UpdateApplicationRequest} with attribute values.
* @return A string representation of the value
*/
@Override
public String toString() {
return "UpdateApplicationRequest{"
+ "applicationId=" + applicationId
+ ", buildpack=" + buildpack
+ ", command=" + command
+ ", console=" + console
+ ", debug=" + debug
+ ", diego=" + diego
+ ", diskQuota=" + diskQuota
+ ", dockerCredentials=" + dockerCredentials
+ ", dockerImage=" + dockerImage
+ ", enableSsh=" + enableSsh
+ ", environmentJsons=" + environmentJsons
+ ", healthCheckHttpEndpoint=" + healthCheckHttpEndpoint
+ ", healthCheckTimeout=" + healthCheckTimeout
+ ", healthCheckType=" + healthCheckType
+ ", instances=" + instances
+ ", memory=" + memory
+ ", name=" + name
+ ", ports=" + ports
+ ", production=" + production
+ ", spaceId=" + spaceId
+ ", stackId=" + stackId
+ ", state=" + state
+ "}";
}
/**
* Utility type used to correctly read immutable object from JSON representation.
* @deprecated Do not use this type directly, it exists only for the Jackson-binding infrastructure
*/
@Generated(from = "_UpdateApplicationRequest", generator = "Immutables")
@Deprecated
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.NONE)
static final class Json extends org.cloudfoundry.client.v2.applications._UpdateApplicationRequest {
String applicationId;
String buildpack;
String command;
Boolean console;
String debug;
Boolean diego;
Integer diskQuota;
DockerCredentials dockerCredentials;
String dockerImage;
Boolean enableSsh;
Map environmentJsons = null;
String healthCheckHttpEndpoint;
Integer healthCheckTimeout;
String healthCheckType;
Integer instances;
Integer memory;
String name;
List ports = null;
String production;
String spaceId;
String stackId;
String state;
@JsonProperty("applicationId")
@JsonIgnore
public void setApplicationId(String applicationId) {
this.applicationId = applicationId;
}
@JsonProperty("buildpack")
public void setBuildpack(@Nullable String buildpack) {
this.buildpack = buildpack;
}
@JsonProperty("command")
public void setCommand(@Nullable String command) {
this.command = command;
}
@JsonProperty("console")
public void setConsole(@Nullable Boolean console) {
this.console = console;
}
@JsonProperty("debug")
public void setDebug(@Nullable String debug) {
this.debug = debug;
}
@JsonProperty("diego")
public void setDiego(@Nullable Boolean diego) {
this.diego = diego;
}
@JsonProperty("disk_quota")
public void setDiskQuota(@Nullable Integer diskQuota) {
this.diskQuota = diskQuota;
}
@JsonProperty("docker_credentials")
public void setDockerCredentials(@Nullable DockerCredentials dockerCredentials) {
this.dockerCredentials = dockerCredentials;
}
@JsonProperty("docker_image")
public void setDockerImage(@Nullable String dockerImage) {
this.dockerImage = dockerImage;
}
@JsonProperty("enable_ssh")
public void setEnableSsh(@Nullable Boolean enableSsh) {
this.enableSsh = enableSsh;
}
@JsonProperty("environment_json")
public void setEnvironmentJsons(@Nullable Map environmentJsons) {
this.environmentJsons = environmentJsons;
}
@JsonProperty("health_check_http_endpoint")
public void setHealthCheckHttpEndpoint(@Nullable String healthCheckHttpEndpoint) {
this.healthCheckHttpEndpoint = healthCheckHttpEndpoint;
}
@JsonProperty("health_check_timeout")
public void setHealthCheckTimeout(@Nullable Integer healthCheckTimeout) {
this.healthCheckTimeout = healthCheckTimeout;
}
@JsonProperty("health_check_type")
public void setHealthCheckType(@Nullable String healthCheckType) {
this.healthCheckType = healthCheckType;
}
@JsonProperty("instances")
public void setInstances(@Nullable Integer instances) {
this.instances = instances;
}
@JsonProperty("memory")
public void setMemory(@Nullable Integer memory) {
this.memory = memory;
}
@JsonProperty("name")
public void setName(@Nullable String name) {
this.name = name;
}
@JsonProperty("ports")
public void setPorts(@Nullable List ports) {
this.ports = ports;
}
@JsonProperty("production")
public void setProduction(@Nullable String production) {
this.production = production;
}
@JsonProperty("space_guid")
public void setSpaceId(@Nullable String spaceId) {
this.spaceId = spaceId;
}
@JsonProperty("stack_guid")
public void setStackId(@Nullable String stackId) {
this.stackId = stackId;
}
@JsonProperty("state")
public void setState(@Nullable String state) {
this.state = state;
}
@Override
public String getApplicationId() { throw new UnsupportedOperationException(); }
@Override
public String getBuildpack() { throw new UnsupportedOperationException(); }
@Override
public String getCommand() { throw new UnsupportedOperationException(); }
@Override
public Boolean getConsole() { throw new UnsupportedOperationException(); }
@Override
public String getDebug() { throw new UnsupportedOperationException(); }
@Override
public Boolean getDiego() { throw new UnsupportedOperationException(); }
@Override
public Integer getDiskQuota() { throw new UnsupportedOperationException(); }
@Override
public DockerCredentials getDockerCredentials() { throw new UnsupportedOperationException(); }
@Override
public String getDockerImage() { throw new UnsupportedOperationException(); }
@Override
public Boolean getEnableSsh() { throw new UnsupportedOperationException(); }
@Override
public Map getEnvironmentJsons() { throw new UnsupportedOperationException(); }
@Override
public String getHealthCheckHttpEndpoint() { throw new UnsupportedOperationException(); }
@Override
public Integer getHealthCheckTimeout() { throw new UnsupportedOperationException(); }
@Override
public String getHealthCheckType() { throw new UnsupportedOperationException(); }
@Override
public Integer getInstances() { throw new UnsupportedOperationException(); }
@Override
public Integer getMemory() { throw new UnsupportedOperationException(); }
@Override
public String getName() { throw new UnsupportedOperationException(); }
@Override
public List getPorts() { throw new UnsupportedOperationException(); }
@Override
public String getProduction() { throw new UnsupportedOperationException(); }
@Override
public String getSpaceId() { throw new UnsupportedOperationException(); }
@Override
public String getStackId() { throw new UnsupportedOperationException(); }
@Override
public String getState() { throw new UnsupportedOperationException(); }
}
/**
* @param json A JSON-bindable data structure
* @return An immutable value type
* @deprecated Do not use this method directly, it exists only for the Jackson-binding infrastructure
*/
@Deprecated
@JsonCreator(mode = JsonCreator.Mode.DELEGATING)
static UpdateApplicationRequest fromJson(Json json) {
UpdateApplicationRequest.Builder builder = UpdateApplicationRequest.builder();
if (json.applicationId != null) {
builder.applicationId(json.applicationId);
}
if (json.buildpack != null) {
builder.buildpack(json.buildpack);
}
if (json.command != null) {
builder.command(json.command);
}
if (json.console != null) {
builder.console(json.console);
}
if (json.debug != null) {
builder.debug(json.debug);
}
if (json.diego != null) {
builder.diego(json.diego);
}
if (json.diskQuota != null) {
builder.diskQuota(json.diskQuota);
}
if (json.dockerCredentials != null) {
builder.dockerCredentials(json.dockerCredentials);
}
if (json.dockerImage != null) {
builder.dockerImage(json.dockerImage);
}
if (json.enableSsh != null) {
builder.enableSsh(json.enableSsh);
}
if (json.environmentJsons != null) {
builder.putAllEnvironmentJsons(json.environmentJsons);
}
if (json.healthCheckHttpEndpoint != null) {
builder.healthCheckHttpEndpoint(json.healthCheckHttpEndpoint);
}
if (json.healthCheckTimeout != null) {
builder.healthCheckTimeout(json.healthCheckTimeout);
}
if (json.healthCheckType != null) {
builder.healthCheckType(json.healthCheckType);
}
if (json.instances != null) {
builder.instances(json.instances);
}
if (json.memory != null) {
builder.memory(json.memory);
}
if (json.name != null) {
builder.name(json.name);
}
if (json.ports != null) {
builder.addAllPorts(json.ports);
}
if (json.production != null) {
builder.production(json.production);
}
if (json.spaceId != null) {
builder.spaceId(json.spaceId);
}
if (json.stackId != null) {
builder.stackId(json.stackId);
}
if (json.state != null) {
builder.state(json.state);
}
return builder.build();
}
/**
* Creates a builder for {@link UpdateApplicationRequest UpdateApplicationRequest}.
*
* UpdateApplicationRequest.builder()
* .applicationId(String) // required {@link UpdateApplicationRequest#getApplicationId() applicationId}
* .buildpack(String | null) // nullable {@link UpdateApplicationRequest#getBuildpack() buildpack}
* .command(String | null) // nullable {@link UpdateApplicationRequest#getCommand() command}
* .console(Boolean | null) // nullable {@link UpdateApplicationRequest#getConsole() console}
* .debug(String | null) // nullable {@link UpdateApplicationRequest#getDebug() debug}
* .diego(Boolean | null) // nullable {@link UpdateApplicationRequest#getDiego() diego}
* .diskQuota(Integer | null) // nullable {@link UpdateApplicationRequest#getDiskQuota() diskQuota}
* .dockerCredentials(org.cloudfoundry.client.v2.applications.DockerCredentials | null) // nullable {@link UpdateApplicationRequest#getDockerCredentials() dockerCredentials}
* .dockerImage(String | null) // nullable {@link UpdateApplicationRequest#getDockerImage() dockerImage}
* .enableSsh(Boolean | null) // nullable {@link UpdateApplicationRequest#getEnableSsh() enableSsh}
* .environmentJsons(Map<String, Object> | null) // nullable {@link UpdateApplicationRequest#getEnvironmentJsons() environmentJsons}
* .healthCheckHttpEndpoint(String | null) // nullable {@link UpdateApplicationRequest#getHealthCheckHttpEndpoint() healthCheckHttpEndpoint}
* .healthCheckTimeout(Integer | null) // nullable {@link UpdateApplicationRequest#getHealthCheckTimeout() healthCheckTimeout}
* .healthCheckType(String | null) // nullable {@link UpdateApplicationRequest#getHealthCheckType() healthCheckType}
* .instances(Integer | null) // nullable {@link UpdateApplicationRequest#getInstances() instances}
* .memory(Integer | null) // nullable {@link UpdateApplicationRequest#getMemory() memory}
* .name(String | null) // nullable {@link UpdateApplicationRequest#getName() name}
* .ports(List<Integer> | null) // nullable {@link UpdateApplicationRequest#getPorts() ports}
* .production(String | null) // nullable {@link UpdateApplicationRequest#getProduction() production}
* .spaceId(String | null) // nullable {@link UpdateApplicationRequest#getSpaceId() spaceId}
* .stackId(String | null) // nullable {@link UpdateApplicationRequest#getStackId() stackId}
* .state(String | null) // nullable {@link UpdateApplicationRequest#getState() state}
* .build();
*
* @return A new UpdateApplicationRequest builder
*/
public static UpdateApplicationRequest.Builder builder() {
return new UpdateApplicationRequest.Builder();
}
/**
* Builds instances of type {@link UpdateApplicationRequest UpdateApplicationRequest}.
* Initialize attributes and then invoke the {@link #build()} method to create an
* immutable instance.
* {@code Builder} is not thread-safe and generally should not be stored in a field or collection,
* but instead used immediately to create instances.
*/
@Generated(from = "_UpdateApplicationRequest", generator = "Immutables")
public static final class Builder {
private static final long INIT_BIT_APPLICATION_ID = 0x1L;
private long initBits = 0x1L;
private String applicationId;
private String buildpack;
private String command;
private Boolean console;
private String debug;
private Boolean diego;
private Integer diskQuota;
private DockerCredentials dockerCredentials;
private String dockerImage;
private Boolean enableSsh;
private Map environmentJsons = null;
private String healthCheckHttpEndpoint;
private Integer healthCheckTimeout;
private String healthCheckType;
private Integer instances;
private Integer memory;
private String name;
private List ports = null;
private String production;
private String spaceId;
private String stackId;
private String state;
private Builder() {
}
/**
* Fill a builder with attribute values from the provided {@code UpdateApplicationRequest} instance.
* Regular attribute values will be replaced with those from the given instance.
* Absent optional values will not replace present values.
* Collection elements and entries will be added, not replaced.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
public final Builder from(UpdateApplicationRequest instance) {
return from((_UpdateApplicationRequest) instance);
}
/**
* Copy abstract value type {@code _UpdateApplicationRequest} instance into builder.
* @param instance The instance from which to copy values
* @return {@code this} builder for use in a chained invocation
*/
final Builder from(_UpdateApplicationRequest instance) {
Objects.requireNonNull(instance, "instance");
applicationId(instance.getApplicationId());
String buildpackValue = instance.getBuildpack();
if (buildpackValue != null) {
buildpack(buildpackValue);
}
String commandValue = instance.getCommand();
if (commandValue != null) {
command(commandValue);
}
Boolean consoleValue = instance.getConsole();
if (consoleValue != null) {
console(consoleValue);
}
String debugValue = instance.getDebug();
if (debugValue != null) {
debug(debugValue);
}
Boolean diegoValue = instance.getDiego();
if (diegoValue != null) {
diego(diegoValue);
}
Integer diskQuotaValue = instance.getDiskQuota();
if (diskQuotaValue != null) {
diskQuota(diskQuotaValue);
}
DockerCredentials dockerCredentialsValue = instance.getDockerCredentials();
if (dockerCredentialsValue != null) {
dockerCredentials(dockerCredentialsValue);
}
String dockerImageValue = instance.getDockerImage();
if (dockerImageValue != null) {
dockerImage(dockerImageValue);
}
Boolean enableSshValue = instance.getEnableSsh();
if (enableSshValue != null) {
enableSsh(enableSshValue);
}
Map environmentJsonsValue = instance.getEnvironmentJsons();
if (environmentJsonsValue != null) {
putAllEnvironmentJsons(environmentJsonsValue);
}
String healthCheckHttpEndpointValue = instance.getHealthCheckHttpEndpoint();
if (healthCheckHttpEndpointValue != null) {
healthCheckHttpEndpoint(healthCheckHttpEndpointValue);
}
Integer healthCheckTimeoutValue = instance.getHealthCheckTimeout();
if (healthCheckTimeoutValue != null) {
healthCheckTimeout(healthCheckTimeoutValue);
}
String healthCheckTypeValue = instance.getHealthCheckType();
if (healthCheckTypeValue != null) {
healthCheckType(healthCheckTypeValue);
}
Integer instancesValue = instance.getInstances();
if (instancesValue != null) {
instances(instancesValue);
}
Integer memoryValue = instance.getMemory();
if (memoryValue != null) {
memory(memoryValue);
}
String nameValue = instance.getName();
if (nameValue != null) {
name(nameValue);
}
List portsValue = instance.getPorts();
if (portsValue != null) {
addAllPorts(portsValue);
}
String productionValue = instance.getProduction();
if (productionValue != null) {
production(productionValue);
}
String spaceIdValue = instance.getSpaceId();
if (spaceIdValue != null) {
spaceId(spaceIdValue);
}
String stackIdValue = instance.getStackId();
if (stackIdValue != null) {
stackId(stackIdValue);
}
String stateValue = instance.getState();
if (stateValue != null) {
state(stateValue);
}
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getApplicationId() applicationId} attribute.
* @param applicationId The value for applicationId
* @return {@code this} builder for use in a chained invocation
*/
public final Builder applicationId(String applicationId) {
this.applicationId = Objects.requireNonNull(applicationId, "applicationId");
initBits &= ~INIT_BIT_APPLICATION_ID;
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getBuildpack() buildpack} attribute.
* @param buildpack The value for buildpack (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder buildpack(@Nullable String buildpack) {
this.buildpack = buildpack;
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getCommand() command} attribute.
* @param command The value for command (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder command(@Nullable String command) {
this.command = command;
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getConsole() console} attribute.
* @param console The value for console (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@Deprecated
public final Builder console(@Nullable Boolean console) {
this.console = console;
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getDebug() debug} attribute.
* @param debug The value for debug (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@Deprecated
public final Builder debug(@Nullable String debug) {
this.debug = debug;
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getDiego() diego} attribute.
* @param diego The value for diego (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder diego(@Nullable Boolean diego) {
this.diego = diego;
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getDiskQuota() diskQuota} attribute.
* @param diskQuota The value for diskQuota (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder diskQuota(@Nullable Integer diskQuota) {
this.diskQuota = diskQuota;
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getDockerCredentials() dockerCredentials} attribute.
* @param dockerCredentials The value for dockerCredentials (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder dockerCredentials(@Nullable DockerCredentials dockerCredentials) {
this.dockerCredentials = dockerCredentials;
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getDockerImage() dockerImage} attribute.
* @param dockerImage The value for dockerImage (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder dockerImage(@Nullable String dockerImage) {
this.dockerImage = dockerImage;
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getEnableSsh() enableSsh} attribute.
* @param enableSsh The value for enableSsh (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder enableSsh(@Nullable Boolean enableSsh) {
this.enableSsh = enableSsh;
return this;
}
/**
* Put one entry to the {@link UpdateApplicationRequest#getEnvironmentJsons() environmentJsons} map.
* @param key The key in the environmentJsons map
* @param value The associated value in the environmentJsons map
* @return {@code this} builder for use in a chained invocation
*/
public final Builder environmentJson(String key, Object value) {
if (this.environmentJsons == null) {
this.environmentJsons = new LinkedHashMap();
}
this.environmentJsons.put(key, value);
return this;
}
/**
* Put one entry to the {@link UpdateApplicationRequest#getEnvironmentJsons() environmentJsons} map. Nulls are not permitted
* @param entry The key and value entry
* @return {@code this} builder for use in a chained invocation
*/
public final Builder environmentJson(Map.Entry entry) {
if (this.environmentJsons == null) {
this.environmentJsons = new LinkedHashMap();
}
String k = entry.getKey();
Object v = entry.getValue();
this.environmentJsons.put(k, v);
return this;
}
/**
* Sets or replaces all mappings from the specified map as entries for the {@link UpdateApplicationRequest#getEnvironmentJsons() environmentJsons} map. Nulls are not permitted as keys or values, but parameter itself can be null
* @param entries The entries that will be added to the environmentJsons map
* @return {@code this} builder for use in a chained invocation
*/
public final Builder environmentJsons(@Nullable Map entries) {
if (entries == null) {
this.environmentJsons = null;
return this;
}
this.environmentJsons = new LinkedHashMap();
return putAllEnvironmentJsons(entries);
}
/**
* Put all mappings from the specified map as entries to {@link UpdateApplicationRequest#getEnvironmentJsons() environmentJsons} map. Nulls are not permitted
* @param entries The entries that will be added to the environmentJsons map
* @return {@code this} builder for use in a chained invocation
*/
public final Builder putAllEnvironmentJsons(Map entries) {
if (this.environmentJsons == null) {
this.environmentJsons = new LinkedHashMap();
}
for (Map.Entry e : entries.entrySet()) {
String k = e.getKey();
Object v = e.getValue();
this.environmentJsons.put(k, v);
}
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getHealthCheckHttpEndpoint() healthCheckHttpEndpoint} attribute.
* @param healthCheckHttpEndpoint The value for healthCheckHttpEndpoint (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder healthCheckHttpEndpoint(@Nullable String healthCheckHttpEndpoint) {
this.healthCheckHttpEndpoint = healthCheckHttpEndpoint;
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getHealthCheckTimeout() healthCheckTimeout} attribute.
* @param healthCheckTimeout The value for healthCheckTimeout (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder healthCheckTimeout(@Nullable Integer healthCheckTimeout) {
this.healthCheckTimeout = healthCheckTimeout;
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getHealthCheckType() healthCheckType} attribute.
* @param healthCheckType The value for healthCheckType (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder healthCheckType(@Nullable String healthCheckType) {
this.healthCheckType = healthCheckType;
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getInstances() instances} attribute.
* @param instances The value for instances (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder instances(@Nullable Integer instances) {
this.instances = instances;
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getMemory() memory} attribute.
* @param memory The value for memory (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder memory(@Nullable Integer memory) {
this.memory = memory;
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getName() name} attribute.
* @param name The value for name (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder name(@Nullable String name) {
this.name = name;
return this;
}
/**
* Adds one element to {@link UpdateApplicationRequest#getPorts() ports} list.
* @param element A ports element
* @return {@code this} builder for use in a chained invocation
*/
public final Builder port(int element) {
if (this.ports == null) {
this.ports = new ArrayList();
}
this.ports.add(element);
return this;
}
/**
* Adds elements to {@link UpdateApplicationRequest#getPorts() ports} list.
* @param elements An array of ports elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder ports(int... elements) {
if (this.ports == null) {
this.ports = new ArrayList();
}
for (int element : elements) {
this.ports.add(element);
}
return this;
}
/**
* Sets or replaces all elements for {@link UpdateApplicationRequest#getPorts() ports} list.
* @param elements An iterable of ports elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder ports(@Nullable Iterable elements) {
if (elements == null) {
this.ports = null;
return this;
}
this.ports = new ArrayList();
return addAllPorts(elements);
}
/**
* Adds elements to {@link UpdateApplicationRequest#getPorts() ports} list.
* @param elements An iterable of ports elements
* @return {@code this} builder for use in a chained invocation
*/
public final Builder addAllPorts(Iterable elements) {
Objects.requireNonNull(elements, "ports element");
if (this.ports == null) {
this.ports = new ArrayList();
}
for (Integer element : elements) {
this.ports.add(Objects.requireNonNull(element, "ports element"));
}
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getProduction() production} attribute.
* @param production The value for production (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
@Deprecated
public final Builder production(@Nullable String production) {
this.production = production;
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getSpaceId() spaceId} attribute.
* @param spaceId The value for spaceId (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder spaceId(@Nullable String spaceId) {
this.spaceId = spaceId;
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getStackId() stackId} attribute.
* @param stackId The value for stackId (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder stackId(@Nullable String stackId) {
this.stackId = stackId;
return this;
}
/**
* Initializes the value for the {@link UpdateApplicationRequest#getState() state} attribute.
* @param state The value for state (can be {@code null})
* @return {@code this} builder for use in a chained invocation
*/
public final Builder state(@Nullable String state) {
this.state = state;
return this;
}
/**
* Builds a new {@link UpdateApplicationRequest UpdateApplicationRequest}.
* @return An immutable instance of UpdateApplicationRequest
* @throws java.lang.IllegalStateException if any required attributes are missing
*/
public UpdateApplicationRequest build() {
if (initBits != 0) {
throw new IllegalStateException(formatRequiredAttributesMessage());
}
return new UpdateApplicationRequest(this);
}
private String formatRequiredAttributesMessage() {
List attributes = new ArrayList<>();
if ((initBits & INIT_BIT_APPLICATION_ID) != 0) attributes.add("applicationId");
return "Cannot build UpdateApplicationRequest, some of required attributes are not set " + attributes;
}
}
private static List createSafeList(Iterable extends T> iterable, boolean checkNulls, boolean skipNulls) {
ArrayList list;
if (iterable instanceof Collection>) {
int size = ((Collection>) iterable).size();
if (size == 0) return Collections.emptyList();
list = new ArrayList<>(size);
} else {
list = new ArrayList<>();
}
for (T element : iterable) {
if (skipNulls && element == null) continue;
if (checkNulls) Objects.requireNonNull(element, "element");
list.add(element);
}
return list;
}
private static List createUnmodifiableList(boolean clone, List list) {
switch(list.size()) {
case 0: return Collections.emptyList();
case 1: return Collections.singletonList(list.get(0));
default:
if (clone) {
return Collections.unmodifiableList(new ArrayList<>(list));
} else {
if (list instanceof ArrayList>) {
((ArrayList>) list).trimToSize();
}
return Collections.unmodifiableList(list);
}
}
}
private static Map createUnmodifiableMap(boolean checkNulls, boolean skipNulls, Map extends K, ? extends V> map) {
switch (map.size()) {
case 0: return Collections.emptyMap();
case 1: {
Map.Entry extends K, ? extends V> e = map.entrySet().iterator().next();
K k = e.getKey();
V v = e.getValue();
if (checkNulls) {
Objects.requireNonNull(k, "key");
Objects.requireNonNull(v, v == null ? "value for key: " + k : null);
}
if (skipNulls && (k == null || v == null)) {
return Collections.emptyMap();
}
return Collections.singletonMap(k, v);
}
default: {
Map linkedMap = new LinkedHashMap<>(map.size() * 4 / 3 + 1);
if (skipNulls || checkNulls) {
for (Map.Entry extends K, ? extends V> e : map.entrySet()) {
K k = e.getKey();
V v = e.getValue();
if (skipNulls) {
if (k == null || v == null) continue;
} else if (checkNulls) {
Objects.requireNonNull(k, "key");
Objects.requireNonNull(v, v == null ? "value for key: " + k : null);
}
linkedMap.put(k, v);
}
} else {
linkedMap.putAll(map);
}
return Collections.unmodifiableMap(linkedMap);
}
}
}
}