evaluator

package
v0.0.0-...-56579fc Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Benchmark

type Benchmark struct {
	Id           string `json:"id"`
	Name         string `json:"name"`
	Version      string `json:"version"`
	Rule_Number  string `json:"rule_number"`
	Posture_Type string `json:"posture_type"`
}

type EventData

type EventData struct {
	RuleResult
	fetching.ResourceInfo
}

type Finding

type Finding struct {
	Result Result `json:"result"`
	Rule   Rule   `json:"rule"`
}

type Metadata

type Metadata struct {
	Version   string    `json:"opa_version"`
	CreatedAt time.Time `json:"createdAt"`
}

type OpaEvaluator

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

func NewOpaEvaluator

func NewOpaEvaluator(ctx context.Context, log *logp.Logger, cfg *config.Config) (*OpaEvaluator, error)

func (*OpaEvaluator) Eval

func (o *OpaEvaluator) Eval(ctx context.Context, resourceInfo fetching.ResourceInfo) (EventData, error)

func (*OpaEvaluator) Stop

func (o *OpaEvaluator) Stop(ctx context.Context)

type OpaInput

type OpaInput struct {
	fetching.Result
	Benchmark string `json:"benchmark,omitempty"`
}

type Result

type Result struct {
	Evaluation string `json:"evaluation"`
	Expected   any    `json:"expected"`
	Evidence   any    `json:"evidence"`
}

type Rule

type Rule struct {
	Id                    string    `json:"id"`
	Name                  string    `json:"name"`
	Profile_Applicability string    `json:"profile_applicability"`
	Description           string    `json:"description"`
	Rationale             string    `json:"rationale"`
	Audit                 string    `json:"audit"`
	Remediation           string    `json:"remediation"`
	Impact                string    `json:"impact"`
	Default_Value         string    `json:"default_value"`
	References            string    `json:"references"`
	Section               string    `json:"section"`
	Version               string    `json:"version"`
	Tags                  []string  `json:"tags"`
	Benchmark             Benchmark `json:"benchmark"`
}

type RuleResult

type RuleResult struct {
	Findings []Finding `json:"findings"`
	Metadata Metadata  `json:"metadata"`
	// Golang 1.18 will introduce generics which will be useful for typing the resource field
	Resource any `json:"resource"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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