Interface | Description |
---|---|
ActionBindOptions |
(experimental) Options when binding a Action to a detector model.
|
ActionConfig |
(experimental) Properties for a AWS IoT Events action.
|
CfnAlarmModel.AcknowledgeFlowProperty |
Specifies whether to get notified for alarm state changes.
|
CfnAlarmModel.AlarmActionProperty |
Specifies one of the following actions to receive notifications when the alarm state changes.
|
CfnAlarmModel.AlarmCapabilitiesProperty |
Contains the configuration information of alarm state changes.
|
CfnAlarmModel.AlarmEventActionsProperty |
Contains information about one or more alarm actions.
|
CfnAlarmModel.AlarmRuleProperty |
Defines when your alarm is invoked.
|
CfnAlarmModel.AssetPropertyTimestampProperty |
A structure that contains timestamp information.
|
CfnAlarmModel.AssetPropertyValueProperty |
A structure that contains value information.
|
CfnAlarmModel.AssetPropertyVariantProperty |
A structure that contains an asset property value.
|
CfnAlarmModel.DynamoDBProperty |
Defines an action to write to the Amazon DynamoDB table that you created.
|
CfnAlarmModel.DynamoDBv2Property |
Defines an action to write to the Amazon DynamoDB table that you created.
|
CfnAlarmModel.FirehoseProperty |
Sends information about the detector model instance and the event that triggered the action to an Amazon Kinesis Data Firehose delivery stream.
|
CfnAlarmModel.InitializationConfigurationProperty |
Specifies the default alarm state.
|
CfnAlarmModel.IotEventsProperty |
Sends an AWS IoT Events input, passing in information about the detector model instance and the event that triggered the action.
|
CfnAlarmModel.IotSiteWiseProperty |
Sends information about the detector model instance and the event that triggered the action to a specified asset property in AWS IoT SiteWise .
|
CfnAlarmModel.IotTopicPublishProperty |
Information required to publish the MQTT message through the AWS IoT message broker.
|
CfnAlarmModel.LambdaProperty |
Calls a Lambda function, passing in information about the detector model instance and the event that triggered the action.
|
CfnAlarmModel.PayloadProperty |
Information needed to configure the payload.
|
CfnAlarmModel.SimpleRuleProperty |
A rule that compares an input property value to a threshold value with a comparison operator.
|
CfnAlarmModel.SnsProperty |
Information required to publish the Amazon SNS message.
|
CfnAlarmModel.SqsProperty |
Sends information about the detector model instance and the event that triggered the action to an Amazon SQS queue.
|
CfnAlarmModelProps |
Properties for defining a `CfnAlarmModel`.
|
CfnDetectorModel.ActionProperty |
An action to be performed when the `condition` is TRUE.
|
CfnDetectorModel.AssetPropertyTimestampProperty |
A structure that contains timestamp information.
|
CfnDetectorModel.AssetPropertyValueProperty |
A structure that contains value information.
|
CfnDetectorModel.AssetPropertyVariantProperty |
A structure that contains an asset property value.
|
CfnDetectorModel.ClearTimerProperty |
Information needed to clear the timer.
|
CfnDetectorModel.DetectorModelDefinitionProperty |
Information that defines how a detector operates.
|
CfnDetectorModel.DynamoDBProperty |
Defines an action to write to the Amazon DynamoDB table that you created.
|
CfnDetectorModel.DynamoDBv2Property |
Defines an action to write to the Amazon DynamoDB table that you created.
|
CfnDetectorModel.EventProperty |
Specifies the `actions` to be performed when the `condition` evaluates to TRUE.
|
CfnDetectorModel.FirehoseProperty |
Sends information about the detector model instance and the event that triggered the action to an Amazon Kinesis Data Firehose delivery stream.
|
CfnDetectorModel.IotEventsProperty |
Sends an AWS IoT Events input, passing in information about the detector model instance and the event that triggered the action.
|
CfnDetectorModel.IotSiteWiseProperty |
Sends information about the detector model instance and the event that triggered the action to a specified asset property in AWS IoT SiteWise .
|
CfnDetectorModel.IotTopicPublishProperty |
Information required to publish the MQTT message through the AWS IoT message broker.
|
CfnDetectorModel.LambdaProperty |
Calls a Lambda function, passing in information about the detector model instance and the event that triggered the action.
|
CfnDetectorModel.OnEnterProperty |
When entering this state, perform these `actions` if the `condition` is TRUE.
|
CfnDetectorModel.OnExitProperty |
When exiting this state, perform these `actions` if the specified `condition` is `TRUE` .
|
CfnDetectorModel.OnInputProperty |
Specifies the actions performed when the `condition` evaluates to TRUE.
|
CfnDetectorModel.PayloadProperty |
Information needed to configure the payload.
|
CfnDetectorModel.ResetTimerProperty |
Information required to reset the timer.
|
CfnDetectorModel.SetTimerProperty |
Information needed to set the timer.
|
CfnDetectorModel.SetVariableProperty |
Information about the variable and its new value.
|
CfnDetectorModel.SnsProperty |
Information required to publish the Amazon SNS message.
|
CfnDetectorModel.SqsProperty |
Sends information about the detector model instance and the event that triggered the action to an Amazon SQS queue.
|
CfnDetectorModel.StateProperty |
Information that defines a state of a detector.
|
CfnDetectorModel.TransitionEventProperty |
Specifies the actions performed and the next state entered when a `condition` evaluates to TRUE.
|
CfnDetectorModelProps |
Properties for defining a `CfnDetectorModel`.
|
CfnInput.AttributeProperty |
The attributes from the JSON payload that are made available by the input.
|
CfnInput.InputDefinitionProperty |
The definition of the input.
|
CfnInputProps |
Properties for defining a `CfnInput`.
|
DetectorModelProps |
(experimental) Properties for defining an AWS IoT Events detector model.
|
Event |
(experimental) Specifies the actions to be performed when the condition evaluates to `true`.
|
IAction |
(experimental) An abstract action for DetectorModel.
|
IAction.Jsii$Default |
Internal default implementation for
IAction . |
IDetectorModel |
(experimental) Represents an AWS IoT Events detector model.
|
IDetectorModel.Jsii$Default |
Internal default implementation for
IDetectorModel . |
IInput |
(experimental) Represents an AWS IoT Events input.
|
IInput.Jsii$Default |
Internal default implementation for
IInput . |
InputProps |
(experimental) Properties for defining an AWS IoT Events input.
|
StateProps |
(experimental) Properties for defining a state of a detector.
|
TransitionOptions |
(experimental) Properties for options of state transition.
|
Enum | Description |
---|---|
EventEvaluation |
(experimental) Information about the order in which events are evaluated and how actions are executed.
|
---
All classes with the
Cfn
prefix in this module (CFN Resources) are always stable and safe to use.
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.
AWS IoT Events enables you to monitor your equipment or device fleets for failures or changes in operation, and to trigger actions when such events occur.
Install the module:
$ npm i @aws-cdk/aws-iotevents
Import it into your code:
import software.amazon.awscdk.services.iotevents.*;
DetectorModel
The following example creates an AWS IoT Events detector model to your stack. The detector model need a reference to at least one AWS IoT Events input. AWS IoT Events inputs enable the detector to get MQTT payload values from IoT Core rules.
You can define built-in actions to use a timer or set a variable, or send data to other AWS resources. See also @aws-cdk/aws-iotevents-actions for other actions.
import software.amazon.awscdk.services.iotevents.*; import software.amazon.awscdk.services.iotevents.actions.*; import software.amazon.awscdk.services.lambda.*; IFunction func; Input input = Input.Builder.create(this, "MyInput") .inputName("my_input") // optional .attributeJsonPaths(List.of("payload.deviceId", "payload.temperature")) .build(); State warmState = State.Builder.create() .stateName("warm") .onEnter(List.of(Event.builder() .eventName("test-enter-event") .condition(Expression.currentInput(input)) .actions(List.of(new LambdaInvokeAction(func))) .build())) .onInput(List.of(Event.builder() // optional .eventName("test-input-event") .actions(List.of(new LambdaInvokeAction(func))).build())) .onExit(List.of(Event.builder() // optional .eventName("test-exit-event") .actions(List.of(new LambdaInvokeAction(func))).build())) .build(); State coldState = State.Builder.create() .stateName("cold") .build(); // transit to coldState when temperature is less than 15 warmState.transitionTo(coldState, TransitionOptions.builder() .eventName("to_coldState") // optional property, default by combining the names of the States .when(Expression.lt(Expression.inputAttribute(input, "payload.temperature"), Expression.fromString("15"))) .executing(List.of(new LambdaInvokeAction(func))) .build()); // transit to warmState when temperature is greater than or equal to 15 coldState.transitionTo(warmState, TransitionOptions.builder() .when(Expression.gte(Expression.inputAttribute(input, "payload.temperature"), Expression.fromString("15"))) .build()); DetectorModel.Builder.create(this, "MyDetectorModel") .detectorModelName("test-detector-model") // optional .description("test-detector-model-description") // optional property, default is none .evaluationMethod(EventEvaluation.SERIAL) // optional property, default is iotevents.EventEvaluation.BATCH .detectorKey("payload.deviceId") // optional property, default is none and single detector instance will be created and all inputs will be routed to it .initialState(warmState) .build();
To grant permissions to put messages in the input,
you can use the grantWrite()
method:
import software.amazon.awscdk.services.iam.*; import software.amazon.awscdk.services.iotevents.*; IGrantable grantable; IInput input = Input.fromInputName(this, "MyInput", "my_input"); input.grantWrite(grantable);