public static final class NodejsFunctionProps.Builder
extends java.lang.Object
NodejsFunctionProps
Constructor and Description |
---|
Builder() |
public NodejsFunctionProps.Builder awsSdkConnectionReuse(java.lang.Boolean awsSdkConnectionReuse)
NodejsFunctionProps.getAwsSdkConnectionReuse()
awsSdkConnectionReuse
- Whether to automatically reuse TCP connections when working with the AWS SDK for JavaScript.
This sets the AWS_NODEJS_CONNECTION_REUSE_ENABLED
environment variable
to 1
.this
public NodejsFunctionProps.Builder bundling(BundlingOptions bundling)
NodejsFunctionProps.getBundling()
bundling
- Bundling options.this
public NodejsFunctionProps.Builder depsLockFilePath(java.lang.String depsLockFilePath)
NodejsFunctionProps.getDepsLockFilePath()
depsLockFilePath
- The path to the dependencies lock file (`yarn.lock` or `package-lock.json`).
This will be used as the source for the volume mounted in the Docker
container.
Modules specified in nodeModules
will be installed using the right
installer (npm
or yarn
) along with this lock file.
this
public NodejsFunctionProps.Builder entry(java.lang.String entry)
NodejsFunctionProps.getEntry()
entry
- Path to the entry file (JavaScript or TypeScript).this
public NodejsFunctionProps.Builder handler(java.lang.String handler)
NodejsFunctionProps.getHandler()
handler
- The name of the exported handler in the entry file.this
public NodejsFunctionProps.Builder projectRoot(java.lang.String projectRoot)
NodejsFunctionProps.getProjectRoot()
projectRoot
- The path to the directory containing project config files (`package.json` or `tsconfig.json`).this
public NodejsFunctionProps.Builder runtime(Runtime runtime)
NodejsFunctionProps.getRuntime()
runtime
- The runtime environment.
Only runtimes of the Node.js family are
supported.this
public NodejsFunctionProps.Builder allowAllOutbound(java.lang.Boolean allowAllOutbound)
FunctionOptions.getAllowAllOutbound()
allowAllOutbound
- Whether to allow the Lambda to send all network traffic.
If set to false, you must individually add traffic rules to allow the
Lambda to connect to network targets.this
public NodejsFunctionProps.Builder allowPublicSubnet(java.lang.Boolean allowPublicSubnet)
FunctionOptions.getAllowPublicSubnet()
allowPublicSubnet
- Lambda Functions in a public subnet can NOT access the internet.
Use this property to acknowledge this limitation and still place the function in a public subnet.this
public NodejsFunctionProps.Builder architecture(Architecture architecture)
FunctionOptions.getArchitecture()
architecture
- The system architectures compatible with this lambda function.this
@Deprecated public NodejsFunctionProps.Builder architectures(java.util.List<? extends Architecture> architectures)
FunctionOptions.getArchitectures()
architectures
- DEPRECATED.this
public NodejsFunctionProps.Builder codeSigningConfig(ICodeSigningConfig codeSigningConfig)
FunctionOptions.getCodeSigningConfig()
codeSigningConfig
- Code signing config associated with this function.this
public NodejsFunctionProps.Builder currentVersionOptions(VersionOptions currentVersionOptions)
FunctionOptions.getCurrentVersionOptions()
currentVersionOptions
- Options for the `lambda.Version` resource automatically created by the `fn.currentVersion` method.this
public NodejsFunctionProps.Builder deadLetterQueue(IQueue deadLetterQueue)
FunctionOptions.getDeadLetterQueue()
deadLetterQueue
- The SQS queue to use if DLQ is enabled.
If SNS topic is desired, specify deadLetterTopic
property instead.this
public NodejsFunctionProps.Builder deadLetterQueueEnabled(java.lang.Boolean deadLetterQueueEnabled)
FunctionOptions.getDeadLetterQueueEnabled()
deadLetterQueueEnabled
- Enabled DLQ.
If deadLetterQueue
is undefined,
an SQS queue with default options will be defined for your Function.this
public NodejsFunctionProps.Builder deadLetterTopic(ITopic deadLetterTopic)
FunctionOptions.getDeadLetterTopic()
deadLetterTopic
- The SNS topic to use as a DLQ.
Note that if deadLetterQueueEnabled
is set to true
, an SQS queue will be created
rather than an SNS topic. Using an SNS topic as a DLQ requires this property to be set explicitly.this
public NodejsFunctionProps.Builder description(java.lang.String description)
FunctionOptions.getDescription()
description
- A description of the function.this
public NodejsFunctionProps.Builder environment(java.util.Map<java.lang.String,java.lang.String> environment)
FunctionOptions.getEnvironment()
environment
- Key-value pairs that Lambda caches and makes available for your Lambda functions.
Use environment variables to apply configuration changes, such
as test and production environment configurations, without changing your
Lambda function source code.this
public NodejsFunctionProps.Builder environmentEncryption(IKey environmentEncryption)
FunctionOptions.getEnvironmentEncryption()
environmentEncryption
- The AWS KMS key that's used to encrypt your function's environment variables.this
public NodejsFunctionProps.Builder ephemeralStorageSize(Size ephemeralStorageSize)
FunctionOptions.getEphemeralStorageSize()
ephemeralStorageSize
- The size of the function’s /tmp directory in MiB.this
public NodejsFunctionProps.Builder events(java.util.List<? extends IEventSource> events)
FunctionOptions.getEvents()
events
- Event sources for this function.
You can also add event sources using addEventSource
.this
public NodejsFunctionProps.Builder filesystem(FileSystem filesystem)
FunctionOptions.getFilesystem()
filesystem
- The filesystem configuration for the lambda function.this
public NodejsFunctionProps.Builder functionName(java.lang.String functionName)
FunctionOptions.getFunctionName()
functionName
- A name for the function.this
public NodejsFunctionProps.Builder initialPolicy(java.util.List<? extends PolicyStatement> initialPolicy)
FunctionOptions.getInitialPolicy()
initialPolicy
- Initial policy statements to add to the created Lambda Role.
You can call addToRolePolicy
to the created lambda to add statements post creation.this
public NodejsFunctionProps.Builder insightsVersion(LambdaInsightsVersion insightsVersion)
FunctionOptions.getInsightsVersion()
insightsVersion
- Specify the version of CloudWatch Lambda insights to use for monitoring.this
public NodejsFunctionProps.Builder layers(java.util.List<? extends ILayerVersion> layers)
FunctionOptions.getLayers()
layers
- A list of layers to add to the function's execution environment.
You can configure your Lambda function to pull in
additional code during initialization in the form of layers. Layers are packages of libraries or other dependencies
that can be used by multiple functions.this
public NodejsFunctionProps.Builder logRetention(RetentionDays logRetention)
FunctionOptions.getLogRetention()
logRetention
- 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
.this
public NodejsFunctionProps.Builder logRetentionRetryOptions(LogRetentionRetryOptions logRetentionRetryOptions)
FunctionOptions.getLogRetentionRetryOptions()
logRetentionRetryOptions
- When log retention is specified, a custom resource attempts to create the CloudWatch log group.
These options control the retry policy when interacting with CloudWatch APIs.this
public NodejsFunctionProps.Builder logRetentionRole(IRole logRetentionRole)
FunctionOptions.getLogRetentionRole()
logRetentionRole
- The IAM role for the Lambda function associated with the custom resource that sets the retention policy.this
public NodejsFunctionProps.Builder memorySize(java.lang.Number memorySize)
FunctionOptions.getMemorySize()
memorySize
- The amount of memory, in MB, that is allocated to your Lambda function.
Lambda uses this value to proportionally allocate the amount of CPU
power. For more information, see Resource Model in the AWS Lambda
Developer Guide.this
public NodejsFunctionProps.Builder profiling(java.lang.Boolean profiling)
FunctionOptions.getProfiling()
profiling
- Enable profiling.this
public NodejsFunctionProps.Builder profilingGroup(IProfilingGroup profilingGroup)
FunctionOptions.getProfilingGroup()
profilingGroup
- Profiling Group.this
public NodejsFunctionProps.Builder reservedConcurrentExecutions(java.lang.Number reservedConcurrentExecutions)
FunctionOptions.getReservedConcurrentExecutions()
reservedConcurrentExecutions
- The maximum of concurrent executions you want to reserve for the function.this
public NodejsFunctionProps.Builder role(IRole role)
FunctionOptions.getRole()
role
- Lambda execution role.
This is the role that will be assumed by the function upon execution.
It controls the permissions that the function will have. The Role must
be assumable by the 'lambda.amazonaws.com' service principal.
The default Role automatically has permissions granted for Lambda execution. If you provide a Role, you must add the relevant AWS managed policies yourself.
The relevant managed policies are "service-role/AWSLambdaBasicExecutionRole" and "service-role/AWSLambdaVPCAccessExecutionRole".
this
@Deprecated public NodejsFunctionProps.Builder securityGroup(ISecurityGroup securityGroup)
FunctionOptions.getSecurityGroup()
securityGroup
- What security group to associate with the Lambda's network interfaces. This property is being deprecated, consider using securityGroups instead.
Only used if 'vpc' is supplied.
Use securityGroups property instead. Function constructor will throw an error if both are specified.
this
public NodejsFunctionProps.Builder securityGroups(java.util.List<? extends ISecurityGroup> securityGroups)
FunctionOptions.getSecurityGroups()
securityGroups
- The list of security groups to associate with the Lambda's network interfaces.
Only used if 'vpc' is supplied.this
public NodejsFunctionProps.Builder timeout(Duration timeout)
FunctionOptions.getTimeout()
timeout
- The function execution time (in seconds) after which Lambda terminates the function.
Because the execution time affects cost, set this value
based on the function's expected execution time.this
public NodejsFunctionProps.Builder tracing(Tracing tracing)
FunctionOptions.getTracing()
tracing
- Enable AWS X-Ray Tracing for Lambda Function.this
public NodejsFunctionProps.Builder vpc(IVpc vpc)
FunctionOptions.getVpc()
vpc
- VPC network to place Lambda network interfaces.
Specify this if the Lambda function needs to access resources in a VPC.this
public NodejsFunctionProps.Builder vpcSubnets(SubnetSelection vpcSubnets)
FunctionOptions.getVpcSubnets()
vpcSubnets
- Where to place the network interfaces within the VPC.
Only used if 'vpc' is supplied. Note: internet access for Lambdas
requires a NAT gateway, so picking Public subnets is not allowed.this
public NodejsFunctionProps.Builder maxEventAge(Duration maxEventAge)
EventInvokeConfigOptions.getMaxEventAge()
maxEventAge
- The maximum age of a request that Lambda sends to a function for processing.
Minimum: 60 seconds
Maximum: 6 hoursthis
public NodejsFunctionProps.Builder onFailure(IDestination onFailure)
EventInvokeConfigOptions.getOnFailure()
onFailure
- The destination for failed invocations.this
public NodejsFunctionProps.Builder onSuccess(IDestination onSuccess)
EventInvokeConfigOptions.getOnSuccess()
onSuccess
- The destination for successful invocations.this
public NodejsFunctionProps.Builder retryAttempts(java.lang.Number retryAttempts)
EventInvokeConfigOptions.getRetryAttempts()
retryAttempts
- The maximum number of times to retry when the function returns an error.
Minimum: 0
Maximum: 2this
public NodejsFunctionProps build()
NodejsFunctionProps
java.lang.NullPointerException
- if any required attribute was not provided