compile

package
v0.35.1 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: Apache-2.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

View Source
const AnyRoleVal = "*"

Variables

This section is empty.

Functions

func BatchCompile

func BatchCompile(queue <-chan *policy.CompilationUnit, schemaMgr schema.Manager) error

func Compile

func Compile(unit *policy.CompilationUnit, schemaMgr schema.Manager) (rps *runtimev1.RunnablePolicySet, err error)

func Condition added in v0.9.0

func Condition(cond *policyv1.Condition) (*runtimev1.Condition, error)

func MigrateCompiledPolicies added in v0.30.0

func MigrateCompiledPolicies(policies *runtimev1.RunnablePolicySet) error

MigrateCompiledPolicies modifies a RunnablePolicySet compiled by a previous version of Cerbos to migrate it to the latest format.

Types

type CELCompileError added in v0.9.0

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

CELCompileError holds CEL compilation errors.

func (*CELCompileError) Error added in v0.9.0

func (cce *CELCompileError) Error() string

func (*CELCompileError) Unwrap added in v0.9.0

func (cce *CELCompileError) Unwrap() error

type Conf added in v0.14.0

type Conf struct {
	// CacheSize is the number of compiled policies to cache in memory.
	CacheSize uint `yaml:"cacheSize" conf:",example=1024"`
	// CacheDuration is the duration to cache an entry.
	CacheDuration time.Duration `yaml:"cacheDuration" conf:",example=60s"`
}

Conf is optional configuration for caches.

func DefaultConf added in v0.14.0

func DefaultConf() *Conf

DefaultConf creates a config with defaults.

func (*Conf) Key added in v0.14.0

func (c *Conf) Key() string

func (*Conf) SetDefaults added in v0.14.0

func (c *Conf) SetDefaults()

func (*Conf) Validate added in v0.25.0

func (c *Conf) Validate() (outErr error)

type Error

type Error struct {
	*runtimev1.CompileErrors_Err
}

Error describes an error encountered during compilation.

func (*Error) Display

func (e *Error) Display() string

func (*Error) Error

func (e *Error) Error() string

func (*Error) MarshalJSON

func (e *Error) MarshalJSON() ([]byte, error)

type ErrorSet added in v0.34.0

type ErrorSet struct {
	CompileErrors map[uint64]*runtimev1.CompileErrors_Err
}

func (*ErrorSet) Add added in v0.34.0

func (e *ErrorSet) Add(err error)

func (*ErrorSet) ErrOrNil added in v0.34.0

func (e *ErrorSet) ErrOrNil() error

func (*ErrorSet) Error added in v0.34.0

func (e *ErrorSet) Error() string

func (*ErrorSet) Errors added in v0.34.0

func (e *ErrorSet) Errors() *runtimev1.CompileErrors

type Manager

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

func NewManager

func NewManager(ctx context.Context, store storage.SourceStore, schemaMgr schema.Manager) (*Manager, error)

func NewManagerFromConf added in v0.15.0

func NewManagerFromConf(ctx context.Context, conf *Conf, store storage.SourceStore, schemaMgr schema.Manager) *Manager

func NewManagerFromDefaultConf added in v0.15.0

func NewManagerFromDefaultConf(ctx context.Context, store storage.SourceStore, schemaMgr schema.Manager) *Manager

func (*Manager) GetFirstMatch added in v0.29.0

func (c *Manager) GetFirstMatch(ctx context.Context, candidates []namer.ModuleID) (*runtimev1.RunnablePolicySet, error)

func (*Manager) GetPolicySet added in v0.20.0

func (c *Manager) GetPolicySet(ctx context.Context, modID namer.ModuleID) (*runtimev1.RunnablePolicySet, error)

func (*Manager) OnStorageEvent

func (c *Manager) OnStorageEvent(events ...storage.Event)

func (*Manager) SubscriberID

func (c *Manager) SubscriberID() string

type PolicyCompilationErr added in v0.9.0

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

func (PolicyCompilationErr) Error added in v0.9.0

func (pce PolicyCompilationErr) Error() string

func (PolicyCompilationErr) Is added in v0.27.0

func (pce PolicyCompilationErr) Is(target error) bool

func (PolicyCompilationErr) Unwrap added in v0.9.0

func (pce PolicyCompilationErr) Unwrap() error

Jump to

Keyboard shortcuts

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