Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var FailedToCompile = errors.New("Failed to compile rules")
FailedToCompile indicates that more than the maximum number of errors occurred during the compilation stage.
var FailedToLoadRegoAPI = errors.New("Failed to load the snyk Rego API")
FailedToLoadRegoAPI indicates that an error occurred while initializing the snyk Rego API.
var FailedToLoadRules = errors.New("Failed to load rules")
FailedToLoadRules indicates that an error occurred while consuming the rego and data producers provided to the engine.
Functions ¶
This section is empty.
Types ¶
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is responsible for evaluating some States with a given set of rules.
func NewEngine ¶
func NewEngine(ctx context.Context, options *EngineOptions) (*Engine, error)
NewEngine constructs a new Engine instance.
type EngineOptions ¶
type EngineOptions struct { // Providers contains functions that produce parsed OPA modules or data documents. Providers []data.Provider // RuleIDs determines which rules are executed. When this option is empty or // unspecified, all rules will be run. RuleIDs map[string]bool // Logger is an optional instance of the logger.Logger interface Logger logging.Logger // Metrics is an optional instance of the metrics.Metrics interface Metrics metrics.Metrics }
EngineOptions contains options for initializing an Engine instance
type EvalOptions ¶
type EvalOptions struct { // Inputs are the State instances that the engine should evaluate. Inputs []models.State Workers int // ResourceResolver is a function that returns a resource state for the given // ResourceRequest. // Multiple ResourcesResolvers can be composed with And() and Or(). ResourcesResolver policy.ResourcesResolver }
EvalOptions contains options for Engine.Eval
type MetadataResult ¶
type PolicyConsumer ¶
type PolicyConsumer struct { Modules map[string]*ast.Module Document map[string]interface{} NumDocuments int }
PolicyConsumer is an implementation of the data.Consumer interface that stores parsed modules, policies, and documents in-memory.
func NewPolicyConsumer ¶
func NewPolicyConsumer() *PolicyConsumer