routers

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EMAIL_DEFAULT_FROM         string = "alerts@gregland.dev"
	EMAIL_DEFAULT_MSG_HDR      string = "To: alerts@gregland.dev\r\nSubject: "
	EMAIL_DEFAULT_MAX_MSG_SIZE int    = 160
)
View Source
const (
	SLACK_DEFAULT_MAX_MSG_SIZE int = 160
)

Variables

This section is empty.

Functions

This section is empty.

Types

type EmailConfig

type EmailConfig struct {
	SmtpHost   string // required
	SmtpPort   int    // required
	Au         string // defaults
	Ap         string // defaults
	From       string // defaults
	MsgHdr     string // defaults
	MaxMsgSize int    // defaults
}

type EmailRouter

type EmailRouter struct {
	Config *EmailConfig
	// contains filtered or unexported fields
}

func (*EmailRouter) GetConfig

func (e *EmailRouter) GetConfig() interface{}

func (*EmailRouter) Init

func (e *EmailRouter) Init() error

func (*EmailRouter) Route

func (e *EmailRouter) Route(event *Event, t interface{}) error

type Event

type Event struct {
	Id      string
	Message string
}

type Router

type Router interface {
	Init() error
	GetConfig() interface{}
	Route(*Event, interface{}) error
}

func NewEmailRouter

func NewEmailRouter(config *EmailConfig) (Router, error)

func NewSlackRouter

func NewSlackRouter(config *SlackConfig) (Router, error)

type SlackConfig

type SlackConfig struct {
	Url        string
	MaxMsgSize int // defaults
}

type SlackMessage

type SlackMessage struct {
	Text string `json:"text"`
}

type SlackRouter

type SlackRouter struct {
	Config *SlackConfig
}

func (*SlackRouter) GetConfig

func (e *SlackRouter) GetConfig() interface{}

func (*SlackRouter) Init

func (e *SlackRouter) Init() error

func (*SlackRouter) Route

func (e *SlackRouter) Route(event *Event, t interface{}) error

Jump to

Keyboard shortcuts

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