mirror of
https://github.com/niusmallnan/steve.git
synced 2025-07-06 19:18:43 +00:00
Change routes to all be under /v1
This commit is contained in:
parent
1dc21e0576
commit
6023e23a0d
@ -8,10 +8,9 @@ import (
|
|||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/rancher/naok/pkg/attributes"
|
|
||||||
|
|
||||||
openapi_v2 "github.com/googleapis/gnostic/OpenAPIv2"
|
openapi_v2 "github.com/googleapis/gnostic/OpenAPIv2"
|
||||||
"github.com/rancher/naok/pkg/accesscontrol"
|
"github.com/rancher/naok/pkg/accesscontrol"
|
||||||
|
"github.com/rancher/naok/pkg/attributes"
|
||||||
"github.com/rancher/norman/pkg/store/proxy"
|
"github.com/rancher/norman/pkg/store/proxy"
|
||||||
"github.com/rancher/norman/pkg/types"
|
"github.com/rancher/norman/pkg/types"
|
||||||
"github.com/rancher/norman/pkg/types/convert"
|
"github.com/rancher/norman/pkg/types/convert"
|
||||||
|
@ -146,11 +146,11 @@ func (a *apiServer) Schema(base string, schema *types.Schema) string {
|
|||||||
gvr := attributes.GVR(schema)
|
gvr := attributes.GVR(schema)
|
||||||
|
|
||||||
if gvr.Group == "" && gvr.Version != "" && gvr.Resource != "" {
|
if gvr.Group == "" && gvr.Version != "" && gvr.Resource != "" {
|
||||||
return urlbuilder.ConstructBasicURL(base, "api", gvr.Version, gvr.Resource)
|
return urlbuilder.ConstructBasicURL(base, gvr.Version, gvr.Resource)
|
||||||
}
|
}
|
||||||
|
|
||||||
if gvr.Resource != "" {
|
if gvr.Resource != "" {
|
||||||
return urlbuilder.ConstructBasicURL(base, "apis", gvr.Group, gvr.Version, gvr.Resource)
|
return urlbuilder.ConstructBasicURL(base, "v1", "apis", gvr.Group, gvr.Version, gvr.Resource)
|
||||||
}
|
}
|
||||||
|
|
||||||
return urlbuilder.ConstructBasicURL(base, "v1", schema.PluralName)
|
return urlbuilder.ConstructBasicURL(base, "v1", schema.PluralName)
|
||||||
|
@ -13,16 +13,16 @@ import (
|
|||||||
type APIFunc func(*types.APIRequest)
|
type APIFunc func(*types.APIRequest)
|
||||||
|
|
||||||
func (a *apiServer) routes() {
|
func (a *apiServer) routes() {
|
||||||
a.Path("/api/{version}/{resource}").Handler(a.handle(a.k8sAPI))
|
a.Path("/v1/{type:schemas}").Handler(a.handle(nil))
|
||||||
a.Path("/api/{version}/{resource}/{nameorns}").Handler(a.handle(a.k8sAPI))
|
a.Path("/v1/{type:schemas}/{name}").Handler(a.handle(nil))
|
||||||
a.Path("/api/{version}/{resource}/{namespace}/{name}").Handler(a.handle(a.k8sAPI))
|
a.Path("/v1/{type:subscribe}").Handler(a.handle(nil))
|
||||||
|
|
||||||
a.Path("/apis/{group}/{version}/{resource}").Handler(a.handle(a.k8sAPI))
|
a.Path("/{version:v1}/{resource}").Handler(a.handle(a.k8sAPI))
|
||||||
a.Path("/apis/{group}/{version}/{resource}/{nameorns}").Handler(a.handle(a.k8sAPI))
|
a.Path("/{version:v1}/{resource}/{nameorns}").Handler(a.handle(a.k8sAPI))
|
||||||
a.Path("/apis/{group}/{version}/{resource}/{namespace}/{name}").Handler(a.handle(a.k8sAPI))
|
a.Path("/{version:v1}/{resource}/{namespace}/{name}").Handler(a.handle(a.k8sAPI))
|
||||||
|
|
||||||
a.Path("/v1/{type}").Handler(a.handle(nil))
|
a.Path("/v1/apis/{group}/{version}/{resource}").Handler(a.handle(a.k8sAPI))
|
||||||
a.Path("/v1/{type}/{name}").Handler(a.handle(nil))
|
a.Path("/v1/apis/{group}/{version}/{resource}/{nameorns}").Handler(a.handle(a.k8sAPI))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *apiServer) handle(apiFunc APIFunc) http.Handler {
|
func (a *apiServer) handle(apiFunc APIFunc) http.Handler {
|
||||||
|
Loading…
Reference in New Issue
Block a user