TriggerProps
- class aws_cdk.triggers.TriggerProps(*, execute_after=None, execute_before=None, execute_on_handler_change=None, handler, invocation_type=None, timeout=None)
Bases:
TriggerOptions
Props for
Trigger
.- Parameters:
execute_after (
Optional
[Sequence
[Construct
]]) – Adds trigger dependencies. Execute this trigger only after these construct scopes have been provisioned. You can also usetrigger.executeAfter()
to add additional dependencies. Default: []execute_before (
Optional
[Sequence
[Construct
]]) – 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 usetrigger.executeBefore()
to add additional dependants. Default: []execute_on_handler_change (
Optional
[bool
]) – 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. Default: truehandler (
Function
) – The AWS Lambda function of the handler to execute.invocation_type (
Optional
[InvocationType
]) – The invocation type to invoke the Lambda function with. Default: RequestResponsetimeout (
Optional
[Duration
]) – The timeout of the invocation call of the Lambda function to be triggered. Default: Duration.minutes(2)
- ExampleMetadata:
infused
Example:
import aws_cdk.triggers as triggers func = lambda_.Function(self, "MyFunction", handler="index.handler", runtime=lambda_.Runtime.NODEJS_18_X, code=lambda_.Code.from_inline("foo") ) triggers.Trigger(self, "MyTrigger", handler=func, timeout=Duration.minutes(10), invocation_type=triggers.InvocationType.EVENT )
Attributes
- execute_after
Adds trigger dependencies. Execute this trigger only after these construct scopes have been provisioned.
You can also use
trigger.executeAfter()
to add additional dependencies.- Default:
[]
- execute_before
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.- Default:
[]
- execute_on_handler_change
Re-executes the trigger every time the handler changes.
This implies that the trigger is associated with the
currentVersion
of the handler, which gets recreated every time the handler or its configuration is updated.- Default:
true
- handler
The AWS Lambda function of the handler to execute.
- invocation_type
The invocation type to invoke the Lambda function with.
- Default:
RequestResponse
- timeout
The timeout of the invocation call of the Lambda function to be triggered.
- Default:
Duration.minutes(2)