api: implement delete layer route

This commit is contained in:
Jimmy Zelinskie 2016-01-29 16:07:35 -05:00
parent 04c7351911
commit b916fba4c6

View File

@ -120,14 +120,21 @@ func getLayer(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *
} }
} }
// add envelope
writeResponse(w, LayerEnvelope{Layer: &layer}) writeResponse(w, LayerEnvelope{Layer: &layer})
return writeHeader(w, http.StatusOK) return writeHeader(w, http.StatusOK)
} }
func deleteLayer(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *context.RouteContext) int { func deleteLayer(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *context.RouteContext) int {
// ez err := ctx.Store.DeleteLayer(p.ByName("layerName"))
return 0 if err == cerrors.ErrNotFound {
writeResponse(w, LayerEnvelope{Error: &Error{err.Error()}})
return writeHeader(w, http.StatusNotFound)
} else if err != nil {
writeResponse(w, LayerEnvelope{Error: &Error{err.Error()}})
return writeHeader(w, http.StatusInternalServerError)
}
return writeHeader(w, http.StatusOK)
} }
func getNamespaces(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *context.RouteContext) int { func getNamespaces(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *context.RouteContext) int {