// ResourceList returns a string representation of a resource list in a human readable format.
2202
func ResourceList(resources v1.ResourceList) string {
	resourceStrings := make([]string, 0, len(resources))
	for key, value := range resources {
		resourceStrings = append(resourceStrings, fmt.Sprintf("%v=%v", key, value.String()))
	}
	// sort the results for consistent log output
	sort.Strings(resourceStrings)
	return strings.Join(resourceStrings, ",")
}
621726
func NetworkList() (networks []types.NetworkResource, err error) {
	err = mgr.Do(func(ctx context.Context, cli *client.Client) (err error) {
		networks, err = cli.NetworkList(ctx, types.NetworkListOptions{})
		if err == nil {
			sort.Slice(networks, func(i, j int) bool {
				return networks[i].Name < networks[j].Name
			})
		}
		return
	})
	return
}
1199541
func (_m *APIClient) VolumeList(ctx context.Context, filter filters.Args) (volume.VolumeListOKBody, error) {
	ret := _m.Called(ctx, filter)

	var r0 volume.VolumeListOKBody
	if rf, ok := ret.Get(0).(func(context.Context, filters.Args) volume.VolumeListOKBody); ok {
		r0 = rf(ctx, filter)
	} else {
		r0 = ret.Get(0).(volume.VolumeListOKBody)
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(context.Context, filters.Args) error); ok {
		r1 = rf(ctx, filter)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
1203645
func (p *podResourcesServer) List(ctx context.Context, req *v1alpha1.ListPodResourcesRequest) (*v1alpha1.ListPodResourcesResponse, error) {
	pods := p.podsProvider.GetPods()
	podResources := make([]*v1alpha1.PodResources, len(pods))

	for i, pod := range pods {
		pRes := v1alpha1.PodResources{
			Name:       pod.Name,
			Namespace:  pod.Namespace,
			Containers: make([]*v1alpha1.ContainerResources, len(pod.Spec.Containers)),
		}

		for j, container := range pod.Spec.Containers {
			pRes.Containers[j] = &v1alpha1.ContainerResources{
				Name:    container.Name,
				Devices: p.devicesProvider.GetDevices(string(pod.UID), container.Name),
			}
		}
		podResources[i] = &pRes
	}

	return &v1alpha1.ListPodResourcesResponse{
		PodResources: podResources,
	}, nil
}
769448
func (st resourceState) ListResources(applicationID string) (resource.ApplicationResources, error) {
	resources, err := st.persist.ListResources(applicationID)
	if err != nil {
		if err := st.raw.VerifyApplication(applicationID); err != nil {
			return resource.ApplicationResources{}, errors.Trace(err)
		}
		return resource.ApplicationResources{}, errors.Trace(err)
	}

	unitIDs, err := st.raw.Units(applicationID)
	if err != nil {
		return resource.ApplicationResources{}, errors.Trace(err)
	}
	for _, unitID := range unitIDs {
		found := false
		for _, unitRes := range resources.UnitResources {
			if unitID.String() == unitRes.Tag.String() {
				found = true
				break
			}
		}
		if !found {
			unitRes := resource.UnitResources{
				Tag: unitID,
			}
			resources.UnitResources = append(resources.UnitResources, unitRes)
		}
	}

	return resources, nil
}
208403
func (c *baseCharmResourcesCommand) ListResources(ids []charmstore.CharmID) ([][]charmresource.Resource, error) {
	bakeryClient, err := c.BakeryClient()
	if err != nil {
		return nil, errors.Trace(err)
	}
	conAPIRoot, err := c.NewControllerAPIRoot()
	if err != nil {
		return nil, errors.Trace(err)
	}
	csURL, err := getCharmStoreAPIURL(conAPIRoot)
	if err != nil {
		return nil, errors.Trace(err)
	}
	client, err := charmstore.NewCustomClient(bakeryClient, csURL)
	if err != nil {
		return nil, errors.Trace(err)
	}
	return client.ListResources(ids)
}
212692
func (cli *Client) PluginList(ctx context.Context) (types.PluginsListResponse, error) {
	var plugins types.PluginsListResponse
	resp, err := cli.get(ctx, "/plugins", nil, nil)
	if err != nil {
		return plugins, err
	}

	err = json.NewDecoder(resp.body).Decode(&plugins)
	ensureReaderClosed(resp)
	return plugins, err
}
48505
func (r *AutoVXLANCfgResource) GetList() (uint, string) {
	cfg := &AutoVXLANCfgResource{}
	cfg.StateDriver = r.StateDriver
	if err := cfg.Read(r.ID); err != nil {
		log.Errorf("Error reading resource %s: %s", r.ID, err)
		return 0, ""
	}

	oper := &AutoVXLANOperResource{}
	oper.StateDriver = r.StateDriver
	if err := oper.Read(r.ID); err != nil {
		log.Errorf("Error reading resource %s: %s", r.ID, err)
		return 0, ""
	}
	oper.FreeVXLANs.InPlaceSymmetricDifference(cfg.VXLANs)

	numVlans := uint(0)
	idx := uint(0)
	startIdx := idx
	list := []string{}
	inRange := false

	for {
		foundValue, found := oper.FreeVXLANs.NextSet(idx)
		if !found {
			break
		}
		numVlans++

		if !inRange { // begin of range
			startIdx = foundValue
			inRange = true
		} else if foundValue > idx { // end of range
			thisRange := rangePrint(startIdx+cfg.FreeVXLANsStart, idx-1+cfg.FreeVXLANsStart)
			list = append(list, thisRange)
			startIdx = foundValue
		}
		idx = foundValue + 1
	}

	// list end with allocated value
	if inRange {
		thisRange := rangePrint(startIdx+cfg.FreeVXLANsStart, idx-1+cfg.FreeVXLANsStart)
		list = append(list, thisRange)
	}

	return numVlans, strings.Join(list, ", ")
}
518397
func (m *Helper) List(namespace, apiVersion string, selector labels.Selector) (runtime.Object, error) {
	return m.RESTClient.Get().
		NamespaceIfScoped(namespace, m.NamespaceScoped).
		Resource(m.Resource).
		LabelsSelectorParam(selector).
		Do().
		Get()
}
103518
func (s *Policy) SetResourceTypeList(v []*string) *Policy {
	s.ResourceTypeList = v
	return s
}
162244
func (c *Client) ResourcePools(ctx context.Context, path string) ([]*object.ResourcePool, error) {
	finder, _, err := c.finder(ctx)
	if err != nil {
		return nil, errors.Trace(err)
	}
	c.logger.Tracef("listing resource pools under %q", path)
	items, err := finder.ResourcePoolList(ctx, path)
	if err != nil {
		if _, ok := err.(*find.NotFoundError); ok {
			c.logger.Debugf("no resource pools for path %q", path)
			return nil, nil
		}
		return nil, errors.Annotate(err, "listing resource pools")
	}
	return items, nil
}
853614
func NewListCharmResourcesCommand(resourceLister ResourceLister) modelcmd.ModelCommand {
	var c ListCharmResourcesCommand
	c.setResourceLister(resourceLister)
	return modelcmd.Wrap(&c)
}
1185837
func (r *resourceRecordSets) List() ([]dnsprovider.ResourceRecordSet, error) {
	records, err := getRecords(r.client, r.zone.Name())
	if err != nil {
		return nil, err
	}

	var rrset *resourceRecordSet
	var rrsets []dnsprovider.ResourceRecordSet
	for _, record := range records {
		// digitalocean API returns the record without the zone
		// but the consumers of this interface expect the zone to be included
		recordName := dns.EnsureDotSuffix(record.Name) + r.Zone().Name()
		rrset = &resourceRecordSet{
			name:       recordName,
			data:       record.Data,
			ttl:        record.TTL,
			recordType: rrstype.RrsType(record.Type),
		}

		rrsets = append(rrsets, rrset)
	}

	return rrsets, nil

}
126547
func (p ResourcePersistence) ListResources(applicationID string) (resource.ApplicationResources, error) {
	logger.Tracef("listing all resources for application %q", applicationID)

	docs, err := p.resources(applicationID)
	if err != nil {
		return resource.ApplicationResources{}, errors.Trace(err)
	}

	store := map[string]charmresource.Resource{}
	units := map[names.UnitTag][]resource.Resource{}
	downloadProgress := make(map[names.UnitTag]map[string]int64)

	var results resource.ApplicationResources
	for _, doc := range docs {
		if doc.PendingID != "" {
			continue
		}

		res, err := doc2basicResource(doc)
		if err != nil {
			return resource.ApplicationResources{}, errors.Trace(err)
		}
		if !doc.LastPolled.IsZero() {
			store[res.Name] = res.Resource
			continue
		}
		if doc.UnitID == "" {
			results.Resources = append(results.Resources, res)
			continue
		}
		tag := names.NewUnitTag(doc.UnitID)
		if doc.PendingID == "" {
			units[tag] = append(units[tag], res)
		}
		if doc.DownloadProgress != nil {
			if downloadProgress[tag] == nil {
				downloadProgress[tag] = make(map[string]int64)
			}
			downloadProgress[tag][doc.Name] = *doc.DownloadProgress
		}
	}
	for _, res := range results.Resources {
		storeRes := store[res.Name]
		results.CharmStoreResources = append(results.CharmStoreResources, storeRes)
	}
	for tag, res := range units {
		results.UnitResources = append(results.UnitResources, resource.UnitResources{
			Tag:              tag,
			Resources:        res,
			DownloadProgress: downloadProgress[tag],
		})
	}
	return results, nil
}
477457
func (s *Service) SpaceList(ctx context.Context, lr *ListRange) (SpaceListResult, error) {
	var space SpaceListResult
	return space, s.Get(ctx, &space, fmt.Sprintf("/spaces"), nil, lr)
}
1291692
func ResourceNames(resources corev1.ResourceList) []corev1.ResourceName {
	result := []corev1.ResourceName{}
	for resourceName := range resources {
		result = append(result, resourceName)
	}
	return result
}
824086
func (r *AutoVLANCfgResource) GetList() (uint, string) {
	cfg := &AutoVLANCfgResource{}
	cfg.StateDriver = r.StateDriver
	if err := cfg.Read(r.ID); err != nil {
		log.Errorf("Error reading resource %s: %s", r.ID, err)
		return 0, ""
	}

	oper := &AutoVLANOperResource{}
	oper.StateDriver = r.StateDriver
	if err := oper.Read(r.ID); err != nil {
		log.Errorf("error fetching the vlan resource: id %s", r.ID)
		return 0, ""
	}
	oper.FreeVLANs.InPlaceSymmetricDifference(cfg.VLANs)

	numVlans := uint(0)
	idx := uint(0)
	startIdx := idx
	list := []string{}
	inRange := false

	for {
		foundValue, found := oper.FreeVLANs.NextSet(idx)
		if !found {
			break
		}
		numVlans++

		if !inRange { // begin of range
			startIdx = foundValue
			inRange = true
		} else if foundValue > idx { // end of range
			thisRange := rangePrint(startIdx, idx-1)
			list = append(list, thisRange)
			startIdx = foundValue
		}
		idx = foundValue + 1
	}

	// list end with allocated value
	if inRange {
		thisRange := rangePrint(startIdx, idx-1)
		list = append(list, thisRange)
	}

	return numVlans, strings.Join(list, ", ")
}