io.github.cdklabs.cdkecsserviceextensions.ContainerExtensionProps Maven / Gradle / Ivy
Show all versions of cdk-ecs-service-extensions Show documentation
package io.github.cdklabs.cdkecsserviceextensions;
/**
* (experimental) Setting for the main application container of a service.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-23T00:29:59.042Z")
@software.amazon.jsii.Jsii(module = io.github.cdklabs.cdkecsserviceextensions.$Module.class, fqn = "@aws-cdk-containers/ecs-service-extensions.ContainerExtensionProps")
@software.amazon.jsii.Jsii.Proxy(ContainerExtensionProps.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface ContainerExtensionProps extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) How much CPU the container requires.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.Number getCpu();
/**
* (experimental) The image to run.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.ContainerImage getImage();
/**
* (experimental) How much memory in megabytes the container requires.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.Number getMemoryMiB();
/**
* (experimental) What port the image listen for traffic on.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@org.jetbrains.annotations.NotNull java.lang.Number getTrafficPort();
/**
* (experimental) Environment variables to pass into the container.
*
* Default: - No environment variables.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.Map getEnvironment() {
return null;
}
/**
* (experimental) The environment files to pass to the container.
*
* Default: - No environment files.
*
* @see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/taskdef-envfiles.html
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.List getEnvironmentFiles() {
return null;
}
/**
* (experimental) The log group into which application container logs should be routed.
*
* Default: - A log group is automatically created for you if the `ECS_SERVICE_EXTENSIONS_ENABLE_DEFAULT_LOG_DRIVER` feature flag is set.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.logs.ILogGroup getLogGroup() {
return null;
}
/**
* (experimental) The secret environment variables to pass to the container.
*
* Default: - No secret environment variables.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.Map getSecrets() {
return null;
}
/**
* @return a {@link Builder} of {@link ContainerExtensionProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link ContainerExtensionProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.Number cpu;
software.amazon.awscdk.services.ecs.ContainerImage image;
java.lang.Number memoryMiB;
java.lang.Number trafficPort;
java.util.Map environment;
java.util.List environmentFiles;
software.amazon.awscdk.services.logs.ILogGroup logGroup;
java.util.Map secrets;
/**
* Sets the value of {@link ContainerExtensionProps#getCpu}
* @param cpu How much CPU the container requires. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder cpu(java.lang.Number cpu) {
this.cpu = cpu;
return this;
}
/**
* Sets the value of {@link ContainerExtensionProps#getImage}
* @param image The image to run. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder image(software.amazon.awscdk.services.ecs.ContainerImage image) {
this.image = image;
return this;
}
/**
* Sets the value of {@link ContainerExtensionProps#getMemoryMiB}
* @param memoryMiB How much memory in megabytes the container requires. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder memoryMiB(java.lang.Number memoryMiB) {
this.memoryMiB = memoryMiB;
return this;
}
/**
* Sets the value of {@link ContainerExtensionProps#getTrafficPort}
* @param trafficPort What port the image listen for traffic on. This parameter is required.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder trafficPort(java.lang.Number trafficPort) {
this.trafficPort = trafficPort;
return this;
}
/**
* Sets the value of {@link ContainerExtensionProps#getEnvironment}
* @param environment Environment variables to pass into the container.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder environment(java.util.Map environment) {
this.environment = environment;
return this;
}
/**
* Sets the value of {@link ContainerExtensionProps#getEnvironmentFiles}
* @param environmentFiles The environment files to pass to the container.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder environmentFiles(java.util.List extends software.amazon.awscdk.services.ecs.EnvironmentFile> environmentFiles) {
this.environmentFiles = (java.util.List)environmentFiles;
return this;
}
/**
* Sets the value of {@link ContainerExtensionProps#getLogGroup}
* @param logGroup The log group into which application container logs should be routed.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder logGroup(software.amazon.awscdk.services.logs.ILogGroup logGroup) {
this.logGroup = logGroup;
return this;
}
/**
* Sets the value of {@link ContainerExtensionProps#getSecrets}
* @param secrets The secret environment variables to pass to the container.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder secrets(java.util.Map secrets) {
this.secrets = (java.util.Map)secrets;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link ContainerExtensionProps}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public ContainerExtensionProps build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link ContainerExtensionProps}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements ContainerExtensionProps {
private final java.lang.Number cpu;
private final software.amazon.awscdk.services.ecs.ContainerImage image;
private final java.lang.Number memoryMiB;
private final java.lang.Number trafficPort;
private final java.util.Map environment;
private final java.util.List environmentFiles;
private final software.amazon.awscdk.services.logs.ILogGroup logGroup;
private final java.util.Map secrets;
/**
* 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.cpu = software.amazon.jsii.Kernel.get(this, "cpu", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.image = software.amazon.jsii.Kernel.get(this, "image", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.ContainerImage.class));
this.memoryMiB = software.amazon.jsii.Kernel.get(this, "memoryMiB", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.trafficPort = software.amazon.jsii.Kernel.get(this, "trafficPort", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.environment = software.amazon.jsii.Kernel.get(this, "environment", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
this.environmentFiles = software.amazon.jsii.Kernel.get(this, "environmentFiles", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.EnvironmentFile.class)));
this.logGroup = software.amazon.jsii.Kernel.get(this, "logGroup", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.logs.ILogGroup.class));
this.secrets = software.amazon.jsii.Kernel.get(this, "secrets", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.Secret.class)));
}
/**
* Constructor that initializes the object based on literal property values passed by the {@link Builder}.
*/
@SuppressWarnings("unchecked")
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.cpu = java.util.Objects.requireNonNull(builder.cpu, "cpu is required");
this.image = java.util.Objects.requireNonNull(builder.image, "image is required");
this.memoryMiB = java.util.Objects.requireNonNull(builder.memoryMiB, "memoryMiB is required");
this.trafficPort = java.util.Objects.requireNonNull(builder.trafficPort, "trafficPort is required");
this.environment = builder.environment;
this.environmentFiles = (java.util.List)builder.environmentFiles;
this.logGroup = builder.logGroup;
this.secrets = (java.util.Map)builder.secrets;
}
@Override
public final java.lang.Number getCpu() {
return this.cpu;
}
@Override
public final software.amazon.awscdk.services.ecs.ContainerImage getImage() {
return this.image;
}
@Override
public final java.lang.Number getMemoryMiB() {
return this.memoryMiB;
}
@Override
public final java.lang.Number getTrafficPort() {
return this.trafficPort;
}
@Override
public final java.util.Map getEnvironment() {
return this.environment;
}
@Override
public final java.util.List getEnvironmentFiles() {
return this.environmentFiles;
}
@Override
public final software.amazon.awscdk.services.logs.ILogGroup getLogGroup() {
return this.logGroup;
}
@Override
public final java.util.Map getSecrets() {
return this.secrets;
}
@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("cpu", om.valueToTree(this.getCpu()));
data.set("image", om.valueToTree(this.getImage()));
data.set("memoryMiB", om.valueToTree(this.getMemoryMiB()));
data.set("trafficPort", om.valueToTree(this.getTrafficPort()));
if (this.getEnvironment() != null) {
data.set("environment", om.valueToTree(this.getEnvironment()));
}
if (this.getEnvironmentFiles() != null) {
data.set("environmentFiles", om.valueToTree(this.getEnvironmentFiles()));
}
if (this.getLogGroup() != null) {
data.set("logGroup", om.valueToTree(this.getLogGroup()));
}
if (this.getSecrets() != null) {
data.set("secrets", om.valueToTree(this.getSecrets()));
}
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.ContainerExtensionProps"));
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;
ContainerExtensionProps.Jsii$Proxy that = (ContainerExtensionProps.Jsii$Proxy) o;
if (!cpu.equals(that.cpu)) return false;
if (!image.equals(that.image)) return false;
if (!memoryMiB.equals(that.memoryMiB)) return false;
if (!trafficPort.equals(that.trafficPort)) return false;
if (this.environment != null ? !this.environment.equals(that.environment) : that.environment != null) return false;
if (this.environmentFiles != null ? !this.environmentFiles.equals(that.environmentFiles) : that.environmentFiles != null) return false;
if (this.logGroup != null ? !this.logGroup.equals(that.logGroup) : that.logGroup != null) return false;
return this.secrets != null ? this.secrets.equals(that.secrets) : that.secrets == null;
}
@Override
public final int hashCode() {
int result = this.cpu.hashCode();
result = 31 * result + (this.image.hashCode());
result = 31 * result + (this.memoryMiB.hashCode());
result = 31 * result + (this.trafficPort.hashCode());
result = 31 * result + (this.environment != null ? this.environment.hashCode() : 0);
result = 31 * result + (this.environmentFiles != null ? this.environmentFiles.hashCode() : 0);
result = 31 * result + (this.logGroup != null ? this.logGroup.hashCode() : 0);
result = 31 * result + (this.secrets != null ? this.secrets.hashCode() : 0);
return result;
}
}
}