Header menu logo FsCDK

FunctionBuilder Type

Constructors

Constructor Description

FunctionBuilder(name)

Full Usage: FunctionBuilder(name)

Parameters:
    name : string

Returns: FunctionBuilder
name : string
Returns: FunctionBuilder

Instance members

Instance member Description

addEventSource eventSource

Full Usage: addEventSource eventSource

Parameters:
Returns: FunctionConfig

Adds a single event source to the internal event sources list.

Prefer using event unless you need to target the internal list directly.

eventSource : IEventSource

Event source.

Returns: FunctionConfig

addEventSourceMapping eventSourceMapping

Full Usage: addEventSourceMapping eventSourceMapping

Parameters:
Returns: FunctionConfig

Adds a single event source mapping.

eventSourceMapping : string * IEventSourceMappingOptions

Tuple of construct id and mapping options.

Returns: FunctionConfig

addEventSourceMappings eventSourceMapping

Full Usage: addEventSourceMappings eventSourceMapping

Parameters:
Returns: FunctionConfig

Sets the event source mappings list to the provided list.

eventSourceMapping : (string * IEventSourceMappingOptions) list

List of tuples of construct id and mapping options.

Returns: FunctionConfig

addEventSources eventSource

Full Usage: addEventSources eventSource

Parameters:
Returns: FunctionConfig

Sets the event source mappings list (used internally) to the provided list.

This internal list is separate from the public events list used by CDK FunctionProps.Events. Prefer using events/event unless you need explicit control here.

eventSource : IEventSource list

List of event sources.

Returns: FunctionConfig

addPermission permissions

Full Usage: addPermission permissions

Parameters:
Returns: FunctionConfig

Adds a single permission to the permissions list.

permissions : IPermission

Permission to add.

Returns: FunctionConfig

addPermissions permissions

Full Usage: addPermissions permissions

Parameters:
    permissions : IPermission list - List of permissions.

Returns: FunctionConfig

Sets the permissions list to the provided list (replaces existing).

permissions : IPermission list

List of permissions.

Returns: FunctionConfig

addRolePolicyStatement statements

Full Usage: addRolePolicyStatement statements

Parameters:
Returns: FunctionConfig

Adds a single role policy statement.

statements : PolicyStatement

Policy statement.

Returns: FunctionConfig

addRolePolicyStatements statements

Full Usage: addRolePolicyStatements statements

Parameters:
Returns: FunctionConfig

Sets the role policy statements list to the provided list (replaces existing).

statements : PolicyStatement list

List of policy statements.

Returns: FunctionConfig

addUrlOption options

Full Usage: addUrlOption options

Parameters:
Returns: FunctionConfig

Adds a single function URL options item to the options list.

options : IFunctionUrlOptions

Function URL options.

Returns: FunctionConfig

addUrlOptions options

Full Usage: addUrlOptions options

Parameters:
Returns: FunctionConfig

Sets the function URL options list (replaces any previously set options).

options : IFunctionUrlOptions list

List of function URL options.

Returns: FunctionConfig

adotInstrumentation adot

Full Usage: adotInstrumentation adot

Parameters:
Returns: FunctionConfig

Enables AWS Distro for OpenTelemetry (ADOT) instrumentation for the Lambda function.

adot : IAdotInstrumentationConfig

ADOT instrumentation configuration.

Returns: FunctionConfig

allowAllIpv6Outbound allow

Full Usage: allowAllIpv6Outbound allow

Parameters:
    allow : bool - True to allow all IPv6 outbound traffic.

Returns: FunctionConfig

Allows all outbound IPv6 traffic for the Lambda function.

allow : bool

True to allow all IPv6 outbound traffic.

Returns: FunctionConfig

allowAllOutbound allow

Full Usage: allowAllOutbound allow

Parameters:
    allow : bool - True to allow all outbound traffic.

Returns: FunctionConfig

Allows the Lambda function to make outbound network calls.

allow : bool

True to allow all outbound traffic.

Returns: FunctionConfig

allowPublicSubnet allow

Full Usage: allowPublicSubnet allow

Parameters:
    allow : bool - True to allow placement in public subnets.

Returns: FunctionConfig

Allows the Lambda function to be placed in public subnets.

allow : bool

True to allow placement in public subnets.

Returns: FunctionConfig

