compile

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 25 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)

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 ErrorList

type ErrorList struct {
	*runtimev1.CompileErrors
}

func (*ErrorList) Add added in v0.9.0

func (e *ErrorList) Add(err error)

func (*ErrorList) Display

func (e *ErrorList) Display() string

func (*ErrorList) ErrOrNil

func (e *ErrorList) ErrOrNil() error

func (*ErrorList) Error

func (e *ErrorList) Error() string

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) 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