Documentation ¶
Overview ¶
Package interfaces provides necessary interfaces and implementations for implementing engine plugins
Index ¶
- type Action
- type ActionCmd
- type ActionType
- type ActionsParams
- type EvalParamsReader
- type EvalStatusParams
- func (e *EvalStatusParams) DecorateLogger(l zerolog.Logger) zerolog.Logger
- func (e *EvalStatusParams) GetActionsErr() evalerrors.ActionsError
- func (e *EvalStatusParams) GetActionsOnOff() map[ActionType]models.ActionOpt
- func (e *EvalStatusParams) GetEvalErr() error
- func (e *EvalStatusParams) GetEvalStatusFromDb() *db.ListRuleEvaluationsByProfileIdRow
- func (e *EvalStatusParams) GetIngestResult() *interfaces.Result
- func (e *EvalStatusParams) GetProfile() *models.ProfileAggregate
- func (e *EvalStatusParams) GetRule() *models.RuleInstance
- func (e *EvalStatusParams) SetActionsErr(ctx context.Context, actionErr evalerrors.ActionsError)
- func (e *EvalStatusParams) SetActionsOnOff(actionsOnOff map[ActionType]models.ActionOpt)
- func (e *EvalStatusParams) SetEvalErr(err error)
- func (e *EvalStatusParams) SetIngestResult(res *interfaces.Result)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Action ¶
type Action interface { Class() ActionType Type() string GetOnOffState(models.ActionOpt) models.ActionOpt Do(ctx context.Context, cmd ActionCmd, setting models.ActionOpt, entity protoreflect.ProtoMessage, params ActionsParams, metadata *json.RawMessage) (json.RawMessage, error) }
Action is the interface for a rule type action
type ActionCmd ¶
type ActionCmd string
ActionCmd is the type that defines what effect an action should have
type ActionType ¶
type ActionType string
ActionType represents the type of action, i.e., remediate, alert, etc.
type ActionsParams ¶
type ActionsParams interface { EvalParamsReader interfaces.ResultSink GetActionsOnOff() map[ActionType]models.ActionOpt GetActionsErr() evalerrors.ActionsError GetEvalErr() error GetEvalStatusFromDb() *db.ListRuleEvaluationsByProfileIdRow GetProfile() *models.ProfileAggregate }
ActionsParams is the interface used for processing a rule type action
type EvalParamsReader ¶
type EvalParamsReader interface { GetRule() *models.RuleInstance GetIngestResult() *interfaces.Result }
EvalParamsReader is the interface used for a rule type evaluator
type EvalStatusParams ¶
type EvalStatusParams struct { Result *interfaces.Result Profile *models.ProfileAggregate Rule *models.RuleInstance ProjectID uuid.UUID ReleaseID uuid.UUID PipelineRunID uuid.UUID TaskRunID uuid.UUID BuildID uuid.UUID EntityType db.Entities EntityID uuid.UUID EvalStatusFromDb *db.ListRuleEvaluationsByProfileIdRow ExecutionID uuid.UUID // contains filtered or unexported fields }
EvalStatusParams is a helper struct to pass parameters to createOrUpdateEvalStatus to avoid confusion with the parameters' order. Since at the moment, all our entities are bound to a repo and most profiles are expecting a repo, the RepoID parameter is mandatory. For entities other than artifacts, the ArtifactID should be 0 that is translated to NULL in the database.
func (*EvalStatusParams) DecorateLogger ¶
func (e *EvalStatusParams) DecorateLogger(l zerolog.Logger) zerolog.Logger
DecorateLogger decorates the logger with the necessary fields
func (*EvalStatusParams) GetActionsErr ¶
func (e *EvalStatusParams) GetActionsErr() evalerrors.ActionsError
GetActionsErr returns the actions' error
func (*EvalStatusParams) GetActionsOnOff ¶
func (e *EvalStatusParams) GetActionsOnOff() map[ActionType]models.ActionOpt
GetActionsOnOff returns the actions' on/off state
func (*EvalStatusParams) GetEvalErr ¶
func (e *EvalStatusParams) GetEvalErr() error
GetEvalErr returns the evaluation error
func (*EvalStatusParams) GetEvalStatusFromDb ¶
func (e *EvalStatusParams) GetEvalStatusFromDb() *db.ListRuleEvaluationsByProfileIdRow
GetEvalStatusFromDb returns the evaluation status from the database Returns nil if there is no previous state for this rule/entity
func (*EvalStatusParams) GetIngestResult ¶
func (e *EvalStatusParams) GetIngestResult() *interfaces.Result
GetIngestResult returns the result of the ingestion, if any
func (*EvalStatusParams) GetProfile ¶
func (e *EvalStatusParams) GetProfile() *models.ProfileAggregate
GetProfile returns the profile
func (*EvalStatusParams) GetRule ¶
func (e *EvalStatusParams) GetRule() *models.RuleInstance
GetRule returns the rule
func (*EvalStatusParams) SetActionsErr ¶
func (e *EvalStatusParams) SetActionsErr(ctx context.Context, actionErr evalerrors.ActionsError)
SetActionsErr sets the actions' error
func (*EvalStatusParams) SetActionsOnOff ¶
func (e *EvalStatusParams) SetActionsOnOff(actionsOnOff map[ActionType]models.ActionOpt)
SetActionsOnOff sets the actions' on/off state
func (*EvalStatusParams) SetEvalErr ¶
func (e *EvalStatusParams) SetEvalErr(err error)
SetEvalErr sets the evaluation error
func (*EvalStatusParams) SetIngestResult ¶
func (e *EvalStatusParams) SetIngestResult(res *interfaces.Result)
SetIngestResult sets the result of the ingestion for use later on in the actions