Documentation
¶
Index ¶
- Constants
- Variables
- func RunTask(ctx context.Context, tsk Task, resolver file.Resolver, s sbomsync.Builder, ...) error
- func Select(allTasks []Task, selectionRequest cataloging.SelectionRequest) ([]Task, Selection, error)
- type CatalogingFactoryConfig
- type ErrInvalidExpression
- type Expression
- type Expressions
- type Factories
- type Operation
- type Selection
- type Selector
- type Task
- func NewDeepSquashedScopeCleanupTask() Task
- func NewEnvironmentTask() Task
- func NewOSFeatureDetectionTask() Task
- func NewPackageTask(cfg CatalogingFactoryConfig, c pkg.Cataloger, tags ...string) Task
- func NewRelationshipsTask(cfg cataloging.RelationshipsConfig, src source.Description) Task
- func NewTask(name string, tsk func(context.Context, file.Resolver, sbomsync.Builder) error, ...) Task
- func NewUnknownsLabelerTask(cfg cataloging.UnknownsConfig) Task
- type TokenSelection
Constants ¶
const ( // Java ecosystem labels Java = "java" Maven = "maven" // Go ecosystem labels Go = "go" Golang = "golang" // JavaScript ecosystem labels JavaScript = "javascript" Node = "node" NPM = "npm" // Python ecosystem labels Python = "python" )
Variables ¶
var ( ErrEmptyToken = fmt.Errorf("no value given") ErrInvalidToken = fmt.Errorf("invalid token given: only alphanumeric characters and hyphens are allowed") ErrInvalidOperator = fmt.Errorf("invalid operator given") ErrUnknownNameOrTag = fmt.Errorf("unknown name or tag given") ErrTagsNotAllowed = fmt.Errorf("tags are not allowed with this operation (must use exact names)") ErrNamesNotAllowed = fmt.Errorf("names are not allowed with this operation (must use tags)") ErrAllNotAllowed = fmt.Errorf("cannot use the 'all' operand in this context") )
Functions ¶
func Select ¶
func Select(allTasks []Task, selectionRequest cataloging.SelectionRequest) ([]Task, Selection, error)
Select parses the given expressions as two sets: expressions that represent a "set" operation, and expressions that represent all other operations. The parsed expressions are then evaluated against the given tasks to return a subset (or the same) set of tasks.
Types ¶
type CatalogingFactoryConfig ¶
type CatalogingFactoryConfig struct {
ComplianceConfig cataloging.ComplianceConfig
SearchConfig cataloging.SearchConfig
RelationshipsConfig cataloging.RelationshipsConfig
DataGenerationConfig cataloging.DataGenerationConfig
LicenseConfig cataloging.LicenseConfig
PackagesConfig pkgcataloging.Config
FilesConfig filecataloging.Config
}
func DefaultCatalogingFactoryConfig ¶
func DefaultCatalogingFactoryConfig() CatalogingFactoryConfig
type ErrInvalidExpression ¶
ErrInvalidExpression represents an expression that cannot be parsed or can be parsed but is logically invalid.
func (ErrInvalidExpression) Error ¶
func (e ErrInvalidExpression) Error() string
type Expression ¶
Expression represents a single operation-operand pair with (all validation errors). E.g. "+foo", "-bar", or "something" are all expressions. Some validations are relevant to not only the syntax (operation and operator) but other are sensitive to the context of the operand (e.g. if a given operand is a tag or a name, validated against the operation).
func (Expression) String ¶
func (e Expression) String() string
type Expressions ¶
type Expressions []Expression
Expressions represents a list of expressions.
func (Expressions) Clone ¶
func (e Expressions) Clone() Expressions
func (Expressions) Errors ¶
func (e Expressions) Errors() (errs []error)
func (Expressions) Len ¶
func (e Expressions) Len() int
func (Expressions) Less ¶
func (e Expressions) Less(i, j int) bool
func (Expressions) Swap ¶
func (e Expressions) Swap(i, j int)
func (Expressions) Validate ¶
func (e Expressions) Validate() error
type Factories ¶ added in v1.20.0
type Factories []factory
func DefaultFileTaskFactories ¶ added in v1.20.0
func DefaultFileTaskFactories() Factories
func DefaultPackageTaskFactories ¶
func DefaultPackageTaskFactories() Factories
type Operation ¶
type Operation string
Operation represents the type of operation to perform on the operand (set, add, remove, sub-select).
type Selection ¶
type Selection struct {
Request cataloging.SelectionRequest
Result *strset.Set
TokensByTask map[string]TokenSelection
}
Selection represents the users request for a subset of tasks to run and the resulting set of task names that were selected. Additionally, all tokens that were matched on to reach the returned conclusion are also provided.
func SelectInGroups ¶ added in v1.20.0
func SelectInGroups(taskGroups [][]Task, selectionRequest cataloging.SelectionRequest) ([][]Task, Selection, error)
SelectInGroups is a convenience function that allows for selecting tasks from multiple groups of tasks. The original request is split into sub-requests, where only tokens that are relevant to the given group of tasks are considered. If tokens are passed that are not relevant to any group of tasks, an error is returned.
type Task ¶
type Task interface {
Name() string
Execute(context.Context, file.Resolver, sbomsync.Builder) error
}
Task is a function that can wrap a cataloger to populate the SBOM with data (coordinated through the mutex).
func NewDeepSquashedScopeCleanupTask ¶ added in v1.24.0
func NewDeepSquashedScopeCleanupTask() Task
func NewEnvironmentTask ¶
func NewEnvironmentTask() Task
func NewOSFeatureDetectionTask ¶ added in v1.29.0
func NewOSFeatureDetectionTask() Task
func NewPackageTask ¶
func NewPackageTask(cfg CatalogingFactoryConfig, c pkg.Cataloger, tags ...string) Task
NewPackageTask creates a Task function for a generic pkg.Cataloger, honoring the common configuration options.
func NewRelationshipsTask ¶
func NewRelationshipsTask(cfg cataloging.RelationshipsConfig, src source.Description) Task
func NewUnknownsLabelerTask ¶ added in v1.14.0
func NewUnknownsLabelerTask(cfg cataloging.UnknownsConfig) Task