io.github.cdklabs.cdkecsserviceextensions.Container Maven / Gradle / Ivy
Show all versions of cdk-ecs-service-extensions Show documentation
package io.github.cdklabs.cdkecsserviceextensions;
/**
* (experimental) The main container of a service.
*
* This is generally the container
* which runs your application business logic. Other extensions will attach
* sidecars alongside this main container.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-24T00:29:08.459Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = io.github.cdklabs.cdkecsserviceextensions.$Module.class, fqn = "@aws-cdk-containers/ecs-service-extensions.Container")
public class Container extends io.github.cdklabs.cdkecsserviceextensions.ServiceExtension {
protected Container(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected Container(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Container(final @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.ContainerExtensionProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* (experimental) This is a hook which allows extensions to modify the settings of the task definition prior to it being created.
*
* For example, the App Mesh
* extension needs to configure an Envoy proxy in the task definition,
* or the Application extension wants to set the overall resource for
* the task.
*
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.TaskDefinitionProps modifyTaskDefinitionProps(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.TaskDefinitionProps props) {
return software.amazon.jsii.Kernel.call(this, "modifyTaskDefinitionProps", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.TaskDefinitionProps.class), new Object[] { java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* (experimental) A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance.
*
* @param service This parameter is required.
* @param scope This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public void prehook(final @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.Service service, final @org.jetbrains.annotations.NotNull software.constructs.Construct scope) {
software.amazon.jsii.Kernel.call(this, "prehook", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(service, "service is required"), java.util.Objects.requireNonNull(scope, "scope is required") });
}
/**
* (experimental) Once all containers are added to the task definition, this hook is called for each extension to give it a chance to resolve its dependency graph so that its container starts in the right order based on the other extensions that were enabled.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public void resolveContainerDependencies() {
software.amazon.jsii.Kernel.call(this, "resolveContainerDependencies", software.amazon.jsii.NativeType.VOID);
}
/**
* (experimental) Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc.
*
* @param taskDefinition This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public void useTaskDefinition(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.TaskDefinition taskDefinition) {
software.amazon.jsii.Kernel.call(this, "useTaskDefinition", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(taskDefinition, "taskDefinition is required") });
}
/**
* (experimental) The port on which the container expects to receive network traffic.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.lang.Number getTrafficPort() {
return software.amazon.jsii.Kernel.get(this, "trafficPort", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
}
/**
* (experimental) The log group into which application container logs should be routed.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.logs.ILogGroup getLogGroup() {
return software.amazon.jsii.Kernel.get(this, "logGroup", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.logs.ILogGroup.class));
}
/**
* (experimental) The log group into which application container logs should be routed.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void setLogGroup(final @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.logs.ILogGroup value) {
software.amazon.jsii.Kernel.set(this, "logGroup", value);
}
/**
* (experimental) A fluent builder for {@link io.github.cdklabs.cdkecsserviceextensions.Container}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create() {
return new Builder();
}
private final io.github.cdklabs.cdkecsserviceextensions.ContainerExtensionProps.Builder props;
private Builder() {
this.props = new io.github.cdklabs.cdkecsserviceextensions.ContainerExtensionProps.Builder();
}
/**
* (experimental) How much CPU the container requires.
*
* @return {@code this}
* @param cpu How much CPU the container requires. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder cpu(final java.lang.Number cpu) {
this.props.cpu(cpu);
return this;
}
/**
* (experimental) The image to run.
*
* @return {@code this}
* @param image The image to run. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder image(final software.amazon.awscdk.services.ecs.ContainerImage image) {
this.props.image(image);
return this;
}
/**
* (experimental) How much memory in megabytes the container requires.
*
* @return {@code this}
* @param memoryMiB How much memory in megabytes the container requires. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder memoryMiB(final java.lang.Number memoryMiB) {
this.props.memoryMiB(memoryMiB);
return this;
}
/**
* (experimental) What port the image listen for traffic on.
*
* @return {@code this}
* @param trafficPort What port the image listen for traffic on. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder trafficPort(final java.lang.Number trafficPort) {
this.props.trafficPort(trafficPort);
return this;
}
/**
* (experimental) Environment variables to pass into the container.
*
* Default: - No environment variables.
*
* @return {@code this}
* @param environment Environment variables to pass into the container. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder environment(final java.util.Map environment) {
this.props.environment(environment);
return this;
}
/**
* (experimental) The environment files to pass to the container.
*
* Default: - No environment files.
*
* @return {@code this}
* @see https://docs.aws.amazon.com/AmazonECS/latest/developerguide/taskdef-envfiles.html
* @param environmentFiles The environment files to pass to the container. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder environmentFiles(final java.util.List extends software.amazon.awscdk.services.ecs.EnvironmentFile> environmentFiles) {
this.props.environmentFiles(environmentFiles);
return this;
}
/**
* (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.
*
* @return {@code this}
* @param logGroup The log group into which application container logs should be routed. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder logGroup(final software.amazon.awscdk.services.logs.ILogGroup logGroup) {
this.props.logGroup(logGroup);
return this;
}
/**
* (experimental) The secret environment variables to pass to the container.
*
* Default: - No secret environment variables.
*
* @return {@code this}
* @param secrets The secret environment variables to pass to the container. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder secrets(final java.util.Map secrets) {
this.props.secrets(secrets);
return this;
}
/**
* @return a newly built instance of {@link io.github.cdklabs.cdkecsserviceextensions.Container}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public io.github.cdklabs.cdkecsserviceextensions.Container build() {
return new io.github.cdklabs.cdkecsserviceextensions.Container(
this.props.build()
);
}
}
}