Implement platform management features
This commit is contained in:
@@ -27,6 +27,14 @@ func ValidateLogBatchIngest(batch domain.LogBatchIngest) error {
|
||||
if !validLogStreamSource(batch.Source) {
|
||||
violations = append(violations, "source is invalid")
|
||||
}
|
||||
hasSessionID := strings.TrimSpace(batch.LogSessionID) != ""
|
||||
hasSessionStart := !batch.SessionStartedAt.IsZero()
|
||||
if hasSessionID != hasSessionStart {
|
||||
violations = append(violations, "logSessionId and sessionStartedAt must be provided together")
|
||||
}
|
||||
if (hasSessionID || hasSessionStart) && batch.Source != domain.LogStreamSourceProcess {
|
||||
violations = append(violations, "log session metadata is only valid for process streams")
|
||||
}
|
||||
if batch.FirstSeq == 0 || batch.LastSeq == 0 {
|
||||
violations = append(violations, "sequence range must be positive")
|
||||
}
|
||||
|
||||
@@ -1667,6 +1667,14 @@ func ValidateLogStream(stream domain.LogStream) error {
|
||||
if !validLogStorageBackend(stream.StorageBackend) {
|
||||
violations = append(violations, "storageBackend is invalid")
|
||||
}
|
||||
hasSessionID := strings.TrimSpace(stream.LogSessionID) != ""
|
||||
hasSessionStart := !stream.SessionStartedAt.IsZero()
|
||||
if hasSessionID != hasSessionStart {
|
||||
violations = append(violations, "logSessionId and sessionStartedAt must be provided together")
|
||||
}
|
||||
if (hasSessionID || hasSessionStart) && stream.Source != domain.LogStreamSourceProcess {
|
||||
violations = append(violations, "log session metadata is only valid for process streams")
|
||||
}
|
||||
return finish(violations)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user