notify

package
v2.0.0+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LocationServersNotifyBody string
	JobResultNotifyBody       string
)

notify template string

Functions

This section is empty.

Types

type APIEndPoint

type APIEndPoint struct {
	IEndPoint
	EndPoint
	// contains filtered or unexported fields
}

APIEndPoint is exported

func (*APIEndPoint) DoEvent

func (endpoint *APIEndPoint) DoEvent(event *Event, data interface{})

DoEvent is exported

type EndPoint

type EndPoint struct {
	Name     string `yaml:"name"`
	URL      string `yaml:"url"`
	Enabled  bool   `yaml:"enabled"`
	Sender   string `yaml:"sender"`
	Host     string `yaml:"host"`
	Port     int    `yaml:"port"`
	User     string `yaml:"user"`
	Password string `yaml:"password"`
}

EndPoint is exported

type Event

type Event struct {
	ID          string
	Type        EventType
	Name        string
	Error       error
	ContactInfo []string
	Endpoints   []IEndPoint
	// contains filtered or unexported fields
}

Event is exported

func NewEvent

func NewEvent(eventType EventType, description string, err error, contactInfo []string, endpoints []IEndPoint) *Event

NewEvent is exported

type EventType

type EventType int

EventType is exported

const (
	//LocationServersEvent is exported
	//cluster discovery watch servers event
	LocationServersEvent EventType = 1000
	//JobNotifyEvent is exported
	//job executed notify event
	JobNotifyEvent EventType = 1001
)

type IEndPoint

type IEndPoint interface {
	DoEvent(event *Event, data interface{})
}

IEndPoint is exported sender endPoint interface

func NewAPIEndPoint

func NewAPIEndPoint(endpoint EndPoint) IEndPoint

NewAPIEndPoint is exported

func NewSMTPEndpoint

func NewSMTPEndpoint(endpoint EndPoint) IEndPoint

NewSMTPEndpoint is exported

type INotifyEndPointFactory

type INotifyEndPointFactory interface {
	CreateAPIEndPoint(endpoint EndPoint) IEndPoint
	CreateSMTPEndPoint(endpoint EndPoint) IEndPoint
}

INotifyEndPointFactory is exported

type JobResult

type JobResult struct {
	JobName    string
	Directory  string
	Location   string
	Server     string
	Execat     string
	IsSuccessd bool
	Content    string
	Stdout     string
	Errout     string
	Execerr    string
}

JobResult is exported

type Notifications

type Notifications struct {
	EndPoints []EndPoint `yaml:"endpoints,omitempty"`
}

Notifications is exported

type NotifyEndPointFactory

type NotifyEndPointFactory struct {
	INotifyEndPointFactory
}

NotifyEndPointFactory is exported

func (*NotifyEndPointFactory) CreateAPIEndPoint

func (factory *NotifyEndPointFactory) CreateAPIEndPoint(endpoint EndPoint) IEndPoint

CreateAPIEndPoint is exported

func (*NotifyEndPointFactory) CreateSMTPEndPoint

func (factory *NotifyEndPointFactory) CreateSMTPEndPoint(endpoint EndPoint) IEndPoint

CreateSMTPEndPoint is exported

type NotifySender

type NotifySender struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

NotifySender is exported

func NewNotifySender

func NewNotifySender(endPoints []EndPoint) *NotifySender

NewNotifySender is exported

func (*NotifySender) AddJobNotifyEvent

func (sender *NotifySender) AddJobNotifyEvent(description string, watchJobNotify *WatchJobNotify)

AddJobNotifyEvent is exported

func (*NotifySender) AddLocationServersEvent

func (sender *NotifySender) AddLocationServersEvent(description string, watchLocation *WatchLocation)

AddLocationServersEvent is exported

type SMTPEndPoint

type SMTPEndPoint struct {
	IEndPoint
	EndPoint
	// contains filtered or unexported fields
}

SMTPEndPoint is exported

func (*SMTPEndPoint) DoEvent

func (endpoint *SMTPEndPoint) DoEvent(event *Event, data interface{})

DoEvent is exported

type Server

type Server struct {
	IP    string
	Name  string
	State string
}

Server is exported

type WatchJobNotify

type WatchJobNotify struct {
	Name        string
	ContactInfo []string
	JobResult
}

WatchJobNotify is exported

type WatchLocation

type WatchLocation struct {
	Name        string
	ContactInfo []string
	Servers     []*Server
}

WatchLocation is exported

func (*WatchLocation) AddContactInfo

func (location *WatchLocation) AddContactInfo(value string)

AddContactInfo is exported

func (*WatchLocation) AddServer

func (location *WatchLocation) AddServer(ip string, name string, state string)

AddServer is exported

type WatchLocations

type WatchLocations map[string]*WatchLocation

WatchLocations is exported

Jump to

Keyboard shortcuts

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