printer

package
v3.0.8 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0 Imports: 53 Imported by: 0

Documentation

Index

Constants

View Source
const TOP_RESOURCE_COUNT = 15
View Source
const TOP_VECTOR_COUNT = 10

Variables

View Source
var INDENT = "   "

Functions

func AssistedRemediationPathsToString

func AssistedRemediationPathsToString(control *resourcesresults.ResourceAssociatedControl) []string

func FinalizeResults

func FinalizeResults(data *cautils.OPASessionObj) *reporthandlingv2.PostureReport

finalizeV2Report finalize the results objects by copying data from map to lists

Types

type HTMLReportingCtx

type HTMLReportingCtx struct {
	OPASessionObj     *cautils.OPASessionObj
	ResourceTableView ResourceTableView
}

type HtmlPrinter

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

func NewHtmlPrinter

func NewHtmlPrinter() *HtmlPrinter

func (*HtmlPrinter) ActionPrint

func (hp *HtmlPrinter) ActionPrint(ctx context.Context, opaSessionObj *cautils.OPASessionObj, imageScanData []cautils.ImageScanData)

func (*HtmlPrinter) PrintNextSteps

func (hp *HtmlPrinter) PrintNextSteps()

func (*HtmlPrinter) Score

func (hp *HtmlPrinter) Score(score float32)

func (*HtmlPrinter) SetWriter

func (hp *HtmlPrinter) SetWriter(ctx context.Context, outputFile string)

type JUnitFailure

type JUnitFailure struct {
	Message  string `xml:"message,attr"`
	Type     string `xml:"type,attr"`
	Contents string `xml:",chardata"`
}

JUnitFailure contains data related to a failed test.

type JUnitProperty

type JUnitProperty struct {
	Name  string `xml:"name,attr"`
	Value string `xml:"value,attr"`
}

JUnitProperty represents a key/value pair used to define properties.

type JUnitSkipMessage

type JUnitSkipMessage struct {
	Message string `xml:"message,attr"`
}

JUnitSkipMessage contains the reason why a testcase was skipped.

type JUnitTestCase

type JUnitTestCase struct {
	XMLName     xml.Name          `xml:"testcase"`
	Classname   string            `xml:"classname,attr"` // Full class name for the class the test method is in. required
	Name        string            `xml:"name,attr"`      // Name of the test method, required
	Time        string            `xml:"time,attr"`      // Time taken (in seconds) to execute the test. optional
	SkipMessage *JUnitSkipMessage `xml:"skipped,omitempty"`
	Failure     *JUnitFailure     `xml:"failure,omitempty"`
}

JUnitTestCase represents a single resource

type JUnitTestSuite

type JUnitTestSuite struct {
	XMLName    xml.Name        `xml:"testsuite"`
	Tests      int             `xml:"tests,attr"`     // total number of tests from this testsuite. Some software may expect to only see the number of successful tests though
	Name       string          `xml:"name,attr"`      // Full (class) name of the test for non-aggregated testsuite documents. Class name without the package for aggregated testsuites documents. Required
	Errors     int             `xml:"errors,attr"`    // The total number of tests in the suite that errors
	Failures   int             `xml:"failures,attr"`  // The total number of tests in the suite that failed
	Hostname   string          `xml:"hostname,attr"`  // Host on which the tests were executed ? cluster name ?
	ID         int             `xml:"id,attr"`        // Starts at 0 for the first testsuite and is incremented by 1 for each following testsuite
	Skipped    string          `xml:"skipped,attr"`   // The total number of skipped tests
	Time       string          `xml:"time,attr"`      // Time taken (in seconds) to execute the tests in the suite
	Timestamp  string          `xml:"timestamp,attr"` // when the test was executed in ISO 8601 format (2014-01-21T16:17:18)
	Properties []JUnitProperty `xml:"properties>property,omitempty"`
	TestCases  []JUnitTestCase `xml:"testcase"`
}

JUnitTestSuite represents a single control

type JUnitTestSuites

type JUnitTestSuites struct {
	XMLName  xml.Name         `xml:"testsuites"`
	Suites   []JUnitTestSuite `xml:"testsuite"`     // list of controls
	Errors   int              `xml:"errors,attr"`   // total number of tests with error result from all testsuites
	Failures int              `xml:"failures,attr"` // total number of failed tests from all testsuites
	Tests    int              `xml:"tests,attr"`    // total number of tests from all testsuites. Some software may expect to only see the number of successful tests from all testsuites though
	Time     string           `xml:"time,attr"`     // time in seconds to execute all test suites
	Name     string           `xml:"name,attr"`     // ? Add framework names ?
}

JUnitTestSuites represents the test summary

type JUnitXML

type JUnitXML struct {
	TestSuites JUnitTestSuites `xml:"testsuites"`
}

type JsonPrinter

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

func NewJsonPrinter

func NewJsonPrinter() *JsonPrinter

func (*JsonPrinter) ActionPrint

func (jp *JsonPrinter) ActionPrint(ctx context.Context, opaSessionObj *cautils.OPASessionObj, imageScanData []cautils.ImageScanData)

func (*JsonPrinter) PrintImageScan

func (jp *JsonPrinter) PrintImageScan(ctx context.Context, scanResults *models.PresenterConfig) error

func (*JsonPrinter) PrintNextSteps

func (jp *JsonPrinter) PrintNextSteps()

func (*JsonPrinter) Score

func (jp *JsonPrinter) Score(score float32)

func (*JsonPrinter) SetWriter

func (jp *JsonPrinter) SetWriter(ctx context.Context, outputFile string)

type JunitPrinter

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

