software.amazon.awscdk.services.ecs.AssetImage Maven / Gradle / Ivy
Show all versions of ecs Show documentation
package software.amazon.awscdk.services.ecs;
/**
* An image that will be built from a local directory with a Dockerfile.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.29.0 (build 41df200)", date = "2021-05-25T18:24:56.991Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.ecs.$Module.class, fqn = "@aws-cdk/aws-ecs.AssetImage")
public class AssetImage extends software.amazon.awscdk.services.ecs.ContainerImage {
protected AssetImage(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected AssetImage(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* Constructs a new instance of the AssetImage class.
*
* @param directory The directory containing the Dockerfile. This parameter is required.
* @param props
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public AssetImage(final @org.jetbrains.annotations.NotNull java.lang.String directory, final @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ecs.AssetImageProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(directory, "directory is required"), props });
}
/**
* Constructs a new instance of the AssetImage class.
*
* @param directory The directory containing the Dockerfile. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public AssetImage(final @org.jetbrains.annotations.NotNull java.lang.String directory) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(directory, "directory is required") });
}
/**
* Called when the image is used by a ContainerDefinition.
*
* @param scope This parameter is required.
* @param containerDefinition This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.ContainerImageConfig bind(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.core.Construct scope, final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.ContainerDefinition containerDefinition) {
return software.amazon.jsii.Kernel.call(this, "bind", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.ContainerImageConfig.class), new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(containerDefinition, "containerDefinition is required") });
}
/**
* A fluent builder for {@link software.amazon.awscdk.services.ecs.AssetImage}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @return a new instance of {@link Builder}.
* @param directory The directory containing the Dockerfile. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static Builder create(final java.lang.String directory) {
return new Builder(directory);
}
private final java.lang.String directory;
private software.amazon.awscdk.services.ecs.AssetImageProps.Builder props;
private Builder(final java.lang.String directory) {
this.directory = directory;
}
/**
* Glob patterns to exclude from the copy.
*
* Default: - nothing is excluded
*
* @return {@code this}
* @param exclude Glob patterns to exclude from the copy. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder exclude(final java.util.List exclude) {
this.props().exclude(exclude);
return this;
}
/**
* (deprecated) A strategy for how to handle symlinks.
*
* Default: Never
*
* @return {@code this}
* @deprecated use `followSymlinks` instead
* @param follow A strategy for how to handle symlinks. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public Builder follow(final software.amazon.awscdk.assets.FollowMode follow) {
this.props().follow(follow);
return this;
}
/**
* The ignore behavior to use for exclude patterns.
*
* Default: IgnoreMode.GLOB
*
* @return {@code this}
* @param ignoreMode The ignore behavior to use for exclude patterns. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder ignoreMode(final software.amazon.awscdk.core.IgnoreMode ignoreMode) {
this.props().ignoreMode(ignoreMode);
return this;
}
/**
* Extra information to encode into the fingerprint (e.g. build instructions and other inputs).
*
* Default: - hash is only based on source content
*
* @return {@code this}
* @param extraHash Extra information to encode into the fingerprint (e.g. build instructions and other inputs). This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder extraHash(final java.lang.String extraHash) {
this.props().extraHash(extraHash);
return this;
}
/**
* A strategy for how to handle symlinks.
*
* Default: SymlinkFollowMode.NEVER
*
* @return {@code this}
* @param followSymlinks A strategy for how to handle symlinks. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder followSymlinks(final software.amazon.awscdk.core.SymlinkFollowMode followSymlinks) {
this.props().followSymlinks(followSymlinks);
return this;
}
/**
* Build args to pass to the `docker build` command.
*
* Since Docker build arguments are resolved before deployment, keys and
* values cannot refer to unresolved tokens (such as lambda.functionArn
or
* queue.queueUrl
).
*
* Default: - no build args are passed
*
* @return {@code this}
* @param buildArgs Build args to pass to the `docker build` command. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder buildArgs(final java.util.Map buildArgs) {
this.props().buildArgs(buildArgs);
return this;
}
/**
* Path to the Dockerfile (relative to the directory).
*
* Default: 'Dockerfile'
*
* @return {@code this}
* @param file Path to the Dockerfile (relative to the directory). This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder file(final java.lang.String file) {
this.props().file(file);
return this;
}
/**
* (deprecated) ECR repository name.
*
* Specify this property if you need to statically address the image, e.g.
* from a Kubernetes Pod. Note, this is only the repository name, without the
* registry and the tag parts.
*
* Default: - the default ECR repository for CDK assets
*
* @return {@code this}
* @deprecated to control the location of docker image assets, please override
* `Stack.addDockerImageAsset`. this feature will be removed in future
* releases.
* @param repositoryName ECR repository name. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public Builder repositoryName(final java.lang.String repositoryName) {
this.props().repositoryName(repositoryName);
return this;
}
/**
* Docker target to build to.
*
* Default: - no target
*
* @return {@code this}
* @param target Docker target to build to. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder target(final java.lang.String target) {
this.props().target(target);
return this;
}
/**
* @returns a newly built instance of {@link software.amazon.awscdk.services.ecs.AssetImage}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public software.amazon.awscdk.services.ecs.AssetImage build() {
return new software.amazon.awscdk.services.ecs.AssetImage(
this.directory,
this.props != null ? this.props.build() : null
);
}
private software.amazon.awscdk.services.ecs.AssetImageProps.Builder props() {
if (this.props == null) {
this.props = new software.amazon.awscdk.services.ecs.AssetImageProps.Builder();
}
return this.props;
}
}
}