diff --git a/pkg/schemas/schemas.go b/pkg/schemas/schemas.go index 7cd4f0d..906c0fd 100644 --- a/pkg/schemas/schemas.go +++ b/pkg/schemas/schemas.go @@ -8,10 +8,9 @@ import ( "sync/atomic" "time" - "github.com/rancher/naok/pkg/attributes" - openapi_v2 "github.com/googleapis/gnostic/OpenAPIv2" "github.com/rancher/naok/pkg/accesscontrol" + "github.com/rancher/naok/pkg/attributes" "github.com/rancher/norman/pkg/store/proxy" "github.com/rancher/norman/pkg/types" "github.com/rancher/norman/pkg/types/convert" diff --git a/pkg/server/api.go b/pkg/server/api.go index dee9775..3a41488 100644 --- a/pkg/server/api.go +++ b/pkg/server/api.go @@ -146,11 +146,11 @@ func (a *apiServer) Schema(base string, schema *types.Schema) string { gvr := attributes.GVR(schema) 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 != "" { - 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) diff --git a/pkg/server/routes.go b/pkg/server/routes.go index b2452d4..4a6ca35 100644 --- a/pkg/server/routes.go +++ b/pkg/server/routes.go @@ -13,16 +13,16 @@ import ( type APIFunc func(*types.APIRequest) func (a *apiServer) routes() { - a.Path("/api/{version}/{resource}").Handler(a.handle(a.k8sAPI)) - a.Path("/api/{version}/{resource}/{nameorns}").Handler(a.handle(a.k8sAPI)) - a.Path("/api/{version}/{resource}/{namespace}/{name}").Handler(a.handle(a.k8sAPI)) + a.Path("/v1/{type:schemas}").Handler(a.handle(nil)) + a.Path("/v1/{type:schemas}/{name}").Handler(a.handle(nil)) + a.Path("/v1/{type:subscribe}").Handler(a.handle(nil)) - a.Path("/apis/{group}/{version}/{resource}").Handler(a.handle(a.k8sAPI)) - a.Path("/apis/{group}/{version}/{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}").Handler(a.handle(a.k8sAPI)) + a.Path("/{version:v1}/{resource}/{nameorns}").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/{type}/{name}").Handler(a.handle(nil)) + a.Path("/v1/apis/{group}/{version}/{resource}").Handler(a.handle(a.k8sAPI)) + a.Path("/v1/apis/{group}/{version}/{resource}/{nameorns}").Handler(a.handle(a.k8sAPI)) } func (a *apiServer) handle(apiFunc APIFunc) http.Handler {