mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
expose creation APIRequestInfoResolver
This commit is contained in:
parent
64678b71f3
commit
3be343449f
@ -218,8 +218,8 @@ type APIRequestInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type APIRequestInfoResolver struct {
|
type APIRequestInfoResolver struct {
|
||||||
apiPrefixes util.StringSet
|
APIPrefixes util.StringSet
|
||||||
restMapper meta.RESTMapper
|
RestMapper meta.RESTMapper
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAPIRequestInfo returns the information from the http request. If error is not nil, APIRequestInfo holds the information as best it is known before the failure
|
// GetAPIRequestInfo returns the information from the http request. If error is not nil, APIRequestInfo holds the information as best it is known before the failure
|
||||||
@ -253,7 +253,7 @@ func (r *APIRequestInfoResolver) GetAPIRequestInfo(req *http.Request) (APIReques
|
|||||||
return requestInfo, fmt.Errorf("Unable to determine kind and namespace from an empty URL path")
|
return requestInfo, fmt.Errorf("Unable to determine kind and namespace from an empty URL path")
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, currPrefix := range r.apiPrefixes.List() {
|
for _, currPrefix := range r.APIPrefixes.List() {
|
||||||
// handle input of form /api/{version}/* by adjusting special paths
|
// handle input of form /api/{version}/* by adjusting special paths
|
||||||
if currentParts[0] == currPrefix {
|
if currentParts[0] == currPrefix {
|
||||||
if len(currentParts) > 1 {
|
if len(currentParts) > 1 {
|
||||||
@ -334,7 +334,7 @@ func (r *APIRequestInfoResolver) GetAPIRequestInfo(req *http.Request) (APIReques
|
|||||||
|
|
||||||
// if we have a resource, we have a good shot at being able to determine kind
|
// if we have a resource, we have a good shot at being able to determine kind
|
||||||
if len(requestInfo.Resource) > 0 {
|
if len(requestInfo.Resource) > 0 {
|
||||||
_, requestInfo.Kind, _ = r.restMapper.VersionAndKindForResource(requestInfo.Resource)
|
_, requestInfo.Kind, _ = r.RestMapper.VersionAndKindForResource(requestInfo.Resource)
|
||||||
}
|
}
|
||||||
|
|
||||||
return requestInfo, nil
|
return requestInfo, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user