func getResourceQuotas(client k8sClient.ResourceQuotasNamespacer, namespace api.Namespace) (*resourcequota.ResourceQuotaDetailList, error) { list, err := client.ResourceQuotas(namespace.Name).List(listEverything) result := &resourcequota.ResourceQuotaDetailList{ Items: make([]resourcequota.ResourceQuotaDetail, 0), ListMeta: common.ListMeta{TotalItems: len(list.Items)}, } for _, item := range list.Items { detail := resourcequota.ToResourceQuotaDetail(&item) result.Items = append(result.Items, *detail) } return result, err }
// GetResourceQuotaListChannel returns a pair of channels to a ResourceQuota list and errors that // both must be read numReads times. func GetResourceQuotaListChannel(client client.ResourceQuotasNamespacer, nsQuery *NamespaceQuery, numReads int) ResourceQuotaListChannel { channel := ResourceQuotaListChannel{ List: make(chan *api.ResourceQuotaList, numReads), Error: make(chan error, numReads), } go func() { list, err := client.ResourceQuotas(nsQuery.ToRequestParam()).List(listEverything) for i := 0; i < numReads; i++ { channel.List <- list channel.Error <- err } }() return channel }