1
0
mirror of https://github.com/rancher/steve.git synced 2025-08-31 06:46:25 +00:00
Files
steve/pkg/server/router/router.go
Darren Shepherd 583309b969 Add column support
2019-08-14 11:08:34 -07:00

30 lines
734 B
Go

package router
import (
"net/http"
"github.com/gorilla/mux"
)
type Handlers struct {
K8sResource http.Handler
GenericResource http.Handler
K8sProxy http.Handler
}
func Routes(h Handlers) http.Handler {
m := mux.NewRouter()
m.UseEncodedPath()
m.StrictSlash(true)
m.NotFoundHandler = h.K8sProxy
m.Path("/v1/{type:schemas}/{name:.*}").Handler(h.GenericResource)
m.Path("/v1/{group}.{version}.{resource}").Handler(h.K8sResource)
m.Path("/v1/{group}.{version}.{resource}/{nameorns}").Handler(h.K8sResource)
m.Path("/v1/{group}.{version}.{resource}/{namespace}/{name}").Handler(h.K8sResource)
m.Path("/v1/{type}").Handler(h.GenericResource)
m.Path("/v1/{type}/{name}").Handler(h.GenericResource)
return m
}