Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Actions for AWS::IoTEvents Detector Model

---

cdk-constructs: Experimental

The APIs of higher level constructs in this module are experimental and under active development. They are subject to non-backward compatible changes or removal in any future version. These are not subject to the Semantic Versioning model and breaking changes will be announced in the release notes. This means that while you may use them, you may need to update your source code when upgrading to a newer version of this package.


This library contains integration classes to specify actions of state events of Detector Model in @aws-cdk/aws-iotevents-alpha. Instances of these classes should be passed to State defined in @aws-cdk/aws-iotevents-alpha You can define built-in actions to use a timer or set a variable, or send data to other AWS resources.

This library contains integration classes to use a timer or set a variable, or send data to other AWS resources. AWS IoT Events can trigger actions when it detects a specified event or transition event.

Currently supported are:

  • Use timer
  • Set variable to detector instance
  • Invoke a Lambda function

Use timer

The code snippet below creates an Action that creates the timer with duration in seconds.

# Example automatically generated from non-compiling source. May contain errors.
import aws_cdk.aws_iotevents_alpha as iotevents
import aws_cdk.aws_iotevents_actions_alpha as actions

# input: iotevents.IInput

state = iotevents.State(
    state_name="MyState",
    on_enter=[iotevents.Event(
        event_name="test-event",
        condition=iotevents.Expression.current_input(input),
        actions=[
            actions.SetTimerAction("MyTimer", {
                "duration": cdk.Duration.seconds(60)
            })
        ]
    )]
)

Setting duration by IoT Events Expression:

# Example automatically generated from non-compiling source. May contain errors.
actions.SetTimerAction("MyTimer",
    duration_expression=iotevents.Expression.input_attribute(input, "payload.durationSeconds")
)

And the timer can be reset and cleared. Below is an example of general Device HeartBeat Detector Model:

# Example automatically generated from non-compiling source. May contain errors.
online = iotevents.State(
    state_name="Online",
    on_enter=[{
        "event_name": "enter-event",
        "condition": iotevents.Expression.current_input(input),
        "actions": [
            actions.SetTimerAction("MyTimer",
                duration=cdk.Duration.seconds(60)
            )
        ]
    }],
    on_input=[{
        "event_name": "input-event",
        "condition": iotevents.Expression.current_input(input),
        "actions": [
            actions.ResetTimerAction("MyTimer")
        ]
    }],
    on_exit=[{
        "event_name": "exit-event",
        "actions": [
            actions.ClearTimerAction("MyTimer")
        ]
    }]
)
offline = iotevents.State(state_name="Offline")

online.transition_to(offline, when=iotevents.Expression.timeout("MyTimer"))
offline.transition_to(online, when=iotevents.Expression.current_input(input))

Set variable to detector instance

The code snippet below creates an Action that set variable to detector instance when it is triggered.

import aws_cdk.aws_iotevents_alpha as iotevents
import aws_cdk.aws_iotevents_actions_alpha as actions

# input: iotevents.IInput

state = iotevents.State(
    state_name="MyState",
    on_enter=[iotevents.Event(
        event_name="test-event",
        condition=iotevents.Expression.current_input(input),
        actions=[
            actions.SetVariableAction("MyVariable",
                iotevents.Expression.input_attribute(input, "payload.temperature"))
        ]
    )]
)

Invoke a Lambda function

The code snippet below creates an Action that invoke a Lambda function when it is triggered.

import aws_cdk.aws_iotevents_alpha as iotevents
import aws_cdk.aws_iotevents_actions_alpha as actions
import aws_cdk.aws_lambda as lambda_

# input: iotevents.IInput
# func: lambda.IFunction

state = iotevents.State(
    state_name="MyState",
    on_enter=[iotevents.Event(
        event_name="test-event",
        condition=iotevents.Expression.current_input(input),
        actions=[actions.LambdaInvokeAction(func)]
    )]
)

Metadata

Release files for aws-cdk.aws-iotevents-actions-alpha 2.262.1a0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aws-cdk.aws-iotevents-actions-alpha 2.262.1a0
File Size Uploaded Provenance Actions
aws_cdk_aws_iotevents_actions_alpha-2.262.1a0.tar.gz 54.7 kB Without provenance Details for aws_cdk_aws_iotevents_actions_alpha-2.262.1a0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for aws-cdk.aws-iotevents-actions-alpha 2.262.1a0
File Interpreter ABI Platform Actions
aws_cdk_aws_iotevents_actions_alpha-2.262.1a0-py3-none-any.whl Python 3 none any Details for aws_cdk_aws_iotevents_actions_alpha-2.262.1a0-py3-none-any.whl

Total release size: 108.0 kB

Release files / aws_cdk_aws_iotevents_actions_alpha-2.262.1a0.tar.gz

Download URL aws_cdk_aws_iotevents_actions_alpha-2.262.1a0.tar.gz
Size 54.7 kB
Tags Source
SHA-256 checksum
How to use checksums
28434fc1e46006c3d8aada8f716fecb7096a2645493c2c6fd47c7bf15adb6340
BLAKE2b-256 checksum
How to use checksums
ae0d0d861857cb1e0cde3f644c62293de22b7bc02da1a49d28ecc48d844a67ac
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / aws_cdk_aws_iotevents_actions_alpha-2.262.1a0-py3-none-any.whl

Download URL aws_cdk_aws_iotevents_actions_alpha-2.262.1a0-py3-none-any.whl
Size 53.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aa33cae4ad86b9b16000786065f13bc4a74ff34e3b24fd115eb48f482ae73bdc
BLAKE2b-256 checksum
How to use checksums
d16412793aa2495b4db5ba52788ae09d698ba83cbaa4d12b97ccc8fb5a6b9e41
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Security for aws-cdk.aws-iotevents-actions-alpha 2.262.1a0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page