func NewJunitPrinter

func NewJunitPrinter(verbose bool) *JunitPrinter

func (*JunitPrinter) ActionPrint

func (jp *JunitPrinter) ActionPrint(ctx context.Context, opaSessionObj *cautils.OPASessionObj, imageScanData []cautils.ImageScanData)

func (*JunitPrinter) PrintNextSteps

func (jp *JunitPrinter) PrintNextSteps()

func (*JunitPrinter) Score

func (jp *JunitPrinter) Score(score float32)

func (*JunitPrinter) SetWriter

func (jp *JunitPrinter) SetWriter(ctx context.Context, outputFile string)

type Matrix

type Matrix [][]string

func (Matrix) Len

func (a Matrix) Len() int

func (Matrix) Less

func (a Matrix) Less(i, j int) bool

func (Matrix) Swap

func (a Matrix) Swap(i, j int)

type Metrics

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

func (*Metrics) String

func (m *Metrics) String() string

type PdfPrinter

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

func NewPdfPrinter

func NewPdfPrinter() *PdfPrinter

func (*PdfPrinter) ActionPrint

func (pp *PdfPrinter) ActionPrint(ctx context.Context, opaSessionObj *cautils.OPASessionObj, imageScanData []cautils.ImageScanData)

func (*PdfPrinter) PrintNextSteps

func (pp *PdfPrinter) PrintNextSteps()

func (*PdfPrinter) Score

func (pp *PdfPrinter) Score(score float32)

func (*PdfPrinter) SetWriter

func (pp *PdfPrinter) SetWriter(ctx context.Context, outputFile string)

type PrettyPrinter

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

func NewPrettyPrinter

func NewPrettyPrinter(verboseMode bool, formatVersion string, attackTree bool, viewType cautils.ViewTypes, scanType cautils.ScanTypes, inputPatterns []string, clusterName string) *PrettyPrinter

func (*PrettyPrinter) ActionPrint

func (pp *PrettyPrinter) ActionPrint(_ context.Context, opaSessionObj *cautils.OPASessionObj, imageScanData []cautils.ImageScanData)

func (*PrettyPrinter) PrintImageScan

func (pp *PrettyPrinter) PrintImageScan(imageScanData []cautils.ImageScanData)

func (*PrettyPrinter) PrintNextSteps

func (pp *PrettyPrinter) PrintNextSteps()

func (*PrettyPrinter) Score

func (pp *PrettyPrinter) Score(score float32)

func (*PrettyPrinter) SetMainPrinter

func (pp *PrettyPrinter) SetMainPrinter()

func (*PrettyPrinter) SetWriter

func (pp *PrettyPrinter) SetWriter(ctx context.Context, outputFile string)

type PrometheusPrinter

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

func NewPrometheusPrinter

func NewPrometheusPrinter(verboseMode bool) *PrometheusPrinter

func (*PrometheusPrinter) ActionPrint

func (pp *PrometheusPrinter) ActionPrint(ctx context.Context, opaSessionObj *cautils.OPASessionObj, imageScanData []cautils.ImageScanData)

func (*PrometheusPrinter) PrintImageScan

func (pp *PrometheusPrinter) PrintImageScan(context.Context, *models.PresenterConfig)

func (*PrometheusPrinter) PrintNextSteps

func (pp *PrometheusPrinter) PrintNextSteps()

func (*PrometheusPrinter) Score

func (pp *PrometheusPrinter) Score(score float32)

func (*PrometheusPrinter) SetWriter

func (pp *PrometheusPrinter) SetWriter(ctx context.Context, outputFile string)

type ResourceControlResult

type ResourceControlResult struct {
	Severity    string
	Name        string
	ID          string
	URL         string
	FailedPaths []string
}

type ResourceResult

type ResourceResult struct {
	Resource       workloadinterface.IMetadata
	ControlsResult []ResourceControlResult
}

type ResourceTableView

type ResourceTableView []ResourceResult

type SARIFPrinter

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

SARIFPrinter is a printer that emits the report in the SARIF format

func NewSARIFPrinter

func NewSARIFPrinter() *SARIFPrinter

NewSARIFPrinter returns a new SARIF printer instance

func (*SARIFPrinter) ActionPrint

func (sp *SARIFPrinter) ActionPrint(ctx context.Context, opaSessionObj *cautils.OPASessionObj, imageScanData []cautils.ImageScanData)

func (*SARIFPrinter) PrintNextSteps

func (sp *SARIFPrinter) PrintNextSteps()

func (*SARIFPrinter) Score

func (sp *SARIFPrinter) Score(score float32)

func (*SARIFPrinter) SetWriter

func (sp *SARIFPrinter) SetWriter(ctx context.Context, outputFile string)

type SilentPrinter

type SilentPrinter struct {
}

SilentPrinter is a printer that does not print anything

func (*SilentPrinter) ActionPrint

func (silentPrinter *SilentPrinter) ActionPrint(ctx context.Context, opaSessionObj *cautils.OPASessionObj, imageScanData []cautils.ImageScanData)

func (*SilentPrinter) PrintImageScan

func (silentPrinter *SilentPrinter) PrintImageScan(context.Context, *models.PresenterConfig)

func (*SilentPrinter) PrintNextSteps

func (silentPrinter *SilentPrinter) PrintNextSteps()

func (*SilentPrinter) Score

func (silentPrinter *SilentPrinter) Score(score float32)

func (*SilentPrinter) SetWriter

func (silentPrinter *SilentPrinter) SetWriter(ctx context.Context, outputFile string)

type WorkloadSummary

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

Jump to

Keyboard shortcuts

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