software.amazon.awscdk.services.lambda.dotnet.BundlingOptions Maven / Gradle / Ivy
package software.amazon.awscdk.services.lambda.dotnet;
/**
* (experimental) Bundling options.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-17T07:57:13.050Z")
@software.amazon.jsii.Jsii(module = software.amazon.awscdk.services.lambda.dotnet.$Module.class, fqn = "@aws-cdk/aws-lambda-dotnet.BundlingOptions")
@software.amazon.jsii.Jsii.Proxy(BundlingOptions.Jsii$Proxy.class)
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public interface BundlingOptions extends software.amazon.jsii.JsiiSerializable {
/**
* (experimental) Specify a custom hash for this asset.
*
* If assetHashType
is set it must
* be set to AssetHashType.CUSTOM
. For consistency, this custom hash will
* be SHA256 hashed and encoded as hex. The resulting hash will be the asset
* hash.
*
* NOTE: the hash is used in order to identify a specific revision of the asset, and
* used for optimizing and caching deployment activities related to this asset such as
* packaging, uploading to Amazon S3, etc. If you chose to customize the hash, you will
* need to make sure it is updated every time the asset changes, or otherwise it is
* possible that some deployments will not be invalidated.
*
* Default: - based on `assetHashType`
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.String getAssetHash() {
return null;
}
/**
* (experimental) Determines how the asset hash is calculated. Assets will get rebuilt and uploaded only if their hash has changed.
*
* If the asset hash is set to OUTPUT
(default), the hash is calculated
* after bundling. This means that any change in the output will cause
* the asset to be invalidated and uploaded. Bear in mind that the
* go binary that is output can be different depending on the environment
* that it was compiled in. If you want to control when the output is changed
* it is recommended that you use immutable build images such as
* public.ecr.aws/bitnami/golang:1.16.3-debian-10-r16
.
*
* If the asset hash is set to SOURCE
, then only changes to the source
* directory will cause the asset to rebuild. If your go project has multiple
* Lambda functions this means that an update to any one function could cause
* all the functions to be rebuilt and uploaded.
*
* Default: - AssetHashType.OUTPUT. If `assetHash` is also specified,
* the default is `CUSTOM`.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.AssetHashType getAssetHashType() {
return null;
}
/**
* (experimental) Command hooks.
*
* Default: - do not run additional commands
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.services.lambda.dotnet.ICommandHooks getCommandHooks() {
return null;
}
/**
* (experimental) A custom bundling Docker image.
*
* Default: - use the Docker image provided by
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable software.amazon.awscdk.DockerImage getDockerImage() {
return null;
}
/**
* (experimental) Environment variables defined when go runs.
*
* Default: - no environment variables are defined.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.Map getEnvironment() {
return null;
}
/**
* (experimental) Force bundling in a Docker container even if local bundling is possible.
*
* Default: - false
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.lang.Boolean getForcedDockerBundling() {
return null;
}
/**
* (experimental) Arguments passed to the dotnet publish
command.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
default @org.jetbrains.annotations.Nullable java.util.List getMsbuildParameters() {
return null;
}
/**
* @return a {@link Builder} of {@link BundlingOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
static Builder builder() {
return new Builder();
}
/**
* A builder for {@link BundlingOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
java.lang.String assetHash;
software.amazon.awscdk.AssetHashType assetHashType;
software.amazon.awscdk.services.lambda.dotnet.ICommandHooks commandHooks;
software.amazon.awscdk.DockerImage dockerImage;
java.util.Map environment;
java.lang.Boolean forcedDockerBundling;
java.util.List msbuildParameters;
/**
* Sets the value of {@link BundlingOptions#getAssetHash}
* @param assetHash Specify a custom hash for this asset.
* If assetHashType
is set it must
* be set to AssetHashType.CUSTOM
. For consistency, this custom hash will
* be SHA256 hashed and encoded as hex. The resulting hash will be the asset
* hash.
*
* NOTE: the hash is used in order to identify a specific revision of the asset, and
* used for optimizing and caching deployment activities related to this asset such as
* packaging, uploading to Amazon S3, etc. If you chose to customize the hash, you will
* need to make sure it is updated every time the asset changes, or otherwise it is
* possible that some deployments will not be invalidated.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder assetHash(java.lang.String assetHash) {
this.assetHash = assetHash;
return this;
}
/**
* Sets the value of {@link BundlingOptions#getAssetHashType}
* @param assetHashType Determines how the asset hash is calculated. Assets will get rebuilt and uploaded only if their hash has changed.
* If the asset hash is set to OUTPUT
(default), the hash is calculated
* after bundling. This means that any change in the output will cause
* the asset to be invalidated and uploaded. Bear in mind that the
* go binary that is output can be different depending on the environment
* that it was compiled in. If you want to control when the output is changed
* it is recommended that you use immutable build images such as
* public.ecr.aws/bitnami/golang:1.16.3-debian-10-r16
.
*
* If the asset hash is set to SOURCE
, then only changes to the source
* directory will cause the asset to rebuild. If your go project has multiple
* Lambda functions this means that an update to any one function could cause
* all the functions to be rebuilt and uploaded.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder assetHashType(software.amazon.awscdk.AssetHashType assetHashType) {
this.assetHashType = assetHashType;
return this;
}
/**
* Sets the value of {@link BundlingOptions#getCommandHooks}
* @param commandHooks Command hooks.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder commandHooks(software.amazon.awscdk.services.lambda.dotnet.ICommandHooks commandHooks) {
this.commandHooks = commandHooks;
return this;
}
/**
* Sets the value of {@link BundlingOptions#getDockerImage}
* @param dockerImage A custom bundling Docker image.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder dockerImage(software.amazon.awscdk.DockerImage dockerImage) {
this.dockerImage = dockerImage;
return this;
}
/**
* Sets the value of {@link BundlingOptions#getEnvironment}
* @param environment Environment variables defined when go runs.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder environment(java.util.Map environment) {
this.environment = environment;
return this;
}
/**
* Sets the value of {@link BundlingOptions#getForcedDockerBundling}
* @param forcedDockerBundling Force bundling in a Docker container even if local bundling is possible.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder forcedDockerBundling(java.lang.Boolean forcedDockerBundling) {
this.forcedDockerBundling = forcedDockerBundling;
return this;
}
/**
* Sets the value of {@link BundlingOptions#getMsbuildParameters}
* @param msbuildParameters Arguments passed to the dotnet publish
command.
* @return {@code this}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder msbuildParameters(java.util.List msbuildParameters) {
this.msbuildParameters = msbuildParameters;
return this;
}
/**
* Builds the configured instance.
* @return a new instance of {@link BundlingOptions}
* @throws NullPointerException if any required attribute was not provided
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public BundlingOptions build() {
return new Jsii$Proxy(this);
}
}
/**
* An implementation for {@link BundlingOptions}
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Internal
final class Jsii$Proxy extends software.amazon.jsii.JsiiObject implements BundlingOptions {
private final java.lang.String assetHash;
private final software.amazon.awscdk.AssetHashType assetHashType;
private final software.amazon.awscdk.services.lambda.dotnet.ICommandHooks commandHooks;
private final software.amazon.awscdk.DockerImage dockerImage;
private final java.util.Map environment;
private final java.lang.Boolean forcedDockerBundling;
private final java.util.List msbuildParameters;
/**
* 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.assetHash = software.amazon.jsii.Kernel.get(this, "assetHash", software.amazon.jsii.NativeType.forClass(java.lang.String.class));
this.assetHashType = software.amazon.jsii.Kernel.get(this, "assetHashType", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.AssetHashType.class));
this.commandHooks = software.amazon.jsii.Kernel.get(this, "commandHooks", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.lambda.dotnet.ICommandHooks.class));
this.dockerImage = software.amazon.jsii.Kernel.get(this, "dockerImage", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.DockerImage.class));
this.environment = software.amazon.jsii.Kernel.get(this, "environment", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class)));
this.forcedDockerBundling = software.amazon.jsii.Kernel.get(this, "forcedDockerBundling", software.amazon.jsii.NativeType.forClass(java.lang.Boolean.class));
this.msbuildParameters = software.amazon.jsii.Kernel.get(this, "msbuildParameters", software.amazon.jsii.NativeType.listOf(software.amazon.jsii.NativeType.forClass(java.lang.String.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.assetHash = builder.assetHash;
this.assetHashType = builder.assetHashType;
this.commandHooks = builder.commandHooks;
this.dockerImage = builder.dockerImage;
this.environment = builder.environment;
this.forcedDockerBundling = builder.forcedDockerBundling;
this.msbuildParameters = builder.msbuildParameters;
}
@Override
public final java.lang.String getAssetHash() {
return this.assetHash;
}
@Override
public final software.amazon.awscdk.AssetHashType getAssetHashType() {
return this.assetHashType;
}
@Override
public final software.amazon.awscdk.services.lambda.dotnet.ICommandHooks getCommandHooks() {
return this.commandHooks;
}
@Override
public final software.amazon.awscdk.DockerImage getDockerImage() {
return this.dockerImage;
}
@Override
public final java.util.Map getEnvironment() {
return this.environment;
}
@Override
public final java.lang.Boolean getForcedDockerBundling() {
return this.forcedDockerBundling;
}
@Override
public final java.util.List getMsbuildParameters() {
return this.msbuildParameters;
}
@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.getAssetHash() != null) {
data.set("assetHash", om.valueToTree(this.getAssetHash()));
}
if (this.getAssetHashType() != null) {
data.set("assetHashType", om.valueToTree(this.getAssetHashType()));
}
if (this.getCommandHooks() != null) {
data.set("commandHooks", om.valueToTree(this.getCommandHooks()));
}
if (this.getDockerImage() != null) {
data.set("dockerImage", om.valueToTree(this.getDockerImage()));
}
if (this.getEnvironment() != null) {
data.set("environment", om.valueToTree(this.getEnvironment()));
}
if (this.getForcedDockerBundling() != null) {
data.set("forcedDockerBundling", om.valueToTree(this.getForcedDockerBundling()));
}
if (this.getMsbuildParameters() != null) {
data.set("msbuildParameters", om.valueToTree(this.getMsbuildParameters()));
}
final com.fasterxml.jackson.databind.node.ObjectNode struct = com.fasterxml.jackson.databind.node.JsonNodeFactory.instance.objectNode();
struct.set("fqn", om.valueToTree("@aws-cdk/aws-lambda-dotnet.BundlingOptions"));
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;
BundlingOptions.Jsii$Proxy that = (BundlingOptions.Jsii$Proxy) o;
if (this.assetHash != null ? !this.assetHash.equals(that.assetHash) : that.assetHash != null) return false;
if (this.assetHashType != null ? !this.assetHashType.equals(that.assetHashType) : that.assetHashType != null) return false;
if (this.commandHooks != null ? !this.commandHooks.equals(that.commandHooks) : that.commandHooks != null) return false;
if (this.dockerImage != null ? !this.dockerImage.equals(that.dockerImage) : that.dockerImage != null) return false;
if (this.environment != null ? !this.environment.equals(that.environment) : that.environment != null) return false;
if (this.forcedDockerBundling != null ? !this.forcedDockerBundling.equals(that.forcedDockerBundling) : that.forcedDockerBundling != null) return false;
return this.msbuildParameters != null ? this.msbuildParameters.equals(that.msbuildParameters) : that.msbuildParameters == null;
}
@Override
public final int hashCode() {
int result = this.assetHash != null ? this.assetHash.hashCode() : 0;
result = 31 * result + (this.assetHashType != null ? this.assetHashType.hashCode() : 0);
result = 31 * result + (this.commandHooks != null ? this.commandHooks.hashCode() : 0);
result = 31 * result + (this.dockerImage != null ? this.dockerImage.hashCode() : 0);
result = 31 * result + (this.environment != null ? this.environment.hashCode() : 0);
result = 31 * result + (this.forcedDockerBundling != null ? this.forcedDockerBundling.hashCode() : 0);
result = 31 * result + (this.msbuildParameters != null ? this.msbuildParameters.hashCode() : 0);
return result;
}
}
}