// ListFilteredPlugins returns pluginDetails or an error.
//
// See https://goo.gl/rmdmWg for more details.
510566
func (c *Client) ListFilteredPlugins(opts ListFilteredPluginsOptions) ([]PluginDetail, error) {
	path := "/plugins/json?" + queryString(opts)
	resp, err := c.do("GET", path, doOptions{
		context: opts.Context,
	})
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	pluginDetails := make([]PluginDetail, 0)
	if err := json.NewDecoder(resp.Body).Decode(&pluginDetails); err != nil {
		return nil, err
	}
	return pluginDetails, nil
}
693037
func (fs *FSObjects) listDirFactory() ListDirFunc {
	// listDir - lists all the entries at a given prefix and given entry in the prefix.
	listDir := func(bucket, prefixDir, prefixEntry string) (entries []string) {
		var err error
		entries, err = readDir(pathJoin(fs.fsPath, bucket, prefixDir))
		if err != nil && err != errFileNotFound {
			logger.LogIf(context.Background(), err)
			return
		}
		sort.Strings(entries)
		return filterMatchingPrefix(entries, prefixEntry)
	}

	// Return list factory instance.
	return listDir
}
421090
func (a *AdmissionOptions) enabledPluginNames() []string {
	allOffPlugins := append(a.DefaultOffPlugins.List(), a.DisablePlugins...)
	disabledPlugins := sets.NewString(allOffPlugins...)
	enabledPlugins := sets.NewString(a.EnablePlugins...)
	disabledPlugins = disabledPlugins.Difference(enabledPlugins)

	orderedPlugins := []string{}
	for _, plugin := range a.RecommendedPluginOrder {
		if !disabledPlugins.Has(plugin) {
			orderedPlugins = append(orderedPlugins, plugin)
		}
	}

	return orderedPlugins
}
831525
func IndexPluginStatus(data interface{}) map[string][]string {
	logrus.DefaultLogger().Debug("IndexPluginStatus ", data)

	indexes := map[string][]string{}
	pluginStatus, ok := data.(*status.PluginStatus)
	if !ok || pluginStatus == nil {
		return indexes
	}

	state := pluginStatus.State
	if state != 0 {
		indexes[stateIndexKey] = []string{state.String()}
	}
	return indexes
}
8117
func InstalledPluginList() ([]Plugin, error) {
	routing, err := readPluginRouting()
	if err != nil {
		return []Plugin{}, err
	}

	pluginList := []Plugin{}

	for name := range routing.RouteMap {
		if plugin, found, err := LoadPlugin(name); err != nil {
			return []Plugin{}, err
		} else if !found {
			return []Plugin{}, fmt.Errorf("Plugin (%s) found in route, but could not load it", name)
		} else {
			pluginList = append(pluginList, plugin)
		}
	}

	return pluginList, nil
}
705552
func ListPlugins() map[string][]string {
	p := make(map[string][]string)

	// server type plugins
	for name := range serverTypes {
		p["server_types"] = append(p["server_types"], name)
	}

	// caddyfile loaders in registration order
	for _, loader := range caddyfileLoaders {
		p["caddyfile_loaders"] = append(p["caddyfile_loaders"], loader.name)
	}
	if defaultCaddyfileLoader.name != "" {
		p["caddyfile_loaders"] = append(p["caddyfile_loaders"], defaultCaddyfileLoader.name)
	}

	// List the event hook plugins
	eventHooks.Range(func(k, _ interface{}) bool {
		p["event_hooks"] = append(p["event_hooks"], k.(string))
		return true
	})

	// alphabetize the rest of the plugins
	var others []string
	for stype, stypePlugins := range plugins {
		for name := range stypePlugins {
			var s string
			if stype != "" {
				s = stype + "."
			}
			s += name
			others = append(others, s)
		}
	}

	sort.Strings(others)
	for _, name := range others {
		p["others"] = append(p["others"], name)
	}

	return p
}
374722
func ListPlugins(dockerCli command.Cli, rootcmd *cobra.Command) ([]Plugin, error) {
	pluginDirs, err := getPluginDirs(dockerCli)
	if err != nil {
		return nil, err
	}

	candidates, err := listPluginCandidates(pluginDirs)
	if err != nil {
		return nil, err
	}

	var plugins []Plugin
	for _, paths := range candidates {
		if len(paths) == 0 {
			continue
		}
		c := &candidate{paths[0]}
		p, err := newPlugin(c, rootcmd)
		if err != nil {
			return nil, err
		}
		p.ShadowedPaths = paths[1:]
		plugins = append(plugins, p)
	}

	return plugins, nil
}
517539
func (s *PluginsService) List(ctx context.Context, opt *PluginsListOpts) (*plugin.PluginList, error) {
	pluginList := &plugin.PluginList{}
	return pluginList, s.client.List(ctx, pluginsUrl, opt, pluginList)
}
466832
func pluginsListAction(ctx *cli.Context, api *client.Client, timeout cmd.Timeout) {
	plugins, err := api.Plugins.List(timeout(), nil)
	if err != nil {
		fmt.Printf("%s", err)
		os.Exit(1)
	}
	fmt.Printf("Found %d plugins:\n", plugins.Count)
	for _, p := range plugins.Results {
		fmt.Println(p)
	}
}
251156
func ListRegisteredFunctions() {
	for k, fn := range mappers {
		println(k, "=>", fn.Name)
	}
	for k, fn := range reducers {
		println(k, "=>", fn.Name)
	}
}
73192
func (r *Containerd) ListContainers(filter string) ([]string, error) {
	return listCRIContainers(r.Runner, filter)
}
1026088
func EnvFiltered(rx *regexp.Regexp) map[string]string {
	res := map[string]string{}
	for _, e := range os.Environ() {
		pair := strings.Split(e, "=")
		if rx.MatchString(pair[0]) {
			res[pair[0]] = pair[1]
		}
	}
	return res
}
243781
func (p *pluginControl) AvailablePlugins() []core.AvailablePlugin {
	var caps []core.AvailablePlugin
	for _, ap := range p.pluginRunner.AvailablePlugins().all() {
		caps = append(caps, ap)
	}
	return caps
}
658779
func AllPlugins(plugins ...infra.Plugin) Option {
	return func(o *Options) {
		infraLogger.Debugf("AllPlugins with %d plugins", len(plugins))

		for _, plugin := range plugins {
			typ := reflect.TypeOf(plugin)
			infraLogger.Debugf("searching for all deps in: %v (type: %v)", plugin, typ)

			foundPlugins, err := findPlugins(reflect.ValueOf(plugin), o.pluginMap)
			if err != nil {
				panic(err)
			}

			infraLogger.Debugf("found %d plugins in: %v (type: %v)", len(foundPlugins), plugin, typ)
			for _, plug := range foundPlugins {
				infraLogger.Debugf(" - plugin: %v (%v)", plug, reflect.TypeOf(plug))

				if _, ok := o.pluginNames[plug.String()]; ok {
					infraLogger.Fatalf("plugin with name %q already registered", plug.String())
				}
				o.pluginNames[plug.String()] = struct{}{}
			}
			o.Plugins = append(o.Plugins, foundPlugins...)

			// TODO: perhaps set plugin name to typ.String() if it's empty
			/*p, ok := plugin.(core.PluginNamed)
			if !ok {
				p = core.NamePlugin(typ.String(), plugin)
			}*/

			if _, ok := o.pluginNames[plugin.String()]; ok {
				infraLogger.Fatalf("plugin with name %q already registered, custom name should be used", plugin.String())
			}
			o.pluginNames[plugin.String()] = struct{}{}
			o.Plugins = append(o.Plugins, plugin)
		}
	}
}
116303
func (cli *Client) PluginList(ctx context.Context, filter filters.Args) (types.PluginsListResponse, error) {
	var plugins types.PluginsListResponse
	query := url.Values{}

	if filter.Len() > 0 {
		filterJSON, err := filters.ToParamWithVersion(cli.version, filter)
		if err != nil {
			return plugins, err
		}
		query.Set("filters", filterJSON)
	}
	resp, err := cli.get(ctx, "/plugins", query, nil)
	defer ensureReaderClosed(resp)
	if err != nil {
		return plugins, wrapResponseError(err, resp, "plugin", "")
	}

	err = json.NewDecoder(resp.body).Decode(&plugins)
	return plugins, err
}
196683
func (c *Cache) FilteredList(filter algorithm.PodFilter, selector labels.Selector) ([]*v1.Pod, error) {
	return nil, nil
}
1003746
func (s *oracleVolumeSource) ListVolumes(ctx context.ProviderCallContext) ([]string, error) {
	tag := fmt.Sprintf("%s=%s", tags.JujuModel, s.modelUUID)
	filter := []oci.Filter{{
		Arg:   "tags",
		Value: tag,
	}}
	volumes, err := s.api.AllStorageVolumes(filter)
	if err != nil {
		return nil, errors.Annotate(err, "listing volumes")
	}

	ids := make([]string, len(volumes.Result))
	for i, volume := range volumes.Result {
		ids[i] = volume.Name
	}

	return ids, nil
}