pluginkit

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2025 License: Apache-2.0 Imports: 13 Imported by: 3

Documentation

Overview

errors.go contains error definitions to streamline testing and log management

Index

Constants

This section is empty.

Variables

View Source
var (
	CORRUPTION_FOUND = func() error {
		return errors.New("Target state may be corrupted! Halting to prevent futher damage. See logs for more information")
	}
	NO_EVALUATION_SUITES = func() error {
		return errors.New("No control evaluations provided by the plugin")
	}
	EVAL_NAME_MISSING = func() error {
		return errors.New("EvaluationSuite name must not be empty")
	}
)

Errors with no parameters

View Source
var (
	VESSEL_NAMES_NOT_SET = func(serviceName, pluginName string) error {
		return fmt.Errorf("expected service and plugin names to be set. ServiceName='%s' PluginName='%s'", serviceName, pluginName)
	}
	WRITE_FAILED = func(name, err string) error {
		return fmt.Errorf("Failed to write results for evaluation suite. name: %s, error: %s", name, err)
	}
	BAD_LOADER = func(pluginName string, err error) error {
		return fmt.Errorf("Failed to load payload for %s: %s", pluginName, err)
	}
)

Errors with parameters required

Functions

This section is empty.

Types

type DataLoader added in v1.0.1

type DataLoader func(*config.Config) (interface{}, error)

type EvaluationSuite added in v1.0.0

type EvaluationSuite struct {
	Name            string        // Name is the name of the suite
	Catalog_Id      string        // Catalog_Id associates this suite with an catalog
	Start_Time      string        // Start_Time is the time the plugin started
	End_Time        string        // End_Time is the time the plugin ended
	Result          layer4.Result // Result is Passed if all evaluations in the suite passed
	Corrupted_State bool          // BadState is true if any testSet failed to revert at the end of the evaluation

	Control_Evaluations []*layer4.ControlEvaluation // Control_Evaluations is a slice of evaluations to be executed
	// contains filtered or unexported fields
}

TestSuite is a struct that contains the results of all ControlEvaluations, organized by name

func (*EvaluationSuite) Evaluate added in v1.0.0

func (e *EvaluationSuite) Evaluate(name string) error

Execute is used to execute a list of ControlEvaluations provided by a Plugin and customized by user config Name is an arbitrary string that will be used to identify the EvaluationSuite

func (*EvaluationSuite) WriteControlEvaluations added in v1.0.0

func (e *EvaluationSuite) WriteControlEvaluations(serviceName string, output string) error

type PayloadTypeExample added in v1.0.0

type PayloadTypeExample struct {
	CustomPayloadField bool
}

type TestSet

type TestSet func() (result layer4.ControlEvaluation)

type Vessel

type Vessel struct {
	Service_Name      string
	Plugin_Name       string
	Payload           interface{}
	Evaluation_Suites []*EvaluationSuite // EvaluationSuite is a map of evaluations to their catalog names
	// contains filtered or unexported fields
}

The vessel gets the armory in position to execute the ControlEvaluations specified in the testSuites

func NewVessel

func NewVessel(pluginName string, loader DataLoader, requiredVars []string) *Vessel

func (*Vessel) AddEvaluationSuite added in v1.0.0

func (v *Vessel) AddEvaluationSuite(catalogId string, loader DataLoader, evaluations []*layer4.ControlEvaluation)

func (*Vessel) Mobilize

func (v *Vessel) Mobilize() error

func (*Vessel) WriteResults added in v1.0.0

func (v *Vessel) WriteResults() error

Jump to

Keyboard shortcuts

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