diff --git a/c_service.go b/c_service.go index 391a4af..1142e7b 100644 --- a/c_service.go +++ b/c_service.go @@ -25,6 +25,12 @@ func (n *Service) Handle(subject string, lines []Message) []Message { case "service.delete.error": lines = append(lines, Message{Body: "\nOops! Something went wrong. Please manually fix any errors shown above and re-apply your service deletion.", Level: "INFO"}) lines = append(lines, Message{Body: "error", Level: "ERROR"}) + case "service.import.done": + lines = append(lines, Message{Body: "SUCCESS: service successfully imported", Level: "SUCCESS"}) + lines = append(lines, Message{Body: "error", Level: "ERROR"}) + case "service.import.error": + lines = append(lines, Message{Body: "\nOops! Something went wrong. Please manually fix any errors shown above and re-apply your definition.", Level: "INFO"}) + lines = append(lines, Message{Body: "error", Level: "ERROR"}) } return lines } diff --git a/main.go b/main.go index 869ef78..6fc6c35 100644 --- a/main.go +++ b/main.go @@ -40,6 +40,8 @@ func main() { n.Subscribe("service.create.error", natsHandler) n.Subscribe("service.delete.done", natsHandler) n.Subscribe("service.delete.error", natsHandler) + n.Subscribe("service.import.done", natsHandler) + n.Subscribe("service.import.error", natsHandler) n.Subscribe("*.*", genericHandler) n.Subscribe("*.*.*", genericHandler) diff --git a/nats.go b/nats.go index 9607a63..fc58b98 100644 --- a/nats.go +++ b/nats.go @@ -32,7 +32,7 @@ func natsHandler(msg *nats.Msg) { for _, nm := range lines { publishMessage(notification.getServiceID(), &nm) } - case "service.create.done", "service.create.error", "service.delete.done", "service.delete.error": + case "service.create.done", "service.create.error", "service.delete.done", "service.delete.error", "service.import.done", "service.import.error": var handler Service lines := handler.Handle(msg.Subject, notification.Messages) for _, nm := range lines {