Documentation
¶
Overview ¶
Package library defined CEL compile and program options in an object that can be used as a library in a CEL environment.
Index ¶
- Constants
- Variables
- type OptFunc
- type Options
- type Protobom
- func (p *Protobom) CompileOptions() []cel.EnvOption
- func (p *Protobom) EnvOption() cel.EnvOption
- func (p *Protobom) Functions() []cel.EnvOption
- func (*Protobom) LibraryName() string
- func (*Protobom) ProgramOptions() []cel.ProgramOption
- func (*Protobom) TypeAdapters() []cel.EnvOption
- func (*Protobom) Types() []cel.EnvOption
- func (p *Protobom) Variables() []cel.EnvOption
Constants ¶
const (
Name = "cel.protobom.api"
)
Variables ¶
var DefaultOptions = Options{ EnableIO: false, ProtobomVarName: "protobom", DocsVarName: "sboms", }
Functions ¶
This section is empty.
Types ¶
type OptFunc ¶
type OptFunc func(*Options)
func WithDocsVarName ¶
func WithEnableIO ¶
func WithProtobomVarName ¶
type Options ¶
type Options struct {
// EnableIO enables the functions that call to the network or the
// local filesystem. If false, these functions will not be available
// in the CEL runtime.
EnableIO bool
// ProtobomVarName is the name of the global variable of the protobom
// object that hosts all the protobom.* functions
ProtobomVarName string
// DocsVarName is the name of the variable that holds the loaded SBOMs.
DocsVarName string
}
Options groups the knobs that can be flicked to control how the library behaves when embedding it into a CEL environment
type Protobom ¶
type Protobom struct {
Options Options
}
func NewProtobom ¶
func (*Protobom) CompileOptions ¶
CompileOptions creates the CEL execution environment that the runner will use to compile and evaluate programs on the SBOM
func (*Protobom) EnvOption ¶
EnvOption compiles the library and supporting functions into a CEL library that can be added to a CEL environment.
func (*Protobom) Functions ¶
Functions returns the compile-time options that define the functions that the protobom library exposes to the cel environment.
func (*Protobom) LibraryName ¶
LibraryName returns the library name as defined in the Name constant
func (*Protobom) ProgramOptions ¶
func (*Protobom) ProgramOptions() []cel.ProgramOption
ProgramOptions is here to implement the cel library interface, currently none are supported.
func (*Protobom) TypeAdapters ¶
TypeAdapters wraps the protobom custom type adapter into an option that can be injected into the CEL environment