silence

package
v0.5.9 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeMatchers     = "Matchers"
	TypeSubscription = "subscription"
)
View Source
const TargetExpressionRuleKey = "rule"

Variables

This section is empty.

Functions

func IsTypeValid

func IsTypeValid(silenceTypeStr string) bool

Types

type Filter

type Filter struct {
	ID                string
	NamespaceID       uint64
	SubscriptionID    uint64
	Match             map[string]string
	SubscriptionMatch map[string]string
}

type Repository

type Repository interface {
	Create(context.Context, Silence) (string, error)
	List(context.Context, Filter) ([]Silence, error)
	Get(ctx context.Context, id string) (Silence, error)
	SoftDelete(ctx context.Context, id string) error
}

type Service

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

func NewService

func NewService(repo Repository) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, sil Silence) (string, error)

func (*Service) Delete

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

func (*Service) Get

func (s *Service) Get(ctx context.Context, id string) (Silence, error)

func (*Service) List

func (s *Service) List(ctx context.Context, filter Filter) ([]Silence, error)

type Silence

type Silence struct {
	ID               string                 `json:"id"`
	NamespaceID      uint64                 `json:"namespace_id"`
	Type             string                 `json:"type"`
	TargetID         uint64                 `json:"target_id"`
	TargetExpression map[string]interface{} `json:"target_expression"`
	Creator          string                 `json:"creator"`
	Comment          string                 `json:"comment"`
	CreatedAt        time.Time              `json:"created_at"`
	DeletedAt        time.Time              `json:"deleted_at"`
}

func (Silence) EvaluateSubscriptionRule

func (s Silence) EvaluateSubscriptionRule(env interface{}) (bool, error)

func (Silence) Validate

func (s Silence) Validate() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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