policy

package
v0.1.21 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: MIT Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsBlocking

func IsBlocking(decision policypkg.Decision) bool

func Validate

func Validate(p policypkg.Policy) error

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

func Load

func Load(path string) (*Engine, error)

func New

func New(p policypkg.Policy) *Engine

func (*Engine) Explain

func (e *Engine) Explain(req policypkg.Request) policypkg.Decision

func (*Engine) Test

func (e *Engine) Test(suite TestSuite) []TestResult

type TestCase

type TestCase struct {
	Name         string            `json:"name" yaml:"name"`
	Request      policypkg.Request `json:"request" yaml:"request"`
	WantDecision string            `json:"want_decision" yaml:"want_decision"`
	WantReason   string            `json:"want_reason,omitempty" yaml:"want_reason,omitempty"`
}

type TestResult

type TestResult struct {
	Name         string             `json:"name"`
	Passed       bool               `json:"passed"`
	Request      policypkg.Request  `json:"request"`
	WantDecision string             `json:"want_decision"`
	Got          policypkg.Decision `json:"got"`
	Error        string             `json:"error,omitempty"`
}

type TestSuite

type TestSuite struct {
	Cases []TestCase `json:"cases" yaml:"cases"`
}

func LoadTestSuite

func LoadTestSuite(path string) (TestSuite, error)

Jump to

Keyboard shortcuts

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