Documentation
¶
Overview ¶
Package execution provides domain models for execution results.
Index ¶
- Constants
- type ControlResult
- type Evidence
- type EvidenceMeta
- type ExecutionResult
- func (r *ExecutionResult) AddControlResult(cr ControlResult)
- func (r *ExecutionResult) AddPartialResult(cr ControlResult)
- func (r *ExecutionResult) Finalize()
- func (r *ExecutionResult) GetControlResultByID(id string) *ControlResult
- func (r *ExecutionResult) GetControlStatus(id string) (values.Status, bool)
- func (r *ExecutionResult) GetID() values.ExecutionID
- func (r *ExecutionResult) GetVersion() int
- func (r *ExecutionResult) IncrementVersion()
- func (r *ExecutionResult) IsComplete(expectedControlCount int) bool
- type ExpectationResult
- type GreedyTruncator
- type ObservationResult
- type PluginError
- type ResultSummary
- type TruncationStrategy
Constants ¶
const DefaultMaxEvidenceSize = constants.DefaultMaxEvidenceSize
DefaultMaxEvidenceSize is the default limit for evidence size (1MB). Re-exported from constants.DefaultMaxEvidenceSize for backward compatibility.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ControlResult ¶
type ControlResult struct {
ID string
Name string
Description string
Severity string
Status values.Status
Message string
SkipReason string
Tags []string
ObservationResults []ObservationResult
Index int
Duration time.Duration
}
ControlResult represents the result of executing a single control.
type Evidence ¶
type Evidence struct {
Timestamp time.Time
Error *PluginError
Data map[string]interface{}
Raw *string
Status bool
}
Evidence represents observation results (proof of compliance state). This is a core domain concept representing the evidence collected during a check.
type EvidenceMeta ¶
EvidenceMeta contains metadata about evidence truncation.
type ExecutionResult ¶
type ExecutionResult struct {
StartTime time.Time
EndTime time.Time
RegletVersion string
ProfileName string
ProfileVersion string
Controls []ControlResult
Summary ResultSummary
Version int
Duration time.Duration
ExecutionID values.ExecutionID
// contains filtered or unexported fields
}
ExecutionResult represents the complete result of executing a profile.
func NewExecutionResult ¶
func NewExecutionResult(profileName, profileVersion string) *ExecutionResult
NewExecutionResult creates a new execution result.
func NewExecutionResultWithID ¶
func NewExecutionResultWithID(id values.ExecutionID, profileName, profileVersion string) *ExecutionResult
NewExecutionResultWithID creates a new execution result with a specific ID.
func (*ExecutionResult) AddControlResult ¶
func (r *ExecutionResult) AddControlResult(cr ControlResult)
AddControlResult adds a control result to the execution result. Thread-safe for concurrent calls during parallel execution.
func (*ExecutionResult) AddPartialResult ¶
func (r *ExecutionResult) AddPartialResult(cr ControlResult)
AddPartialResult adds a control result from a partial execution (e.g. worker).
func (*ExecutionResult) Finalize ¶
func (r *ExecutionResult) Finalize()
Finalize completes the execution result and calculates the summary. Controls are sorted by their original definition order for deterministic output.
func (*ExecutionResult) GetControlResultByID ¶
func (r *ExecutionResult) GetControlResultByID(id string) *ControlResult
GetControlResultByID returns a pointer to the control result with the given ID, or nil if not found. Thread-safe.
func (*ExecutionResult) GetControlStatus ¶
func (r *ExecutionResult) GetControlStatus(id string) (values.Status, bool)
GetControlStatus returns the status of a control by ID. Returns the status and a boolean indicating if the control was found. Thread-safe.
func (*ExecutionResult) GetID ¶
func (r *ExecutionResult) GetID() values.ExecutionID
GetID returns the execution ID.
func (*ExecutionResult) GetVersion ¶
func (r *ExecutionResult) GetVersion() int
GetVersion returns the optimistic locking version.
func (*ExecutionResult) IncrementVersion ¶
func (r *ExecutionResult) IncrementVersion()
IncrementVersion increments the version counter.
func (*ExecutionResult) IsComplete ¶
func (r *ExecutionResult) IsComplete(expectedControlCount int) bool
IsComplete checks if the number of executed controls matches the expected count.
type ExpectationResult ¶
ExpectationResult represents the result of evaluating a single expectation expression. The Message field provides human-readable context about failures, constructed by the StatusAggregator which has full access to the evidence and expression evaluation context.
type GreedyTruncator ¶
type GreedyTruncator struct{}
GreedyTruncator implements a simple greedy truncation strategy. It truncates large string fields or replaces large complex objects until the size is reduced.
func (*GreedyTruncator) Truncate ¶
func (t *GreedyTruncator) Truncate(data map[string]interface{}, limit int) (map[string]interface{}, *EvidenceMeta, error)
Truncate returns a truncated copy of the evidence if it exceeds the limit.
type ObservationResult ¶
type ObservationResult struct {
RawError error
LoopItem interface{}
Config map[string]interface{}
Evidence *Evidence
EvidenceMeta *EvidenceMeta
Error *PluginError
Status values.Status
Plugin string
Expectations []ExpectationResult
Children []ObservationResult
Duration time.Duration
LoopIndex int
IsLoop bool
}
ObservationResult represents the result of executing a single observation.
type PluginError ¶
PluginError represents an error from plugin execution. This is a domain concept representing a failure in collecting evidence.
func (*PluginError) Error ¶
func (e *PluginError) Error() string
Error implements the error interface
type ResultSummary ¶
type ResultSummary struct {
TotalControls int
PassedControls int
FailedControls int
ErrorControls int
SkippedControls int
TotalObservations int
PassedObservations int
FailedObservations int
ErrorObservations int
}
ResultSummary provides aggregate statistics about the execution.
type TruncationStrategy ¶
type TruncationStrategy interface {
Truncate(data map[string]interface{}, limit int) (map[string]interface{}, *EvidenceMeta, error)
}
TruncationStrategy defines how evidence should be truncated when it exceeds limits.