io.github.cdklabs.cdkecsserviceextensions.AutoScalingOptions Maven / Gradle / Ivy
Show all versions of cdk-ecs-service-extensions Show documentation
package io.github.cdklabs.cdkecsserviceextensions;
/**
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-27T00:29:46.227Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.cdkecsserviceextensions.$Module.class, fqn = "@aws-cdk-containers/ecs-service-extensions.AutoScalingOptions")
@software.amazon.jsii.Jsii.Proxy(AutoScalingOptions.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface AutoScalingOptions extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) The maximum number of tasks when scaling out.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.Number getMaxTaskCount();
/**
* (experimental) The minimum number of tasks when scaling in.
*
* Default: - 1
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getMinTaskCount() {
return null;
}
/**
* (experimental) The target value for CPU utilization across all tasks in the service.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getTargetCpuUtilization() {
return null;
}
/**
* (experimental) The target value for memory utilization across all tasks in the service.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getTargetMemoryUtilization() {
return null;
}
/**
* @return a {@link Builder} of {@link AutoScalingOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link AutoScalingOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.Number maxTaskCount;
java.lang.Number minTaskCount;
java.lang.Number targetCpuUtilization;
java.lang.Number targetMemoryUtilization;
/**
* Sets the value of {@link AutoScalingOptions#getMaxTaskCount}
* @param maxTaskCount The maximum number of tasks when scaling out. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder maxTaskCount(java.lang.Number maxTaskCount) {
this.maxTaskCount = maxTaskCount;
return this;
}
/**
* Sets the value of {@link AutoScalingOptions#getMinTaskCount}
* @param minTaskCount The minimum number of tasks when scaling in.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder minTaskCount(java.lang.Number minTaskCount) {
this.minTaskCount = minTaskCount;
return this;
}
/**
* Sets the value of {@link AutoScalingOptions#getTargetCpuUtilization}
* @param targetCpuUtilization The target value for CPU utilization across all tasks in the service.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder targetCpuUtilization(java.lang.Number targetCpuUtilization) {
this.targetCpuUtilization = targetCpuUtilization;
return this;
}
/**
* Sets the value of {@link AutoScalingOptions#getTargetMemoryUtilization}
* @param targetMemoryUtilization The target value for memory utilization across all tasks in the service.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder targetMemoryUtilization(java.lang.Number targetMemoryUtilization) {
this.targetMemoryUtilization = targetMemoryUtilization;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link AutoScalingOptions}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public AutoScalingOptions build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link AutoScalingOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements AutoScalingOptions {
private final java.lang.Number maxTaskCount;
private final java.lang.Number minTaskCount;
private final java.lang.Number targetCpuUtilization;
private final java.lang.Number targetMemoryUtilization;
/**
* Constructor that initializes the object based on values retrieved from the JsiiObject.
* @param objRef Reference to the JSII managed object.
*/
protected Jsii$Proxy(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
this.maxTaskCount = software.amazon.jsii.Kernel.get(this, "maxTaskCount", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.minTaskCount = software.amazon.jsii.Kernel.get(this, "minTaskCount", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.targetCpuUtilization = software.amazon.jsii.Kernel.get(this, "targetCpuUtilization", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.targetMemoryUtilization = software.amazon.jsii.Kernel.get(this, "targetMemoryUtilization", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.maxTaskCount = java.util.Objects.requireNonNull(builder.maxTaskCount, "maxTaskCount is required");
this.minTaskCount = builder.minTaskCount;
this.targetCpuUtilization = builder.targetCpuUtilization;
this.targetMemoryUtilization = builder.targetMemoryUtilization;
}
@Override
public final java.lang.Number getMaxTaskCount() {
return this.maxTaskCount;
}
@Override
public final java.lang.Number getMinTaskCount() {
return this.minTaskCount;
}
@Override
public final java.lang.Number getTargetCpuUtilization() {
return this.targetCpuUtilization;
}
@Override
public final java.lang.Number getTargetMemoryUtilization() {
return this.targetMemoryUtilization;
}
@Override
@software.amazon.jsii.Internal
public com.fasterxml.jackson.databind.JsonNode $jsii$toJson() {
final com.fasterxml.jackson.databind.ObjectMapper om = software.amazon.jsii.JsiiObjectMapper.INSTANCE;
final com.fasterxml.jackson.databind.node.ObjectNode data = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
data.set("maxTaskCount", om.valueToTree(this.getMaxTaskCount()));
if (this.getMinTaskCount() != null) {
data.set("minTaskCount", om.valueToTree(this.getMinTaskCount()));
}
if (this.getTargetCpuUtilization() != null) {
data.set("targetCpuUtilization", om.valueToTree(this.getTargetCpuUtilization()));
}
if (this.getTargetMemoryUtilization() != null) {
data.set("targetMemoryUtilization", om.valueToTree(this.getTargetMemoryUtilization()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk-containers/ecs-service-extensions.AutoScalingOptions"));
struct.set("data", data);
final com.fasterxml.jackson.databind.node.ObjectNode obj = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
obj.set("$jsii.struct", struct);
return obj;
}
@Override
public final boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
AutoScalingOptions.Jsii$Proxy that = (AutoScalingOptions.Jsii$Proxy) o;
if (!maxTaskCount.equals(that.maxTaskCount)) return false;
if (this.minTaskCount != null ? !this.minTaskCount.equals(that.minTaskCount) : that.minTaskCount != null) return false;
if (this.targetCpuUtilization != null ? !this.targetCpuUtilization.equals(that.targetCpuUtilization) : that.targetCpuUtilization != null) return false;
return this.targetMemoryUtilization != null ? this.targetMemoryUtilization.equals(that.targetMemoryUtilization) : that.targetMemoryUtilization == null;
}
@Override
public final int hashCode() {
int result = this.maxTaskCount.hashCode();
result = 31 * result + (this.minTaskCount != null ? this.minTaskCount.hashCode() : 0);
result = 31 * result + (this.targetCpuUtilization != null ? this.targetCpuUtilization.hashCode() : 0);
result = 31 * result + (this.targetMemoryUtilization != null ? this.targetMemoryUtilization.hashCode() : 0);
return result;
}
}
}