Allow v1beta3 to POST events to all namespaces

A namespaced resource that supports ALL may allow creation
on the root (all namespaces) collection, thus adding POST
here.

We need to better formalize the definition of calls on namespaced
resources at the root scope, so Storage objects that do not support
that call pattern can do so at definition time and reject those
calls.
This commit is contained in:
Clayton Coleman
2015-05-11 10:07:34 -04:00
parent 84d1f19016
commit ecbca9eb17

View File

@@ -320,9 +320,11 @@ func (a *APIInstaller) registerResourceHandlers(path string, storage rest.Storag
actions = appendIf(actions, action{"CONNECT", itemPath, nameParams, namer}, isConnecter)
actions = appendIf(actions, action{"CONNECT", itemPath + "/{path:*}", nameParams, namer}, isConnecter && connectSubpath)
// list across namespace.
// list or post across namespace.
// TODO: more strongly type whether a resource allows these actions on "all namespaces" (bulk delete)
namer = scopeNaming{scope, a.group.Linker, gpath.Join(a.prefix, itemPath), true}
actions = appendIf(actions, action{"LIST", resource, params, namer}, isLister)
actions = appendIf(actions, action{"POST", resource, params, namer}, isCreater)
actions = appendIf(actions, action{"WATCHLIST", "watch/" + resource, params, namer}, allowWatchList)
} else {