pkg

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAPI

func NewAPI(cfg Config) (*api, error)

NewAPI creates new api instance using provided config

Types

type API

type API interface {
	Send(vars map[string]interface{}, templates []string, dest services.Destination) error
	RunTrigger(triggerName string, vars map[string]interface{}) ([]triggers.ConditionResult, error)
	AddNotificationService(name string, service services.NotificationService)
	GetNotificationServices() map[string]services.NotificationService
}

API provides high level interface to send notifications and manage notification services

type Config

type Config struct {
	Services  map[string]ServiceFactory
	Triggers  map[string][]triggers.Condition
	Templates map[string]services.Notification
}

Config holds settings required to create new api

func ParseConfig

func ParseConfig(configMap *v1.ConfigMap, secret *v1.Secret) (*Config, error)

ParseConfig retrieves Config from given ConfigMap and Secret

type ServiceFactory

type ServiceFactory func() (services.NotificationService, error)

type Subscriptions

type Subscriptions map[string][]services.Destination

Subscriptions holds an information what explains when, where and how a notification should be sent

func (Subscriptions) Dedup

func (s Subscriptions) Dedup() Subscriptions

func (Subscriptions) Merge

func (s Subscriptions) Merge(other Subscriptions)

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
mocks
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.
util

Jump to

Keyboard shortcuts

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