Documentation ¶
Index ¶
- func Module() fx.Option
- type ActiveRuleset
- type ClassificationEngine
- func (c *ClassificationEngine) ActiveRules() []compiler.ReportedRule
- func (c *ClassificationEngine) AddPreview(preview iface.HTTPRequestPreview)
- func (c *ClassificationEngine) AddRules(ctx context.Context, name string, ...) (ActiveRuleset, error)
- func (c *ClassificationEngine) Classify(ctx context.Context, svcs []string, ctrlPt string, ...) ([]*flowcontrolv1.ClassifierInfo, flowlabel.FlowLabels)
- func (c *ClassificationEngine) DropPreview(preview iface.HTTPRequestPreview)
- func (c *ClassificationEngine) GetClassifier(classifierID iface.ClassifierID) iface.Classifier
- func (c *ClassificationEngine) RegisterClassifier(classifier iface.Classifier) error
- func (c *ClassificationEngine) UnregisterClassifier(classifier iface.Classifier) error
- type ClassificationEngineIn
- type Classifier
- type Input
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ActiveRuleset ¶
type ActiveRuleset struct {
// contains filtered or unexported fields
}
ActiveRuleset represents one of currently active set of rules.
func (ActiveRuleset) Drop ¶
func (rs ActiveRuleset) Drop()
Drop retracts all the rules belonging to a ruleset.
type ClassificationEngine ¶
type ClassificationEngine struct {
// contains filtered or unexported fields
}
ClassificationEngine receives classification policies and provides Classify method.
func NewClassificationEngine ¶
func NewClassificationEngine(agentInfo *agentinfo.AgentInfo, registry status.Registry) *ClassificationEngine
NewClassificationEngine creates a new Classifier.
func ProvideClassificationEngine ¶
func ProvideClassificationEngine(in ClassificationEngineIn) (iface.ClassificationEngine, *ClassificationEngine)
ProvideClassificationEngine provides a classifier that loads the rules from config file.
func (*ClassificationEngine) ActiveRules ¶
func (c *ClassificationEngine) ActiveRules() []compiler.ReportedRule
ActiveRules returns a slice of uncompiled Rules which are currently active.
func (*ClassificationEngine) AddPreview ¶
func (c *ClassificationEngine) AddPreview(preview iface.HTTPRequestPreview)
AddPreview adds a preview to the active previews.
func (*ClassificationEngine) AddRules ¶
func (c *ClassificationEngine) AddRules( ctx context.Context, name string, classifierWrapper *policysyncv1.ClassifierWrapper, ) (ActiveRuleset, error)
AddRules compiles a ruleset and adds it to the active rules
The name will be used for reporting ¶
To retract the rules, call Classifier.Drop.
func (*ClassificationEngine) Classify ¶
func (c *ClassificationEngine) Classify( ctx context.Context, svcs []string, ctrlPt string, labelsForMatching labels.Labels, input Input, ) ([]*flowcontrolv1.ClassifierInfo, flowlabel.FlowLabels)
Classify takes rego input, performs classification, and returns a map of flow labels. LabelsForMatching are additional labels to use for selector matching.
func (*ClassificationEngine) DropPreview ¶
func (c *ClassificationEngine) DropPreview(preview iface.HTTPRequestPreview)
DropPreview removes a preview from the active previews.
func (*ClassificationEngine) GetClassifier ¶
func (c *ClassificationEngine) GetClassifier(classifierID iface.ClassifierID) iface.Classifier
GetClassifier Lookup function for getting classifier.
func (*ClassificationEngine) RegisterClassifier ¶
func (c *ClassificationEngine) RegisterClassifier(classifier iface.Classifier) error
RegisterClassifier adds classifier to map.
func (*ClassificationEngine) UnregisterClassifier ¶
func (c *ClassificationEngine) UnregisterClassifier(classifier iface.Classifier) error
UnregisterClassifier removes classifier from map.
type ClassificationEngineIn ¶
type ClassificationEngineIn struct { fx.In Watcher notifiers.Watcher `name:"classifier"` Lifecycle fx.Lifecycle Registry status.Registry PromRegistry *prometheus.Registry AgentInfo *agentinfo.AgentInfo }
ClassificationEngineIn holds parameters for ProvideClassificationEngine.
type Classifier ¶
type Classifier struct { iface.Classifier // contains filtered or unexported fields }
Classifier implements iface.Classifier interface.
func (*Classifier) GetClassifierID ¶
func (c *Classifier) GetClassifierID() iface.ClassifierID
GetClassifierID returns ClassifierID object that should uniquely identify classifier.
func (*Classifier) GetRequestCounter ¶
func (c *Classifier) GetRequestCounter() prometheus.Counter
GetRequestCounter returns the counter for the classifier.
func (*Classifier) GetSelectors ¶
func (c *Classifier) GetSelectors() []*policylangv1.Selector
GetSelectors returns the selectors.
type Input ¶ added in v2.6.0
Input is an input to Classify method.
Classifier sometimes needs the input in ast.Value format and sometimes in interface{} format. Using this interface allows to minimize number of conversions. Note that values returned from both methods should be equivalent.
Each method can be called multiple times (including zero).