io.github.cdklabs.cdkecsserviceextensions.ServiceBuild Maven / Gradle / Ivy
Show all versions of cdk-ecs-service-extensions Show documentation
package io.github.cdklabs.cdkecsserviceextensions;
/**
* (experimental) A set of mutable service props in the process of being assembled using a builder pattern.
*
* They will eventually to be translated into an
* ecs.Ec2ServiceProps or ecs.FargateServiceProps interface, depending on the
* environment's capacity type.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-25T00:29:02.318Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.cdkecsserviceextensions.$Module.class, fqn = "@aws-cdk-containers/ecs-service-extensions.ServiceBuild")
@software.amazon.jsii.Jsii.Proxy(ServiceBuild.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface ServiceBuild extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) The cluster in which to launch the service.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.ICluster getCluster();
/**
* (experimental) The task definition registered to this service.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.TaskDefinition getTaskDefinition();
/**
* (experimental) Specifies whether the task's elastic network interface receives a public IP address.
*
* If true, each task will receive a public IP address.
*
* Default: - false
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getAssignPublicIp() {
return null;
}
/**
* (experimental) Configuration for how to register the service in service discovery.
*
* Default: - No Cloud Map configured
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ecs.CloudMapOptions getCloudMapOptions() {
return null;
}
/**
* (experimental) How many tasks to run.
*
* Default: - 1
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getDesiredCount() {
return null;
}
/**
* (experimental) How long the healthcheck can fail during initial task startup before the task is considered unhealthy.
*
* This is used to give the task more
* time to start passing healthchecks.
*
* Default: - No grace period
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.Duration getHealthCheckGracePeriod() {
return null;
}
/**
* (experimental) Maximum percentage of tasks that can be launched.
*
* Default: - 200
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getMaxHealthyPercent() {
return null;
}
/**
* (experimental) Minimum healthy task percentage.
*
* Default: - 100
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getMinHealthyPercent() {
return null;
}
/**
* (experimental) Configuration for service connect for this service.
*
* Default: - No Service Connect configured.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ecs.ServiceConnectProps getServiceConnectConfiguration() {
return null;
}
/**
* @return a {@link Builder} of {@link ServiceBuild}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link ServiceBuild}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
software.amazon.awscdk.services.ecs.ICluster cluster;
software.amazon.awscdk.services.ecs.TaskDefinition taskDefinition;
java.lang.Boolean assignPublicIp;
software.amazon.awscdk.services.ecs.CloudMapOptions cloudMapOptions;
java.lang.Number desiredCount;
software.amazon.awscdk.Duration healthCheckGracePeriod;
java.lang.Number maxHealthyPercent;
java.lang.Number minHealthyPercent;
software.amazon.awscdk.services.ecs.ServiceConnectProps serviceConnectConfiguration;
/**
* Sets the value of {@link ServiceBuild#getCluster}
* @param cluster The cluster in which to launch the service. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder cluster(software.amazon.awscdk.services.ecs.ICluster cluster) {
this.cluster = cluster;
return this;
}
/**
* Sets the value of {@link ServiceBuild#getTaskDefinition}
* @param taskDefinition The task definition registered to this service. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder taskDefinition(software.amazon.awscdk.services.ecs.TaskDefinition taskDefinition) {
this.taskDefinition = taskDefinition;
return this;
}
/**
* Sets the value of {@link ServiceBuild#getAssignPublicIp}
* @param assignPublicIp Specifies whether the task's elastic network interface receives a public IP address.
* If true, each task will receive a public IP address.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder assignPublicIp(java.lang.Boolean assignPublicIp) {
this.assignPublicIp = assignPublicIp;
return this;
}
/**
* Sets the value of {@link ServiceBuild#getCloudMapOptions}
* @param cloudMapOptions Configuration for how to register the service in service discovery.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder cloudMapOptions(software.amazon.awscdk.services.ecs.CloudMapOptions cloudMapOptions) {
this.cloudMapOptions = cloudMapOptions;
return this;
}
/**
* Sets the value of {@link ServiceBuild#getDesiredCount}
* @param desiredCount How many tasks to run.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder desiredCount(java.lang.Number desiredCount) {
this.desiredCount = desiredCount;
return this;
}
/**
* Sets the value of {@link ServiceBuild#getHealthCheckGracePeriod}
* @param healthCheckGracePeriod How long the healthcheck can fail during initial task startup before the task is considered unhealthy.
* This is used to give the task more
* time to start passing healthchecks.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder healthCheckGracePeriod(software.amazon.awscdk.Duration healthCheckGracePeriod) {
this.healthCheckGracePeriod = healthCheckGracePeriod;
return this;
}
/**
* Sets the value of {@link ServiceBuild#getMaxHealthyPercent}
* @param maxHealthyPercent Maximum percentage of tasks that can be launched.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder maxHealthyPercent(java.lang.Number maxHealthyPercent) {
this.maxHealthyPercent = maxHealthyPercent;
return this;
}
/**
* Sets the value of {@link ServiceBuild#getMinHealthyPercent}
* @param minHealthyPercent Minimum healthy task percentage.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder minHealthyPercent(java.lang.Number minHealthyPercent) {
this.minHealthyPercent = minHealthyPercent;
return this;
}
/**
* Sets the value of {@link ServiceBuild#getServiceConnectConfiguration}
* @param serviceConnectConfiguration Configuration for service connect for this service.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder serviceConnectConfiguration(software.amazon.awscdk.services.ecs.ServiceConnectProps serviceConnectConfiguration) {
this.serviceConnectConfiguration = serviceConnectConfiguration;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link ServiceBuild}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public ServiceBuild build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link ServiceBuild}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements ServiceBuild {
private final software.amazon.awscdk.services.ecs.ICluster cluster;
private final software.amazon.awscdk.services.ecs.TaskDefinition taskDefinition;
private final java.lang.Boolean assignPublicIp;
private final software.amazon.awscdk.services.ecs.CloudMapOptions cloudMapOptions;
private final java.lang.Number desiredCount;
private final software.amazon.awscdk.Duration healthCheckGracePeriod;
private final java.lang.Number maxHealthyPercent;
private final java.lang.Number minHealthyPercent;
private final software.amazon.awscdk.services.ecs.ServiceConnectProps serviceConnectConfiguration;
/**
* 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.cluster = software.amazon.jsii.Kernel.get(this, "cluster", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.ICluster.class));
this.taskDefinition = software.amazon.jsii.Kernel.get(this, "taskDefinition", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.TaskDefinition.class));
this.assignPublicIp = software.amazon.jsii.Kernel.get(this, "assignPublicIp", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.cloudMapOptions = software.amazon.jsii.Kernel.get(this, "cloudMapOptions", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.CloudMapOptions.class));
this.desiredCount = software.amazon.jsii.Kernel.get(this, "desiredCount", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.healthCheckGracePeriod = software.amazon.jsii.Kernel.get(this, "healthCheckGracePeriod", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.Duration.class));
this.maxHealthyPercent = software.amazon.jsii.Kernel.get(this, "maxHealthyPercent", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.minHealthyPercent = software.amazon.jsii.Kernel.get(this, "minHealthyPercent", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.serviceConnectConfiguration = software.amazon.jsii.Kernel.get(this, "serviceConnectConfiguration", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.ServiceConnectProps.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.cluster = java.util.Objects.requireNonNull(builder.cluster, "cluster is required");
this.taskDefinition = java.util.Objects.requireNonNull(builder.taskDefinition, "taskDefinition is required");
this.assignPublicIp = builder.assignPublicIp;
this.cloudMapOptions = builder.cloudMapOptions;
this.desiredCount = builder.desiredCount;
this.healthCheckGracePeriod = builder.healthCheckGracePeriod;
this.maxHealthyPercent = builder.maxHealthyPercent;
this.minHealthyPercent = builder.minHealthyPercent;
this.serviceConnectConfiguration = builder.serviceConnectConfiguration;
}
@Override
public final software.amazon.awscdk.services.ecs.ICluster getCluster() {
return this.cluster;
}
@Override
public final software.amazon.awscdk.services.ecs.TaskDefinition getTaskDefinition() {
return this.taskDefinition;
}
@Override
public final java.lang.Boolean getAssignPublicIp() {
return this.assignPublicIp;
}
@Override
public final software.amazon.awscdk.services.ecs.CloudMapOptions getCloudMapOptions() {
return this.cloudMapOptions;
}
@Override
public final java.lang.Number getDesiredCount() {
return this.desiredCount;
}
@Override
public final software.amazon.awscdk.Duration getHealthCheckGracePeriod() {
return this.healthCheckGracePeriod;
}
@Override
public final java.lang.Number getMaxHealthyPercent() {
return this.maxHealthyPercent;
}
@Override
public final java.lang.Number getMinHealthyPercent() {
return this.minHealthyPercent;
}
@Override
public final software.amazon.awscdk.services.ecs.ServiceConnectProps getServiceConnectConfiguration() {
return this.serviceConnectConfiguration;
}
@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("cluster", om.valueToTree(this.getCluster()));
data.set("taskDefinition", om.valueToTree(this.getTaskDefinition()));
if (this.getAssignPublicIp() != null) {
data.set("assignPublicIp", om.valueToTree(this.getAssignPublicIp()));
}
if (this.getCloudMapOptions() != null) {
data.set("cloudMapOptions", om.valueToTree(this.getCloudMapOptions()));
}
if (this.getDesiredCount() != null) {
data.set("desiredCount", om.valueToTree(this.getDesiredCount()));
}
if (this.getHealthCheckGracePeriod() != null) {
data.set("healthCheckGracePeriod", om.valueToTree(this.getHealthCheckGracePeriod()));
}
if (this.getMaxHealthyPercent() != null) {
data.set("maxHealthyPercent", om.valueToTree(this.getMaxHealthyPercent()));
}
if (this.getMinHealthyPercent() != null) {
data.set("minHealthyPercent", om.valueToTree(this.getMinHealthyPercent()));
}
if (this.getServiceConnectConfiguration() != null) {
data.set("serviceConnectConfiguration", om.valueToTree(this.getServiceConnectConfiguration()));
}
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.ServiceBuild"));
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;
ServiceBuild.Jsii$Proxy that = (ServiceBuild.Jsii$Proxy) o;
if (!cluster.equals(that.cluster)) return false;
if (!taskDefinition.equals(that.taskDefinition)) return false;
if (this.assignPublicIp != null ? !this.assignPublicIp.equals(that.assignPublicIp) : that.assignPublicIp != null) return false;
if (this.cloudMapOptions != null ? !this.cloudMapOptions.equals(that.cloudMapOptions) : that.cloudMapOptions != null) return false;
if (this.desiredCount != null ? !this.desiredCount.equals(that.desiredCount) : that.desiredCount != null) return false;
if (this.healthCheckGracePeriod != null ? !this.healthCheckGracePeriod.equals(that.healthCheckGracePeriod) : that.healthCheckGracePeriod != null) return false;
if (this.maxHealthyPercent != null ? !this.maxHealthyPercent.equals(that.maxHealthyPercent) : that.maxHealthyPercent != null) return false;
if (this.minHealthyPercent != null ? !this.minHealthyPercent.equals(that.minHealthyPercent) : that.minHealthyPercent != null) return false;
return this.serviceConnectConfiguration != null ? this.serviceConnectConfiguration.equals(that.serviceConnectConfiguration) : that.serviceConnectConfiguration == null;
}
@Override
public final int hashCode() {
int result = this.cluster.hashCode();
result = 31 * result + (this.taskDefinition.hashCode());
result = 31 * result + (this.assignPublicIp != null ? this.assignPublicIp.hashCode() : 0);
result = 31 * result + (this.cloudMapOptions != null ? this.cloudMapOptions.hashCode() : 0);
result = 31 * result + (this.desiredCount != null ? this.desiredCount.hashCode() : 0);
result = 31 * result + (this.healthCheckGracePeriod != null ? this.healthCheckGracePeriod.hashCode() : 0);
result = 31 * result + (this.maxHealthyPercent != null ? this.maxHealthyPercent.hashCode() : 0);
result = 31 * result + (this.minHealthyPercent != null ? this.minHealthyPercent.hashCode() : 0);
result = 31 * result + (this.serviceConnectConfiguration != null ? this.serviceConnectConfiguration.hashCode() : 0);
return result;
}
}
}