rule

package
v0.0.0-...-a98ece3 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Element

type Element struct {
	Plugin string
	Name   string
	Params []string
	Rule   policy.Rule
}

Element is a structure that host a definition of policy Rule, and the Rule itself when created

type List

type List struct {
	Reply         bool
	Rules         []*Element
	DefaultPolicy int
}

List of Rules checked in order of the list

func NewList

func NewList(ifNoResult int, isReply bool) (*List, error)

NewList to create an empty new List of Rules

func (*List) Add

func (p *List) Add(e *Element) error

Add the element at end of the list

func (*List) BuildRules

func (p *List) BuildRules(engines map[string]policy.Engine) error

BuildRules instanciate the Rule of each Element, based on the parameters collected from setup.

func (*List) Engines

func (p *List) Engines() map[string]string

Engines list all engines involved - return map[name] -> plugin

func (*List) Evaluate

func (p *List) Evaluate(ctx context.Context, state request.Request, data map[string]interface{}, engines map[string]policy.Engine) (int, error)

Evaluate all policy one by one until one provide a valid result if no Rule can provide a result, the DefaultPolicy of the list applies

Jump to

Keyboard shortcuts

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