notification

package
v0.2.6 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2022 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAllNotifications

func GetAllNotifications() map[string]map[string]map[string]Config

GetAllNotifications returns all notifications loaded from the data directory within this package as a native map.

func GetProductNotifications

func GetProductNotifications(team, product string) map[string]Config

GetTeamNotifications returns all notifications loaded from the data directory within this package for a particular team and product as a native map.

func GetTeamNotifications

func GetTeamNotifications(team string) map[string]map[string]Config

GetTeamNotifications returns all notifications loaded from the data directory within this package for a particular team as a native map.

func MatchesPattern added in v0.2.4

func MatchesPattern(pattern *regexp.Regexp) validator.Func

Types

type Config

type Config struct {
	Description  string `validate:"required,ends-with-alnum"`
	InternalOnly bool   `yaml:"internalOnly"`
	ServiceName  string `yaml:"serviceName"`
	Severity     string `validate:"required,oneof=Debug Error Fatal Info Warning"`
	Summary      string `validate:"required"`
}

Config abstracts configuration values for a customer notification. Any changes to this struct should be updated in './data/README.md'.

func GetNotification

func GetNotification(team, product, id string) (Config, bool)

GetNotification returns a Config and the value 'true' if a config exists for the given combination of 'team', 'product' and 'id' from the data directory within this package. Otherwise, an empty Config value is returned along with 'false'.

func (*Config) ProvideRowData added in v0.2.2

func (c *Config) ProvideRowData() map[string]interface{}

func (*Config) UnmarshalYAML

func (c *Config) UnmarshalYAML(value *yaml.Node) error

type ConfigTree

type ConfigTree map[string]map[string]map[string]Config

ConfigTree abstracts notification configs loaded from a filesystem.

func (ConfigTree) GetAllNotifications

func (t ConfigTree) GetAllNotifications() map[string]map[string]map[string]Config

GetAllNotifications returns a copy of the ConfigTree in native values.

func (ConfigTree) GetNotification

func (t ConfigTree) GetNotification(team, product, id string) (Config, bool)

GetNotification returns a Config and the value 'true' if a config exists for the given combination of 'team', 'product' and 'id'. Otherwise, an empty Config value is returned along with 'false'.

func (ConfigTree) GetProductNotifications

func (t ConfigTree) GetProductNotifications(team, product string) map[string]Config

GetProductNotifications returns a map from id -> Config for all notifications related to a team and product.

func (ConfigTree) GetProducts

func (t ConfigTree) GetProducts(team string) []string

GetProducts returns a slice of products for a particular team from a ConfigTree.

func (ConfigTree) GetTeamNotifications

func (t ConfigTree) GetTeamNotifications(team string) map[string]map[string]Config

GetTeamNotifications returns a sub-tree for a particular team in native values.

func (ConfigTree) GetTeams

func (t ConfigTree) GetTeams() []string

GetTeams returns a slice of teams from a ConfigTree.

Jump to

Keyboard shortcuts

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