createDetectorModel method
Creates a detector model.
May throw InternalFailureException.
May throw InvalidRequestException.
May throw LimitExceededException.
May throw ResourceAlreadyExistsException.
May throw ResourceInUseException.
May throw ServiceUnavailableException.
May throw ThrottlingException.
Parameter detectorModelDefinition :
Information that defines how the detectors operate.
Parameter detectorModelName :
The name of the detector model.
Parameter roleArn :
The ARN of the role that grants permission to AWS IoT Events to perform
its operations.
Parameter detectorModelDescription :
A brief description of the detector model.
Parameter evaluationMethod :
Information about the order in which events are evaluated and how actions
are executed.
Parameter key :
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 in the message payload of each input to specify the
attribute-value pair that is used to identify the device associated with
the input.
Parameter tags :
Metadata that can be used to manage the detector model.
Implementation
Future<CreateDetectorModelResponse> createDetectorModel({
required DetectorModelDefinition detectorModelDefinition,
required String detectorModelName,
required String roleArn,
String? detectorModelDescription,
EvaluationMethod? evaluationMethod,
String? key,
List<Tag>? tags,
}) async {
final $payload = <String, dynamic>{
'detectorModelDefinition': detectorModelDefinition,
'detectorModelName': detectorModelName,
'roleArn': roleArn,
if (detectorModelDescription != null)
'detectorModelDescription': detectorModelDescription,
if (evaluationMethod != null) 'evaluationMethod': evaluationMethod.value,
if (key != null) 'key': key,
if (tags != null) 'tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/detector-models',
exceptionFnMap: _exceptionFns,
);
return CreateDetectorModelResponse.fromJson(response);
}