api

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRPCErr added in v0.7.8

func GenerateRPCErr(logger log.Logger, e error) error

func GetHeaderString

func GetHeaderString(ctx context.Context, headerKey string) string

func SupportedHeaders

func SupportedHeaders(cfg HeadersConfig) map[string]bool

Types

type AlertService

type AlertService interface {
	CreateAlerts(ctx context.Context, providerType string, providerID uint64, namespaceID uint64, body map[string]any) ([]alert.Alert, error)
	List(context.Context, alert.Filter) ([]alert.Alert, error)
}

type Config added in v0.7.8

type Config struct {
	UseGlobalSubscription bool
	WithDebugRequest      bool
}

type Deps

type Deps struct {
	TemplateService             TemplateService
	RuleService                 RuleService
	AlertService                AlertService
	ProviderService             ProviderService
	NamespaceService            NamespaceService
	ReceiverService             ReceiverService
	SubscriptionService         SubscriptionService
	SubscriptionReceiverService SubscriptionReceiverService
	NotificationService         NotificationService
	SilenceService              SilenceService
}

type HeadersConfig

type HeadersConfig struct {
	IdempotencyKey   string `mapstructure:"idempotency_key" yaml:"idempotency_key" default:"Idempotency-Key"`
	IdempotencyScope string `mapstructure:"idempotency_scope" yaml:"idempotency_scope" default:"Idempotency-Scope"`
}

type NotificationService

type NotificationService interface {
	Dispatch(context.Context, []notification.Notification) ([]string, error)
	RemoveIdempotencies(ctx context.Context, TTL time.Duration) error
	CheckIdempotency(ctx context.Context, scope, key string) (string, error)
	InsertIdempotency(ctx context.Context, scope, key, notificationID string) error
	ListNotificationMessages(ctx context.Context, notificationID string) ([]notification.Message, error)
	List(ctx context.Context, flt notification.Filter) ([]notification.Notification, error)
}

type ReceiverService

type ReceiverService interface {
	List(ctx context.Context, flt receiver.Filter) ([]receiver.Receiver, error)
	Create(ctx context.Context, rcv *receiver.Receiver) error
	Get(ctx context.Context, id uint64, gopts ...receiver.GetOption) (*receiver.Receiver, error)
	Update(ctx context.Context, rcv *receiver.Receiver) error
	Delete(ctx context.Context, id uint64) error
}

type RuleService

type RuleService interface {
	Upsert(context.Context, *rule.Rule) error
	List(context.Context, rule.Filter) ([]rule.Rule, error)
}

type SilenceService

type SilenceService interface {
	Create(ctx context.Context, sil silence.Silence) (string, error)
	List(ctx context.Context, filter silence.Filter) ([]silence.Silence, error)
	Get(ctx context.Context, id string) (silence.Silence, error)
	Delete(ctx context.Context, id string) error
}

type SubscriptionReceiverService added in v0.7.6

type SubscriptionReceiverService interface {
	List(ctx context.Context, flt subscriptionreceiver.Filter) ([]subscriptionreceiver.Relation, error)
	BulkUpsert(ctx context.Context, rels []subscriptionreceiver.Relation) error
	Update(ctx context.Context, rel *subscriptionreceiver.Relation) error
	BulkSoftDelete(ctx context.Context, flt subscriptionreceiver.DeleteFilter) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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