2 Notifier Events
Hunter Long edited this page 2020-05-01 05:38:52 -07:00

Events are handled by added interfaces for the elements you want to monitor.

Required Notifier Interface

// Notifier interface is required to create a new Notifier
type Notifier interface {
        // OnSuccess is triggered when a service is successful
	OnSuccess(*services.Service) error
        // OnFailure is triggered when a service is failing
	OnFailure(*services.Service, *failures.Failure) error
        // OnTest is triggered for testing
	OnTest() (string, error)
}

Basic Success/Failure Interface

// BasicEvents includes the most minimal events, failing and successful service triggers
type BasicEvents interface {
	// OnSuccess is triggered when a service is successful
	OnSuccess(*types.Service)
	// OnFailure is triggered when a service is failing
	OnFailure(*types.Service, *types.Failure)
}

Service Events

// ServiceEvents are events for Services
type ServiceEvents interface {
	OnNewService(*types.Service)
	OnUpdatedService(*types.Service)
	OnDeletedService(*types.Service)
}

User Events

// UserEvents are events for Users
type UserEvents interface {
	OnNewUser(*types.User)
	OnUpdatedUser(*types.User)
	OnDeletedUser(*types.User)
}

Core Events

// CoreEvents are events for the main Core app
type CoreEvents interface {
	OnUpdatedCore(*types.Core)
}

Notifier Events

// NotifierEvents are events for other Notifiers
type NotifierEvents interface {
	OnNewNotifier(*Notification)
	OnUpdatedNotifier(*Notification)
}