createDetectorModel method

Future<CreateDetectorModelResponse> createDetectorModel({
  1. required DetectorModelDefinition detectorModelDefinition,
  2. required String detectorModelName,
  3. required String roleArn,
  4. String? detectorModelDescription,
  5. EvaluationMethod? evaluationMethod,
  6. String? key,
  7. List<Tag>? tags,
})

Creates a detector model.

May throw InvalidRequestException. May throw ResourceInUseException. May throw ResourceAlreadyExistsException. May throw LimitExceededException. May throw ThrottlingException. May throw InternalFailureException. May throw ServiceUnavailableException.

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 {
  ArgumentError.checkNotNull(
      detectorModelDefinition, 'detectorModelDefinition');
  ArgumentError.checkNotNull(detectorModelName, 'detectorModelName');
  _s.validateStringLength(
    'detectorModelName',
    detectorModelName,
    1,
    128,
    isRequired: true,
  );
  ArgumentError.checkNotNull(roleArn, 'roleArn');
  _s.validateStringLength(
    'roleArn',
    roleArn,
    1,
    2048,
    isRequired: true,
  );
  _s.validateStringLength(
    'detectorModelDescription',
    detectorModelDescription,
    0,
    128,
  );
  _s.validateStringLength(
    'key',
    key,
    1,
    128,
  );
  final $payload = <String, dynamic>{
    'detectorModelDefinition': detectorModelDefinition,
    'detectorModelName': detectorModelName,
    'roleArn': roleArn,
    if (detectorModelDescription != null)
      'detectorModelDescription': detectorModelDescription,
    if (evaluationMethod != null)
      'evaluationMethod': evaluationMethod.toValue(),
    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);
}