fix: recover run runtime state and logs
This commit is contained in:
@@ -66,6 +66,9 @@ type RunLifecycleReportRequest struct {
|
||||
Progress JobProgressBody `json:"progress"`
|
||||
Message string `json:"message,omitempty"`
|
||||
ErrorCode string `json:"errorCode,omitempty"`
|
||||
ManagedProcessID string `json:"managedProcessId,omitempty"`
|
||||
ObservationSeq uint64 `json:"observationSeq,omitempty"`
|
||||
ObservedAt time.Time `json:"observedAt,omitempty"`
|
||||
ExecutionResult RunJobExecutionResultBody `json:"executionResult,omitempty"`
|
||||
}
|
||||
|
||||
@@ -122,6 +125,9 @@ func (request RunLifecycleReportRequest) ToDomain() domain.RunLifecycleReport {
|
||||
Progress: progressReportToDomain(request.Progress),
|
||||
Message: request.Message,
|
||||
ErrorCode: request.ErrorCode,
|
||||
ManagedProcessID: request.ManagedProcessID,
|
||||
ObservationSeq: request.ObservationSeq,
|
||||
ObservedAt: request.ObservedAt,
|
||||
ExecutionResult: domain.JobExecutionResult{Kind: request.ExecutionResult.Kind, ProcessState: request.ExecutionResult.ProcessState, ExitClassification: request.ExecutionResult.ExitClassification, ExitCode: request.ExecutionResult.ExitCode, Version: request.ExecutionResult.Version, Checksum: request.ExecutionResult.Checksum, SizeBytes: request.ExecutionResult.SizeBytes, AuditSummary: request.ExecutionResult.AuditSummary, Content: request.ExecutionResult.Content, ServerDeploymentEvidence: serverDeploymentEvidenceToDomain(request.ExecutionResult.ServerDeploymentEvidence), DeploymentReceipt: deploymentReceiptToDomain(request.ExecutionResult.DeploymentReceipt)},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,6 +53,22 @@ type LogStreamCursorResponse struct {
|
||||
LatestSeq uint64 `json:"latestSeq"`
|
||||
}
|
||||
|
||||
type RunLogStreamProgressRequest struct {
|
||||
RunEndpointID string `json:"runEndpointId"`
|
||||
SessionToken string `json:"sessionToken"`
|
||||
ServerInstanceID string `json:"serverInstanceId"`
|
||||
LogStreamID string `json:"logStreamId"`
|
||||
}
|
||||
|
||||
type RunLogStreamProgressResponse struct {
|
||||
Accepted bool `json:"accepted"`
|
||||
RunEndpointID string `json:"runEndpointId"`
|
||||
ServerInstanceID string `json:"serverInstanceId"`
|
||||
LogStreamID string `json:"logStreamId"`
|
||||
LatestSeq uint64 `json:"latestSeq"`
|
||||
ServerTime time.Time `json:"serverTime"`
|
||||
}
|
||||
|
||||
type LogStreamEventResponse struct {
|
||||
ServerInstanceID string `json:"serverInstanceId"`
|
||||
StreamID string `json:"streamId"`
|
||||
@@ -92,6 +108,10 @@ func (request LogStreamCursorRequest) ToDomain() domain.LogStreamCursorQuery {
|
||||
}
|
||||
}
|
||||
|
||||
func (request RunLogStreamProgressRequest) ToDomain() domain.RunLogStreamProgress {
|
||||
return domain.RunLogStreamProgress{RunEndpointID: request.RunEndpointID, SessionToken: request.SessionToken, ServerInstanceID: request.ServerInstanceID, LogStreamID: request.LogStreamID}
|
||||
}
|
||||
|
||||
func LogBatchIngestFromDomain(result domain.LogBatchIngestResult) LogBatchIngestResponse {
|
||||
return LogBatchIngestResponse{
|
||||
Accepted: result.Accepted,
|
||||
@@ -114,6 +134,10 @@ func LogStreamCursorFromDomain(result domain.LogStreamCursorResult) LogStreamCur
|
||||
}
|
||||
}
|
||||
|
||||
func RunLogStreamProgressFromDomain(result domain.RunLogStreamProgressResult) RunLogStreamProgressResponse {
|
||||
return RunLogStreamProgressResponse{Accepted: result.Accepted, RunEndpointID: result.RunEndpointID, ServerInstanceID: result.ServerInstanceID, LogStreamID: result.LogStreamID, LatestSeq: result.LatestSeq, ServerTime: result.ServerTime}
|
||||
}
|
||||
|
||||
func LogStreamEventFromDomain(event domain.LogStreamEvent) LogStreamEventResponse {
|
||||
event = domain.CopyLogStreamEvent(event)
|
||||
return LogStreamEventResponse{
|
||||
|
||||
@@ -587,6 +587,7 @@ type ServerInstanceResponse struct {
|
||||
OwnerUserID string `json:"ownerUserId,omitempty"`
|
||||
AdminUserIDs []string `json:"adminUserIds"`
|
||||
State domain.ServerInstanceState `json:"state"`
|
||||
LifecycleObservedAt *time.Time `json:"lifecycleObservedAt,omitempty"`
|
||||
ConfigVersion int `json:"configVersion"`
|
||||
ConfigKey string `json:"configKey,omitempty"`
|
||||
ConfigChecksum string `json:"configChecksum,omitempty"`
|
||||
@@ -1640,6 +1641,7 @@ func ServerInstanceFromDomain(instance domain.ServerInstance) ServerInstanceResp
|
||||
OwnerUserID: instance.OwnerUserID,
|
||||
AdminUserIDs: adminUserIDs,
|
||||
State: instance.State,
|
||||
LifecycleObservedAt: optionalTime(instance.LifecycleObservedAt),
|
||||
ConfigVersion: instance.ConfigVersion,
|
||||
ConfigKey: instance.ConfigKey,
|
||||
ConfigChecksum: instance.ConfigChecksum,
|
||||
|
||||
Reference in New Issue
Block a user