com.cloudsnorkel.cdk.turbo_layers.NodejsDependencyPackager Maven / Gradle / Ivy
Show all versions of cdk.turbo-layers Show documentation
package com.cloudsnorkel.cdk.turbo_layers;
/**
* (experimental) Packager for creating Lambda layers for Node.js dependencies in AWS. Nothing is done locally so this doesn't require Docker, doesn't download any packages and doesn't upload huge files to S3.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-07T13:40:26.581Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = com.cloudsnorkel.cdk.turbo_layers.$Module.class, fqn = "@cloudsnorkel/cdk-turbo-layers.NodejsDependencyPackager")
public class NodejsDependencyPackager extends software.constructs.Construct implements software.amazon.awscdk.services.iam.IGrantable, software.amazon.awscdk.services.ec2.IConnectable {
protected NodejsDependencyPackager(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected NodejsDependencyPackager(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public NodejsDependencyPackager(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.Nullable com.cloudsnorkel.cdk.turbo_layers.DependencyPackagerProps 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"), props });
}
/**
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public NodejsDependencyPackager(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id) {
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") });
}
/**
* (experimental) Create a layer for dependencies passed as an argument and installed with npm.
*
* @param id This parameter is required.
* @param libraries This parameter is required.
* @param props
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.lambda.LayerVersion layerFromInline(final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull java.util.List libraries, final @org.jetbrains.annotations.Nullable com.cloudsnorkel.cdk.turbo_layers.LayerProps props) {
return software.amazon.jsii.Kernel.call(this, "layerFromInline", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.lambda.LayerVersion.class), new Object[] { java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(libraries, "libraries is required"), props });
}
/**
* (experimental) Create a layer for dependencies passed as an argument and installed with npm.
*
* @param id This parameter is required.
* @param libraries This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.lambda.LayerVersion layerFromInline(final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull java.util.List libraries) {
return software.amazon.jsii.Kernel.call(this, "layerFromInline", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.lambda.LayerVersion.class), new Object[] { java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(libraries, "libraries is required") });
}
/**
* (experimental) Create a layer for dependencies defined in package.json and (optionally) package-lock.json and installed with npm.
*
* @param id This parameter is required.
* @param path This parameter is required.
* @param props
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.lambda.LayerVersion layerFromPackageJson(final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull java.lang.String path, final @org.jetbrains.annotations.Nullable com.cloudsnorkel.cdk.turbo_layers.LayerProps props) {
return software.amazon.jsii.Kernel.call(this, "layerFromPackageJson", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.lambda.LayerVersion.class), new Object[] { java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(path, "path is required"), props });
}
/**
* (experimental) Create a layer for dependencies defined in package.json and (optionally) package-lock.json and installed with npm.
*
* @param id This parameter is required.
* @param path This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.lambda.LayerVersion layerFromPackageJson(final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull java.lang.String path) {
return software.amazon.jsii.Kernel.call(this, "layerFromPackageJson", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.lambda.LayerVersion.class), new Object[] { java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(path, "path is required") });
}
/**
* (experimental) Create a layer for dependencies defined in package.json and yarn.lock and installed with yarn.
*
* @param id This parameter is required.
* @param path This parameter is required.
* @param props
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.lambda.LayerVersion layerFromYarn(final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull java.lang.String path, final @org.jetbrains.annotations.Nullable com.cloudsnorkel.cdk.turbo_layers.LayerProps props) {
return software.amazon.jsii.Kernel.call(this, "layerFromYarn", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.lambda.LayerVersion.class), new Object[] { java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(path, "path is required"), props });
}
/**
* (experimental) Create a layer for dependencies defined in package.json and yarn.lock and installed with yarn.
*
* @param id This parameter is required.
* @param path This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.lambda.LayerVersion layerFromYarn(final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.NotNull java.lang.String path) {
return software.amazon.jsii.Kernel.call(this, "layerFromYarn", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.lambda.LayerVersion.class), new Object[] { java.util.Objects.requireNonNull(id, "id is required"), java.util.Objects.requireNonNull(path, "path is required") });
}
/**
* (experimental) The network connections associated with this resource.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ec2.Connections getConnections() {
return software.amazon.jsii.Kernel.get(this, "connections", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ec2.Connections.class));
}
/**
* (experimental) The principal to grant permissions to.
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.iam.IPrincipal getGrantPrincipal() {
return software.amazon.jsii.Kernel.get(this, "grantPrincipal", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.iam.IPrincipal.class));
}
/**
* (experimental) A fluent builder for {@link com.cloudsnorkel.cdk.turbo_layers.NodejsDependencyPackager}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
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.Experimental)
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 com.cloudsnorkel.cdk.turbo_layers.DependencyPackagerProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
}
/**
* (experimental) Target Lambda architecture.
*
* Packages will be installed for this architecture so make sure it fits your Lambda functions.
*
* @return {@code this}
* @param architecture Target Lambda architecture. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder architecture(final software.amazon.awscdk.services.lambda.Architecture architecture) {
this.props().architecture(architecture);
return this;
}
/**
* (experimental) Removal policy for logs of image builds.
*
* If deployment fails on the custom resource, try setting this to RemovalPolicy.RETAIN
. This way the CodeBuild logs can still be viewed, and you can see why the build failed.
*
* We try to not leave anything behind when removed. But sometimes a log staying behind is useful.
*
* Default: RemovalPolicy.DESTROY
*
* @return {@code this}
* @param logRemovalPolicy Removal policy for logs of image builds. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder logRemovalPolicy(final software.amazon.awscdk.RemovalPolicy logRemovalPolicy) {
this.props().logRemovalPolicy(logRemovalPolicy);
return this;
}
/**
* (experimental) The number of days log events are kept in CloudWatch Logs.
*
* When updating
* this property, unsetting it doesn't remove the log retention policy. To
* remove the retention policy, set the value to INFINITE
.
*
* Default: logs.RetentionDays.ONE_MONTH
*
* @return {@code this}
* @param logRetention The number of days log events are kept in CloudWatch Logs. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder logRetention(final software.amazon.awscdk.services.logs.RetentionDays logRetention) {
this.props().logRetention(logRetention);
return this;
}
/**
* (experimental) Additional commands to run before installing packages.
*
* Use this to authenticate your package repositories like CodeArtifact.
*
* Default: []
*
* @return {@code this}
* @param preinstallCommands Additional commands to run before installing packages. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder preinstallCommands(final java.util.List preinstallCommands) {
this.props().preinstallCommands(preinstallCommands);
return this;
}
/**
* (experimental) Target Lambda runtime.
*
* Packages will be installed for this runtime so make sure it fits your Lambda functions.
*
* @return {@code this}
* @param runtime Target Lambda runtime. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder runtime(final software.amazon.awscdk.services.lambda.Runtime runtime) {
this.props().runtime(runtime);
return this;
}
/**
* (experimental) VPC subnets used for packager.
*
* Default: default subnets, if VPC is used
*
* @return {@code this}
* @param subnetSelection VPC subnets used for packager. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder subnetSelection(final software.amazon.awscdk.services.ec2.SubnetSelection subnetSelection) {
this.props().subnetSelection(subnetSelection);
return this;
}
/**
* (experimental) Type of dependency packager.
*
* Use Lambda for speed and CodeBuild for complex dependencies that require building native extensions.
*
* Default: {@link DependencyPackagerType.LAMBDA}
*
* @return {@code this}
* @param type Type of dependency packager. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder type(final com.cloudsnorkel.cdk.turbo_layers.DependencyPackagerType type) {
this.props().type(type);
return this;
}
/**
* (experimental) VPC used for packager.
*
* Use this if your package repositories are only available from within a VPC.
*
* Default: no VPC
*
* @return {@code this}
* @param vpc VPC used for packager. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder vpc(final software.amazon.awscdk.services.ec2.IVpc vpc) {
this.props().vpc(vpc);
return this;
}
/**
* @return a newly built instance of {@link com.cloudsnorkel.cdk.turbo_layers.NodejsDependencyPackager}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public com.cloudsnorkel.cdk.turbo_layers.NodejsDependencyPackager build() {
return new com.cloudsnorkel.cdk.turbo_layers.NodejsDependencyPackager(
this.scope,
this.id,
this.props != null ? this.props.build() : null
);
}
private com.cloudsnorkel.cdk.turbo_layers.DependencyPackagerProps.Builder props() {
if (this.props == null) {
this.props = new com.cloudsnorkel.cdk.turbo_layers.DependencyPackagerProps.Builder();
}
return this.props;
}
}
}