parser

package
v0.0.0-...-a0dc65e Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BenchmarkData

type BenchmarkData struct {
	Controls []Control `json:"controls"`
	Totals   Totals    `json:"totals"`
}

BenchmarkData represents the parsed kube-bench data

func ParseFile

func ParseFile(filePath string) (*BenchmarkData, error)

ParseFile parses a kube-bench output file and returns the structured data

func ParseJUnitXML

func ParseJUnitXML(filePath string) (*BenchmarkData, error)

ParseJUnitXML parses a JUnit XML file and converts it to BenchmarkData

type Check

type Check struct {
	ID          string `json:"id"`
	Text        string `json:"text"`
	Audit       string `json:"audit,omitempty"`
	Remediation string `json:"remediation,omitempty"`
	State       string `json:"state"` // "pass", "fail", "warn", "info", "skipped"
}

Check represents an individual check item

type Control

type Control struct {
	ID     string  `json:"id"`
	Text   string  `json:"text"`
	Type   string  `json:"type"`
	Groups []Group `json:"groups"`
}

Control represents a top-level control section (e.g., "Master Node Security Configuration")

type Group

type Group struct {
	ID     string  `json:"id"`
	Text   string  `json:"text"`
	Checks []Check `json:"checks"`
}

Group represents a group of checks within a control

type JUnitFailure

type JUnitFailure struct {
	XMLName xml.Name `xml:"failure"`
	Type    string   `xml:"type,attr"`
	Content string   `xml:",chardata"`
}

JUnitFailure represents a failure in a test case

type JUnitSkipped

type JUnitSkipped struct {
	XMLName xml.Name `xml:"skipped"`
}

JUnitSkipped represents a skipped test case

type JUnitTestCase

type JUnitTestCase struct {
	XMLName   xml.Name      `xml:"testcase"`
	Name      string        `xml:"name,attr"`
	ClassName string        `xml:"classname,attr"`
	Time      string        `xml:"time,attr"`
	Failure   *JUnitFailure `xml:"failure,omitempty"`
	Skipped   *JUnitSkipped `xml:"skipped,omitempty"`
	SystemOut string        `xml:"system-out,omitempty"`
}

JUnitTestCase represents a test case in JUnit XML

type JUnitTestSuite

type JUnitTestSuite struct {
	XMLName   xml.Name        `xml:"testsuite"`
	Name      string          `xml:"name,attr"`
	Tests     int             `xml:"tests,attr"`
	Failures  int             `xml:"failures,attr"`
	Errors    int             `xml:"errors,attr"`
	Time      string          `xml:"time,attr"`
	TestCases []JUnitTestCase `xml:"testcase"`
}

JUnitTestSuite represents a test suite in JUnit XML

type JUnitTestSuites

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

JUnitTestSuites represents the root element of a JUnit XML file

type TestDetails

type TestDetails struct {
	TestNumber     string   `json:"test_number"`
	TestDesc       string   `json:"test_desc"`
	Audit          string   `json:"audit"`
	AuditEnv       string   `json:"AuditEnv"`
	AuditConfig    string   `json:"AuditConfig"`
	Type           string   `json:"type"`
	Remediation    string   `json:"remediation"`
	TestInfo       []string `json:"test_info"`
	Status         string   `json:"status"`
	ActualValue    string   `json:"actual_value"`
	Scored         bool     `json:"scored"`
	IsMultiple     bool     `json:"IsMultiple"`
	ExpectedResult string   `json:"expected_result"`
	Reason         string   `json:"reason,omitempty"`
}

TestDetails represents the detailed test information from system-out

type Totals

type Totals struct {
	Pass int `json:"pass"`
	Fail int `json:"fail"`
	Warn int `json:"warn"`
	Info int `json:"info"`
}

Totals represents the summary counts

Jump to

Keyboard shortcuts

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