f-21: api coherence

Signed-off-by: GnomeZworc <nicolas.boufidjeline@g3e.fr>
This commit is contained in:
GnomeZworc 2026-04-26 16:14:18 +02:00
commit e939467abf
Signed by: nicolas.boufideline
GPG key ID: 4406BBBF8845D632
5 changed files with 43 additions and 17 deletions

View file

@ -42,7 +42,11 @@ func (s *Server) getVpc(w http.ResponseWriter, _ *http.Request, name string) {
func (s *Server) deleteVpc(w http.ResponseWriter, _ *http.Request, name string) {
cmd := dispatcher.DeleteVPCCommand{Name: name}
if err := s.dispatcher.Prepare(cmd); err != nil {
w.WriteHeader(http.StatusNotFound)
if _, dbErr := kv.GetFromDB(s.db, "vpc/"+name+"/state"); dbErr != nil {
w.WriteHeader(http.StatusNotFound)
} else {
w.WriteHeader(http.StatusConflict)
}
json.NewEncoder(w).Encode(ErrorResponse{Error: err.Error()})
return
}