software.amazon.awscdk.services.apprunner.alpha.ImageConfiguration Maven / Gradle / Ivy
Show all versions of apprunner-alpha Show documentation
package software.amazon.awscdk.services.apprunner.alpha;
/**
* (experimental) Describes the configuration that AWS App Runner uses to run an App Runner service using an image pulled from a source image repository.
*
* Example:
*
*
* import software.amazon.awscdk.services.ecr.assets.*;
* DockerImageAsset imageAsset = DockerImageAsset.Builder.create(this, "ImageAssets")
* .directory(join(__dirname, "./docker.assets"))
* .build();
* Service.Builder.create(this, "Service")
* .source(Source.fromAsset(AssetProps.builder()
* .imageConfiguration(ImageConfiguration.builder().port(8000).build())
* .asset(imageAsset)
* .build()))
* .build();
*
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apprunner-service-imageconfiguration.html
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.63.2 (build a8a8833)", date = "2022-08-10T20:16:28.251Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.apprunner.alpha.$Module.class, fqn = "@aws-cdk/aws-apprunner-alpha.ImageConfiguration")
@software.amazon.jsii.Jsii.Proxy(ImageConfiguration.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface ImageConfiguration extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) Environment variables that are available to your running App Runner service.
*
* 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 port that your application listens to in the container.
*
* Default: 8080
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Number getPort() {
return null;
}
/**
* (experimental) An optional command that App Runner runs to start the application in the source image.
*
* If specified, this command overrides the Docker image’s default start command.
*
* Default: - no start command
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getStartCommand() {
return null;
}
/**
* @return a {@link Builder} of {@link ImageConfiguration}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link ImageConfiguration}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.util.Map environment;
java.lang.Number port;
java.lang.String startCommand;
/**
* Sets the value of {@link ImageConfiguration#getEnvironment}
* @param environment Environment variables that are available to your running App Runner service.
* @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 ImageConfiguration#getPort}
* @param port The port that your application listens to in the container.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder port(java.lang.Number port) {
this.port = port;
return this;
}
/**
* Sets the value of {@link ImageConfiguration#getStartCommand}
* @param startCommand An optional command that App Runner runs to start the application in the source image.
* If specified, this command overrides the Docker image’s default start command.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder startCommand(java.lang.String startCommand) {
this.startCommand = startCommand;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link ImageConfiguration}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public ImageConfiguration build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link ImageConfiguration}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements ImageConfiguration {
private final java.util.Map environment;
private final java.lang.Number port;
private final java.lang.String startCommand;
/**
* 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.environment = software.amazon.jsii.Kernel.get(this, "environment", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
this.port = software.amazon.jsii.Kernel.get(this, "port", software.amazon.jsii.NativeType.forClass(java.lang.Number.class));
this.startCommand = software.amazon.jsii.Kernel.get(this, "startCommand", software.amazon.jsii.NativeType.forClass(java.lang.String.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.environment = builder.environment;
this.port = builder.port;
this.startCommand = builder.startCommand;
}
@Override
public final java.util.Map getEnvironment() {
return this.environment;
}
@Override
public final java.lang.Number getPort() {
return this.port;
}
@Override
public final java.lang.String getStartCommand() {
return this.startCommand;
}
@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();
if (this.getEnvironment() != null) {
data.set("environment", om.valueToTree(this.getEnvironment()));
}
if (this.getPort() != null) {
data.set("port", om.valueToTree(this.getPort()));
}
if (this.getStartCommand() != null) {
data.set("startCommand", om.valueToTree(this.getStartCommand()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-apprunner-alpha.ImageConfiguration"));
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;
ImageConfiguration.Jsii$Proxy that = (ImageConfiguration.Jsii$Proxy) o;
if (this.environment != null ? !this.environment.equals(that.environment) : that.environment != null) return false;
if (this.port != null ? !this.port.equals(that.port) : that.port != null) return false;
return this.startCommand != null ? this.startCommand.equals(that.startCommand) : that.startCommand == null;
}
@Override
public final int hashCode() {
int result = this.environment != null ? this.environment.hashCode() : 0;
result = 31 * result + (this.port != null ? this.port.hashCode() : 0);
result = 31 * result + (this.startCommand != null ? this.startCommand.hashCode() : 0);
return result;
}
}
}