// ListUnitFilesByPatterns returns an array of all available units on disk matched the patterns.
169228
func (c *Conn) ListUnitFilesByPatterns(states []string, patterns []string) ([]UnitFile, error) {
	return c.listUnitFilesInternal(c.sysobj.Call("org.freedesktop.systemd1.Manager.ListUnitFilesByPatterns", 0, states, patterns).Store)
}
378467
func (a *StatsAdapter) ListStats(patterns ...string) ([]string, error) {
	var statNames []string
	for _, stat := range a.entries {
		statNames = append(statNames, stat.Name)
	}
	return statNames, nil
}
1289534
func (s *LimitService) ListResourceLimits(p *ListResourceLimitsParams) (*ListResourceLimitsResponse, error) {
	resp, err := s.cs.newRequest("listResourceLimits", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r ListResourceLimitsResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
1037700
func ListAll(fs *Filestore, fileOrder bool) (func() *ListRes, error) {
	if fileOrder {
		return listAllFileOrder(fs, false)
	}
	return listAll(fs, false)
}
850190
func (r *EtcdRegistry) getAllUnitsHashMap() (map[string]*unit.UnitFile, error) {
	key := r.prefixed(unitPrefix)
	opts := &etcd.GetOptions{
		Recursive: true,
		Quorum:    true,
	}
	hashToUnit := map[string]*unit.UnitFile{}
	start := time.Now()
	resp, err := r.kAPI.Get(context.Background(), key, opts)
	if err != nil {
		metrics.ReportRegistryOpFailure(metrics.GetAll)
		return nil, err
	}
	metrics.ReportRegistryOpSuccess(metrics.GetAll, start)

	for _, node := range resp.Node.Nodes {
		parts := strings.Split(node.Key, "/")
		if len(parts) == 0 {
			log.Errorf("key '%v' doesn't have enough parts", node.Key)
			continue
		}
		stringHash := parts[len(parts)-1]
		hash, err := unit.HashFromHexString(stringHash)
		if err != nil {
			log.Errorf("failed to get Hash for key '%v' with stringHash '%v': %v", node.Key, stringHash, err)
			continue
		}
		unit := r.unitFromEtcdNode(hash, node)
		if unit == nil {
			continue
		}
		hashToUnit[stringHash] = unit
	}

	return hashToUnit, nil
}
1100924
func (c *Connect) ListAllInterfaces(flags ConnectListAllInterfacesFlags) ([]Interface, error) {
	var cList *C.virInterfacePtr
	var err C.virError
	numIfaces := C.virConnectListAllInterfacesWrapper(c.ptr, (**C.virInterfacePtr)(&cList), C.uint(flags), &err)
	if numIfaces == -1 {
		return nil, makeError(&err)
	}
	hdr := reflect.SliceHeader{
		Data: uintptr(unsafe.Pointer(cList)),
		Len:  int(numIfaces),
		Cap:  int(numIfaces),
	}
	var ifaces []Interface
	slice := *(*[]C.virInterfacePtr)(unsafe.Pointer(&hdr))
	for _, ptr := range slice {
		ifaces = append(ifaces, Interface{ptr})
	}
	C.free(unsafe.Pointer(cList))
	return ifaces, nil
}
1263224
func (c *Client) ListImages(opts ListImagesOptions) ([]APIImages, error) {
	path := "/images/json?" + queryString(opts)
	resp, err := c.do("GET", path, doOptions{context: opts.Context})
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	var images []APIImages
	if err := json.NewDecoder(resp.Body).Decode(&images); err != nil {
		return nil, err
	}
	return images, nil
}
146411
func (c *CloudAPI) ListImages(filters map[string]string) ([]cloudapi.Image, error) {
	if err := c.ProcessFunctionHook(c, filters); err != nil {
		return nil, err
	}

	availableImages := c.images

	if filters != nil {
		for k, f := range filters {
			// check if valid filter
			if contains(imagesFilters, k) {
				imgs := []cloudapi.Image{}
				// filter from availableImages and add to imgs
				for _, i := range availableImages {
					if k == "name" && i.Name == f {
						imgs = append(imgs, i)
					} else if k == "os" && i.OS == f {
						imgs = append(imgs, i)
					} else if k == "version" && i.Version == f {
						imgs = append(imgs, i)
					} else if k == "public" && fmt.Sprintf("%v", i.Public) == f {
						imgs = append(imgs, i)
					} else if k == "state" && i.State == f {
						imgs = append(imgs, i)
					} else if k == "owner" && i.Owner == f {
						imgs = append(imgs, i)
					} else if k == "type" && i.Type == f {
						imgs = append(imgs, i)
					}
				}
				availableImages = imgs
			}
		}
	}

	return availableImages, nil
}
806918
func listFiles(path string) func(string) []string {
	return func(line string) []string {
		names := make([]string, 0)
		files, _ := ioutil.ReadDir(path)
		for _, f := range files {
			names = append(names, f.Name())
		}
		return names
	}
}
576183
func (f *ControllerClient) ListVolumes(ctx context.Context, in *csipb.ListVolumesRequest, opts ...grpc.CallOption) (*csipb.ListVolumesResponse, error) {
	return nil, nil
}
572224
func (api *ImageManagerAPI) ListImages(arg params.ImageFilterParams) (params.ListImageResult, error) {
	var result params.ListImageResult
	admin, err := api.authorizer.HasPermission(permission.SuperuserAccess, api.state.ControllerTag())
	if err != nil {
		return result, errors.Trace(err)
	}
	if !admin {
		return result, common.ServerError(common.ErrPerm)
	}

	if len(arg.Images) > 1 {
		return result, errors.New("image filter with multiple terms not supported")
	}
	filter := imagestorage.ImageFilter{}
	if len(arg.Images) == 1 {
		filter = imagestorage.ImageFilter{
			Kind:   arg.Images[0].Kind,
			Series: arg.Images[0].Series,
			Arch:   arg.Images[0].Arch,
		}
	}
	stor := api.state.ImageStorage()
	metadata, err := stor.ListImages(filter)
	if err != nil {
		return result, nil
	}
	result.Result = make([]params.ImageMetadata, len(metadata))
	for i, m := range metadata {
		result.Result[i] = params.ImageMetadata{
			Kind:    m.Kind,
			Series:  m.Series,
			Arch:    m.Arch,
			URL:     m.SourceURL,
			Created: m.Created,
		}
	}
	return result, nil
}
202272
func (c *Client) ListVolumes(machines []string) ([]params.VolumeDetailsListResult, error) {
	filters := make([]params.VolumeFilter, len(machines))
	for i, machine := range machines {
		filters[i].Machines = []string{names.NewMachineTag(machine).String()}
	}
	if len(filters) == 0 {
		filters = []params.VolumeFilter{{}}
	}
	args := params.VolumeFilters{filters}
	var results params.VolumeDetailsListResults
	if err := c.facade.FacadeCall("ListVolumes", args, &results); err != nil {
		return nil, errors.Trace(err)
	}
	if len(results.Results) != len(filters) {
		return nil, errors.Errorf(
			"expected %d result(s), got %d",
			len(filters), len(results.Results),
		)
	}
	return results.Results, nil
}
1202114
func (c *Client) ListStorageDetails() ([]params.StorageDetails, error) {
	args := params.StorageFilters{
		[]params.StorageFilter{{}}, // one empty filter
	}
	var results params.StorageDetailsListResults
	if err := c.facade.FacadeCall("ListStorageDetails", args, &results); err != nil {
		return nil, errors.Trace(err)
	}
	if len(results.Results) != 1 {
		return nil, errors.Errorf(
			"expected 1 result, got %d",
			len(results.Results),
		)
	}
	if results.Results[0].Error != nil {
		return nil, errors.Trace(results.Results[0].Error)
	}
	return results.Results[0].Result, nil
}
461760
func (n *hdfsObjects) ListObjects(ctx context.Context, bucket, prefix, marker, delimiter string, maxKeys int) (loi minio.ListObjectsInfo, err error) {
	getObjectInfo := func(ctx context.Context, bucket, entry string) (minio.ObjectInfo, error) {
		return n.GetObjectInfo(ctx, bucket, entry, minio.ObjectOptions{})
	}

	return minio.ListObjects(ctx, n, bucket, prefix, marker, delimiter, maxKeys, n.listPool, n.listDirFactory(), getObjectInfo, getObjectInfo)
}
559414
func ListFiles(fs fs.FileSystem, spec api.VolumeSpec) ([]string, error) {
	result := []string{}
	if _, err := os.Stat(spec.Source); err != nil {
		return nil, err
	}
	err := fs.Walk(spec.Source, func(path string, f os.FileInfo, err error) error {
		if err != nil {
			return err
		}

		// Detected files will be truncated. k8s' AtomicWriter creates
		// directories and symlinks to directories in order to inject files.
		// An attempt to truncate either a dir or symlink to a dir will fail.
		// Thus, we need to dereference symlinks to see if they might point
		// to a directory.
		// Do not try to simplify this logic to simply return nil if a symlink
		// is detected. During the tar transfer to an assemble image, symlinked
		// files are turned concrete (i.e. they will be turned into regular files
		// containing the content of their target). These newly concrete files
		// need to be truncated as well.

		if f.Mode()&os.ModeSymlink != 0 {
			linkDest, err := filepath.EvalSymlinks(path)
			if err != nil {
				return fmt.Errorf("unable to evaluate symlink [%v]: %v", path, err)
			}
			// Evaluate the destination of the link.
			f, err = os.Lstat(linkDest)
			if err != nil {
				// This is not a fatal error. If AtomicWrite tried multiple times, a symlink might not point
				// to a valid destination.
				glog.Warningf("Unable to lstat symlink destination [%s]->[%s]. err: %v. Partial atomic write?", path, linkDest, err)
				return nil
			}
		}

		if f.IsDir() {
			return nil
		}

		newPath := filepath.ToSlash(filepath.Join(spec.Destination, strings.TrimPrefix(path, spec.Source)))
		result = append(result, newPath)
		return nil
	})
	if err != nil {
		return nil, err
	}
	return result, nil
}
1191421
func ListAlgorithmProviders() string {
	var availableAlgorithmProviders []string
	for name := range algorithmProviderMap {
		availableAlgorithmProviders = append(availableAlgorithmProviders, name)
	}
	sort.Strings(availableAlgorithmProviders)
	return strings.Join(availableAlgorithmProviders, " | ")
}
1000372
func (m *MemoryStore) ListFiles() []string {
	names := make([]string, 0, len(m.data))
	for n := range m.data {
		names = append(names, n)
	}
	return names
}