Class DetectorModel
(experimental) Defines an AWS IoT Events detector model in this stack.
Inherited Members
Namespace: Amazon.CDK.AWS.IoTEvents
Assembly: Amazon.CDK.AWS.IoTEvents.dll
Syntax (csharp)
public class DetectorModel : Resource, IDetectorModel, IResource, IConstruct, IDependable
Syntax (vb)
Public Class DetectorModel
Inherits Resource
Implements IDetectorModel, IResource, IConstruct, IDependable
Remarks
Stability: Experimental
ExampleMetadata: infused
Examples
using Amazon.CDK.AWS.IoTEvents;
using Amazon.CDK.AWS.IoTEvents.Actions;
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
Constructors
DetectorModel(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
DetectorModel(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
DetectorModel(Construct, String, IDetectorModelProps) |
Properties
DetectorModelName | (experimental) The name of the detector model. |
Methods
FromDetectorModelName(Construct, String, String) | (experimental) Import an existing detector model. |
Constructors
DetectorModel(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected DetectorModel(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
DetectorModel(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected DetectorModel(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
DetectorModel(Construct, String, IDetectorModelProps)
public DetectorModel(Construct scope, string id, IDetectorModelProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props IDetectorModelProps
Remarks
Stability: Experimental
Properties
DetectorModelName
(experimental) The name of the detector model.
public virtual string DetectorModelName { get; }
Property Value
System.String
Remarks
Stability: Experimental
Methods
FromDetectorModelName(Construct, String, String)
(experimental) Import an existing detector model.
public static IDetectorModel FromDetectorModelName(Construct scope, string id, string detectorModelName)
Parameters
- scope Constructs.Construct
- id System.String
- detectorModelName System.String
Returns
Remarks
Stability: Experimental