interfaces

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package interfaces provides necessary interfaces and implementations for implementing engine plugins

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionOpt added in v0.0.7

type ActionOpt int

ActionOpt is the type that defines what action to take when remediating

const (
	// ActionOptOn means perform the remediation
	ActionOptOn ActionOpt = iota
	// ActionOptOff means do not perform the remediation
	ActionOptOff
	// ActionOptDryRun means perform a dry run of the remediation
	ActionOptDryRun
	// ActionOptUnknown means the action is unknown. This is a sentinel value.
	ActionOptUnknown
)

func ActionOptFromString added in v0.0.7

func ActionOptFromString(s *string) ActionOpt

ActionOptFromString returns the ActionOpt from a string representation

type Evaluator

type Evaluator interface {
	Eval(ctx context.Context, profile map[string]any, res *Result) error
}

Evaluator is the interface for a rule type evaluator

type Ingester

type Ingester interface {
	// Ingest does the actual data ingestion for a rule type
	Ingest(ctx context.Context, ent protoreflect.ProtoMessage, params map[string]any) (*Result, error)
}

Ingester is the interface for a rule type ingester

type Remediator added in v0.0.5

type Remediator interface {
	Remediate(
		ctx context.Context,
		remAction ActionOpt,
		ent protoreflect.ProtoMessage,
		pol map[string]any,
		params map[string]any) error
}

Remediator is the interface for a rule type remediator

type Result

type Result struct {
	// Object is the object that was ingested. Normally comes from an external
	// system like an HTTP server.
	Object any
	// Fs is the filesystem that was created as a result of the ingestion. This
	// is normally used by the evaluator to do rule evaluation. The filesystem
	// may be a git repo, or a memory filesystem.
	Fs billy.Filesystem
}

Result is the result of an ingester

Jump to

Keyboard shortcuts

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