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.iam.*;
* Service service = Service.Builder.create(this, "Service")
* .source(Source.fromEcrPublic(EcrPublicProps.builder()
* .imageConfiguration(ImageConfiguration.builder().port(8000).build())
* .imageIdentifier("public.ecr.aws/aws-containers/hello-app-runner:latest")
* .build()))
* .build();
* service.addToRolePolicy(PolicyStatement.Builder.create()
* .effect(Effect.ALLOW)
* .actions(List.of("s3:GetObject"))
* .resources(List.of("*"))
* .build());
*
*
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-apprunner-service-imageconfiguration.html
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.104.0 (build e79254c)", date = "2024-11-22T02:24:11.370Z")
@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 {
/**
* (deprecated) Environment variables that are available to your running App Runner service.
*
* Default: - no environment variables
*
* @deprecated use environmentVariables.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
default @org.jetbrains.annotations.Nullable java.util.Map getEnvironment() {
return null;
}
/**
* (experimental) Environment secrets that are available to your running App Runner service.
*
* Default: - no environment secrets
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.Map getEnvironmentSecrets() {
return null;
}
/**
* (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 getEnvironmentVariables() {
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.util.Map environmentSecrets;
java.util.Map environmentVariables;
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}
* @deprecated use environmentVariables.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public Builder environment(java.util.Map environment) {
this.environment = environment;
return this;
}
/**
* Sets the value of {@link ImageConfiguration#getEnvironmentSecrets}
* @param environmentSecrets Environment secrets that are available to your running App Runner service.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@SuppressWarnings("unchecked")
public Builder environmentSecrets(java.util.Map environmentSecrets) {
this.environmentSecrets = (java.util.Map)environmentSecrets;
return this;
}
/**
* Sets the value of {@link ImageConfiguration#getEnvironmentVariables}
* @param environmentVariables 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 environmentVariables(java.util.Map environmentVariables) {
this.environmentVariables = environmentVariables;
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.util.Map environmentSecrets;
private final java.util.Map environmentVariables;
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.environmentSecrets = software.amazon.jsii.Kernel.get(this, "environmentSecrets", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.apprunner.alpha.Secret.class)));
this.environmentVariables = software.amazon.jsii.Kernel.get(this, "environmentVariables", 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}.
*/
@SuppressWarnings("unchecked")
protected Jsii$Proxy(final Builder builder) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
this.environment = builder.environment;
this.environmentSecrets = (java.util.Map)builder.environmentSecrets;
this.environmentVariables = builder.environmentVariables;
this.port = builder.port;
this.startCommand = builder.startCommand;
}
@Override
public final java.util.Map getEnvironment() {
return this.environment;
}
@Override
public final java.util.Map getEnvironmentSecrets() {
return this.environmentSecrets;
}
@Override
public final java.util.Map getEnvironmentVariables() {
return this.environmentVariables;
}
@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.getEnvironmentSecrets() != null) {
data.set("environmentSecrets", om.valueToTree(this.getEnvironmentSecrets()));
}
if (this.getEnvironmentVariables() != null) {
data.set("environmentVariables", om.valueToTree(this.getEnvironmentVariables()));
}
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.environmentSecrets != null ? !this.environmentSecrets.equals(that.environmentSecrets) : that.environmentSecrets != null) return false;
if (this.environmentVariables != null ? !this.environmentVariables.equals(that.environmentVariables) : that.environmentVariables != 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.environmentSecrets != null ? this.environmentSecrets.hashCode() : 0);
result = 31 * result + (this.environmentVariables != null ? this.environmentVariables.hashCode() : 0);
result = 31 * result + (this.port != null ? this.port.hashCode() : 0);
result = 31 * result + (this.startCommand != null ? this.startCommand.hashCode() : 0);
return result;
}
}
}