api: implement delete vulnerability

This commit is contained in:
Jimmy Zelinskie 2016-02-01 16:04:58 -05:00
parent dc99d45f47
commit 8209922c0c

View File

@ -166,13 +166,23 @@ func getVulnerability(w http.ResponseWriter, r *http.Request, p httprouter.Param
writeResponse(w, VulnerabilityEnvelope{Vulnerability: &vuln}) writeResponse(w, VulnerabilityEnvelope{Vulnerability: &vuln})
return writeHeader(w, http.StatusOK) return writeHeader(w, http.StatusOK)
} }
func patchVulnerability(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *context.RouteContext) int { func patchVulnerability(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *context.RouteContext) int {
// ez // ez
return 0 return 0
} }
func deleteVulnerability(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *context.RouteContext) int { func deleteVulnerability(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *context.RouteContext) int {
// ez err := ctx.Store.DeleteVulnerability(p.ByName("namespaceName"), p.ByName("vulnerabilityName"))
return 0 if err == cerrors.ErrNotFound {
writeResponse(w, VulnerabilityEnvelope{Error: &Error{err.Error()}})
return writeHeader(w, http.StatusNotFound)
} else if err != nil {
writeResponse(w, VulnerabilityEnvelope{Error: &Error{err.Error()}})
return writeHeader(w, http.StatusInternalServerError)
}
return writeHeader(w, http.StatusOK)
} }
func postFix(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *context.RouteContext) int { func postFix(w http.ResponseWriter, r *http.Request, p httprouter.Params, ctx *context.RouteContext) int {