Class TriggerFunctionProps.Builder
- All Implemented Interfaces:
software.amazon.jsii.Builder<TriggerFunctionProps>
- Enclosing interface:
TriggerFunctionProps
TriggerFunctionProps
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionallowAllOutbound
(Boolean allowAllOutbound) Sets the value ofFunctionOptions.getAllowAllOutbound()
allowPublicSubnet
(Boolean allowPublicSubnet) Sets the value ofFunctionOptions.getAllowPublicSubnet()
architecture
(Architecture architecture) Sets the value ofFunctionOptions.getArchitecture()
architectures
(List<? extends Architecture> architectures) Deprecated.use `architecture`build()
Builds the configured instance.Sets the value ofFunctionProps.getCode()
codeSigningConfig
(ICodeSigningConfig codeSigningConfig) Sets the value ofFunctionOptions.getCodeSigningConfig()
currentVersionOptions
(VersionOptions currentVersionOptions) Sets the value ofFunctionOptions.getCurrentVersionOptions()
deadLetterQueue
(IQueue deadLetterQueue) Sets the value ofFunctionOptions.getDeadLetterQueue()
deadLetterQueueEnabled
(Boolean deadLetterQueueEnabled) Sets the value ofFunctionOptions.getDeadLetterQueueEnabled()
deadLetterTopic
(ITopic deadLetterTopic) Sets the value ofFunctionOptions.getDeadLetterTopic()
description
(String description) Sets the value ofFunctionOptions.getDescription()
environment
(Map<String, String> environment) Sets the value ofFunctionOptions.getEnvironment()
environmentEncryption
(IKey environmentEncryption) Sets the value ofFunctionOptions.getEnvironmentEncryption()
ephemeralStorageSize
(Size ephemeralStorageSize) Sets the value ofFunctionOptions.getEphemeralStorageSize()
events
(List<? extends IEventSource> events) Sets the value ofFunctionOptions.getEvents()
executeAfter
(List<? extends software.constructs.Construct> executeAfter) Sets the value ofTriggerOptions.getExecuteAfter()
executeBefore
(List<? extends software.constructs.Construct> executeBefore) Sets the value ofTriggerOptions.getExecuteBefore()
executeOnHandlerChange
(Boolean executeOnHandlerChange) Sets the value ofTriggerOptions.getExecuteOnHandlerChange()
filesystem
(FileSystem filesystem) Sets the value ofFunctionOptions.getFilesystem()
functionName
(String functionName) Sets the value ofFunctionOptions.getFunctionName()
Sets the value ofFunctionProps.getHandler()
initialPolicy
(List<? extends PolicyStatement> initialPolicy) Sets the value ofFunctionOptions.getInitialPolicy()
insightsVersion
(LambdaInsightsVersion insightsVersion) Sets the value ofFunctionOptions.getInsightsVersion()
layers
(List<? extends ILayerVersion> layers) Sets the value ofFunctionOptions.getLayers()
logRetention
(RetentionDays logRetention) Sets the value ofFunctionOptions.getLogRetention()
logRetentionRetryOptions
(LogRetentionRetryOptions logRetentionRetryOptions) Sets the value ofFunctionOptions.getLogRetentionRetryOptions()
logRetentionRole
(IRole logRetentionRole) Sets the value ofFunctionOptions.getLogRetentionRole()
maxEventAge
(Duration maxEventAge) Sets the value ofEventInvokeConfigOptions.getMaxEventAge()
memorySize
(Number memorySize) Sets the value ofFunctionOptions.getMemorySize()
onFailure
(IDestination onFailure) Sets the value ofEventInvokeConfigOptions.getOnFailure()
onSuccess
(IDestination onSuccess) Sets the value ofEventInvokeConfigOptions.getOnSuccess()
Sets the value ofFunctionOptions.getProfiling()
profilingGroup
(IProfilingGroup profilingGroup) Sets the value ofFunctionOptions.getProfilingGroup()
reservedConcurrentExecutions
(Number reservedConcurrentExecutions) Sets the value ofFunctionOptions.getReservedConcurrentExecutions()
retryAttempts
(Number retryAttempts) Sets the value ofEventInvokeConfigOptions.getRetryAttempts()
Sets the value ofFunctionOptions.getRole()
Sets the value ofFunctionProps.getRuntime()
securityGroup
(ISecurityGroup securityGroup) Deprecated.- This property is deprecated, use securityGroups insteadsecurityGroups
(List<? extends ISecurityGroup> securityGroups) Sets the value ofFunctionOptions.getSecurityGroups()
Sets the value ofFunctionOptions.getTimeout()
Sets the value ofFunctionOptions.getTracing()
Sets the value ofFunctionOptions.getVpc()
vpcSubnets
(SubnetSelection vpcSubnets) Sets the value ofFunctionOptions.getVpcSubnets()
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
code
Sets the value ofFunctionProps.getCode()
- Parameters:
code
- The source code of your Lambda function. This parameter is required. You can point to a file in an Amazon Simple Storage Service (Amazon S3) bucket or specify your source code as inline text.- Returns:
this
-
handler
Sets the value ofFunctionProps.getHandler()
- Parameters:
handler
- The name of the method within your code that Lambda calls to execute your function. This parameter is required. The format includes the file name. It can also include namespaces and other qualifiers, depending on the runtime. For more information, see https://docs.aws.amazon.com/lambda/latest/dg/gettingstarted-features.html#gettingstarted-features-programmingmodel.Use
Handler.FROM_IMAGE
when defining a function from a Docker image.NOTE: If you specify your source code as inline text by specifying the ZipFile property within the Code property, specify index.function_name as the handler.
- Returns:
this
-
runtime
Sets the value ofFunctionProps.getRuntime()
- Parameters:
runtime
- The runtime environment for the Lambda function that you are uploading. This parameter is required. For valid values, see the Runtime property in the AWS Lambda Developer Guide.Use
Runtime.FROM_IMAGE
when when defining a function from a Docker image.- Returns:
this
-
allowAllOutbound
Sets the value ofFunctionOptions.getAllowAllOutbound()
- Parameters:
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.- Returns:
this
-
allowPublicSubnet
Sets the value ofFunctionOptions.getAllowPublicSubnet()
- Parameters:
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.- Returns:
this
-
architecture
Sets the value ofFunctionOptions.getArchitecture()
- Parameters:
architecture
- The system architectures compatible with this lambda function.- Returns:
this
-
architectures
@Stability(Deprecated) @Deprecated public TriggerFunctionProps.Builder architectures(List<? extends Architecture> architectures) Deprecated.use `architecture`Sets the value ofFunctionOptions.getArchitectures()
- Parameters:
architectures
- DEPRECATED.- Returns:
this
-
codeSigningConfig
@Stability(Stable) public TriggerFunctionProps.Builder codeSigningConfig(ICodeSigningConfig codeSigningConfig) Sets the value ofFunctionOptions.getCodeSigningConfig()
- Parameters:
codeSigningConfig
- Code signing config associated with this function.- Returns:
this
-
currentVersionOptions
@Stability(Stable) public TriggerFunctionProps.Builder currentVersionOptions(VersionOptions currentVersionOptions) Sets the value ofFunctionOptions.getCurrentVersionOptions()
- Parameters:
currentVersionOptions
- Options for thelambda.Version
resource automatically created by thefn.currentVersion
method.- Returns:
this
-
deadLetterQueue
Sets the value ofFunctionOptions.getDeadLetterQueue()
- Parameters:
deadLetterQueue
- The SQS queue to use if DLQ is enabled. If SNS topic is desired, specifydeadLetterTopic
property instead.- Returns:
this
-
deadLetterQueueEnabled
@Stability(Stable) public TriggerFunctionProps.Builder deadLetterQueueEnabled(Boolean deadLetterQueueEnabled) Sets the value ofFunctionOptions.getDeadLetterQueueEnabled()
- Parameters:
deadLetterQueueEnabled
- Enabled DLQ. IfdeadLetterQueue
is undefined, an SQS queue with default options will be defined for your Function.- Returns:
this
-
deadLetterTopic
Sets the value ofFunctionOptions.getDeadLetterTopic()
- Parameters:
deadLetterTopic
- The SNS topic to use as a DLQ. Note that ifdeadLetterQueueEnabled
is set totrue
, 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.- Returns:
this
-
description
Sets the value ofFunctionOptions.getDescription()
- Parameters:
description
- A description of the function.- Returns:
this
-
environment
Sets the value ofFunctionOptions.getEnvironment()
- Parameters:
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.- Returns:
this
-
environmentEncryption
@Stability(Stable) public TriggerFunctionProps.Builder environmentEncryption(IKey environmentEncryption) Sets the value ofFunctionOptions.getEnvironmentEncryption()
- Parameters:
environmentEncryption
- The AWS KMS key that's used to encrypt your function's environment variables.- Returns:
this
-
ephemeralStorageSize
@Stability(Stable) public TriggerFunctionProps.Builder ephemeralStorageSize(Size ephemeralStorageSize) Sets the value ofFunctionOptions.getEphemeralStorageSize()
- Parameters:
ephemeralStorageSize
- The size of the function’s /tmp directory in MiB.- Returns:
this
-
events
Sets the value ofFunctionOptions.getEvents()
- Parameters:
events
- Event sources for this function. You can also add event sources usingaddEventSource
.- Returns:
this
-
filesystem
Sets the value ofFunctionOptions.getFilesystem()
- Parameters:
filesystem
- The filesystem configuration for the lambda function.- Returns:
this
-
functionName
Sets the value ofFunctionOptions.getFunctionName()
- Parameters:
functionName
- A name for the function.- Returns:
this
-
initialPolicy
@Stability(Stable) public TriggerFunctionProps.Builder initialPolicy(List<? extends PolicyStatement> initialPolicy) Sets the value ofFunctionOptions.getInitialPolicy()
- Parameters:
initialPolicy
- Initial policy statements to add to the created Lambda Role. You can calladdToRolePolicy
to the created lambda to add statements post creation.- Returns:
this
-
insightsVersion
@Stability(Stable) public TriggerFunctionProps.Builder insightsVersion(LambdaInsightsVersion insightsVersion) Sets the value ofFunctionOptions.getInsightsVersion()
- Parameters:
insightsVersion
- Specify the version of CloudWatch Lambda insights to use for monitoring.- Returns:
this
-
layers
Sets the value ofFunctionOptions.getLayers()
- Parameters:
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.- Returns:
this
-
logRetention
Sets the value ofFunctionOptions.getLogRetention()
- Parameters:
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 toINFINITE
.- Returns:
this
-
logRetentionRetryOptions
@Stability(Stable) public TriggerFunctionProps.Builder logRetentionRetryOptions(LogRetentionRetryOptions logRetentionRetryOptions) Sets the value ofFunctionOptions.getLogRetentionRetryOptions()
- Parameters:
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.- Returns:
this
-
logRetentionRole
Sets the value ofFunctionOptions.getLogRetentionRole()
- Parameters:
logRetentionRole
- The IAM role for the Lambda function associated with the custom resource that sets the retention policy.- Returns:
this
-
memorySize
Sets the value ofFunctionOptions.getMemorySize()
- Parameters:
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.- Returns:
this
-
profiling
Sets the value ofFunctionOptions.getProfiling()
- Parameters:
profiling
- Enable profiling.- Returns:
this
-
profilingGroup
@Stability(Stable) public TriggerFunctionProps.Builder profilingGroup(IProfilingGroup profilingGroup) Sets the value ofFunctionOptions.getProfilingGroup()
- Parameters:
profilingGroup
- Profiling Group.- Returns:
this
-
reservedConcurrentExecutions
@Stability(Stable) public TriggerFunctionProps.Builder reservedConcurrentExecutions(Number reservedConcurrentExecutions) Sets the value ofFunctionOptions.getReservedConcurrentExecutions()
- Parameters:
reservedConcurrentExecutions
- The maximum of concurrent executions you want to reserve for the function.- Returns:
this
-
role
Sets the value ofFunctionOptions.getRole()
- Parameters:
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".
- Returns:
this
-
securityGroup
@Stability(Deprecated) @Deprecated public TriggerFunctionProps.Builder securityGroup(ISecurityGroup securityGroup) Deprecated.- This property is deprecated, use securityGroups insteadSets the value ofFunctionOptions.getSecurityGroup()
- Parameters:
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.
- Returns:
this
-
securityGroups
@Stability(Stable) public TriggerFunctionProps.Builder securityGroups(List<? extends ISecurityGroup> securityGroups) Sets the value ofFunctionOptions.getSecurityGroups()
- Parameters:
securityGroups
- The list of security groups to associate with the Lambda's network interfaces. Only used if 'vpc' is supplied.- Returns:
this
-
timeout
Sets the value ofFunctionOptions.getTimeout()
- Parameters:
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.- Returns:
this
-
tracing
Sets the value ofFunctionOptions.getTracing()
- Parameters:
tracing
- Enable AWS X-Ray Tracing for Lambda Function.- Returns:
this
-
vpc
Sets the value ofFunctionOptions.getVpc()
- Parameters:
vpc
- VPC network to place Lambda network interfaces. Specify this if the Lambda function needs to access resources in a VPC.- Returns:
this
-
vpcSubnets
Sets the value ofFunctionOptions.getVpcSubnets()
- Parameters:
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.- Returns:
this
-
maxEventAge
Sets the value ofEventInvokeConfigOptions.getMaxEventAge()
- Parameters:
maxEventAge
- The maximum age of a request that Lambda sends to a function for processing. Minimum: 60 seconds Maximum: 6 hours- Returns:
this
-
onFailure
Sets the value ofEventInvokeConfigOptions.getOnFailure()
- Parameters:
onFailure
- The destination for failed invocations.- Returns:
this
-
onSuccess
Sets the value ofEventInvokeConfigOptions.getOnSuccess()
- Parameters:
onSuccess
- The destination for successful invocations.- Returns:
this
-
retryAttempts
Sets the value ofEventInvokeConfigOptions.getRetryAttempts()
- Parameters:
retryAttempts
- The maximum number of times to retry when the function returns an error. Minimum: 0 Maximum: 2- Returns:
this
-
executeAfter
@Stability(Stable) public TriggerFunctionProps.Builder executeAfter(List<? extends software.constructs.Construct> executeAfter) Sets the value ofTriggerOptions.getExecuteAfter()
- Parameters:
executeAfter
- Adds trigger dependencies. Execute this trigger only after these construct scopes have been provisioned. You can also usetrigger.executeAfter()
to add additional dependencies.- Returns:
this
-
executeBefore
@Stability(Stable) public TriggerFunctionProps.Builder executeBefore(List<? extends software.constructs.Construct> executeBefore) Sets the value ofTriggerOptions.getExecuteBefore()
- Parameters:
executeBefore
- Adds this trigger as a dependency on other constructs. This means that this trigger will get executed before the given construct(s).You can also use
trigger.executeBefore()
to add additional dependants.- Returns:
this
-
executeOnHandlerChange
@Stability(Stable) public TriggerFunctionProps.Builder executeOnHandlerChange(Boolean executeOnHandlerChange) Sets the value ofTriggerOptions.getExecuteOnHandlerChange()
- Parameters:
executeOnHandlerChange
- Re-executes the trigger every time the handler changes. This implies that the trigger is associated with thecurrentVersion
of the handler, which gets recreated every time the handler or its configuration is updated.- Returns:
this
-
build
Builds the configured instance.- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<TriggerFunctionProps>
- Returns:
- a new instance of
TriggerFunctionProps
- Throws:
NullPointerException
- if any required attribute was not provided
-