// mappingFor returns the RESTMapping for the Kind referenced by the resource. // prefers a fully specified GroupVersionResource match. If we don't have one match on GroupResource func (b *Builder) mappingFor(resourceArg string) (*meta.RESTMapping, error) { fullySpecifiedGVR, groupResource := unversioned.ParseResourceArg(resourceArg) gvk := unversioned.GroupVersionKind{} if fullySpecifiedGVR != nil { gvk, _ = b.mapper.KindFor(*fullySpecifiedGVR) } if gvk.IsEmpty() { var err error gvk, err = b.mapper.KindFor(groupResource.WithVersion("")) if err != nil { return nil, err } } return b.mapper.RESTMapping(gvk.GroupKind(), gvk.Version) }