mirror of
https://github.com/bingohuang/docker-labs.git
synced 2025-10-05 09:53:21 +08:00
Initial commit
This commit is contained in:
21
handlers/delete_instance.go
Normal file
21
handlers/delete_instance.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package handlers
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/go-zoo/bone"
|
||||
"github.com/xetorthio/play-with-docker/services"
|
||||
)
|
||||
|
||||
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
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user