mirror of
https://github.com/floci-io/floci.git
synced 2026-11-24 06:20:24 -05:00
fix: serialize Kinesis stream creation timestamps as plain decimals (#2173)
Fixes #2099 Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
This commit is contained in:
1 parent
c22652dd15
commit
c33508651e
3 files changed
+103
-3
No files matched your search
@@ -15,6 +15,8 @@ import jakarta.enterprise.context.ApplicationScoped;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Base64;
|
||||
import java.util.HashMap;
|
||||
@@ -168,7 +170,7 @@ public class KinesisJsonHandler {
|
||||
desc.put("StreamStatus", stream.getStreamStatus());
|
||||
desc.put("HasMoreShards", false);
|
||||
desc.put("RetentionPeriodHours", stream.getRetentionPeriodHours());
|
||||
desc.put("StreamCreationTimestamp", stream.getStreamCreationTimestamp().toEpochMilli() / 1000.0);
|
||||
desc.put("StreamCreationTimestamp", epochSeconds(stream.getStreamCreationTimestamp()));
|
||||
desc.put("EncryptionType", stream.getEncryptionType());
|
||||
if (stream.getKeyId() != null) {
|
||||
desc.put("KeyId", stream.getKeyId());
|
||||
@@ -209,7 +211,7 @@ public class KinesisJsonHandler {
|
||||
summary.put("StreamARN", stream.getStreamArn());
|
||||
summary.put("StreamStatus", stream.getStreamStatus());
|
||||
summary.put("RetentionPeriodHours", stream.getRetentionPeriodHours());
|
||||
summary.put("StreamCreationTimestamp", stream.getStreamCreationTimestamp().toEpochMilli() / 1000.0);
|
||||
summary.put("StreamCreationTimestamp", epochSeconds(stream.getStreamCreationTimestamp()));
|
||||
summary.put("OpenShardCount", (int) stream.getShards().stream().filter(s -> !s.isClosed()).count());
|
||||
summary.put("EncryptionType", stream.getEncryptionType());
|
||||
if (stream.getKeyId() != null) {
|
||||
@@ -231,6 +233,10 @@ public class KinesisJsonHandler {
|
||||
parent.putObject("StreamModeDetails").put("StreamMode", stream.getStreamMode());
|
||||
}
|
||||
|
||||
private BigDecimal epochSeconds(Instant timestamp) {
|
||||
return BigDecimal.valueOf(timestamp.toEpochMilli(), 3);
|
||||
}
|
||||
|
||||
private Response handleRegisterStreamConsumer(JsonNode request, String region) {
|
||||
String streamArn = request.path("StreamARN").asText();
|
||||
String consumerName = request.path("ConsumerName").asText();
|
||||
|
||||
Reference in new issue
Block a user