Interface IDetectorModelProps
(experimental) Properties for defining an AWS IoT Events detector model.
Namespace: Amazon.CDK.AWS.IoTEvents.Alpha
Assembly: Amazon.CDK.AWS.IoTEvents.Alpha.dll
Syntax (csharp)
public interface IDetectorModelProps
Syntax (vb)
Public Interface IDetectorModelProps
Remarks
Stability: Experimental
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.IoTEvents.Alpha;
using Amazon.CDK.AWS.IoTEvents.Actions.Alpha;
using Amazon.CDK.AWS.Lambda;
IFunction func;
var input = new Input(this, "MyInput", new InputProps {
InputName = "my_input", // optional
AttributeJsonPaths = new [] { "payload.deviceId", "payload.temperature" }
});
var warmState = new State(new StateProps {
StateName = "warm",
OnEnter = new [] { new Event {
EventName = "test-enter-event",
Condition = Expression.CurrentInput(input),
Actions = new [] { new LambdaInvokeAction(func) }
} },
OnInput = new [] { new Event { // optional
EventName = "test-input-event",
Actions = new [] { new LambdaInvokeAction(func) } } },
OnExit = new [] { new Event { // optional
EventName = "test-exit-event",
Actions = new [] { new LambdaInvokeAction(func) } } }
});
var coldState = new State(new StateProps {
StateName = "cold"
});
// transit to coldState when temperature is less than 15
warmState.TransitionTo(coldState, new TransitionOptions {
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 = new [] { new LambdaInvokeAction(func) }
});
// transit to warmState when temperature is greater than or equal to 15
coldState.TransitionTo(warmState, new TransitionOptions {
When = Expression.Gte(Expression.InputAttribute(input, "payload.temperature"), Expression.FromString("15"))
});
new DetectorModel(this, "MyDetectorModel", new DetectorModelProps {
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
});
Synopsis
Properties
Description | (experimental) A brief description of the detector model. |
DetectorKey | (experimental) The value used to identify a detector instance. |
DetectorModelName | (experimental) The name of the detector model. |
EvaluationMethod | (experimental) Information about the order in which events are evaluated and how actions are executed. |
InitialState | (experimental) The state that is entered at the creation of each detector. |
Role | (experimental) The role that grants permission to AWS IoT Events to perform its operations. |
Properties
Description
(experimental) A brief description of the detector model.
virtual string Description { get; }
Property Value
System.String
Remarks
Default: none
Stability: Experimental
DetectorKey
(experimental) The value used to identify a detector instance.
virtual string DetectorKey { get; }
Property Value
System.String
Remarks
When a device or system sends input, a new detector instance with a unique key value is created. AWS IoT Events can continue to route input to its corresponding detector instance based on this identifying information.
This parameter uses a JSON-path expression to select the attribute-value pair in the message payload that is used for identification. To route the message to the correct detector instance, the device must send a message payload that contains the same attribute-value.
Default: - none (single detector instance will be created and all inputs will be routed to it)
Stability: Experimental
DetectorModelName
(experimental) The name of the detector model.
virtual string DetectorModelName { get; }
Property Value
System.String
Remarks
Default: - CloudFormation will generate a unique name of the detector model
Stability: Experimental
EvaluationMethod
(experimental) Information about the order in which events are evaluated and how actions are executed.
virtual Nullable<EventEvaluation> EvaluationMethod { get; }
Property Value
System.Nullable<EventEvaluation>
Remarks
When setting to SERIAL, variables are updated and event conditions are evaluated in the order that the events are defined. When setting to BATCH, variables within a state are updated and events within a state are performed only after all event conditions are evaluated.
Default: EventEvaluation.BATCH
Stability: Experimental
InitialState
(experimental) The state that is entered at the creation of each detector.
State InitialState { get; }
Property Value
Remarks
Stability: Experimental
Role
(experimental) The role that grants permission to AWS IoT Events to perform its operations.
virtual IRole Role { get; }
Property Value
Remarks
Default: - a role will be created with default permissions
Stability: Experimental