in pkg/api/platformapi/allocatorapi/filter.go [27:49]
func FilterByTag(tags map[string]string, allocators []*models.AllocatorInfo) []*models.AllocatorInfo {
var matchedAllocators []*models.AllocatorInfo
if len(tags) > 0 {
for _, a := range allocators {
matches := 0
for k, v := range tags {
for _, m := range a.Metadata {
if *m.Key == k && *m.Value == v {
matches++
break
}
}
}
if matches == len(tags) {
matchedAllocators = append(matchedAllocators, a)
}
}
return matchedAllocators
}
return allocators
}