getEventPrediction method

Future<GetEventPredictionResult> getEventPrediction({
  1. required String detectorId,
  2. required List<Entity> entities,
  3. required String eventId,
  4. required String eventTimestamp,
  5. required String eventTypeName,
  6. required Map<String, String> eventVariables,
  7. String? detectorVersionId,
  8. Map<String, ModelEndpointDataBlob>? externalModelEndpointDataBlobs,
})

Evaluates an event against a detector version. If a version ID is not provided, the detector’s (ACTIVE) version is used.

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

Parameter detectorId : The detector ID.

Parameter entities : The entity type (associated with the detector's event type) and specific entity ID representing who performed the event. If an entity id is not available, use "UNKNOWN."

Parameter eventId : The unique ID used to identify the event.

Parameter eventTimestamp : Timestamp that defines when the event under evaluation occurred.

Parameter eventTypeName : The event type associated with the detector specified for the prediction.

Parameter eventVariables : Names of the event type's variables you defined in Amazon Fraud Detector to represent data elements and their corresponding values for the event you are sending for evaluation.

Parameter detectorVersionId : The detector version ID.

Parameter externalModelEndpointDataBlobs : The Amazon SageMaker model endpoint input data blobs.

Implementation

Future<GetEventPredictionResult> getEventPrediction({
  required String detectorId,
  required List<Entity> entities,
  required String eventId,
  required String eventTimestamp,
  required String eventTypeName,
  required Map<String, String> eventVariables,
  String? detectorVersionId,
  Map<String, ModelEndpointDataBlob>? externalModelEndpointDataBlobs,
}) async {
  ArgumentError.checkNotNull(detectorId, 'detectorId');
  ArgumentError.checkNotNull(entities, 'entities');
  ArgumentError.checkNotNull(eventId, 'eventId');
  ArgumentError.checkNotNull(eventTimestamp, 'eventTimestamp');
  ArgumentError.checkNotNull(eventTypeName, 'eventTypeName');
  ArgumentError.checkNotNull(eventVariables, 'eventVariables');
  _s.validateStringLength(
    'detectorVersionId',
    detectorVersionId,
    1,
    5,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSHawksNestServiceFacade.GetEventPrediction'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'detectorId': detectorId,
      'entities': entities,
      'eventId': eventId,
      'eventTimestamp': eventTimestamp,
      'eventTypeName': eventTypeName,
      'eventVariables': eventVariables,
      if (detectorVersionId != null) 'detectorVersionId': detectorVersionId,
      if (externalModelEndpointDataBlobs != null)
        'externalModelEndpointDataBlobs': externalModelEndpointDataBlobs,
    },
  );

  return GetEventPredictionResult.fromJson(jsonResponse.body);
}