applicationLogLevelV2 level

Full Usage: applicationLogLevelV2 level

Parameters:
Returns: FunctionConfig

Sets the application log level for the function (CloudWatch Logs V2).

level : ApplicationLogLevel

Application log level.

Returns: FunctionConfig

architecture arch

Full Usage: architecture arch

Parameters:
Returns: FunctionConfig

Sets the CPU architecture for the function (e.g., x86_64 or arm64).

arch : Architecture

CPU architecture.

Returns: FunctionConfig

asyncInvokeOption options

Full Usage: asyncInvokeOption options

Parameters:
Returns: FunctionConfig

Adds a single asynchronous invocation option.

options : IEventInvokeConfigOptions

Async invoke option.

Returns: FunctionConfig

asyncInvokeOptions options

Full Usage: asyncInvokeOptions options

Parameters:
Returns: FunctionConfig

Sets the asynchronous invocation options list (replaces existing).

options : IEventInvokeConfigOptions list

List of async invoke configuration options.

Returns: FunctionConfig

autoAddPowertools value

Full Usage: autoAddPowertools value

Parameters:
    value : bool - True to auto-add Powertools, false to skip.

Returns: FunctionConfig

Controls automatic Lambda Powertools layer addition. Default: true (Yan Cui recommendation). Set to false to disable Powertools auto-addition.

value : bool

True to auto-add Powertools, false to skip.

Returns: FunctionConfig

autoCreateDLQ value

Full Usage: autoCreateDLQ value

Parameters:
    value : bool - True to enable, false to disable automatic DLQ creation.

Returns: FunctionConfig

Controls automatic DLQ creation. Default: true (Yan Cui recommendation). Set to false to disable auto-DLQ creation.

value : bool

True to enable, false to disable automatic DLQ creation.

Returns: FunctionConfig

code path

Full Usage: code path

Parameters:
    path : Code - The Code object.

Returns: FunctionConfig

Sets the code source from a Code object.

path : Code

The Code object.

Returns: FunctionConfig

code path options

Full Usage: code path options

Parameters:
    path : string - The path to the code asset.
    options : AssetOptions - Asset options.

Returns: FunctionConfig

Sets the code source from a local asset with options.

path : string

The path to the code asset.

options : AssetOptions

Asset options.

Returns: FunctionConfig

code path

Full Usage: code path

Parameters:
    path : string - The path to the code asset.

Returns: FunctionConfig

Sets the code source from a local asset.

path : string

The path to the code asset.

Returns: FunctionConfig

codeSigningConfig csc

Full Usage: codeSigningConfig csc

Parameters:
Returns: FunctionConfig

Attaches a code signing configuration to the function.

csc : ICodeSigningConfig

Code signing configuration.

Returns: FunctionConfig

this.Combine

Full Usage: this.Combine

Parameters:
Returns: FunctionConfig
state1 : FunctionConfig
state2 : FunctionConfig
Returns: FunctionConfig

constructId id

Full Usage: constructId id

Parameters:
    id : string - The construct ID.

Returns: FunctionConfig

Sets the construct ID for the Lambda function.

id : string

The construct ID.

Returns: FunctionConfig

currentVersionOptions options

Full Usage: currentVersionOptions options

Parameters:
Returns: FunctionConfig

Configures options for the current version of the function.

options : IVersionOptions

Version options.

Returns: FunctionConfig

deadLetterQueue queue

Full Usage: deadLetterQueue queue

Parameters:
    queue : IQueue - Dead-letter queue.

Returns: FunctionConfig

Sets an SQS dead-letter queue for asynchronous invocation failures.

queue : IQueue

Dead-letter queue.

Returns: FunctionConfig

deadLetterQueueEnabled value

Full Usage: deadLetterQueueEnabled value

Parameters:
    value : bool - True to enable the DLQ, false to disable.

Returns: FunctionConfig

Enables or disables use of the configured dead-letter queue.

value : bool

True to enable the DLQ, false to disable.

Returns: FunctionConfig

deadLetterTopic topic

Full Usage: deadLetterTopic topic

Parameters:
Returns: FunctionConfig

Sets a dead-letter SNS topic for asynchronous invocation failures.

topic : ITopic

SNS topic.

Returns: FunctionConfig

this.Delay

Full Usage: this.Delay

