Define a mapping between REST resource name and kind/apiVersion

Allows clients to abstractly map user input to generic resource
paths as per docs/api-conventions.md

Extracted from #2000 and supports #1958
Agree this should be in one place.  The one challenge is renames - in v1beta3 we rename minions to nodes, which doesn't seem like it belongs to this code.  Possibly this is something that belongs to the scheme.  You still need the generic mechanism that takes a runtime.Unknown that loads the right base path for the RESTClient (I have to go do that in openshift today, but it's really better if it's ComponentPlugin doing it).

----- Original Message -----
> > +// resource name is also accepted for convenience.
> > +//
> > +// TODO: Only accept plural for some operations for increased control?
> > +// (`get pod bar` vs `get pods bar`)
> > +type DefaultRESTMapper struct {
> > +	mapping map[string]api.TypeMeta
> > +	reverse map[api.TypeMeta]string
> > +}
> > +
> > +// NewDefaultRESTMapper initializes a mapping between Kind and APIVersion
> > +// to a resource name and back based on the Kubernetes api.Scheme and the
> > +// Kubernetes API conventions.
> > +func NewDefaultRESTMapper() meta.RESTMapper {
> > +	mapping := make(map[string]api.TypeMeta)
> > +	reverse := make(map[api.TypeMeta]string)
> > +	for _, version := range Versions {
> 
> I'd love it if we could construct this in our code that adds handlers to
> apiserver.
> 
> ---
> Reply to this email directly or view it on GitHub:
> https://github.com/GoogleCloudPlatform/kubernetes/pull/2059/files#r19571262