All Downloads are FREE. Search and download functionalities are using the official Maven repository.

software.amazon.awscdk.services.ecr.assets.DockerImageAsset Maven / Gradle / Ivy

package software.amazon.awscdk.services.ecr.assets;

/**
 * An asset that represents a Docker image.
 * 

* The image will be created in build time and uploaded to an ECR repository. *

* Example: *

*

 * import software.amazon.awscdk.services.ecr.assets.DockerImageAsset;
 * import software.amazon.awscdk.services.ecr.assets.NetworkMode;
 * DockerImageAsset asset = DockerImageAsset.Builder.create(this, "MyBuildImage")
 *         .directory(join(__dirname, "my-image"))
 *         .networkMode(NetworkMode.HOST)
 *         .build();
 * 
*/ @javax.annotation.Generated(value = "jsii-pacmak/1.63.2 (build a8a8833)", date = "2022-08-17T17:31:13.759Z") @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.ecr.assets.$Module.class, fqn = "@aws-cdk/aws-ecr-assets.DockerImageAsset") public class DockerImageAsset extends software.amazon.awscdk.core.Construct implements software.amazon.awscdk.assets.IAsset { protected DockerImageAsset(final software.amazon.jsii.JsiiObjectRef objRef) { super(objRef); } protected DockerImageAsset(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) { super(initializationMode); } /** * @param scope This parameter is required. * @param id This parameter is required. * @param props This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public DockerImageAsset(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecr.assets.DockerImageAssetProps props) { super(software.amazon.jsii.JsiiObject.InitializationMode.JSII); software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(props, "props is required") }); } /** * Adds CloudFormation template metadata to the specified resource with information that indicates which resource property is mapped to this local asset. *

* This can be used by tools such as SAM CLI to provide local * experience such as local invocation and debugging of Lambda functions. *

* Asset metadata will only be included if the stack is synthesized with the * "aws:cdk:enable-asset-metadata" context key defined, which is the default * behavior when synthesizing via the CDK Toolkit. *

* @see https://github.com/aws/aws-cdk/issues/1432 * @param resource The CloudFormation resource which is using this asset [disable-awslint:ref-via-interface]. This parameter is required. * @param resourceProperty The property name where this asset is referenced. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public void addResourceMetadata(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.core.CfnResource resource, final @org.jetbrains.annotations.NotNull java.lang.String resourceProperty) { software.amazon.jsii.Kernel.call(this, "addResourceMetadata", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(resource, "resource is required"), java.util.Objects.requireNonNull(resourceProperty, "resourceProperty is required") }); } /** * A hash of this asset, which is available at construction time. *

* As this is a plain string, it * can be used in construct IDs in order to enforce creation of a new resource when the content * hash has changed. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public @org.jetbrains.annotations.NotNull java.lang.String getAssetHash() { return software.amazon.jsii.Kernel.get(this, "assetHash", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * (deprecated) A hash of the source of this asset, which is available at construction time. *

* As this is a plain * string, it can be used in construct IDs in order to enforce creation of a new resource when * the content hash has changed. *

* @deprecated use assetHash */ @Override @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated) @Deprecated public @org.jetbrains.annotations.NotNull java.lang.String getSourceHash() { return software.amazon.jsii.Kernel.get(this, "sourceHash", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * The full URI of the image (including a tag). *

* Use this reference to pull * the asset. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public @org.jetbrains.annotations.NotNull java.lang.String getImageUri() { return software.amazon.jsii.Kernel.get(this, "imageUri", software.amazon.jsii.NativeType.forClass(java.lang.String.class)); } /** * The full URI of the image (including a tag). *

* Use this reference to pull * the asset. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public void setImageUri(final @org.jetbrains.annotations.NotNull java.lang.String value) { software.amazon.jsii.Kernel.set(this, "imageUri", java.util.Objects.requireNonNull(value, "imageUri is required")); } /** * Repository where the image is stored. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecr.IRepository getRepository() { return software.amazon.jsii.Kernel.get(this, "repository", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecr.IRepository.class)); } /** * Repository where the image is stored. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public void setRepository(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecr.IRepository value) { software.amazon.jsii.Kernel.set(this, "repository", java.util.Objects.requireNonNull(value, "repository is required")); } /** * A fluent builder for {@link software.amazon.awscdk.services.ecr.assets.DockerImageAsset}. */ @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 scope This parameter is required. * @param id This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public static Builder create(final software.constructs.Construct scope, final java.lang.String id) { return new Builder(scope, id); } private final software.constructs.Construct scope; private final java.lang.String id; private final software.amazon.awscdk.services.ecr.assets.DockerImageAssetProps.Builder props; private Builder(final software.constructs.Construct scope, final java.lang.String id) { this.scope = scope; this.id = id; this.props = new software.amazon.awscdk.services.ecr.assets.DockerImageAssetProps.Builder(); } /** * 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; } /** * Options to control which parameters are used to invalidate the asset hash. *

* Default: - hash all parameters *

* @return {@code this} * @param invalidation Options to control which parameters are used to invalidate the asset hash. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder invalidation(final software.amazon.awscdk.services.ecr.assets.DockerImageAssetInvalidationOptions invalidation) { this.props.invalidation(invalidation); return this; } /** * Networking mode for the RUN commands during build. *

* Support docker API 1.25+. *

* Default: - no networking mode specified (the default networking mode `NetworkMode.DEFAULT` will be used) *

* @return {@code this} * @param networkMode Networking mode for the RUN commands during build. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder networkMode(final software.amazon.awscdk.services.ecr.assets.NetworkMode networkMode) { this.props.networkMode(networkMode); return this; } /** * Platform to build for. *

* Requires Docker Buildx. *

* Default: - no platform specified (the current machine architecture will be used) *

* @return {@code this} * @param platform Platform to build for. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder platform(final software.amazon.awscdk.services.ecr.assets.Platform platform) { this.props.platform(platform); 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; } /** * The directory where the Dockerfile is stored. *

* Any directory inside with a name that matches the CDK output folder (cdk.out by default) will be excluded from the asset *

* @return {@code this} * @param directory The directory where the Dockerfile is stored. This parameter is required. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) public Builder directory(final java.lang.String directory) { this.props.directory(directory); return this; } /** * @returns a newly built instance of {@link software.amazon.awscdk.services.ecr.assets.DockerImageAsset}. */ @software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable) @Override public software.amazon.awscdk.services.ecr.assets.DockerImageAsset build() { return new software.amazon.awscdk.services.ecr.assets.DockerImageAsset( this.scope, this.id, this.props.build() ); } } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy