Fetch the repository succeeded.
package server
import (
"context"
"net/http"
"net/url"
normanapi "github.com/rancher/norman/api"
"github.com/rancher/norman/parse"
"github.com/rancher/norman/types"
"github.com/rancher/rancher/pkg/api/cluster/api/setup"
"github.com/rancher/rancher/pkg/api/cluster/store"
"github.com/rancher/rancher/pkg/rbac"
"github.com/rancher/types/config"
)
func New(ctx context.Context, cluster *config.ClusterContext) (http.Handler, error) {
if err := setup.Schemas(ctx, cluster, cluster.Schemas); err != nil {
return nil, err
}
server := normanapi.NewAPIServer()
server.AccessControl = rbac.NewAccessControl(cluster.RBAC)
server.URLParser = func(schemas *types.Schemas, url *url.URL) (parse.ParsedURL, error) {
return URLParser(cluster.ClusterName, schemas, url)
}
server.StoreWrapper = store.ProjectSetter(server.StoreWrapper)
if err := server.AddSchemas(cluster.Schemas); err != nil {
return nil, err
}
return server, nil
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。