report

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2022 License: Apache-2.0 Imports: 15 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(report Report, option Option) error

Write writes the results in the give format

Types

type ConsolidatedReport

type ConsolidatedReport struct {
	SchemaVersion int `json:",omitempty"`
	ClusterName   string
	Findings      []Resource `json:",omitempty"`
}

ConsolidatedReport represents a kubernetes scan report with consolidated findings

type JSONWriter

type JSONWriter struct {
	Output io.Writer
	Report string
}

func (JSONWriter) Write

func (jw JSONWriter) Write(report Report) error

Write writes the results in JSON format

type Option

type Option struct {
	Format     string
	Report     string
	Output     io.Writer
	Severities []dbTypes.Severity
}

type Report

type Report struct {
	SchemaVersion     int `json:",omitempty"`
	ClusterName       string
	Vulnerabilities   []Resource `json:",omitempty"`
	Misconfigurations []Resource `json:",omitempty"`
}

Report represents a kubernetes scan report

func (Report) Failed

func (r Report) Failed() bool

Failed returns whether the k8s report includes any vulnerabilities or misconfigurations

type Resource

type Resource struct {
	Namespace string `json:",omitempty"`
	Kind      string
	Name      string
	// TODO(josedonizetti): should add metadata? per report? per Result?
	// Metadata  Metadata `json:",omitempty"`
	Results types.Results `json:",omitempty"`
	Error   string        `json:",omitempty"`

	// original report
	Report types.Report `json:"-"`
}

Resource represents a kubernetes resource report

func CreateResource

func CreateResource(artifact *artifacts.Artifact, report types.Report, err error) Resource

type SummaryWriter

type SummaryWriter struct {
	Output           io.Writer
	Severities       []string
	SeverityHeadings []string
}

func NewSummaryWriter

func NewSummaryWriter(output io.Writer, requiredSevs []dbTypes.Severity) SummaryWriter

func (SummaryWriter) Write

func (s SummaryWriter) Write(report Report) error

Write writes the results in a summarized table format

type TableWriter

type TableWriter struct {
	Report     string
	Output     io.Writer
	Severities []dbTypes.Severity
}

func (TableWriter) Write

func (tw TableWriter) Write(report Report) error

type Writer

type Writer interface {
	Write(Report) error
}

Writer defines the result write operation

Jump to

Keyboard shortcuts

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