printer

package
v1.0.129 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PrettyFormat       string = "pretty-printer"
	JsonFormat         string = "json"
	JunitResultPrinter string = "junit"
)
View Source
const EmptyPercentage = "NaN"

Variables

View Source
var INDENT = "   "

Functions

This section is empty.

Types

type ControlSummary

type ControlSummary struct {
	TotalResources    int
	TotalFailed       int
	TotalWarning      int
	Description       string
	Remediation       string
	ListInputKinds    []string
	FailedWorkloads   map[string][]WorkloadSummary // <namespace>:[<WorkloadSummary>]
	ExcludedWorkloads map[string][]WorkloadSummary // <namespace>:[<WorkloadSummary>]
}

func (*ControlSummary) ToSlice

func (controlSummary *ControlSummary) ToSlice() []string

type IPrinter added in v1.0.87

type IPrinter interface {
	ActionPrint(opaSessionObj *cautils.OPASessionObj)
	SetWriter(outputFile string)
	Score(score float32)
}

func GetPrinter added in v1.0.87

func GetPrinter(printFormat string) IPrinter

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"`
	Name        string            `xml:"name,attr"`
	Time        string            `xml:"time,attr"`
	Resources   int               `xml:"resources,attr"`
	Excluded    int               `xml:"excluded,attr"`
	Failed      int               `xml:"filed,attr"`
	SkipMessage *JUnitSkipMessage `xml:"skipped,omitempty"`
	Failure     *JUnitFailure     `xml:"failure,omitempty"`
}

JUnitTestCase is a single test case with its result.

type JUnitTestSuite

type JUnitTestSuite struct {
	XMLName    xml.Name        `xml:"testsuite"`
	Tests      int             `xml:"tests,attr"`
	Time       string          `xml:"time,attr"`
	Name       string          `xml:"name,attr"`
	Resources  int             `xml:"resources,attr"`
	Excluded   int             `xml:"excluded,attr"`
	Failed     int             `xml:"filed,attr"`
	Properties []JUnitProperty `xml:"properties>property,omitempty"`
	TestCases  []JUnitTestCase `xml:"testcase"`
}

JUnitTestSuite is a single JUnit test suite which may contain many testcases.

type JUnitTestSuites

type JUnitTestSuites struct {
	XMLName xml.Name         `xml:"testsuites"`
	Suites  []JUnitTestSuite `xml:"testsuite"`
}

type JsonPrinter

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

func NewJsonPrinter added in v1.0.87

func NewJsonPrinter() *JsonPrinter

func (*JsonPrinter) ActionPrint added in v1.0.87

func (jsonPrinter *JsonPrinter) ActionPrint(opaSessionObj *cautils.OPASessionObj)

func (*JsonPrinter) Score added in v1.0.87

func (jsonPrinter *JsonPrinter) Score(score float32)

func (*JsonPrinter) SetWriter added in v1.0.87

func (jsonPrinter *JsonPrinter) SetWriter(outputFile string)

type JunitPrinter added in v1.0.87

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

func NewJunitPrinter added in v1.0.87

func NewJunitPrinter() *JunitPrinter

func (*JunitPrinter) ActionPrint added in v1.0.87

func (junitPrinter *JunitPrinter) ActionPrint(opaSessionObj *cautils.OPASessionObj)

func (*JunitPrinter) Score added in v1.0.87

func (junitPrinter *JunitPrinter) Score(score float32)

func (*JunitPrinter) SetWriter added in v1.0.87

func (junitPrinter *JunitPrinter) SetWriter(outputFile string)

type PrettyPrinter

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

func NewPrettyPrinter added in v1.0.87

func NewPrettyPrinter() *PrettyPrinter

func (*PrettyPrinter) ActionPrint added in v1.0.87

func (printer *PrettyPrinter) ActionPrint(opaSessionObj *cautils.OPASessionObj)

func (*PrettyPrinter) Score added in v1.0.87

func (printer *PrettyPrinter) Score(score float32)

func (*PrettyPrinter) SetWriter added in v1.0.87

func (printer *PrettyPrinter) SetWriter(outputFile string)

type SilentPrinter added in v1.0.87

type SilentPrinter struct {
}

func (*SilentPrinter) ActionPrint added in v1.0.87

func (silentPrinter *SilentPrinter) ActionPrint(opaSessionObj *cautils.OPASessionObj)

type Summary

type Summary map[string]ControlSummary

func NewSummary

func NewSummary() Summary

type WorkloadSummary

type WorkloadSummary struct {
	Kind      string
	Name      string
	Namespace string
	Group     string
	Exception *armotypes.PostureExceptionPolicy
}

func (*WorkloadSummary) ToString

func (workloadSummary *WorkloadSummary) ToString() string

Jump to

Keyboard shortcuts

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