layer4

package module
v0.0.0-...-5ffe096 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplyFunc

type ApplyFunc func() (*interface{}, error)

type AssessmentResult

type AssessmentResult struct {
	Passed      bool               // Passed is true if the test passed
	Description string             // Description is a human-readable description of the test
	Message     string             // Message is a human-readable description of the test result
	Function    string             // Function is the name of the code that was executed
	Value       interface{}        // Value is the object that was returned during the test
	Changes     map[string]*Change // Changes is a slice of changes that were made during the test
}

TestResult is a struct that contains the results of a single step within a testSet

func (*AssessmentResult) NewChange

func (t *AssessmentResult) NewChange(changeName string, targetName string, targetObject *interface{}, applyFunc ApplyFunc, revertFunc RevertFunc) *Change

func (*AssessmentResult) RevertChanges

func (t *AssessmentResult) RevertChanges() (badStateAlert bool)

func (*AssessmentResult) SetFail

func (t *AssessmentResult) SetFail(message string, value interface{})

func (*AssessmentResult) SetPass

func (t *AssessmentResult) SetPass(message string, value interface{})

func (*AssessmentResult) SetReview

func (t *AssessmentResult) SetReview(message string, value interface{})

type Change

type Change struct {
	Target_Name   string       // TargetName is the name or ID of the resource or configuration that is to be changed
	Target_Object *interface{} // TargetObject is the object that is to be changed, retained here for logging purposes
	Applied       bool         // Applied is true if the change was successfully applied at least once
	Reverted      bool         // Reverted is true if the change was successfully reverted and not applied again
	Error         error        // Error is used if any error occurred during the change
	// contains filtered or unexported fields
}

Change is a struct that contains the data and functions associated with a single change

func NewChange

func NewChange(targetName string, targetObject *interface{}, applyFunc ApplyFunc, revertFunc RevertFunc) *Change

NewChange creates a new Change struct with the provided data

func (*Change) Apply

func (c *Change) Apply()

Apply executes the Apply function for the change

func (*Change) Revert

func (c *Change) Revert()

Revert executes the Revert function for the change

type ControlEvaluation

type ControlEvaluation struct {
	Name            string                      // TestSuiteName is the human-readable name or description of the control evaluation
	Control_Id      string                      // Control_Id is the unique identifier for the control being evaluated
	Passed          bool                        // Passed is true if all testSets in the testSuite passed
	Message         string                      // Message is the human-readable result of the final assessment to run in this evaluation
	Corrupted_State bool                        // BadState is true if any testSet failed to revert at the end of the testSuite
	User_Guide      string                      // User_Guide is the URL to the documentation for this evaluation
	Results         map[string]AssessmentResult // Control_Evaluations is a map of testSet names to their results
}

ControlEvaluation is a struct that contains all assessment results, organinzed by name

func (*ControlEvaluation) Cleanup

func (c *ControlEvaluation) Cleanup()

func (*ControlEvaluation) CloseHandler

func (c *ControlEvaluation) CloseHandler()

CloseHandler creates a 'listener' on a new goroutine which will notify the program if it receives an interrupt from the OS. If an interrupt is received, the program will attempt to revert any changes made by the terminated Plugin.

func (*ControlEvaluation) ExecuteTest

func (c *ControlEvaluation) ExecuteTest(testFunc func() AssessmentResult)

ExecuteTest is a helper function to run a test function and update the result

type RevertFunc

type RevertFunc func() error

Jump to

Keyboard shortcuts

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