Documentation
¶
Index ¶
- Constants
- Variables
- type Domain
- type DomainResources
- type LulaValidation
- type LulaValidationMap
- type LulaValidationOption
- func ExecutionAllowed(executionAllowed bool) LulaValidationOption
- func GetResourcesOnly(onlyResources bool) LulaValidationOption
- func Interactive(isInteractive bool) LulaValidationOption
- func WithSpinner(spinner *message.Spinner) LulaValidationOption
- func WithStaticResources(resources DomainResources) LulaValidationOption
- type LulaValidationType
- type Provider
- type Result
Constants ¶
const (
LulaValidationWorkDir contextKey = iota
)
Variables ¶
var ( ErrExecutionNotAllowed = errors.New("execution not allowed") ErrDomainGetResources = errors.New("domain GetResources error") ErrProviderEvaluate = errors.New("provider Evaluate error") )
Define base errors for validations
Functions ¶
This section is empty.
Types ¶
type Domain ¶ added in v0.2.0
type Domain interface { GetResources(context.Context) (DomainResources, error) IsExecutable() bool }
type DomainResources ¶ added in v0.2.0
type DomainResources map[string]interface{}
type LulaValidation ¶ added in v0.2.0
type LulaValidation struct { // Name of the Validation Name string // UUID of the validation - tied to the component-definition.backmatter UUID string // Provider is the provider that is evaluating the validation Provider *Provider // Domain is the domain that provides the evidence for the validation Domain *Domain // DomainResources is the set of resources that the domain is providing DomainResources *DomainResources // LulaValidationType is the type of validation that is being performed LulaValidationType LulaValidationType // Evaluated is a boolean that represents if the validation has been evaluated Evaluated bool // Result is the result of the validation Result *Result }
func CreateFailingLulaValidation ¶ added in v0.4.0
func CreateFailingLulaValidation(name string) *LulaValidation
CreateFailingLulaValidation creates a placeholder LulaValidation object that is always failing
func CreatePassingLulaValidation ¶ added in v0.4.0
func CreatePassingLulaValidation(name string) *LulaValidation
CreatePassingLulaValidation creates a placeholder LulaValidation object that is always passing
func (*LulaValidation) GetDomainResourcesAsJSON ¶ added in v0.8.0
func (val *LulaValidation) GetDomainResourcesAsJSON() []byte
Return domain resources as a json []byte
func (*LulaValidation) RequireExecutionConfirmation ¶ added in v0.4.0
func (val *LulaValidation) RequireExecutionConfirmation() (confirm bool)
Check if the validation requires confirmation before possible execution code is run
func (*LulaValidation) Validate ¶ added in v0.2.0
func (val *LulaValidation) Validate(ctx context.Context, opts ...LulaValidationOption) error
Perform the validation, and store the result in the LulaValidation struct
type LulaValidationMap ¶ added in v0.2.0
type LulaValidationMap = map[string]LulaValidation
LulaValidationMap is a map of LulaValidation objects
type LulaValidationOption ¶ added in v0.3.0
type LulaValidationOption func(*lulaValidationOptions)
func ExecutionAllowed ¶ added in v0.4.0
func ExecutionAllowed(executionAllowed bool) LulaValidationOption
ExecutionAllowed sets the value of the executionAllowed field in the LulaValidation object
func GetResourcesOnly ¶ added in v0.4.0
func GetResourcesOnly(onlyResources bool) LulaValidationOption
RequireExecutionConfirmation is a function that returns a boolean indicating if the validation requires confirmation before execution
func Interactive ¶ added in v0.4.0
func Interactive(isInteractive bool) LulaValidationOption
Interactive is a function that returns a boolean indicating if the validation should be interactive
func WithSpinner ¶ added in v0.4.0
func WithSpinner(spinner *message.Spinner) LulaValidationOption
WithSpinner returns a LulaValidationOption that sets the spinner for the LulaValidation object
func WithStaticResources ¶ added in v0.3.0
func WithStaticResources(resources DomainResources) LulaValidationOption
WithStaticResources sets the static resources for the LulaValidation object
type LulaValidationType ¶ added in v0.2.0
type LulaValidationType string
const ( LulaValidationTypeNormal LulaValidationType = "Lula Validation" DefaultLulaValidationType LulaValidationType = LulaValidationTypeNormal )
type Provider ¶ added in v0.2.0
type Provider interface {
Evaluate(DomainResources) (Result, error)
}
type Result ¶
type Result struct { UUID string `json:"uuid" yaml:"uuid"` ControlId string `json:"control-id" yaml:"control-id"` Description string `json:"description" yaml:"description"` Passing int `json:"passing" yaml:"passing"` Failing int `json:"failing" yaml:"failing"` State string `json:"state" yaml:"state"` Observations map[string]string `json:"observations" yaml:"observations"` }
native type for conversion to targeted report format