Documentation ¶
Index ¶
- type AndCondition
- type ChainTemplate
- type CodeSnip
- type ConditionContext
- type ConditionEntry
- type ConditionResponse
- type Conditional
- type CustomVariable
- type IncidentContext
- type Location
- type Message
- type Option
- type OrCondition
- type Perform
- type Position
- type Rule
- type RuleEngine
- type RuleMeta
- type RuleSelector
- type RuleSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AndCondition ¶
type AndCondition struct {
Conditions []ConditionEntry `yaml:"and"`
}
func (AndCondition) Evaluate ¶
func (a AndCondition) Evaluate(ctx context.Context, log logr.Logger, condCtx ConditionContext) (ConditionResponse, error)
type ChainTemplate ¶
type ChainTemplate struct { Filepaths []string `yaml:"filepaths"` Extras map[string]interface{} `yaml:"extras"` }
Chain Templates are used by rules and providers to pass context around during rule execution.
type ConditionContext ¶
type ConditionContext struct { Tags map[string]interface{} `yaml:"tags"` Template map[string]ChainTemplate `yaml:"template"` }
type ConditionEntry ¶
type ConditionEntry struct { From string As string Ignorable bool Not bool ProviderSpecificConfig Conditional }
func (ConditionEntry) Evaluate ¶
func (ce ConditionEntry) Evaluate(ctx context.Context, log logr.Logger, condCtx ConditionContext) (ConditionResponse, error)
type ConditionResponse ¶
type ConditionResponse struct { Matched bool `yaml:"matched"` // For each time the condition is hit, add all of the context. // keys here, will be used in the message. Incidents []IncidentContext `yaml:"incidents"` TemplateContext map[string]interface{} `yaml:",inline"` }
type Conditional ¶
type Conditional interface {
Evaluate(ctx context.Context, log logr.Logger, condCtx ConditionContext) (ConditionResponse, error)
}
type CustomVariable ¶
type IncidentContext ¶
type Option ¶
type Option func(engine *ruleEngine)
func WithCodeSnipLimit ¶
func WithContextLines ¶
func WithIncidentLimit ¶
func WithIncidentSelector ¶
func WithLocationPrefixes ¶ added in v0.3.1
type OrCondition ¶
type OrCondition struct {
Conditions []ConditionEntry `yaml:"or"`
}
func (OrCondition) Evaluate ¶
func (o OrCondition) Evaluate(ctx context.Context, log logr.Logger, condCtx ConditionContext) (ConditionResponse, error)
type Position ¶
type Position struct { /*Line defined: * Line position in a document (zero-based). * If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document. * If a line number is negative, it defaults to 0. */ Line int `yaml:"line"` /*Character defined: * Character offset on a line in a document (zero-based). Assuming that the line is * represented as a string, the `character` value represents the gap between the * `character` and `character + 1`. * * If the character value is greater than the line length it defaults back to the * line length. * If a line number is negative, it defaults to 0. */ Character int `yaml:"character"` }
type Rule ¶
type Rule struct { RuleMeta `yaml:",inline" json:",inline"` Perform Perform `yaml:",inline" json:"perform,omitempty"` When Conditional `yaml:"when,omitempty" json:"when,omitempty"` Snipper CodeSnip `yaml:"-" json:"-"` CustomVariables []CustomVariable `yaml:"customVariables,omitempty" json:"customVariables,omitempty"` }
type RuleEngine ¶
type RuleEngine interface { RunRules(context context.Context, rules []RuleSet, selectors ...RuleSelector) []konveyor.RuleSet Stop() }
func CreateRuleEngine ¶
type RuleMeta ¶
type RuleMeta struct { RuleID string `yaml:"ruleID,omitempty" json:"ruleID,omitempty"` Description string `yaml:"description,omitempty" json:"description,omitempty"` Category *konveyor.Category `yaml:"category,omitempty" json:"category,omitempty"` Labels []string `yaml:"labels,omitempty" json:"labels,omitempty"` Effort *int `json:"effort,omitempty"` }
type RuleSelector ¶
RuleSelector selects rules based on rule metadata
type RuleSet ¶
type RuleSet struct { Name string `json:"name,omitempty" yaml:"name,omitempty"` Description string `json:"description,omitempty" yaml:"description,omitempty"` Labels []string `json:"labels,omitempty" yaml:"labels,omitempty"` Tags []string `json:"tags,omitempty" yaml:"tags,omitempty"` Rules []Rule `json:"rules,omitempty" yaml:"rules,omitempty"` }
Click to show internal directories.
Click to hide internal directories.