Support kubectl group/resource name

This commit is contained in:
Janet Kuo
2015-09-23 18:17:09 -07:00
parent 7ba48583fa
commit 57388f9f94
8 changed files with 221 additions and 14 deletions

View File

@@ -82,6 +82,12 @@ func (e ShortcutExpander) VersionAndKindForResource(resource string) (defaultVer
return defaultVersion, kind, err
}
// ResourceIsValid takes a string (kind) and checks if it's a valid resource.
// It expands the resource first, then invokes the wrapped mapper.
func (e ShortcutExpander) ResourceIsValid(resource string) bool {
return e.RESTMapper.ResourceIsValid(expandResourceShortcut(resource))
}
// expandResourceShortcut will return the expanded version of resource
// (something that a pkg/api/meta.RESTMapper can understand), if it is
// indeed a shortcut. Otherwise, will return resource unmodified.