manager

package
v0.5.31 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type M

type M struct {
	tools.RunOpts
	policy.Store
}

func (*M) DetectPolicy

func (m *M) DetectPolicy(dir string) error

Finds and loads rules in a directory. The directory may be any directory in the policies tree. Only rules underneath the directory will be loaded. Policy directories have the following layout:

policies/ policies/<rule-tyoe> policies/<rule-type>/<rule> (must contain metadata.yaml) policies/<rule-type>/<rule>/<target>

<target> is optional depending on <rule-type>.

func (*M) Register

func (m *M) Register(cmd *cobra.Command)

func (*M) TestRules

func (m *M) TestRules() (TestMetrics, error)

func (*M) ValidateRules

func (m *M) ValidateRules() ValidateResult

type PassFail added in v0.5.29

type PassFail *bool

type RuleTestMetrics

type RuleTestMetrics struct {
	Path     string        `json:"path"`
	Target   policy.Target `json:"target"`
	TestType string        `json:"test_type"`
	Success  bool          `json:"success"`
}

type RuleType

type RuleType interface {
	policy.RuleType
	ValidateRules(runOpts tools.RunOpts, rules []*policy.Rule) ValidateResult
	GetTestRunner(runOpts tools.RunOpts, target policy.Target) tools.Single
	// Find a test result.  This must be tool-specific because the
	// findings have not been normalized.
	FindRuleResult(findings assessments.Findings, id string) PassFail
}

type TestMetrics

type TestMetrics struct {
	Rules  []RuleTestMetrics `json:"rules,omitempty"`
	Passed int               `json:"passed"`
	Failed int               `json:"failed"`
}

type ValidateResult added in v0.5.29

type ValidateResult struct {
	Errors  error `json:"-"`
	Valid   int   `json:"valid"`
	Invalid int   `json:"invalid"`
}

func (*ValidateResult) AppendError added in v0.5.29

func (vr *ValidateResult) AppendError(err error)

Jump to

Keyboard shortcuts

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