fix(eventbridge): report a delivered event's time to the second, from the entry's Time when given (#8020)

This commit is contained in:
Niels Kootstra authored and GitHub committed 2026-11-11 12:01:45 -04:00
1 parent e37f45f714
commit 3eb01eb8e9
4 files changed
+121 -2

No files matched your search

@@ -7,6 +7,7 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
import io.floci.aws.core.common.AwsErrorResponse;
import io.floci.aws.core.common.AwsException;
import io.floci.aws.core.common.AwsJson11Controller;
import io.floci.aws.core.common.AwsJsonTimestamp;
import io.floci.aws.core.common.PaginatedResult;
import io.floci.aws.core.common.Pagination;
import io.floci.aws.services.eventbridge.model.ApiDestination;
@@ -413,6 +414,10 @@ public class EventBridgeHandler {
if (!entryNode.path("Resources").isMissingNode()) {
entry.put("Resources", entryNode.path("Resources"));
}
Instant time = AwsJsonTimestamp.epochSeconds(entryNode, "Time", "SerializationException");
if (time != null) {
entry.put("Time", time);
}
entries.add(entry);
}
}
@@ -51,6 +51,7 @@ import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
@@ -1490,7 +1491,8 @@ public class EventBridgeService implements ResourceProvider, StoredResourceArns
node.put("source", source);
node.put("detail-type", detailType);
node.put("account", envelopeAccount);
node.put("time", Instant.now().toString());
Instant time = entry.get("Time") instanceof Instant entryTime ? entryTime : Instant.now();
node.put("time", time.truncatedTo(ChronoUnit.SECONDS).toString());
node.put("region", envelopeRegion);
node.putArray("resources").addAll(resources);
node.set("detail", objectMapper.readTree(detail));