Skip to content

send_event async

send_event(
    event_id: identifier,
    event_type_name: identifier,
    event_timestamp: utcTimestampISO8601,
    event_variables: EventVariableMap,
    entities: listOfEntities,
    *,
    config_overrides: Optional[AsyncFraudDetectorClientConfig] = None,
    assigned_label: Optional[identifier] = None,
    label_timestamp: Optional[utcTimestampISO8601] = None,
) -> SendEventResult

Stores events in Amazon Fraud Detector without generating fraud predictions for those events. For example, you can use SendEvent to upload a historical dataset, which you can then later use to train a model.

Parameters:

  • event_id (identifier) –

    The event ID to upload.

  • event_type_name (identifier) –

    The event type name of the event.

  • event_timestamp (utcTimestampISO8601) –

    The timestamp that defines when the event under evaluation occurred. The timestamp must be specified using ISO 8601 standard in UTC.

  • event_variables (EventVariableMap) –

    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.

  • assigned_label (Optional[identifier], default: None ) –

    The label to associate with the event. Required if specifying labelTimestamp.

  • label_timestamp (Optional[utcTimestampISO8601], default: None ) –

    The timestamp associated with the label. Required if specifying assignedLabel.

  • entities (listOfEntities) –

    An array of entities.

Raises:

  • AccessDeniedException –

    An exception indicating Amazon Fraud Detector does not have the needed permissions. This can occur if you submit a request, such as PutExternalModel, that specifies a role that is not in your account.

  • ConflictException –

    An exception indicating there was a conflict during a delete operation.

  • InternalServerException –

    An exception indicating an internal server error.

  • ResourceNotFoundException –

    An exception indicating the specified resource was not found.

  • ThrottlingException –

    An exception indicating a throttling error.

  • ValidationException –

    An exception indicating a specified value is not allowed.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_frauddetector/_services/async_fraud_detector.py
async def send_event(
    self,
    event_id: "capo_frauddetector.types.identifier.identifier",
    event_type_name: "capo_frauddetector.types.identifier.identifier",
    event_timestamp: "capo_frauddetector.types.utc_timestamp_iso8601.utcTimestampISO8601",
    event_variables: "capo_frauddetector.types.event_variable_map.EventVariableMap",
    entities: "capo_frauddetector.types.list_of_entities.listOfEntities",
    *,
    config_overrides: Optional[AsyncFraudDetectorClientConfig] = None,
    assigned_label: Optional[
        "capo_frauddetector.types.identifier.identifier"
    ] = None,
    label_timestamp: Optional[
        "capo_frauddetector.types.utc_timestamp_iso8601.utcTimestampISO8601"
    ] = None,
) -> "capo_frauddetector.types.send_event_result.SendEventResult":
    """<p>Stores events in Amazon Fraud Detector without generating fraud predictions for those events. For example, you can use <code>SendEvent</code> to upload a historical dataset, which you can then later use to train a model.</p>

    Args:
        event_id: <p>The event ID to upload.</p>
        event_type_name: <p>The event type name of the event.</p>
        event_timestamp: <p>The timestamp that defines when the event under evaluation occurred. The timestamp must be specified using ISO 8601 standard in UTC.</p>
        event_variables: <p>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.</p>
        assigned_label: <p>The label to associate with the event. Required if specifying <code>labelTimestamp</code>.</p>
        label_timestamp: <p>The timestamp associated with the label. Required if specifying <code>assignedLabel</code>.</p>
        entities: <p>An array of entities.</p>

    Raises:
        capo_frauddetector.errors.access_denied_exception.AccessDeniedException: <p>An exception indicating Amazon Fraud Detector does not have the needed permissions. This can occur if you submit a request, such as <code>PutExternalModel</code>, that specifies a role that is not in your account.</p>
        capo_frauddetector.errors.conflict_exception.ConflictException: <p>An exception indicating there was a conflict during a delete operation.</p>
        capo_frauddetector.errors.internal_server_exception.InternalServerException: <p>An exception indicating an internal server error.</p>
        capo_frauddetector.errors.resource_not_found_exception.ResourceNotFoundException: <p>An exception indicating the specified resource was not found.</p>
        capo_frauddetector.errors.throttling_exception.ThrottlingException: <p>An exception indicating a throttling error.</p>
        capo_frauddetector.errors.validation_exception.ValidationException: <p>An exception indicating a specified value is not allowed.</p>
        capo_frauddetector.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_frauddetector.types.send_event_request.SendEventRequest]",
    ) -> AsyncOperationResponse[
        "capo_frauddetector.types.send_event_result.SendEventResult"
    ]:
        import capo_frauddetector._operations.aws_hawks_nest_service_facade.send_event

        (
            output,
            http_response,
        ) = await capo_frauddetector._operations.aws_hawks_nest_service_facade.send_event.async_send_event(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_frauddetector.types.send_event_request.SendEventRequest",
    ) -> dict[str, Any]:
        import capo_frauddetector.types.send_event_request

        return capo_frauddetector.types.send_event_request.redact_sensitive(input_)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SendEvent", redact_input=_redact_input)
    )
    input_: capo_frauddetector.types.send_event_request.SendEventRequest = {
        "event_id": event_id,
        "event_type_name": event_type_name,
        "event_timestamp": event_timestamp,
        "event_variables": event_variables,
        "entities": entities,
    }
    if assigned_label is not None:
        input_["assigned_label"] = assigned_label
    if label_timestamp is not None:
        input_["label_timestamp"] = label_timestamp

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output