createEvent doesn't need a receiver and is generally useful
@@ -20,7 +20,7 @@ type MessageBusEventCreator struct {
// Warn sends a check with status of warn for a keepalive.
func (creatorPtr *MessageBusEventCreator) Warn(entity *types.Entity) error {
- event := creatorPtr.createEvent(entity)
+ event := createEvent(entity)
event.Check.Status = 1
return creatorPtr.MessageBus.Publish(messaging.TopicEvent, event)
@@ -28,7 +28,7 @@ func (creatorPtr *MessageBusEventCreator) Warn(entity *types.Entity) error {
// Critical sends a check with status of critical for a keepalive.
func (creatorPtr *MessageBusEventCreator) Critical(entity *types.Entity) error {
- event := creatorPtr.createEvent(entity)
+ event := createEvent(entity)
event.Check.Status = 2
return creatorPtr.MessageBus.Publish(messaging.TopicEvent, event)
@@ -36,13 +36,13 @@ func (creatorPtr *MessageBusEventCreator) Critical(entity *types.Entity) error {
// Resolve sends a check with a status of OK for a keepalive.
func (creatorPtr *MessageBusEventCreator) Resolve(entity *types.Entity) error {
- event := creatorPtr.createEvent(entity)
+ event := createEvent(entity)
event.Check.Status = 0
return creatorPtr.MessageBus.Publish(messaging.TopicEvent, event)
}
-func (creatorPtr *MessageBusEventCreator) createEvent(entity *types.Entity) *types.Event {
+func createEvent(entity *types.Entity) *types.Event {
keepaliveCheck := &types.Check{
Config: &types.CheckConfig{
Name: "keepalive",
