find partial resource matches

This commit is contained in:
deads2k
2015-12-07 08:12:24 -05:00
parent 3415f1dfc2
commit 41b78ad2b6
21 changed files with 699 additions and 135 deletions

View File

@@ -158,12 +158,23 @@ type RESTMapping struct {
// TODO(caesarxuchao): Add proper multi-group support so that kinds & resources are
// scoped to groups. See http://issues.k8s.io/12413 and http://issues.k8s.io/10009.
type RESTMapper interface {
// KindFor takes a resource and returns back the unambiguous Kind (GroupVersionKind)
KindFor(resource string) (unversioned.GroupVersionKind, error)
// KindFor takes a partial resource and returns back the single match. Returns an error if there are multiple matches
KindFor(resource unversioned.GroupVersionResource) (unversioned.GroupVersionKind, error)
// KindsFor takes a partial resource and returns back the list of potential kinds in priority order
KindsFor(resource unversioned.GroupVersionResource) ([]unversioned.GroupVersionKind, error)
// ResourceFor takes a partial resource and returns back the single match. Returns an error if there are multiple matches
ResourceFor(input unversioned.GroupVersionResource) (unversioned.GroupVersionResource, error)
// ResourcesFor takes a partial resource and returns back the list of potential resource in priority order
ResourcesFor(input unversioned.GroupVersionResource) ([]unversioned.GroupVersionResource, error)
RESTMapping(gk unversioned.GroupKind, versions ...string) (*RESTMapping, error)
AliasesForResource(resource string) ([]string, bool)
ResourceSingularizer(resource string) (singular string, err error)
ResourceIsValid(resource string) bool
// ResourceIsValid takes a partial resource and returns back whether or not the resource matches at least one kind
ResourceIsValid(resource unversioned.GroupVersionResource) bool
}