report

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 10, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Check

type Check struct {
	Status  rule.Status   `json:"status"`
	Message string        `json:"message"`
	Targets []rule.Target `json:"targets,omitempty"`
}

Check is the result of a single Rule check.

type DifferenceReport added in v0.6.0

type DifferenceReport struct {
	Title     string               `json:"title,omitempty"`
	Time      time.Time            `json:"time"`
	MinStatus rule.Status          `json:"minStatus,omitempty"`
	Providers []ProviderDifference `json:"providers"`
}

DifferenceReport contains the difference between two reports.

func CreateDifference added in v0.6.0

func CreateDifference(oldReport Report, newReport Report, title string) (*DifferenceReport, error)

CreateDifference creates the difference between two reports.

type DifferenceReportsWrapper added in v0.6.0

type DifferenceReportsWrapper struct {
	DifferenceReports  []*DifferenceReport `json:"differenceReports"`
	IdentityAttributes map[string]string   `json:"identityAttributes"`
}

DifferenceReportsWrapper wraps DifferenceReports and additional attributes needed for html rendering.

type HTMLRenderer

type HTMLRenderer struct {
	// contains filtered or unexported fields
}

HTMLRenderer renders Diki reports in html format.

func NewHTMLRenderer

func NewHTMLRenderer() (*HTMLRenderer, error)

NewHTMLRenderer creates a HTMLRenderer.

func (*HTMLRenderer) Render

func (r *HTMLRenderer) Render(w io.Writer, report any) error

Render writes a Diki report in html format into the passed writer.

type MergedCheck

type MergedCheck struct {
	Status         rule.Status              `json:"status"`
	Message        string                   `json:"message"`
	ReportsTargets map[string][]rule.Target `json:"targets,omitempty"`
}

MergedCheck is the result of a single Rule check for multiple reports.

type MergedProvider

type MergedProvider struct {
	ID         string                       `json:"id"`
	Name       string                       `json:"name"`
	DistinctBy string                       `json:"distinctBy"`
	Metadata   map[string]map[string]string `json:"metadata,omitempty"`
	Rulesets   []MergedRuleset              `json:"rulesets"`
}

MergedProvider contains information from multiple reports about a known provider and its ran rulesets.

type MergedReport

type MergedReport struct {
	Time        time.Time        `json:"time"`
	MinStatus   rule.Status      `json:"minStatus,omitempty"`
	DikiVersion string           `json:"dikiVersion"`
	Metadata    map[string]any   `json:"metadata,omitempty"`
	Providers   []MergedProvider `json:"providers"`
}

MergedReport contains information about multiple Diki runs in a suitable for reporting format.

func MergeReport

func MergeReport(reports []*Report, distinctByAttrs map[string]string) (*MergedReport, error)

MergeReport merges given reports by specified providers and unique metadata attribute.

type MergedRule

type MergedRule struct {
	ID     string        `json:"id"`
	Name   string        `json:"name"`
	Checks []MergedCheck `json:"checks"`
}

MergedRule contains information about a ran rule for multiple reports.

type MergedRuleset

type MergedRuleset struct {
	ID      string       `json:"id"`
	Name    string       `json:"name"`
	Version string       `json:"version"`
	Rules   []MergedRule `json:"rules"`
}

MergedRuleset contains information from multiple reports about a ruleset and its rules.

type Metadata added in v0.8.0

type Metadata map[string]any

Metadata is additional report values.

func (Metadata) ApplyToReport added in v0.8.0

func (md Metadata) ApplyToReport(opts *ReportOptions)

ApplyToReport implements ReportOption.

type MinStatus

type MinStatus rule.Status

MinStatus is the minimal reporting status.

func (MinStatus) ApplyToReport

func (ms MinStatus) ApplyToReport(opts *ReportOptions)

ApplyToReport implements ReportOption.

type Provider

type Provider struct {
	ID       string            `json:"id"`
	Name     string            `json:"name"`
	Metadata map[string]string `json:"metadata,omitempty"`
	Rulesets []Ruleset         `json:"rulesets"`
}

Provider contains information about a known provider and its ran rulesets.

type ProviderDifference added in v0.6.0

type ProviderDifference struct {
	ID          string              `json:"id"`
	Name        string              `json:"name"`
	OldMetadata map[string]string   `json:"oldMetadata,omitempty"`
	NewMetadata map[string]string   `json:"newMetadata,omitempty"`
	Rulesets    []RulesetDifference `json:"rulesets"`
}

ProviderDifference contains the difference between two reports for a known provider and its ran rulesets.

type Report

type Report struct {
	Time        time.Time      `json:"time"`
	MinStatus   rule.Status    `json:"minStatus,omitempty"`
	DikiVersion string         `json:"dikiVersion"`
	Metadata    map[string]any `json:"metadata,omitempty"`
	Providers   []Provider     `json:"providers"`
}

Report contains information about a Diki run in a suitable for reporting format.

func FromProviderResults

func FromProviderResults(results []provider.ProviderResult, options ...ReportOption) *Report

FromProviderResults returns a Diki report from ProviderResults.

func (*Report) WriteToFile

func (r *Report) WriteToFile(filePath string) error

WriteToFile writes a Diki report to a file.

type ReportOption

type ReportOption interface {
	ApplyToReport(*ReportOptions)
}

ReportOption defines a single option that can be applied to a Report.

type ReportOptions

type ReportOptions struct {
	MinStatus rule.Status
	Metadata  map[string]any
}

ReportOptions are options that can be applied to a Report.

type Rule

type Rule struct {
	ID     string  `json:"id"`
	Name   string  `json:"name"`
	Checks []Check `json:"checks"`
}

Rule contains information about a ran rule.

type RuleDifference added in v0.6.0

type RuleDifference struct {
	ID      string  `json:"id"`
	Name    string  `json:"name"`
	Added   []Check `json:"added,omitempty"`
	Removed []Check `json:"removed,omitempty"`
}

RuleDifference contains the difference between two reports for a single rule.

type Ruleset

type Ruleset struct {
	ID      string `json:"id"`
	Name    string `json:"name"`
	Version string `json:"version"`
	Rules   []Rule `json:"rules"`
}

Ruleset contains information about a rule set and its rules.

type RulesetDifference added in v0.6.0

type RulesetDifference struct {
	ID      string           `json:"id"`
	Name    string           `json:"name"`
	Version string           `json:"version"`
	Rules   []RuleDifference `json:"rules"`
}

RulesetDifference contains the difference between two reports for a ruleset and its rules.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL