Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BadExtractor = badExtractor{}
BadExtractor occurs when extractor is invalid.
var BadLabelName = badLabelName{}
BadLabelName is an error occurring when label name is invalid.
var BadPackageName = badPackageName{}
BadPackageName occurs when package name is invalid.
Functions ¶
func CompileToRego ¶
func CompileToRego( packageName string, labelExtractors map[string]*classificationv1.Extractor, ) (string, error)
CompileToRego compiles the extractors into a rego.
func IsRegoIdent ¶
IsRegoIdent checks if string is a valid rego identifier – not a rego keyword and composed of allowed characters - alphanumeric and underscore.
Types ¶
type AttributePath ¶
type AttributePath []string
AttributePath is a dot-separated path to attribute to extract data from
Should be either: * one of the fields of [Attribute Context]ctx, or * a special "request.http.bearer" pseudo-attribute.
Eg. Request.http.method
func ParseAttributePath ¶
func ParseAttributePath(path string) AttributePath
ParseAttributePath parses a string into an attribute path.
func (AttributePath) String ¶
func (p AttributePath) String() string
String returns the attribute path as a dot-separated string.
type JSONPointer ¶
type JSONPointer struct {
// contains filtered or unexported fields
}
JSONPointer represents a parsed JSON pointer
https://datatracker.ietf.org/doc/html/rfc6901
func ParseJSONPointer ¶
func ParseJSONPointer(pointer string) (JSONPointer, error)
ParseJSONPointer parses a pointer into a JSONPointer.
func (JSONPointer) Segments ¶
func (p JSONPointer) Segments() []string
Segments returns the segments of the JSON pointer.
func (JSONPointer) String ¶
func (p JSONPointer) String() string
String returns the string representation of the JSON pointer escapedSegments.
type PathTemplate ¶
PathTemplate is an OpenAPI-inspired path template
See github.com/fluxninja/aperture/api/gen/proto/go/aperture/classification/v1.PathTemplateMatcher.
func ParsePathTemplate ¶
func ParsePathTemplate(pathTemplate string) (PathTemplate, error)
ParsePathTemplate parses a path template string into a PathTemplate.
func (PathTemplate) IsMoreSpecificThan ¶
func (pt PathTemplate) IsMoreSpecificThan(other PathTemplate) bool
IsMoreSpecificThan returns whether path template might specific than other (eg. /foo is more specific than /*).
Note: This function might have false positives (eg. /foo/bar is treated as more specific than /xyz, even though they're not related), but it should not have any false negatives.
This function can be used as sorting comparator.
func (PathTemplate) NumSegments ¶
func (pt PathTemplate) NumSegments() int
NumSegments returns the number of segments in the path template.
func (PathTemplate) String ¶
func (pt PathTemplate) String() string
String returns string representation of the path template.