org.cdk8s.image.Image Maven / Gradle / Ivy
Show all versions of cdk8s-image Show documentation
package org.cdk8s.image;
/**
* Represents a docker image built during synthesis from a context directory (dir
) with a Dockerfile
.
*
* The image will be built using docker build
and then pushed through docker push
. The URL of the pushed image can be accessed through image.url
.
*
* If you push to a registry other than docker hub, you can specify the registry
* URL through the registry
option.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.96.0 (build 921e240)", date = "2024-03-23T12:14:03.108Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@software.amazon.jsii.Jsii(module = org.cdk8s.image.$Module.class, fqn = "cdk8s-image.Image")
public class Image extends software.constructs.Construct {
protected Image(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected Image(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 Image(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull org.cdk8s.image.ImageProps 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") });
}
/**
* The image URL to use in order to pull this instance of the image.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public @org.jetbrains.annotations.NotNull java.lang.String getUrl() {
return software.amazon.jsii.Kernel.get(this, "url", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
}
/**
* A fluent builder for {@link org.cdk8s.image.Image}.
*/
@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 org.cdk8s.image.ImageProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
this.props = new org.cdk8s.image.ImageProps.Builder();
}
/**
* The docker build context directory (where Dockerfile
is).
*
* @return {@code this}
* @param dir The docker build context directory (where Dockerfile
is). This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder dir(final java.lang.String dir) {
this.props.dir(dir);
return this;
}
/**
* List of build args to pass to the build action.
*
* @return {@code this}
* @param buildArgs List of build args to pass to the build action. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder buildArgs(final java.util.List extends org.cdk8s.image.BuildArg> buildArgs) {
this.props.buildArgs(buildArgs);
return this;
}
/**
* Path to Dockerfile.
*
* @return {@code this}
* @param file Path to Dockerfile. 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;
}
/**
* Name for the image.
*
* Docker convention is {registry_name}/{name}:{tag}
* Visit https://docs.docker.com/engine/reference/commandline/tag/ for more information
*
* Default: - auto-generated name
*
* @return {@code this}
* @param name Name for the image. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder name(final java.lang.String name) {
this.props.name(name);
return this;
}
/**
* Set to specify the target platform for the build output, (for example, linux/amd64, linux/arm64, or darwin/amd64).
*
* @return {@code this}
* @param platform Set to specify the target platform for the build output, (for example, linux/amd64, linux/arm64, or darwin/amd64). This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder platform(final java.lang.String platform) {
this.props.platform(platform);
return this;
}
/**
* The registry URL to use.
*
* This will be used as the prefix for the image name.
*
* For example, if you have a local registry listening on port 500, you can set this to localhost:5000
.
*
* Default: "docker.io/library"
*
* @return {@code this}
* @param registry The registry URL to use. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder registry(final java.lang.String registry) {
this.props.registry(registry);
return this;
}
/**
* Tag for the image.
*
* Docker convention is {registry_name}/{name}:{tag}
* Visit https://docs.docker.com/engine/reference/commandline/tag/ for more information
*
* Default: "latest"
*
* @return {@code this}
* @param tag Tag for the image. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
public Builder tag(final java.lang.String tag) {
this.props.tag(tag);
return this;
}
/**
* @return a newly built instance of {@link org.cdk8s.image.Image}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Stable)
@Override
public org.cdk8s.image.Image build() {
return new org.cdk8s.image.Image(
this.scope,
this.id,
this.props.build()
);
}
}
}