sendDataIntegrationEvent method

Future<SendDataIntegrationEventResponse> sendDataIntegrationEvent({
  1. required String data,
  2. required String eventGroupId,
  3. required DataIntegrationEventType eventType,
  4. required String instanceId,
  5. String? clientToken,
  6. DataIntegrationEventDatasetTargetConfiguration? datasetTarget,
  7. DateTime? eventTimestamp,
})

Send the data payload for the event with real-time data for analysis or monitoring. The real-time data events are stored in an Amazon Web Services service before being processed and stored in data lake.

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

Parameter data : The data payload of the event, should follow the data schema of the target dataset, or see Data entities supported in AWS Supply Chain. To send single data record, use JsonObject format; to send multiple data records, use JsonArray format.

Note that for AWS Supply Chain dataset under asc namespace, it has a connection_id internal field that is not allowed to be provided by client directly, they will be auto populated.

Parameter eventGroupId : Event identifier (for example, orderId for InboundOrder) used for data sharding or partitioning. Noted under one eventGroupId of same eventType and instanceId, events are processed sequentially in the order they are received by the server.

Parameter eventType : The data event type.

Parameter instanceId : The AWS Supply Chain instance identifier.

Parameter clientToken : The idempotent client token. The token is active for 8 hours, and within its lifetime, it ensures the request completes only once upon retry with same client token. If omitted, the AWS SDK generates a unique value so that AWS SDK can safely retry the request upon network errors.

Parameter datasetTarget : The target dataset configuration for scn.data.dataset event type.

Parameter eventTimestamp : The timestamp (in epoch seconds) associated with the event. If not provided, it will be assigned with current timestamp.

Implementation

Future<SendDataIntegrationEventResponse> sendDataIntegrationEvent({
  required String data,
  required String eventGroupId,
  required DataIntegrationEventType eventType,
  required String instanceId,
  String? clientToken,
  DataIntegrationEventDatasetTargetConfiguration? datasetTarget,
  DateTime? eventTimestamp,
}) async {
  final $payload = <String, dynamic>{
    'data': data,
    'eventGroupId': eventGroupId,
    'eventType': eventType.value,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (datasetTarget != null) 'datasetTarget': datasetTarget,
    if (eventTimestamp != null)
      'eventTimestamp': unixTimestampToJson(eventTimestamp),
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri:
        '/api-data/data-integration/instance/${Uri.encodeComponent(instanceId)}/data-integration-events',
    exceptionFnMap: _exceptionFns,
  );
  return SendDataIntegrationEventResponse.fromJson(response);
}