
software.amazon.awscdk.services.ecr.assets.DockerImageAssetOptions Maven / Gradle / Ivy
package software.amazon.awscdk.services.ecr.assets;
/**
* Options for DockerImageAsset.
*
* Example:
*
*
* // The code below shows an example of how to instantiate this type.
* // The values are placeholders you should change.
* import software.amazon.awscdk.assets.*;
* import software.amazon.awscdk.services.ecr.assets.*;
* import software.amazon.awscdk.core.*;
* NetworkMode networkMode;
* Platform platform;
* DockerImageAssetOptions dockerImageAssetOptions = DockerImageAssetOptions.builder()
* .buildArgs(Map.of(
* "buildArgsKey", "buildArgs"))
* .exclude(List.of("exclude"))
* .extraHash("extraHash")
* .file("file")
* .follow(FollowMode.NEVER)
* .followSymlinks(SymlinkFollowMode.NEVER)
* .ignoreMode(IgnoreMode.GLOB)
* .invalidation(DockerImageAssetInvalidationOptions.builder()
* .buildArgs(false)
* .extraHash(false)
* .file(false)
* .networkMode(false)
* .platform(false)
* .repositoryName(false)
* .target(false)
* .build())
* .networkMode(networkMode)
* .platform(platform)
* .repositoryName("repositoryName")
* .target("target")
* .build();
*
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.63.2 (build a8a8833)", date = "2022-08-17T17:31:13.762Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.ecr.assets.$Module.class, fqn = "@aws-cdk/aws-ecr-assets.DockerImageAssetOptions")
@software.amazon.jsii.Jsii.Proxy(DockerImageAssetOptions.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public interface DockerImageAssetOptions extends software.amazon.jsii.JsiiSerializable, software.amazon.awscdk.assets.FingerprintOptions, software.amazon.awscdk.core.FileFingerprintOptions {
/**
* 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
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.util.Map getBuildArgs() {
return null;
}
/**
* Path to the Dockerfile (relative to the directory).
*
* Default: 'Dockerfile'
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.String getFile() {
return null;
}
/**
* Options to control which parameters are used to invalidate the asset hash.
*
* Default: - hash all parameters
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ecr.assets.DockerImageAssetInvalidationOptions getInvalidation() {
return null;
}
/**
* 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)
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ecr.assets.NetworkMode getNetworkMode() {
return null;
}
/**
* Platform to build for.
*
* Requires Docker Buildx.
*
* Default: - no platform specified (the current machine architecture will be used)
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.ecr.assets.Platform getPlatform() {
return null;
}
/**
* (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
*
* @deprecated to control the location of docker image assets, please override
* `Stack.addDockerImageAsset`. this feature will be removed in future
* releases.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
default @org.jetbrains.annotations.Nullable java.lang.String getRepositoryName() {
return null;
}
/**
* Docker target to build to.
*
* Default: - no target
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
default @org.jetbrains.annotations.Nullable java.lang.String getTarget() {
return null;
}
/**
* (deprecated) Extra information to encode into the fingerprint (e.g. build instructions and other inputs).
*
* Default: - hash is only based on source content
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
@Override
default @org.jetbrains.annotations.Nullable java.lang.String getExtraHash() {
return null;
}
/**
* (deprecated) Glob patterns to exclude from the copy.
*
* Default: nothing is excluded
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
@Override
default @org.jetbrains.annotations.Nullable java.util.List getExclude() {
return null;
}
/**
* (deprecated) The ignore behavior to use for exclude patterns.
*
* Default: - GLOB for file assets, DOCKER or GLOB for docker assets depending on whether the
* '
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
@Override
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.core.IgnoreMode getIgnoreMode() {
return null;
}
/**
* @return a {@link Builder} of {@link DockerImageAssetOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link DockerImageAssetOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public static final class Builder implements software.amazon.jsii.Builder {
java.util.Map buildArgs;
java.lang.String file;
software.amazon.awscdk.services.ecr.assets.DockerImageAssetInvalidationOptions invalidation;
software.amazon.awscdk.services.ecr.assets.NetworkMode networkMode;
software.amazon.awscdk.services.ecr.assets.Platform platform;
java.lang.String repositoryName;
java.lang.String target;
java.lang.String extraHash;
java.util.List exclude;
software.amazon.awscdk.assets.FollowMode follow;
software.amazon.awscdk.core.IgnoreMode ignoreMode;
software.amazon.awscdk.core.SymlinkFollowMode followSymlinks;
/**
* Sets the value of {@link DockerImageAssetOptions#getBuildArgs}
* @param buildArgs 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
).
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder buildArgs(java.util.Map buildArgs) {
this.buildArgs = buildArgs;
return this;
}
/**
* Sets the value of {@link DockerImageAssetOptions#getFile}
* @param file Path to the Dockerfile (relative to the directory).
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder file(java.lang.String file) {
this.file = file;
return this;
}
/**
* Sets the value of {@link DockerImageAssetOptions#getInvalidation}
* @param invalidation Options to control which parameters are used to invalidate the asset hash.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder invalidation(software.amazon.awscdk.services.ecr.assets.DockerImageAssetInvalidationOptions invalidation) {
this.invalidation = invalidation;
return this;
}
/**
* Sets the value of {@link DockerImageAssetOptions#getNetworkMode}
* @param networkMode Networking mode for the RUN commands during build.
* Support docker API 1.25+.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder networkMode(software.amazon.awscdk.services.ecr.assets.NetworkMode networkMode) {
this.networkMode = networkMode;
return this;
}
/**
* Sets the value of {@link DockerImageAssetOptions#getPlatform}
* @param platform Platform to build for.
* Requires Docker Buildx.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder platform(software.amazon.awscdk.services.ecr.assets.Platform platform) {
this.platform = platform;
return this;
}
/**
* Sets the value of {@link DockerImageAssetOptions#getRepositoryName}
* @param repositoryName 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.
* @return {@code this}
* @deprecated to control the location of docker image assets, please override
`Stack.addDockerImageAsset`. this feature will be removed in future
releases.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public Builder repositoryName(java.lang.String repositoryName) {
this.repositoryName = repositoryName;
return this;
}
/**
* Sets the value of {@link DockerImageAssetOptions#getTarget}
* @param target Docker target to build to.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder target(java.lang.String target) {
this.target = target;
return this;
}
/**
* Sets the value of {@link DockerImageAssetOptions#getExtraHash}
* @param extraHash Extra information to encode into the fingerprint (e.g. build instructions and other inputs).
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder extraHash(java.lang.String extraHash) {
this.extraHash = extraHash;
return this;
}
/**
* Sets the value of {@link DockerImageAssetOptions#getExclude}
* @param exclude Glob patterns to exclude from the copy.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder exclude(java.util.List exclude) {
this.exclude = exclude;
return this;
}
/**
* Sets the value of {@link DockerImageAssetOptions#getFollow}
* @param follow A strategy for how to handle symlinks.
* @return {@code this}
* @deprecated use `followSymlinks` instead
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Deprecated)
@Deprecated
public Builder follow(software.amazon.awscdk.assets.FollowMode follow) {
this.follow = follow;
return this;
}
/**
* Sets the value of {@link DockerImageAssetOptions#getIgnoreMode}
* @param ignoreMode The ignore behavior to use for exclude patterns.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder ignoreMode(software.amazon.awscdk.core.IgnoreMode ignoreMode) {
this.ignoreMode = ignoreMode;
return this;
}
/**
* Sets the value of {@link DockerImageAssetOptions#getFollowSymlinks}
* @param followSymlinks A strategy for how to handle symlinks.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder followSymlinks(software.amazon.awscdk.core.SymlinkFollowMode followSymlinks) {
this.followSymlinks = followSymlinks;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link DockerImageAssetOptions}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public DockerImageAssetOptions build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link DockerImageAssetOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements DockerImageAssetOptions {
private final java.util.Map buildArgs;
private final java.lang.String file;
private final software.amazon.awscdk.services.ecr.assets.DockerImageAssetInvalidationOptions invalidation;
private final software.amazon.awscdk.services.ecr.assets.NetworkMode networkMode;
private final software.amazon.awscdk.services.ecr.assets.Platform platform;
private final java.lang.String repositoryName;
private final java.lang.String target;
private final java.lang.String extraHash;
private final java.util.List exclude;
private final software.amazon.awscdk.assets.FollowMode follow;
private final software.amazon.awscdk.core.IgnoreMode ignoreMode;
private final software.amazon.awscdk.core.SymlinkFollowMode followSymlinks;
/**
* 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.buildArgs = software.amazon.jsii.Kernel.get(this, "buildArgs", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
this.file = software.amazon.jsii.Kernel.get(this, "file", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.invalidation = software.amazon.jsii.Kernel.get(this, "invalidation", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecr.assets.DockerImageAssetInvalidationOptions.class));
this.networkMode = software.amazon.jsii.Kernel.get(this, "networkMode", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecr.assets.NetworkMode.class));
this.platform = software.amazon.jsii.Kernel.get(this, "platform", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecr.assets.Platform.class));
this.repositoryName = software.amazon.jsii.Kernel.get(this, "repositoryName", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.target = software.amazon.jsii.Kernel.get(this, "target", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.extraHash = software.amazon.jsii.Kernel.get(this, "extraHash", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.exclude = software.amazon.jsii.Kernel.get(this, "exclude", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
this.follow = software.amazon.jsii.Kernel.get(this, "follow", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.assets.FollowMode.class));
this.ignoreMode = software.amazon.jsii.Kernel.get(this, "ignoreMode", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.core.IgnoreMode.class));
this.followSymlinks = software.amazon.jsii.Kernel.get(this, "followSymlinks", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.core.SymlinkFollowMode.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.buildArgs = builder.buildArgs;
this.file = builder.file;
this.invalidation = builder.invalidation;
this.networkMode = builder.networkMode;
this.platform = builder.platform;
this.repositoryName = builder.repositoryName;
this.target = builder.target;
this.extraHash = builder.extraHash;
this.exclude = builder.exclude;
this.follow = builder.follow;
this.ignoreMode = builder.ignoreMode;
this.followSymlinks = builder.followSymlinks;
}
@Override
public final java.util.Map getBuildArgs() {
return this.buildArgs;
}
@Override
public final java.lang.String getFile() {
return this.file;
}
@Override
public final software.amazon.awscdk.services.ecr.assets.DockerImageAssetInvalidationOptions getInvalidation() {
return this.invalidation;
}
@Override
public final software.amazon.awscdk.services.ecr.assets.NetworkMode getNetworkMode() {
return this.networkMode;
}
@Override
public final software.amazon.awscdk.services.ecr.assets.Platform getPlatform() {
return this.platform;
}
@Override
public final java.lang.String getRepositoryName() {
return this.repositoryName;
}
@Override
public final java.lang.String getTarget() {
return this.target;
}
@Override
public final java.lang.String getExtraHash() {
return this.extraHash;
}
@Override
public final java.util.List getExclude() {
return this.exclude;
}
@Override
public final software.amazon.awscdk.assets.FollowMode getFollow() {
return this.follow;
}
@Override
public final software.amazon.awscdk.core.IgnoreMode getIgnoreMode() {
return this.ignoreMode;
}
@Override
public final software.amazon.awscdk.core.SymlinkFollowMode getFollowSymlinks() {
return this.followSymlinks;
}
@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.getBuildArgs() != null) {
data.set("buildArgs", om.valueToTree(this.getBuildArgs()));
}
if (this.getFile() != null) {
data.set("file", om.valueToTree(this.getFile()));
}
if (this.getInvalidation() != null) {
data.set("invalidation", om.valueToTree(this.getInvalidation()));
}
if (this.getNetworkMode() != null) {
data.set("networkMode", om.valueToTree(this.getNetworkMode()));
}
if (this.getPlatform() != null) {
data.set("platform", om.valueToTree(this.getPlatform()));
}
if (this.getRepositoryName() != null) {
data.set("repositoryName", om.valueToTree(this.getRepositoryName()));
}
if (this.getTarget() != null) {
data.set("target", om.valueToTree(this.getTarget()));
}
if (this.getExtraHash() != null) {
data.set("extraHash", om.valueToTree(this.getExtraHash()));
}
if (this.getExclude() != null) {
data.set("exclude", om.valueToTree(this.getExclude()));
}
if (this.getFollow() != null) {
data.set("follow", om.valueToTree(this.getFollow()));
}
if (this.getIgnoreMode() != null) {
data.set("ignoreMode", om.valueToTree(this.getIgnoreMode()));
}
if (this.getFollowSymlinks() != null) {
data.set("followSymlinks", om.valueToTree(this.getFollowSymlinks()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-ecr-assets.DockerImageAssetOptions"));
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;
DockerImageAssetOptions.Jsii$Proxy that = (DockerImageAssetOptions.Jsii$Proxy) o;
if (this.buildArgs != null ? !this.buildArgs.equals(that.buildArgs) : that.buildArgs != null) return false;
if (this.file != null ? !this.file.equals(that.file) : that.file != null) return false;
if (this.invalidation != null ? !this.invalidation.equals(that.invalidation) : that.invalidation != null) return false;
if (this.networkMode != null ? !this.networkMode.equals(that.networkMode) : that.networkMode != null) return false;
if (this.platform != null ? !this.platform.equals(that.platform) : that.platform != null) return false;
if (this.repositoryName != null ? !this.repositoryName.equals(that.repositoryName) : that.repositoryName != null) return false;
if (this.target != null ? !this.target.equals(that.target) : that.target != null) return false;
if (this.extraHash != null ? !this.extraHash.equals(that.extraHash) : that.extraHash != null) return false;
if (this.exclude != null ? !this.exclude.equals(that.exclude) : that.exclude != null) return false;
if (this.follow != null ? !this.follow.equals(that.follow) : that.follow != null) return false;
if (this.ignoreMode != null ? !this.ignoreMode.equals(that.ignoreMode) : that.ignoreMode != null) return false;
return this.followSymlinks != null ? this.followSymlinks.equals(that.followSymlinks) : that.followSymlinks == null;
}
@Override
public final int hashCode() {
int result = this.buildArgs != null ? this.buildArgs.hashCode() : 0;
result = 31 * result + (this.file != null ? this.file.hashCode() : 0);
result = 31 * result + (this.invalidation != null ? this.invalidation.hashCode() : 0);
result = 31 * result + (this.networkMode != null ? this.networkMode.hashCode() : 0);
result = 31 * result + (this.platform != null ? this.platform.hashCode() : 0);
result = 31 * result + (this.repositoryName != null ? this.repositoryName.hashCode() : 0);
result = 31 * result + (this.target != null ? this.target.hashCode() : 0);
result = 31 * result + (this.extraHash != null ? this.extraHash.hashCode() : 0);
result = 31 * result + (this.exclude != null ? this.exclude.hashCode() : 0);
result = 31 * result + (this.follow != null ? this.follow.hashCode() : 0);
result = 31 * result + (this.ignoreMode != null ? this.ignoreMode.hashCode() : 0);
result = 31 * result + (this.followSymlinks != null ? this.followSymlinks.hashCode() : 0);
return result;
}
}
}