// APIRequestInfo holds information parsed from the http.Request
// RequestInfo holds information parsed from the http.Request
typeAPIRequestInfostruct{
typeRequestInfostruct{
// Verb is the kube verb associated with the request, not the http verb. This includes things like list and watch.
// IsResourceRequest indicates whether or not the request is for an API resource or subresource
IsResourceRequestbool
// Path is the URL path of the request
Pathstring
// Verb is the kube verb associated with the request for API requests, not the http verb. This includes things like list and watch.
// for non-resource requests, this is the lowercase http verb
Verbstring
Verbstring
APIPrefixstring
APIPrefixstring
APIGroupstring
APIGroupstring
APIVersionstring
APIVersionstring
...
@@ -410,20 +416,18 @@ type APIRequestInfo struct {
...
@@ -410,20 +416,18 @@ type APIRequestInfo struct {
Namestring
Namestring
// Parts are the path parts for the request, always starting with /{resource}/{name}
// Parts are the path parts for the request, always starting with /{resource}/{name}
Parts[]string
Parts[]string
// Raw is the unparsed form of everything other than parts.
// Raw + Parts = complete URL path
Raw[]string
}
}
typeAPIRequestInfoResolverstruct{
typeRequestInfoResolverstruct{
APIPrefixessets.String
APIPrefixessets.String
GrouplessAPIPrefixessets.String
GrouplessAPIPrefixessets.String
}
}
// TODO write an integration test against the swagger doc to test the APIRequestInfo and match up behavior to responses
// TODO write an integration test against the swagger doc to test the RequestInfo and match up behavior to responses
// 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
// GetRequestInfo returns the information from the http request. If error is not nil, RequestInfo holds the information as best it is known before the failure
// It handles both resource and non-resource requests and fills in all the pertinent information for each.
// Valid Inputs:
// Valid Inputs:
// Storage paths
// Resource paths
// /apis/{api-group}/{version}/namespaces
// /apis/{api-group}/{version}/namespaces
// /api/{version}/namespaces
// /api/{version}/namespaces
// /api/{version}/namespaces/{namespace}
// /api/{version}/namespaces/{namespace}
...
@@ -439,19 +443,32 @@ type APIRequestInfoResolver struct {
...
@@ -439,19 +443,32 @@ type APIRequestInfoResolver struct {