compliance

package
v0.0.0-...-63b02d4 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ActionCheck   Action = "check"
	ActionFix     Action = "fix"
	ActionFixable Action = "fixable"
	ActionAuto    Action = "auto"

	ExitCodeOk  int = 0
	ExitCodeNok int = 1
	ExitCodeNA  int = 2
)
View Source
const (
	VarPrefix = "OSVC_COMP_"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action string

type Data

type Data struct {
	Modsets             Modulesets                `json:"modulesets,omitempty"`
	Rsets               Rulesets                  `json:"rulesets,omitempty"`
	ModsetRsetRelations ModulesetRulesetRelations `json:"modset_rset_relations,omitempty"`
	ModsetRelations     ModulesetRelations        `json:"modset_relations,omitempty"`
}

func (Data) AllModules

func (t Data) AllModules() Modules

func (Data) AllModulesMap

func (t Data) AllModulesMap() map[string]*Module

func (Data) CascadingModulesetModules

func (t Data) CascadingModulesetModules(name string) map[string]string

func (Data) ExpandModules

func (t Data) ExpandModules(modsetNames, modNames []string) Modules

ExpandModules returns a map indexed by module name, with the hosting moduleset name as value.

func (Data) HeadModulesets

func (t Data) HeadModulesets() []string

HeadModulesets returns the name of modulesets that either

  • have no parent in ModsetRelations
  • have a parent in ModsetRelations, but this parent is not in Modsets, ie not attached

func (Data) ModulesetTree

func (t Data) ModulesetTree(modset string) *ModulesetTree

func (Data) ModulesetsTree

func (t Data) ModulesetsTree() *ModulesetTree

func (Data) Render

func (t Data) Render() string

func (Data) Ruleset

func (t Data) Ruleset(name string) Ruleset

func (Data) RulesetsMD5

func (t Data) RulesetsMD5() string

type Envs

type Envs map[string][]string

Envs is indexed by module name

func (Envs) Render

func (t Envs) Render() string

type ExitCode

type ExitCode int

type LogEntries

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

func NewLogEntries

func NewLogEntries() *LogEntries

func (*LogEntries) Entries

func (t *LogEntries) Entries() []LogEntry

func (*LogEntries) Err

func (t *LogEntries) Err(s string)

func (*LogEntries) MarshalJSON

func (t *LogEntries) MarshalJSON() ([]byte, error)

MarshalJSON marshals the data as a quoted json string

func (*LogEntries) Out

func (t *LogEntries) Out(s string)

func (*LogEntries) Render

func (t *LogEntries) Render() string

func (*LogEntries) RenderForCollector

func (t *LogEntries) RenderForCollector() string

func (*LogEntries) UnmarshalJSON

func (t *LogEntries) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals a quoted json string to value

type LogEntry

type LogEntry struct {
	Level LogLevel
	Msg   string
}

type LogLevel

type LogLevel int
const (
	LogLevelOut LogLevel = 0
	LogLevelErr LogLevel = 1
)

type Module

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

func NewModule

func NewModule(name string) *Module

func (Module) Autofix

func (t Module) Autofix() bool

func (Module) ModulesetName

func (t Module) ModulesetName() string

func (Module) Name

func (t Module) Name() string

func (Module) Order

func (t Module) Order() int

func (Module) Path

func (t Module) Path() string

func (*Module) SetAutofix

func (t *Module) SetAutofix(v bool) *Module

func (*Module) SetModulesetName

func (t *Module) SetModulesetName(s string) *Module

type ModuleAction

type ModuleAction struct {
	Action   Action
	Module   string
	BeginAt  time.Time
	EndAt    time.Time
	ExitCode int
	Log      LogEntries
}

func (*ModuleAction) Duration

func (t *ModuleAction) Duration() time.Duration

func (*ModuleAction) Render

func (t *ModuleAction) Render() string

func (*ModuleAction) Status

func (t *ModuleAction) Status() string

func (*ModuleAction) StatusAndExitCode

func (t *ModuleAction) StatusAndExitCode() string

type ModuleActions

type ModuleActions []*ModuleAction

func (ModuleActions) Render

func (t ModuleActions) Render() string

type Modules

type Modules []*Module

func (Modules) Len

func (t Modules) Len() int

func (Modules) Less

func (t Modules) Less(i, j int) bool

func (Modules) Swap

func (t Modules) Swap(i, j int)

type Moduleset

type Moduleset []ModulesetModule

func (Moduleset) ModuleNames

func (t Moduleset) ModuleNames() []string

func (Moduleset) String

func (t Moduleset) String() string

type ModulesetModule

type ModulesetModule struct {
	Name    string
	AutoFix bool
}

func (ModulesetModule) MarshalJSON

func (t ModulesetModule) MarshalJSON() ([]byte, error)

MarshalJSON marshals the data as a quoted json string

func (ModulesetModule) Render

func (t ModulesetModule) Render() string

func (ModulesetModule) String

func (t ModulesetModule) String() string

func (*ModulesetModule) UnmarshalJSON

func (t *ModulesetModule) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to value

type ModulesetRelations

type ModulesetRelations map[string][]string

func (ModulesetRelations) Parents

func (t ModulesetRelations) Parents() map[string][]string

func (ModulesetRelations) Render

func (t ModulesetRelations) Render() string

type ModulesetRulesetRelations

type ModulesetRulesetRelations map[string][]string

func (ModulesetRulesetRelations) Render

func (t ModulesetRulesetRelations) Render() string

type ModulesetTree

type ModulesetTree struct {
	Name       string
	Modules    []ModulesetModule
	Modulesets []*ModulesetTree
}

func (*ModulesetTree) AddModuleset

func (t *ModulesetTree) AddModuleset(data Data, modset string)

func (ModulesetTree) Render

func (t ModulesetTree) Render() string

type Modulesets

type Modulesets map[string]Moduleset

func (Modulesets) ModulesOf

func (t Modulesets) ModulesOf(modset string) []ModulesetModule

func (Modulesets) Render

func (t Modulesets) Render() string

type Ruleset

type Ruleset struct {
	Filter string
	Name   string
	Vars   Vars
}

func (Ruleset) Get

func (t Ruleset) Get(name string) interface{}

func (Ruleset) GetString

func (t Ruleset) GetString(name string) string

func (Ruleset) Render

func (t Ruleset) Render() string

type Rulesets

type Rulesets map[string]Ruleset

func (Rulesets) Render

func (t Rulesets) Render() string

type Run

type Run struct {
	Modsets []string
	Mods    []string
	Attach  bool
	Force   bool

	InitAt        time.Time
	BeginAt       time.Time
	EndAt         time.Time
	ModuleActions ModuleActions
	// contains filtered or unexported fields
}

func (*Run) Auto

func (t *Run) Auto() error

func (*Run) Check

func (t *Run) Check() error

func (*Run) Close

func (t *Run) Close()

func (*Run) Env

func (t *Run) Env() (Envs, error)

func (*Run) Fix

func (t *Run) Fix() error

func (*Run) Fixable

func (t *Run) Fixable() error

func (Run) Push

func (t Run) Push() error

func (Run) Render

func (t Run) Render() string

func (*Run) SetAttach

func (t *Run) SetAttach(v bool)

func (*Run) SetForce

func (t *Run) SetForce(v bool)

func (*Run) SetModules

func (t *Run) SetModules(l []string)

func (*Run) SetModulesExpr

func (t *Run) SetModulesExpr(s string)

func (*Run) SetModulesets

func (t *Run) SetModulesets(l []string)

func (*Run) SetModulesetsExpr

func (t *Run) SetModulesetsExpr(s string)

func (Run) Stat

func (t Run) Stat() RunStat

type RunStat

type RunStat struct {
	Ok    int
	Nok   int
	NA    int
	Total int
}

type T

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

func New

func New() *T

func (T) AttachModuleset

func (t T) AttachModuleset(s string) error

func (T) AttachModulesets

func (t T) AttachModulesets(l []string) error

func (T) AttachRuleset

func (t T) AttachRuleset(s string) error

func (T) DetachModuleset

func (t T) DetachModuleset(s string) error

func (T) DetachRuleset

func (t T) DetachRuleset(s string) error

func (T) GetAllData

func (t T) GetAllData(modsets []string) (Data, error)

func (T) GetData

func (t T) GetData(modsets []string) (Data, error)

func (T) GetNodeData

func (t T) GetNodeData(modsets []string) (Data, error)

func (T) GetObjectData

func (t T) GetObjectData(p naming.Path, modsets []string) (Data, error)

func (T) GetRulesets

func (t T) GetRulesets() (Rulesets, error)

func (T) ListModuleNames

func (t T) ListModuleNames() ([]string, error)

func (T) ListModules

func (t T) ListModules() (Modules, error)

func (T) ListModulesets

func (t T) ListModulesets(filter string) ([]string, error)

func (T) ListRulesets

func (t T) ListRulesets(filter string) ([]string, error)

func (*T) NewRun

func (t *T) NewRun() *Run

func (*T) NewValidModule

func (t *T) NewValidModule(name string) (*Module, error)

func (*T) SetCollectorClient

func (t *T) SetCollectorClient(c *collector.Client)

func (*T) SetLogger

func (t *T) SetLogger(v *plog.Logger)

func (*T) SetObjectPath

func (t *T) SetObjectPath(s naming.Path)

func (*T) SetVarDir

func (t *T) SetVarDir(s string)

func (*T) Validate

func (t *T) Validate(mod *Module) error

type Var

type Var struct {
	Name  string
	Value interface{}
	Class string
}

func (Var) EnvName

func (t Var) EnvName() string

func (Var) EnvValue

func (t Var) EnvValue() string

func (Var) MarshalJSON

func (t Var) MarshalJSON() ([]byte, error)

MarshalJSON marshals the data as a quoted json string

func (Var) String

func (t Var) String() string

func (*Var) UnmarshalJSON

func (t *Var) UnmarshalJSON(b []byte) error

UnmarshalJSON unmashals a quoted json string to value

type Vars

type Vars []Var

func NewVars

func NewVars() Vars

func (Vars) EnvMap

func (t Vars) EnvMap() map[string]string

func (Vars) Len

func (t Vars) Len() int

func (Vars) Less

func (t Vars) Less(i, j int) bool

func (Vars) Swap

func (t Vars) Swap(i, j int)

Jump to

Keyboard shortcuts

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