Documentation ¶
Index ¶
- Constants
- Variables
- func IsTypeSupported(receiverType string) bool
- type ConfigResolver
- type Encryptor
- type Filter
- type GetOption
- type NotFoundError
- type Receiver
- type Repository
- type Service
- func (s *Service) Create(ctx context.Context, rcv *Receiver) error
- func (s *Service) Delete(ctx context.Context, id uint64) error
- func (s *Service) Get(ctx context.Context, id uint64, gopts ...GetOption) (*Receiver, error)
- func (s *Service) List(ctx context.Context, flt Filter) ([]Receiver, error)
- func (s *Service) PostHookDBTransformConfigs(ctx context.Context, receiverType string, configs map[string]any) (map[string]any, error)
- func (s *Service) Update(ctx context.Context, rcv *Receiver) error
Constants ¶
View Source
const ( LabelKeyID = "id" LabelKeyType = "type" )
Variables ¶
View Source
var (
ErrNotImplemented = errors.New("operation not supported")
)
View Source
var SupportedTypes = []string{ TypeSlack, TypeLark, TypeSlackChannel, TypeLarkChannel, TypeHTTP, TypePagerDuty, TypeFile, }
Functions ¶
func IsTypeSupported ¶
Types ¶
type ConfigResolver ¶
type ConfigResolver interface { BuildData(ctx context.Context, configs map[string]any) (map[string]any, error) PreHookDBTransformConfigs(ctx context.Context, configs map[string]any) (map[string]any, error) PostHookDBTransformConfigs(ctx context.Context, configs map[string]any) (map[string]any, error) }
type GetOption ¶
type GetOption func(*getOpts)
func GetWithExpand ¶ added in v0.6.5
func GetWithExpand() GetOption
GetWithExpand populates receiver configs with parent config
type NotFoundError ¶
type NotFoundError struct {
ID uint64
}
func (NotFoundError) Error ¶
func (err NotFoundError) Error() string
type Receiver ¶
type Receiver struct { ID uint64 `json:"id"` Name string `json:"name"` Labels map[string]string `json:"labels"` Configurations map[string]any `json:"configurations"` Data map[string]any `json:"data"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` // The pointer to receiver parent of a child receiver. This field is required if a receiver is a child receiver // If ParentID != 0, the receiver is a child receiver. ParentID uint64 `json:"parent_id"` // Type should be immutable Type string `json:"type"` }
func (Receiver) ToSubscriptionReceiverRelation ¶ added in v0.7.5
func (r Receiver) ToSubscriptionReceiverRelation(subscriptionID uint64) subscriptionreceiver.Relation
type Repository ¶
type Repository interface { List(context.Context, Filter) ([]Receiver, error) Create(context.Context, *Receiver) error Get(context.Context, uint64, Filter) (*Receiver, error) Update(context.Context, *Receiver) error Delete(context.Context, uint64) error PatchLabels(context.Context, *Receiver) error }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles business logic
func NewService ¶
func NewService(repository Repository, receiverPlugins map[string]ConfigResolver) *Service
func (*Service) PostHookDBTransformConfigs ¶ added in v0.7.5
Source Files ¶
Click to show internal directories.
Click to hide internal directories.