manager

package
v0.5.27 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2022 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 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() (ValidateMetrics, error)

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
	GetTestRunner(runOpts tools.RunOpts, target policy.Target) tools.Single
	ValidateRules(runOpts tools.RunOpts, rules []*policy.Rule) error
}

type TestMetrics

type TestMetrics struct {
	Rules    []RuleTestMetrics `json:"rules,omitempty"`
	Count    int               `json:"count"`
	Failures int               `json:"failures"`
}

type ValidateMetrics

type ValidateMetrics struct {
	Count    int `json:"count"`
	Failures int `json:"failures"`
}

type ValidationDetails

type ValidationDetails map[*policy.Rule]error

Jump to

Keyboard shortcuts

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