1
0
mirror of https://github.com/bingohuang/docker-labs.git synced 2025-07-14 18:27:25 +08:00
docker-labs/handlers/delete_instance.go
Jonathan Leibiusky (@xetorthio) b6b849e2c6 Change import paths
Add session cleanup
2016-10-08 10:25:10 +02:00

22 lines
474 B
Go

package handlers
import (
"net/http"
"github.com/franela/play-with-docker/services"
"github.com/go-zoo/bone"
)
func DeleteInstance(rw http.ResponseWriter, req *http.Request) {
sessionId := bone.GetValue(req, "sessionId")
instanceId := bone.GetValue(req, "instanceId")
s := services.GetSession(sessionId)
i := services.GetInstance(s, instanceId)
err := services.DeleteInstance(s, i)
if err != nil {
rw.WriteHeader(http.StatusInternalServerError)
return
}
}