Add per-device routing long-tail: hosts, providers, routes, routing_rules
Storage + CRUD (migration 0006, model, id-keyed store, REST handlers) plus compiler rendering: each section is owned by a device and projected into that device's rendered config (hosts/providers/routes/routing_rules).
This commit is contained in:
@@ -61,6 +61,7 @@ func (s *Server) mountResources(r chi.Router) {
|
||||
})
|
||||
s.mountNAT(r)
|
||||
s.mountLongtail(r)
|
||||
s.mountPerDevice(r)
|
||||
}
|
||||
|
||||
// respondOne writes a single resource, mapping ErrNotFound to 404.
|
||||
@@ -76,6 +77,15 @@ func respondOne(w http.ResponseWriter, v any, err error) {
|
||||
writeJSON(w, http.StatusOK, v)
|
||||
}
|
||||
|
||||
// respondCreated writes a 201 with the created resource, or 500 on error.
|
||||
func respondCreated(w http.ResponseWriter, v any, err error) {
|
||||
if err != nil {
|
||||
writeError(w, http.StatusInternalServerError, err.Error())
|
||||
return
|
||||
}
|
||||
writeJSON(w, http.StatusCreated, v)
|
||||
}
|
||||
|
||||
// respondDelete maps a delete result to 204/404/500.
|
||||
func respondDelete(w http.ResponseWriter, err error) {
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user