Documentation ¶
Index ¶
- Variables
- func GenerateNativeSummary(r *scan.Report, options ...Option) (interface{}, error)
- func GenerateSummary(r *scan.Report, options ...Option) (interface{}, error)
- func Merge(mimeType string, r1, r2 interface{}) (interface{}, error)
- func MergeNativeReport(r1, r2 interface{}) (interface{}, error)
- func MergeNativeSummary(s1, s2 interface{}) (interface{}, error)
- func MergeSummary(mimeType string, s1, s2 interface{}) (interface{}, error)
- func ResolveData(mime string, jsonData []byte, options ...Option) (interface{}, error)
- type Manager
- type Merger
- type Option
- type Options
- type Reports
- type SummaryGenerator
- type SummaryMerger
Constants ¶
This section is empty.
Variables ¶
var ( // Mgr is the global report manager Mgr = NewManager() )
var SupportedGenerators = map[string]SummaryGenerator{ v1.MimeTypeNativeReport: GenerateNativeSummary, v1.MimeTypeGenericVulnerabilityReport: GenerateNativeSummary, }
SupportedGenerators declares mappings between mime type and summary generator func.
var SupportedMergers = map[string]Merger{ v1.MimeTypeNativeReport: MergeNativeReport, v1.MimeTypeGenericVulnerabilityReport: MergeNativeReport, }
SupportedMergers declares mappings between mime type and report merger func.
var SupportedMimes = map[string]interface{}{ v1.MimeTypeNativeReport: (*vuln.Report)(nil), v1.MimeTypeGenericVulnerabilityReport: (*vuln.Report)(nil), }
SupportedMimes indicates what mime types are supported to render at UI end.
var SupportedSummaryMergers = map[string]SummaryMerger{ v1.MimeTypeNativeReport: MergeNativeSummary, v1.MimeTypeGenericVulnerabilityReport: MergeNativeSummary, }
SupportedSummaryMergers declares mappings between mime type and summary merger func.
Functions ¶
func GenerateNativeSummary ¶
GenerateNativeSummary generates the report summary for the native report.
func GenerateSummary ¶
GenerateSummary is a helper function to generate report summary based on the given report.
func MergeNativeReport ¶
func MergeNativeReport(r1, r2 interface{}) (interface{}, error)
MergeNativeReport merge report r1 and r2
func MergeNativeSummary ¶
func MergeNativeSummary(s1, s2 interface{}) (interface{}, error)
MergeNativeSummary merge vuln.NativeReportSummary together
func MergeSummary ¶
MergeSummary merge summary s1 and s2
Types ¶
type Manager ¶
type Manager interface { // Create a new report record. // // Arguments: // ctx context.Context : the context for this method // r *scan.Report : report model to be created // // Returns: // string : uuid of the new report // error : non nil error if any errors occurred // Create(ctx context.Context, r *scan.Report) (string, error) // Delete delete report by uuid // // Arguments: // ctx context.Context : the context for this method // uuid string : uuid of the report to delete // // Returns: // error : non nil error if any errors occurred // Delete(ctx context.Context, uuid string) error // Update the report data (with JSON format) of the given report. // // Arguments: // ctx context.Context : the context for this method // uuid string : uuid to identify the report // report string : report JSON data // // Returns: // error : non nil error if any errors occurred // UpdateReportData(ctx context.Context, uuid string, report string) error // Get the reports for the given digest by other properties. // // Arguments: // ctx context.Context : the context for this method // digest string : digest of the artifact // registrationUUID string : [optional] the report generated by which registration. // If it is empty, reports by all the registrations are retrieved. // mimeTypes []string : [optional] mime types of the reports requiring // If empty array is specified, reports with all the supported mimes are retrieved. // // Returns: // []*scan.Report : report list // error : non nil error if any errors occurred GetBy(ctx context.Context, digest string, registrationUUID string, mimeTypes []string) ([]*scan.Report, error) // Delete the reports related with the specified digests (one or more...) // // Arguments: // ctx context.Context : the context for this method // digests ...string : specify one or more digests whose reports will be deleted // // Returns: // error : non nil error if any errors occurred DeleteByDigests(ctx context.Context, digests ...string) error // List reports according to the query // // Arguments: // ctx context.Context : the context for this method // query *q.Query : the query to list the reports // // Returns: // []*scan.Report : report list // error : non nil error if any errors occurred List(ctx context.Context, query *q.Query) ([]*scan.Report, error) }
Manager is used to manage the scan reports.
type Merger ¶
type Merger func(r1, r2 interface{}) (interface{}, error)
Merger is a helper function to merge report together
type Option ¶
type Option func(options *Options)
Option for getting the report w/ summary with func template way.
func WithArtifactDigest ¶
WithArtifactDigest is an option of setting artifact digest
type Options ¶
type Options struct { // If it is set, the returned report will contains artifact digest for the vulnerabilities ArtifactDigest string }
Options provides options for getting the report w/ summary.
type Reports ¶
Reports slice of scan.Reports pointer
func (Reports) ResolveData ¶
ResolveData resolve the data from the reports and merge them together
type SummaryGenerator ¶
SummaryGenerator is a func template which used to generated report summary for relevant mime type.
type SummaryMerger ¶
type SummaryMerger func(s1, s2 interface{}) (interface{}, error)
SummaryMerger is a helper function to merge summary together