Creates a detector model.
See also: AWS API Documentation
See 'aws help' for descriptions of global parameters.
create-detector-model
--detector-model-name <value>
--detector-model-definition <value>
[--detector-model-description <value>]
[--key <value>]
--role-arn <value>
[--tags <value>]
[--evaluation-method <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]
--detector-model-name (string)
The name of the detector model.
--detector-model-definition (structure)
Information that defines how the detectors operate.
JSON Syntax:
{
"states": [
{
"stateName": "string",
"onInput": {
"events": [
{
"eventName": "string",
"condition": "string",
"actions": [
{
"setVariable": {
"variableName": "string",
"value": "string"
},
"sns": {
"targetArn": "string"
},
"iotTopicPublish": {
"mqttTopic": "string"
},
"setTimer": {
"timerName": "string",
"seconds": integer
},
"clearTimer": {
"timerName": "string"
},
"resetTimer": {
"timerName": "string"
},
"lambda": {
"functionArn": "string"
},
"iotEvents": {
"inputName": "string"
},
"sqs": {
"queueUrl": "string",
"useBase64": true|false
},
"firehose": {
"deliveryStreamName": "string",
"separator": "string"
}
}
...
]
}
...
],
"transitionEvents": [
{
"eventName": "string",
"condition": "string",
"actions": [
{
"setVariable": {
"variableName": "string",
"value": "string"
},
"sns": {
"targetArn": "string"
},
"iotTopicPublish": {
"mqttTopic": "string"
},
"setTimer": {
"timerName": "string",
"seconds": integer
},
"clearTimer": {
"timerName": "string"
},
"resetTimer": {
"timerName": "string"
},
"lambda": {
"functionArn": "string"
},
"iotEvents": {
"inputName": "string"
},
"sqs": {
"queueUrl": "string",
"useBase64": true|false
},
"firehose": {
"deliveryStreamName": "string",
"separator": "string"
}
}
...
],
"nextState": "string"
}
...
]
},
"onEnter": {
"events": [
{
"eventName": "string",
"condition": "string",
"actions": [
{
"setVariable": {
"variableName": "string",
"value": "string"
},
"sns": {
"targetArn": "string"
},
"iotTopicPublish": {
"mqttTopic": "string"
},
"setTimer": {
"timerName": "string",
"seconds": integer
},
"clearTimer": {
"timerName": "string"
},
"resetTimer": {
"timerName": "string"
},
"lambda": {
"functionArn": "string"
},
"iotEvents": {
"inputName": "string"
},
"sqs": {
"queueUrl": "string",
"useBase64": true|false
},
"firehose": {
"deliveryStreamName": "string",
"separator": "string"
}
}
...
]
}
...
]
},
"onExit": {
"events": [
{
"eventName": "string",
"condition": "string",
"actions": [
{
"setVariable": {
"variableName": "string",
"value": "string"
},
"sns": {
"targetArn": "string"
},
"iotTopicPublish": {
"mqttTopic": "string"
},
"setTimer": {
"timerName": "string",
"seconds": integer
},
"clearTimer": {
"timerName": "string"
},
"resetTimer": {
"timerName": "string"
},
"lambda": {
"functionArn": "string"
},
"iotEvents": {
"inputName": "string"
},
"sqs": {
"queueUrl": "string",
"useBase64": true|false
},
"firehose": {
"deliveryStreamName": "string",
"separator": "string"
}
}
...
]
}
...
]
}
}
...
],
"initialStateName": "string"
}
--detector-model-description (string)
A brief description of the detector model.
--key (string)
The input attribute key used to identify a device or system to create a detector (an instance of the detector model) and then to route each input received to the appropriate detector (instance). This parameter uses a JSON-path expression to specify the attribute-value pair in the message payload of each input that is used to identify the device associated with the input.
--role-arn (string)
The ARN of the role that grants permission to AWS IoT Events to perform its operations.
--tags (list)
Metadata that can be used to manage the detector model.
Shorthand Syntax:
key=string,value=string ...
JSON Syntax:
[
{
"key": "string",
"value": "string"
}
...
]
--evaluation-method (string)
When set to SERIAL , variables are updated and event conditions evaluated in the order that the events are defined. When set to BATCH , variables are updated and events performed only after all event conditions are evaluated.
Possible values:
- BATCH
- SERIAL
--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally.
--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.
See 'aws help' for descriptions of global parameters.
To create a detector model
The following create-detector-model example creates a detector model with its configuration specified by a parameter file.
aws iotevents create-detector-model \
--cli-input-json file://motorDetectorModel.json
Contents of motorDetectorModel.json:
{
"detectorModelName": "motorDetectorModel",
"detectorModelDefinition": {
"states": [
{
"stateName": "Normal",
"onEnter": {
"events": [
{
"eventName": "init",
"condition": "true",
"actions": [
{
"setVariable": {
"variableName": "pressureThresholdBreached",
"value": "0"
}
}
]
}
]
},
"onInput": {
"transitionEvents": [
{
"eventName": "Overpressurized",
"condition": "$input.PressureInput.sensorData.pressure > 70",
"actions": [
{
"setVariable": {
"variableName": "pressureThresholdBreached",
"value": "$variable.pressureThresholdBreached + 3"
}
}
],
"nextState": "Dangerous"
}
]
}
},
{
"stateName": "Dangerous",
"onEnter": {
"events": [
{
"eventName": "Pressure Threshold Breached",
"condition": "$variable.pressureThresholdBreached > 1",
"actions": [
{
"sns": {
"targetArn": "arn:aws:sns:us-east-1:123456789012:underPressureAction"
}
}
]
}
]
},
"onInput": {
"events": [
{
"eventName": "Overpressurized",
"condition": "$input.PressureInput.sensorData.pressure > 70",
"actions": [
{
"setVariable": {
"variableName": "pressureThresholdBreached",
"value": "3"
}
}
]
},
{
"eventName": "Pressure Okay",
"condition": "$input.PressureInput.sensorData.pressure <= 70",
"actions": [
{
"setVariable": {
"variableName": "pressureThresholdBreached",
"value": "$variable.pressureThresholdBreached - 1"
}
}
]
}
],
"transitionEvents": [
{
"eventName": "BackToNormal",
"condition": "$input.PressureInput.sensorData.pressure <= 70 && $variable.pressureThresholdBreached <= 1",
"nextState": "Normal"
}
]
},
"onExit": {
"events": [
{
"eventName": "Normal Pressure Restored",
"condition": "true",
"actions": [
{
"sns": {
"targetArn": "arn:aws:sns:us-east-1:123456789012:pressureClearedAction"
}
}
]
}
]
}
}
],
"initialStateName": "Normal"
},
"key": "motorid",
"roleArn": "arn:aws:iam::123456789012:role/IoTEventsRole"
}
Output:
{
"detectorModelConfiguration": {
"status": "ACTIVATING",
"lastUpdateTime": 1560796816.077,
"roleArn": "arn:aws:iam::123456789012:role/IoTEventsRole",
"creationTime": 1560796816.077,
"detectorModelArn": "arn:aws:iotevents:us-west-2:123456789012:detectorModel/motorDetectorModel",
"key": "motorid",
"detectorModelName": "motorDetectorModel",
"detectorModelVersion": "1"
}
}
For more information, see CreateDetectorModel in the AWS IoT Events API Reference.
detectorModelConfiguration -> (structure)
Information about how the detector model is configured.
detectorModelName -> (string)
The name of the detector model.detectorModelVersion -> (string)
The version of the detector model.detectorModelDescription -> (string)
A brief description of the detector model.detectorModelArn -> (string)
The ARN of the detector model.roleArn -> (string)
The ARN of the role that grants permission to AWS IoT Events to perform its operations.creationTime -> (timestamp)
The time the detector model was created.lastUpdateTime -> (timestamp)
The time the detector model was last updated.status -> (string)
The status of the detector model.key -> (string)
The input attribute key used to identify a device or system to create a detector (an instance of the detector model) and then to route each input received to the appropriate detector (instance). This parameter uses a JSON-path expression to specify the attribute-value pair in the message payload of each input that is used to identify the device associated with the input.evaluationMethod -> (string)
When set to SERIAL , variables are updated and event conditions evaluated in the order that the events are defined. When set to BATCH , variables are updated and events performed only after all event conditions are evaluated.