createDetectorVersion method

Future<CreateDetectorVersionResult> createDetectorVersion({
  1. required String detectorId,
  2. required List<Rule> rules,
  3. String? description,
  4. List<String>? externalModelEndpoints,
  5. List<ModelVersion>? modelVersions,
  6. RuleExecutionMode? ruleExecutionMode,
  7. List<Tag>? tags,
})

Creates a detector version. The detector version starts in a DRAFT status.

May throw ValidationException. May throw ResourceNotFoundException. May throw InternalServerException. May throw ThrottlingException. May throw AccessDeniedException.

Parameter detectorId : The ID of the detector under which you want to create a new version.

Parameter rules : The rules to include in the detector version.

Parameter description : The description of the detector version.

Parameter externalModelEndpoints : The Amazon Sagemaker model endpoints to include in the detector version.

Parameter modelVersions : The model versions to include in the detector version.

Parameter ruleExecutionMode : The rule execution mode for the rules included in the detector version.

You can define and edit the rule mode at the detector version level, when it is in draft status.

If you specify FIRST_MATCHED, Amazon Fraud Detector evaluates rules sequentially, first to last, stopping at the first matched rule. Amazon Fraud dectector then provides the outcomes for that single rule.

If you specifiy ALL_MATCHED, Amazon Fraud Detector evaluates all rules and returns the outcomes for all matched rules.

The default behavior is FIRST_MATCHED.

Parameter tags : A collection of key and value pairs.

Implementation

Future<CreateDetectorVersionResult> createDetectorVersion({
  required String detectorId,
  required List<Rule> rules,
  String? description,
  List<String>? externalModelEndpoints,
  List<ModelVersion>? modelVersions,
  RuleExecutionMode? ruleExecutionMode,
  List<Tag>? tags,
}) async {
  ArgumentError.checkNotNull(detectorId, 'detectorId');
  _s.validateStringLength(
    'detectorId',
    detectorId,
    1,
    64,
    isRequired: true,
  );
  ArgumentError.checkNotNull(rules, 'rules');
  _s.validateStringLength(
    'description',
    description,
    1,
    128,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSHawksNestServiceFacade.CreateDetectorVersion'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'detectorId': detectorId,
      'rules': rules,
      if (description != null) 'description': description,
      if (externalModelEndpoints != null)
        'externalModelEndpoints': externalModelEndpoints,
      if (modelVersions != null) 'modelVersions': modelVersions,
      if (ruleExecutionMode != null)
        'ruleExecutionMode': ruleExecutionMode.toValue(),
      if (tags != null) 'tags': tags,
    },
  );

  return CreateDetectorVersionResult.fromJson(jsonResponse.body);
}