Parameters:
Returns: FunctionConfig
Modifiers: inline
f : unit -> FunctionConfig
Returns: FunctionConfig

description desc

Full Usage: description desc

Parameters:
    desc : string - The function description.

Returns: FunctionConfig

Sets the description for the Lambda function.

desc : string

The function description.

Returns: FunctionConfig

dockerImageCode directory ?cmd ?entrypoint

Full Usage: dockerImageCode directory ?cmd ?entrypoint

Parameters:
    directory : string - The directory containing the Dockerfile.
    ?cmd : string[] - Optional CMD for the Docker image.
    ?entrypoint : string[] - Optional ENTRYPOINT for the Docker image.

Returns: FunctionConfig

Sets the code source from a Docker image.

directory : string

The directory containing the Dockerfile.

?cmd : string[]

Optional CMD for the Docker image.

?entrypoint : string[]

Optional ENTRYPOINT for the Docker image.

Returns: FunctionConfig

envVar key value

Full Usage: envVar key value

Parameters:
    key : string - The environment variable key.
    value : string - The environment variable value.

Returns: FunctionConfig

Adds a single environment variable.

key : string

The environment variable key.

value : string

The environment variable value.

Returns: FunctionConfig

environment env

Full Usage: environment env

Parameters:
    env : (string * string) list - List of key-value pairs for environment variables.

Returns: FunctionConfig

Sets environment variables for the Lambda function.

env : (string * string) list

List of key-value pairs for environment variables.

Returns: FunctionConfig

environmentEncryption key

Full Usage: environmentEncryption key

Parameters:
    key : IKey - KMS key for environment encryption.

Returns: FunctionConfig

Sets a KMS key to encrypt environment variables.

key : IKey

KMS key for environment encryption.

Returns: FunctionConfig

ephemeralStorageSize sizeInMB

Full Usage: ephemeralStorageSize sizeInMB

Parameters:
    sizeInMB : int - Storage size in megabytes (512-10240).

Returns: FunctionConfig

Sets the ephemeral storage size for the Lambda function in MB. Default: 512 MB (free tier). Valid range: 512-10240 MB. Cost optimization: Only increase if needed for /tmp storage.

sizeInMB : int

Storage size in megabytes (512-10240).

Returns: FunctionConfig

event eventSource

Full Usage: event eventSource

Parameters:
Returns: FunctionConfig

Adds a single event source to the function.

eventSource : IEventSource

Event source.

Returns: FunctionConfig

events eventSource

Full Usage: events eventSource

Parameters:
Returns: FunctionConfig

Adds a list of event sources to the function.

eventSource : IEventSource list

List of event sources.

Returns: FunctionConfig

fileSystem fileSystem

Full Usage: fileSystem fileSystem

Parameters:
    fileSystem : FileSystem - The file system configuration.

Returns: FunctionConfig

Attaches a file system configuration (e.g., EFS) to the function.

fileSystem : FileSystem

The file system configuration.

Returns: FunctionConfig

this.For

Full Usage: this.For

Parameters:
Returns: FunctionConfig
Modifiers: inline
config : FunctionConfig
f : unit -> FunctionConfig
Returns: FunctionConfig

handler handler

Full Usage: handler handler

Parameters:
    handler : string - The handler name (e.g., "index.handler").

Returns: FunctionConfig

Sets the handler for the Lambda function.

handler : string

The handler name (e.g., "index.handler").

Returns: FunctionConfig

initialPolicy statements

Full Usage: initialPolicy statements

Parameters:
Returns: FunctionConfig

Sets initial IAM policy statements to attach to the execution role.

statements : PolicyStatement list

List of policy statements.

Returns: FunctionConfig

initialPolicyStatement statement

Full Usage: initialPolicyStatement statement

Parameters:
Returns: FunctionConfig

Adds a single IAM policy statement to the execution role.

statement : PolicyStatement

Policy statement.

Returns: FunctionConfig

inlineCode code

Full Usage: inlineCode code

Parameters:
    code : string - The inline code string.

Returns: FunctionConfig

Sets inline code for the Lambda function.

code : string

The inline code string.

Returns: FunctionConfig

insightsVersion version

Full Usage: insightsVersion version

Parameters:
Returns: FunctionConfig

