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

@@ -37,6 +37,8 @@ var (
// AllPreferredGroupVersions returns the preferred versions of all
// registered groups in the form of "group1/version1,group2/version2,..."
AllPreferredGroupVersions = allGroups.AllPreferredGroupVersions
// IsRegistered is a shortcut to allGroups.IsRegistered.
IsRegistered = allGroups.IsRegistered
)
// GroupMetaMap is a map between group names and their metadata.
@@ -65,6 +67,12 @@ func (g GroupMetaMap) Group(group string) (*GroupMeta, error) {
return groupMeta, nil
}
// IsRegistered takes a string and determines if it's one of the registered groups
func (g GroupMetaMap) IsRegistered(group string) bool {
_, found := g[group]
return found
}
// TODO: This is an expedient function, because we don't check if a Group is
// supported throughout the code base. We will abandon this function and
// checking the error returned by the Group() function.