mappers

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRef

func CreateRef(file string) string

func LoadMappersConfig

func LoadMappersConfig(data []byte) (map[string][]model.MapperConfig, error)

LoadMappersConfig reads a YAML file from the given path and returns a slice of MapperConfig. The YAML file can either contain a direct list of mappers or a map with a key (e.g., "results") that contains a list of mappers with name and config properties.

func NewAppendFile

func NewAppendFile(file string, ref string) flow.MapFunction[map[string]interface{}, map[string]interface{}]

Creates appender by reading file on creation moment.

func NewDebug

func NewDebug(config string) flow.MapFunction[map[string]interface{}, map[string]interface{}]

func NewEnricherMap

func NewEnricherMap(name string, enricher model.EnricherConfig, enricherCommon *model.EnricherCommonConfig) streams.Flow

func NewPureHbs

func NewPureHbs[T any, R any](rule string) flow.MapFunction[T, R]

func NewStarlark

func NewStarlark(rule string) flow.MapFunction[map[string]interface{}, map[string]interface{}]

func NewStarlet

func NewStarlet(rule string) (flow.MapFunction[map[string]interface{}, map[string]interface{}], error)

func NewVisual

func NewVisual(enricher *model.Enricher, enricherCommon *model.EnricherCommonConfig) flow.MapFunction[map[string]interface{}, map[string]interface{}]

func NewYaegi

func NewYaegi(rule string) flow.MapFunction[map[string]interface{}, map[string]interface{}]

func ToMap

func ToMap(data any) map[string]interface{}

func ToUnWrappedResult

func ToUnWrappedResult(name string) func(result WrappedResult) model.PharosScanResult

func Wrap

func Wrap(fn flow.MapFunction[map[string]interface{}, map[string]interface{}]) flow.MapFunction[WrappedResult, WrappedResult]

Types

type Header struct {
	Version string `yaml:"version"`
	Kind    string `yaml:"kind"`
}

type Policy

type Policy[T any] struct {
	// contains filtered or unexported fields
}

Policy represents a policy loaded from an HBS template file.

func NewPolicy

func NewPolicy[T any](templatePath string) (*Policy[T], error)

NewRiskPolicy loads a policy template from the given file path and returns a RiskPolicy instance.

func (*Policy[T]) Evaluate

func (rp *Policy[T]) Evaluate(context any) (*bytes.Buffer, error)

Evaluate applies the RiskPolicy template to the given Image and returns the appropriate Risk structure based on version.

type WrappedResult

type WrappedResult struct {
	Context map[string]interface{}
	Result  model.PharosScanResult
}

For mappers simplicity origin input might be lost. Wrapper preservers origin scan result and modifies only Context This allows to store only last context in result

func ToWrappedResult

func ToWrappedResult(result model.PharosScanResult) WrappedResult

Jump to

Keyboard shortcuts

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