Skip to content

Commit

Permalink
Merge pull request #23 from ernestio/import
Browse files Browse the repository at this point in the history
Support service.import
  • Loading branch information
purehyperbole authored Jan 16, 2017
2 parents 9871393 + d68ae64 commit 9a1d1a5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
6 changes: 6 additions & 0 deletions c_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
2 changes: 2 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion nats.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 9a1d1a5

Please sign in to comment.