58 lines
1.3 KiB
Go
58 lines
1.3 KiB
Go
package server
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/go-chi/chi/v5"
|
|
)
|
|
|
|
// mountResources wires the Terraform-facing CRUD endpoints for every resource in
|
|
// the model. Handlers are stubbed pending the storage layer (see task: domain
|
|
// model + Postgres storage).
|
|
func (s *Server) mountResources(r chi.Router) {
|
|
for _, name := range resourceCollections {
|
|
r.Route("/"+name, func(r chi.Router) {
|
|
r.Get("/", s.notImplemented)
|
|
r.Post("/", s.notImplemented)
|
|
r.Get("/{id}", s.notImplemented)
|
|
r.Put("/{id}", s.notImplemented)
|
|
r.Delete("/{id}", s.notImplemented)
|
|
})
|
|
}
|
|
}
|
|
|
|
// resourceCollections are the REST collection paths exposed to Terraform, one per
|
|
// model resource.
|
|
var resourceCollections = []string{
|
|
"fabrics",
|
|
"zones",
|
|
"address-groups",
|
|
"portgroups",
|
|
"policies",
|
|
"rules",
|
|
"devices",
|
|
"bindings",
|
|
"snat",
|
|
"netmap",
|
|
"nat",
|
|
"blrules",
|
|
"conntrack",
|
|
"hosts",
|
|
"providers",
|
|
"routes",
|
|
"routing-rules",
|
|
"tunnels",
|
|
}
|
|
|
|
func (s *Server) handleDeviceConfig(w http.ResponseWriter, r *http.Request) {
|
|
s.notImplemented(w, r)
|
|
}
|
|
|
|
func (s *Server) handleDeviceStatus(w http.ResponseWriter, r *http.Request) {
|
|
s.notImplemented(w, r)
|
|
}
|
|
|
|
func (s *Server) notImplemented(w http.ResponseWriter, _ *http.Request) {
|
|
writeError(w, http.StatusNotImplemented, "not implemented yet")
|
|
}
|