Documentation
¶
Index ¶
- func CollectComponentResults(results []Result, errorFormatter func(Result) error) ([]applicationsnapshot.Component, [][]byte, error)
- func ContainsOutputFormat(outputFormats []string, format string) bool
- func GetPolicyConfig(ctx context.Context, policyConfiguration string) (string, error)
- func ProcessOutputForImageValidation(out *output.Output, err error, comp app.SnapshotComponent, showSuccesses bool, ...) applicationsnapshot.Component
- func ReadFile(ctx context.Context, fileName string) (string, error)
- func WriteReport(data ReportData, opts ReportOutputOptions, cmd *cobra.Command) (applicationsnapshot.Report, error)
- type ReportData
- type ReportOutputOptions
- type Result
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CollectComponentResults ¶ added in v0.8.73
func CollectComponentResults( results []Result, errorFormatter func(Result) error, ) ([]applicationsnapshot.Component, [][]byte, error)
CollectComponentResults processes a slice of results, accumulating errors and collecting successful components. It returns the collected components (sorted by ContainerImage), policy inputs, and any aggregated errors. The errorFormatter is called for each failed result to create an error message.
func ContainsOutputFormat ¶ added in v0.8.73
ContainsOutputFormat checks if the specified output format is in the output formats list. It handles formats that may include file paths (e.g., "attestation=/path/to/file").
func GetPolicyConfig ¶
Determine policyConfig
func ProcessOutputForImageValidation ¶ added in v0.8.73
func ProcessOutputForImageValidation( out *output.Output, err error, comp app.SnapshotComponent, showSuccesses bool, outputFormats []string, ) applicationsnapshot.Component
ProcessOutputForImageValidation processes an output.Output using the same pipeline as the validate image command. This ensures consistent processing for both validate image and validate vsa (fallback) commands. Returns the processed Component which contains violations, warnings, successes processed with the same logic (filtering, sorting, etc.) as the validate image command.
func WriteReport ¶ added in v0.8.73
func WriteReport(data ReportData, opts ReportOutputOptions, cmd *cobra.Command) (applicationsnapshot.Report, error)
WriteReport creates and writes a report using the provided data and options. It returns the created report so it can be used for further processing (e.g., VSA validation).
Types ¶
type ReportData ¶ added in v0.8.73
type ReportData struct {
Snapshot string
Components []applicationsnapshot.Component
Policy policy.Policy
PolicyInputs [][]byte
Expansion *applicationsnapshot.ExpansionInfo
ShowSuccesses bool
ShowWarnings bool
}
ReportData contains the data needed to create an application snapshot report
type ReportOutputOptions ¶ added in v0.8.73
ReportOutputOptions contains options for formatting and writing the report
type Result ¶ added in v0.8.73
type Result struct {
Err error
Component applicationsnapshot.Component
PolicyInput []byte
}
Result represents the result of validating a single component
func PopulateResultFromOutput ¶ added in v0.8.73
func PopulateResultFromOutput( out *output.Output, err error, comp app.SnapshotComponent, showSuccesses bool, outputFormats []string, ) Result
PopulateResultFromOutput decomposes an output.Output object into a Result object. This is used to convert validation output into a consistent result structure that can be used for report generation.