Sets the Lambda Insights version to enable enhanced monitoring.

version : LambdaInsightsVersion

Insights layer version.

Returns: FunctionConfig

ipv6AllowedForDualStack allow

Full Usage: ipv6AllowedForDualStack allow

Parameters:
    allow : bool - True to allow IPv6 for dual-stack.

Returns: FunctionConfig

Allows IPv6 for dual-stack networking.

allow : bool

True to allow IPv6 for dual-stack.

Returns: FunctionConfig

layer layer

Full Usage: layer layer

Parameters:
Returns: FunctionConfig

Adds a single Lambda layer to the function.

layer : ILayerVersion

Layer version to add.

Returns: FunctionConfig

layers layers

Full Usage: layers layers

Parameters:
Returns: FunctionConfig

Adds multiple Lambda layers to the function in one call.

layers : ILayerVersion list

List of layer versions.

Returns: FunctionConfig

logGroup logGroup

Full Usage: logGroup logGroup

Parameters:
Returns: FunctionConfig

Provides a pre-created CloudWatch Log Group to the function.

logGroup : ILogGroup

Log group to use.

Returns: FunctionConfig

logRetentionRetryOptions opts

Full Usage: logRetentionRetryOptions opts

Parameters:
Returns: FunctionConfig

Configures retry options for CloudWatch Log retention.

opts : ILogRetentionRetryOptions

Log retention retry options.

Returns: FunctionConfig

logRetentionRole role

Full Usage: logRetentionRole role

Parameters:
    role : IRole - IAM role used by the log retention resource.

Returns: FunctionConfig

Sets the IAM role for the log retention custom resource.

role : IRole

IAM role used by the log retention resource.

Returns: FunctionConfig

loggingFormat format

Full Usage: loggingFormat format

Parameters:
Returns: FunctionConfig

Sets the logging format for CloudWatch Logs (JSON or TEXT).

format : LoggingFormat

Logging format.

Returns: FunctionConfig

maxEventAge age

Full Usage: maxEventAge age

Parameters:
    age : Duration - Maximum event age as a duration.

Returns: FunctionConfig

Sets the maximum event age for asynchronous invocations.

age : Duration

Maximum event age as a duration.

Returns: FunctionConfig

memorySize mb

Full Usage: memorySize mb

Parameters:
    mb : int - The memory size in megabytes.

Returns: FunctionConfig

Sets the memory allocation for the Lambda function.

mb : int

The memory size in megabytes.

Returns: FunctionConfig

onFailure destination

Full Usage: onFailure destination

Parameters:
Returns: FunctionConfig

Sets an asynchronous failure destination (EventInvokeConfig).

destination : IDestination

Failure destination.

Returns: FunctionConfig

onSuccess destination

Full Usage: onSuccess destination

Parameters:
Returns: FunctionConfig

Sets an asynchronous success destination (EventInvokeConfig).

destination : IDestination

Success destination.

Returns: FunctionConfig

paramsAndSecrets ps

Full Usage: paramsAndSecrets ps

Parameters:
Returns: FunctionConfig

Configures the Parameters and Secrets extension layer.

ps : ParamsAndSecretsLayerVersion

Params and Secrets layer version.

Returns: FunctionConfig

profiling enabled

Full Usage: profiling enabled

Parameters:
    enabled : bool - True to enable profiling.

Returns: FunctionConfig

Enables or disables CodeGuru Profiler profiling.

enabled : bool

True to enable profiling.

Returns: FunctionConfig

profilingGroup group

Full Usage: profilingGroup group

Parameters:
Returns: FunctionConfig

Associates a CodeGuru Profiler profiling group with the function.

group : IProfilingGroup

The profiling group.

Returns: FunctionConfig

recursiveLoop loop

Full Usage: recursiveLoop loop

Parameters:
Returns: FunctionConfig

Configures the function's recursive loop behavior.

loop : RecursiveLoop

Recursive loop configuration.

Returns: FunctionConfig

reservedConcurrentExecutions value

Full Usage: reservedConcurrentExecutions value

Parameters:
    value : int - Reserved concurrency value.

Returns: FunctionConfig

Sets reserved concurrent executions for the function.

value : int

Reserved concurrency value.

Returns: FunctionConfig

retryAttempts value

Full Usage: retryAttempts value

Parameters:
    value : int - Number of retries.

