Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

Note: You are viewing the documentation for an older major version of the AWS CLI (version 1).

AWS CLI version 2, the latest major version of AWS CLI, is now stable and recommended for general use. To view this page for the AWS CLI version 2, click here. For more information see the AWS CLI version 2 installation instructions and migration guide.

[ aws . iotevents ]

update-detector-model

Description

Updates a detector model. Detectors (instances) spawned by the previous version are deleted and then re-created as new inputs arrive.

See also: AWS API Documentation

See 'aws help' for descriptions of global parameters.

Synopsis

  update-detector-model
--detector-model-name <value>
--detector-model-definition <value>
[--detector-model-description <value>]
--role-arn <value>
[--evaluation-method <value>]
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--detector-model-name (string)

The name of the detector model that is updated.

--detector-model-definition (structure)

Information that defines how a detector operates.

JSON Syntax:

{
  "states": [
    {
      "stateName": "string",
      "onInput": {
        "events": [
          {
            "eventName": "string",
            "condition": "string",
            "actions": [
              {
                "setVariable": {
                  "variableName": "string",
                  "value": "string"
                },
                "sns": {
                  "targetArn": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "iotTopicPublish": {
                  "mqttTopic": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "setTimer": {
                  "timerName": "string",
                  "seconds": integer,
                  "durationExpression": "string"
                },
                "clearTimer": {
                  "timerName": "string"
                },
                "resetTimer": {
                  "timerName": "string"
                },
                "lambda": {
                  "functionArn": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "iotEvents": {
                  "inputName": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "sqs": {
                  "queueUrl": "string",
                  "useBase64": true|false,
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "firehose": {
                  "deliveryStreamName": "string",
                  "separator": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "dynamoDB": {
                  "hashKeyType": "string",
                  "hashKeyField": "string",
                  "hashKeyValue": "string",
                  "rangeKeyType": "string",
                  "rangeKeyField": "string",
                  "rangeKeyValue": "string",
                  "operation": "string",
                  "payloadField": "string",
                  "tableName": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "dynamoDBv2": {
                  "tableName": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "iotSiteWise": {
                  "entryId": "string",
                  "assetId": "string",
                  "propertyId": "string",
                  "propertyAlias": "string",
                  "propertyValue": {
                    "value": {
                      "stringValue": "string",
                      "integerValue": "string",
                      "doubleValue": "string",
                      "booleanValue": "string"
                    },
                    "timestamp": {
                      "timeInSeconds": "string",
                      "offsetInNanos": "string"
                    },
                    "quality": "string"
                  }
                }
              }
              ...
            ]
          }
          ...
        ],
        "transitionEvents": [
          {
            "eventName": "string",
            "condition": "string",
            "actions": [
              {
                "setVariable": {
                  "variableName": "string",
                  "value": "string"
                },
                "sns": {
                  "targetArn": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "iotTopicPublish": {
                  "mqttTopic": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "setTimer": {
                  "timerName": "string",
                  "seconds": integer,
                  "durationExpression": "string"
                },
                "clearTimer": {
                  "timerName": "string"
                },
                "resetTimer": {
                  "timerName": "string"
                },
                "lambda": {
                  "functionArn": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "iotEvents": {
                  "inputName": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "sqs": {
                  "queueUrl": "string",
                  "useBase64": true|false,
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "firehose": {
                  "deliveryStreamName": "string",
                  "separator": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "dynamoDB": {
                  "hashKeyType": "string",
                  "hashKeyField": "string",
                  "hashKeyValue": "string",
                  "rangeKeyType": "string",
                  "rangeKeyField": "string",
                  "rangeKeyValue": "string",
                  "operation": "string",
                  "payloadField": "string",
                  "tableName": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "dynamoDBv2": {
                  "tableName": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "iotSiteWise": {
                  "entryId": "string",
                  "assetId": "string",
                  "propertyId": "string",
                  "propertyAlias": "string",
                  "propertyValue": {
                    "value": {
                      "stringValue": "string",
                      "integerValue": "string",
                      "doubleValue": "string",
                      "booleanValue": "string"
                    },
                    "timestamp": {
                      "timeInSeconds": "string",
                      "offsetInNanos": "string"
                    },
                    "quality": "string"
                  }
                }
              }
              ...
            ],
            "nextState": "string"
          }
          ...
        ]
      },
      "onEnter": {
        "events": [
          {
            "eventName": "string",
            "condition": "string",
            "actions": [
              {
                "setVariable": {
                  "variableName": "string",
                  "value": "string"
                },
                "sns": {
                  "targetArn": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "iotTopicPublish": {
                  "mqttTopic": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "setTimer": {
                  "timerName": "string",
                  "seconds": integer,
                  "durationExpression": "string"
                },
                "clearTimer": {
                  "timerName": "string"
                },
                "resetTimer": {
                  "timerName": "string"
                },
                "lambda": {
                  "functionArn": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "iotEvents": {
                  "inputName": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "sqs": {
                  "queueUrl": "string",
                  "useBase64": true|false,
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "firehose": {
                  "deliveryStreamName": "string",
                  "separator": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "dynamoDB": {
                  "hashKeyType": "string",
                  "hashKeyField": "string",
                  "hashKeyValue": "string",
                  "rangeKeyType": "string",
                  "rangeKeyField": "string",
                  "rangeKeyValue": "string",
                  "operation": "string",
                  "payloadField": "string",
                  "tableName": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "dynamoDBv2": {
                  "tableName": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "iotSiteWise": {
                  "entryId": "string",
                  "assetId": "string",
                  "propertyId": "string",
                  "propertyAlias": "string",
                  "propertyValue": {
                    "value": {
                      "stringValue": "string",
                      "integerValue": "string",
                      "doubleValue": "string",
                      "booleanValue": "string"
                    },
                    "timestamp": {
                      "timeInSeconds": "string",
                      "offsetInNanos": "string"
                    },
                    "quality": "string"
                  }
                }
              }
              ...
            ]
          }
          ...
        ]
      },
      "onExit": {
        "events": [
          {
            "eventName": "string",
            "condition": "string",
            "actions": [
              {
                "setVariable": {
                  "variableName": "string",
                  "value": "string"
                },
                "sns": {
                  "targetArn": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "iotTopicPublish": {
                  "mqttTopic": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "setTimer": {
                  "timerName": "string",
                  "seconds": integer,
                  "durationExpression": "string"
                },
                "clearTimer": {
                  "timerName": "string"
                },
                "resetTimer": {
                  "timerName": "string"
                },
                "lambda": {
                  "functionArn": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "iotEvents": {
                  "inputName": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "sqs": {
                  "queueUrl": "string",
                  "useBase64": true|false,
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "firehose": {
                  "deliveryStreamName": "string",
                  "separator": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "dynamoDB": {
                  "hashKeyType": "string",
                  "hashKeyField": "string",
                  "hashKeyValue": "string",
                  "rangeKeyType": "string",
                  "rangeKeyField": "string",
                  "rangeKeyValue": "string",
                  "operation": "string",
                  "payloadField": "string",
                  "tableName": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "dynamoDBv2": {
                  "tableName": "string",
                  "payload": {
                    "contentExpression": "string",
                    "type": "STRING"|"JSON"
                  }
                },
                "iotSiteWise": {
                  "entryId": "string",
                  "assetId": "string",
                  "propertyId": "string",
                  "propertyAlias": "string",
                  "propertyValue": {
                    "value": {
                      "stringValue": "string",
                      "integerValue": "string",
                      "doubleValue": "string",
                      "booleanValue": "string"
                    },
                    "timestamp": {
                      "timeInSeconds": "string",
                      "offsetInNanos": "string"
                    },
                    "quality": "string"
                  }
                }
              }
              ...
            ]
          }
          ...
        ]
      }
    }
    ...
  ],
  "initialStateName": "string"
}

--detector-model-description (string)

A brief description of the detector model.

--role-arn (string)

The ARN of the role that grants permission to AWS IoT Events to perform its operations.

--evaluation-method (string)

Information about the order in which events are evaluated and how actions are executed.

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.

Examples

To update a detector model

The following update-detector-model example updates the specified detector model. Detectors (instances) spawned by the previous version are deleted and then re-created as new inputs arrive.

aws iotevents update-detector-model \
    --cli-input-json file://motorDetectorModel.update.json

Contents of motorDetectorModel.update.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"
    },
    "roleArn": "arn:aws:iam::123456789012:role/IoTEventsRole"
}

Output:

{
    "detectorModelConfiguration": {
        "status": "ACTIVATING",
        "lastUpdateTime": 1560799387.719,
        "roleArn": "arn:aws:iam::123456789012:role/IoTEventsRole",
        "creationTime": 1560799387.719,
        "detectorModelArn": "arn:aws:iotevents:us-west-2:123456789012:detectorModel/motorDetectorModel",
        "key": "motorid",
        "detectorModelName": "motorDetectorModel",
        "detectorModelVersion": "2"
    }
}

For more information, see UpdateDetectorModel in the AWS IoT Events API Reference.

Output

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 value used to identify a detector instance. 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.

evaluationMethod -> (string)

Information about the order in which events are evaluated and how actions are executed.