TriggerProps

class aws_cdk.triggers.TriggerProps(*, execute_after=None, execute_before=None, execute_on_handler_change=None, handler)

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 use trigger.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 use trigger.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 the currentVersion of the handler, which gets recreated every time the handler or its configuration is updated. Default: true

  • handler (Function) – The AWS Lambda function of the handler to execute.

ExampleMetadata:

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_lambda as lambda_
import aws_cdk.triggers as triggers
import constructs as constructs

# construct: constructs.Construct
# function_: lambda.Function

trigger_props = triggers.TriggerProps(
    handler=function_,

    # the properties below are optional
    execute_after=[construct],
    execute_before=[construct],
    execute_on_handler_change=False
)

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.