Returns: FunctionConfig

Sets the number of retry attempts for asynchronous invocations.

value : int

Number of retries.

Returns: FunctionConfig

role role

Full Usage: role role

Parameters:
    role : IRole - Execution role.

Returns: FunctionConfig

Sets the IAM role to be used by the function.

role : IRole

Execution role.

Returns: FunctionConfig

this.Run

Full Usage: this.Run

Parameters:
Returns: FunctionSpec
config : FunctionConfig
Returns: FunctionSpec

runtime runtime

Full Usage: runtime runtime

Parameters:
    runtime : Runtime - The Lambda runtime.

Returns: FunctionConfig

Sets the runtime for the Lambda function.

runtime : Runtime

The Lambda runtime.

Returns: FunctionConfig

runtimeManagementMode mode

Full Usage: runtimeManagementMode mode

Parameters:
Returns: FunctionConfig

Configures the runtime management mode for the function.

mode : RuntimeManagementMode

Runtime management mode.

Returns: FunctionConfig

securityGroups sgs

Full Usage: securityGroups sgs

Parameters:
Returns: FunctionConfig

Adds one or more security groups to the function's network configuration.

sgs : ISecurityGroup list

List of security groups.

Returns: FunctionConfig

snapStart snap

Full Usage: snapStart snap

Parameters:
Returns: FunctionConfig

Enables SnapStart for the function (cold start optimization).

snap : SnapStartConf

SnapStart configuration.

Returns: FunctionConfig

systemLogLevelV2 level

Full Usage: systemLogLevelV2 level

Parameters:
Returns: FunctionConfig

Sets the system log level for the function (CloudWatch Logs V2).

level : SystemLogLevel

System log level.

Returns: FunctionConfig

timeout seconds

Full Usage: timeout seconds

Parameters:
    seconds : float - The timeout in seconds.

Returns: FunctionConfig

Sets the timeout for the Lambda function.

seconds : float

The timeout in seconds.

Returns: FunctionConfig

tracing tracing

Full Usage: tracing tracing

Parameters:
    tracing : Tracing - Tracing mode (e.g., ACTIVE, PASS_THROUGH).

Returns: FunctionConfig

Sets the tracing mode for AWS X-Ray.

tracing : Tracing

Tracing mode (e.g., ACTIVE, PASS_THROUGH).

Returns: FunctionConfig

vpc vpc

Full Usage: vpc vpc

Parameters:
    vpc : IVpc - VPC to associate with.

Returns: FunctionConfig

Associates the function with a VPC.

vpc : IVpc

VPC to associate with.

Returns: FunctionConfig

vpcSubnets subnets

Full Usage: vpcSubnets subnets

Parameters:
Returns: FunctionConfig

Specifies which subnets in the VPC the function should use.

subnets : ISubnetSelection

Subnet selection.

Returns: FunctionConfig

xrayEnabled

Full Usage: xrayEnabled

Returns: FunctionConfig

Convenience operation to enable AWS X-Ray tracing (equivalent to tracing Tracing.ACTIVE).

Returns: FunctionConfig

this.Yield

Full Usage: this.Yield

Parameters:
Returns: FunctionConfig
spec : string * IEventSourceMappingOptions
Returns: FunctionConfig

this.Yield

Full Usage: this.Yield

Parameters:
Returns: FunctionConfig
spec : IPermission
Returns: FunctionConfig

this.Yield

Full Usage: this.Yield

Parameters:
Returns: FunctionConfig
event : IEventSource
Returns: FunctionConfig

this.Yield

Full Usage: this.Yield

Parameters:
Returns: FunctionConfig
stmt : PolicyStatement
Returns: FunctionConfig

this.Yield

Full Usage: this.Yield

Parameters:
Returns: FunctionConfig
spec : IFunctionUrlOptions
Returns: FunctionConfig

this.Yield

Full Usage: this.Yield

Parameters:
Returns: FunctionConfig
spec : IEventInvokeConfigOptions
Returns: FunctionConfig

this.Yield

Full Usage: this.Yield

Parameters:
    () : unit

Returns: FunctionConfig
() : unit
Returns: FunctionConfig

this.Zero

Full Usage: this.Zero

Returns: FunctionConfig
Returns: FunctionConfig

Type something to start searching.