| 91 | } |
| 92 | |
| 93 | func matchResources(patterns []string, apiRes metav1.APIResource) bool { |
| 94 | if apiRes.SingularName == "" { |
| 95 | apiRes.SingularName = strings.ToLower(apiRes.Kind) |
| 96 | } |
| 97 | names := []string{apiRes.Name, apiRes.SingularName, apiRes.Kind} |
| 98 | names = append(names, apiRes.ShortNames...) |
| 99 | |
| 100 | return matchAny(patterns, func(pattern string) (bool, error) { |
| 101 | for _, name := range names { |
| 102 | ok, err := filepath.Match(pattern, name) |
| 103 | if err != nil { |
| 104 | return false, err |
| 105 | } |
| 106 | if ok { |
| 107 | return true, nil |
| 108 | } |
| 109 | } |
| 110 | |
| 111 | return false, nil |
| 112 | }) |
| 113 | } |
| 114 | |
| 115 | func findAPIs(client discovery.DiscoveryInterface, apiGroups, resources []string) (*resourceMap, error) { |
| 116 | start := time.Now() |