ruleservice

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrChannelNotFound = fmt.Errorf("notification channel not found")
View Source
var ErrOriginsNotFound error = errors.New("one or more origins do not exist")
View Source
var ErrRecipientNotSupported = fmt.Errorf("recipient is not supported for the selected channel")
View Source
var ErrRecipientRequired = fmt.Errorf("recipient is required for the selected channel")
View Source
var ErrRuleLimitReached = fmt.Errorf("alert rule limit reached")

Functions

This section is empty.

Types

type NotificationChannelRepository

type NotificationChannelRepository interface {
	GetNotificationChannelById(ctx context.Context, id string) (models.NotificationChannel, error)
	ListNotificationChannelsByType(ctx context.Context, channelType models.ChannelType) ([]models.NotificationChannel, error)
}

type OriginRepository

type OriginRepository interface {
	UpsertOrigins(ctx context.Context, serviceID string, origins []entities.Origin) error
	ListOrigins(ctx context.Context) ([]entities.Origin, error)
}

type RuleRepository

type RuleRepository interface {
	Get(ctx context.Context, id string) (models.Rule, error)
	List(ctx context.Context) ([]models.Rule, error)
	Create(ctx context.Context, rule models.Rule) (models.Rule, error)
	Update(ctx context.Context, id string, rule models.Rule) (models.Rule, error)
	Delete(ctx context.Context, id string) error
}

type RuleService

type RuleService struct {
	// contains filtered or unexported fields
}

func NewRuleService

func NewRuleService(store RuleRepository, channelStore NotificationChannelRepository, originStore OriginRepository, ruleLimit int) (*RuleService, error)

NewRuleService creates a new RuleService and registers the special "All" origin which is used to match all notifications.

func (*RuleService) Create

func (s *RuleService) Create(ctx context.Context, rule models.Rule) (models.Rule, error)

func (*RuleService) Delete

func (s *RuleService) Delete(ctx context.Context, id string) error

func (*RuleService) Get

func (s *RuleService) Get(ctx context.Context, id string) (models.Rule, error)

Get retrieves a rule by its ID. If the rule is invalid due to missing references, it is deactivated, but still returned.

func (*RuleService) GetAllRuleOptions

func (s *RuleService) GetAllRuleOptions(ctx context.Context) (*models.RuleOptions, error)

func (*RuleService) List

func (s *RuleService) List(ctx context.Context) ([]models.Rule, error)

List retrieves all rules. If any rule is invalid due to missing references, it is deactivated, but still returned.

func (*RuleService) ProcessRules added in v0.14.0

func (s *RuleService) ProcessRules(ctx context.Context, notification models.Notification) ([]models.Action, error)

func (*RuleService) Update

func (s *RuleService) Update(ctx context.Context, id string, rule models.Rule) (models.Rule, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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