// ListWAFs returns the list of wafs for the configuration version.
174315
func (c *Client) ListWAFs(i *ListWAFsInput) ([]*WAF, error) {
	if i.Service == "" {
		return nil, ErrMissingService
	}

	if i.Version == 0 {
		return nil, ErrMissingVersion
	}

	path := fmt.Sprintf("/service/%s/version/%d/wafs", i.Service, i.Version)
	resp, err := c.Get(path, nil)
	if err != nil {
		return nil, err
	}

	data, err := jsonapi.UnmarshalManyPayload(resp.Body, wafType)
	if err != nil {
		return nil, err
	}

	wafs := make([]*WAF, len(data))
	for i := range data {
		typed, ok := data[i].(*WAF)
		if !ok {
			return nil, fmt.Errorf("got back a non-WAF response")
		}
		wafs[i] = typed
	}
	return wafs, nil
}
715017
func (c *ContainerServer) ListContainers(filters ...func(*oci.Container) bool) ([]*oci.Container, error) {
	containers := c.listContainers()
	if len(filters) == 0 {
		return containers, nil
	}
	filteredContainers := make([]*oci.Container, 0, len(containers))
	for _, container := range containers {
		for _, filter := range filters {
			if filter(container) {
				filteredContainers = append(filteredContainers, container)
			}
		}
	}
	return filteredContainers, nil
}
219495
func (c *Client) ListPools(providers, names []string) ([]params.StoragePool, error) {
	args := params.StoragePoolFilters{
		Filters: []params.StoragePoolFilter{{
			Names:     names,
			Providers: providers,
		}},
	}
	var results params.StoragePoolsResults
	if err := c.facade.FacadeCall("ListPools", 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 err := results.Results[0].Error; err != nil {
		return nil, err
	}
	return results.Results[0].Result, nil
}
462796
func (c *Client) UpdateWAFConfigSet(i *UpdateWAFConfigSetInput) (UpdateWAFConfigSetResponse, error) {
	if err := i.validate(); err != nil {
		return UpdateWAFConfigSetResponse{}, err
	}
	var wafs []interface{}
	for _, w := range i.WAFList {
		wafs = append(wafs, &w)
	}

	path := fmt.Sprintf("/wafs/configuration_sets/%s/relationships/wafs", i.ConfigSetID)
	resp, err := c.PatchJSONAPI(path, wafs, nil)
	if err != nil {
		return UpdateWAFConfigSetResponse{}, err
	}

	wafConfigSetResponse := UpdateWAFConfigSetResponse{}

	err = c.interpretWAFCongfigSetResponse(&wafConfigSetResponse, resp)
	if err != nil {
		return UpdateWAFConfigSetResponse{}, err
	}

	return wafConfigSetResponse, nil
}
1220045
func (c *Client) ListFilesystems(machines []string) ([]params.FilesystemDetailsListResult, error) {
	filters := make([]params.FilesystemFilter, len(machines))
	for i, machine := range machines {
		filters[i].Machines = []string{names.NewMachineTag(machine).String()}
	}
	if len(filters) == 0 {
		filters = []params.FilesystemFilter{{}}
	}
	args := params.FilesystemFilters{filters}
	var results params.FilesystemDetailsListResults
	if err := c.facade.FacadeCall("ListFilesystems", 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
}
1294603
func (_m *Cluster) ListContainers(ctx context.Context, opts *types.ListContainersOptions) ([]*types.Container, error) {
	ret := _m.Called(ctx, opts)

	var r0 []*types.Container
	if rf, ok := ret.Get(0).(func(context.Context, *types.ListContainersOptions) []*types.Container); ok {
		r0 = rf(ctx, opts)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]*types.Container)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(context.Context, *types.ListContainersOptions) error); ok {
		r1 = rf(ctx, opts)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
873004
func (ovs OvsdbClient) ListDbs() ([]string, error) {
	var dbs []string
	err := ovs.rpcClient.Call("list_dbs", nil, &dbs)
	if err != nil {
		log.Fatal("ListDbs failure", err)
	}
	return dbs, err
}
321631
func (c *Client) ListFolders(name string) ([]os.FileInfo, error) {
	return c.ListFilter(name, func(info os.FileInfo) bool {
		return info.IsDir()
	})
}
1154837
func (s *VPCService) ListVPCOfferings(p *ListVPCOfferingsParams) (*ListVPCOfferingsResponse, error) {
	resp, err := s.cs.newRequest("listVPCOfferings", p.toURLValues())
	if err != nil {
		return nil, err
	}

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

	return &r, nil
}
1374272
func (s *RPCServer) ListTypes(arg ListTypesIn, out *ListTypesOut) error {
	tps, err := s.debugger.Types(arg.Filter)
	if err != nil {
		return err
	}
	out.Types = tps
	return nil
}
326815
func (c *Client) ListHeaders(i *ListHeadersInput) ([]*Header, error) {
	if i.Service == "" {
		return nil, ErrMissingService
	}

	if i.Version == 0 {
		return nil, ErrMissingVersion
	}

	path := fmt.Sprintf("/service/%s/version/%d/header", i.Service, i.Version)
	resp, err := c.Get(path, nil)
	if err != nil {
		return nil, err
	}

	var bs []*Header
	if err := decodeJSON(&bs, resp.Body); err != nil {
		return nil, err
	}
	sort.Stable(headersByName(bs))
	return bs, nil
}
113782
func (c *Connect) ListAllNWFilters(flags uint32) ([]NWFilter, error) {
	var cList *C.virNWFilterPtr
	var err C.virError
	numNWFilters := C.virConnectListAllNWFiltersWrapper(c.ptr, (**C.virNWFilterPtr)(&cList), C.uint(flags), &err)
	if numNWFilters == -1 {
		return nil, makeError(&err)
	}
	hdr := reflect.SliceHeader{
		Data: uintptr(unsafe.Pointer(cList)),
		Len:  int(numNWFilters),
		Cap:  int(numNWFilters),
	}
	var filters []NWFilter
	slice := *(*[]C.virNWFilterPtr)(unsafe.Pointer(&hdr))
	for _, ptr := range slice {
		filters = append(filters, NWFilter{ptr})
	}
	C.free(unsafe.Pointer(cList))
	return filters, nil
}
431808
func (s *TldsService) ListTlds(options *ListOptions) (*tldsResponse, error) {
	path := versioned("/tlds")
	tldsResponse := &tldsResponse{}

	path, err := addURLQueryOptions(path, options)
	if err != nil {
		return nil, err
	}

	resp, err := s.client.get(path, tldsResponse)
	if err != nil {
		return tldsResponse, err
	}

	tldsResponse.HttpResponse = resp
	return tldsResponse, nil
}
1004120
func (h HeaderMap) ListKeys() []string {
	keys := make([]string, 0, len(h))
	for k := range h {
		keys = append(keys, k)
	}
	return keys
}
713470
func ListFiles(dir string) ([]string, error) {
	var files []string
	err := filepath.Walk(dir, func(active string, info os.FileInfo, err error) error {
		// ignore directories
		if info.IsDir() {
			return nil
		}
		if err != nil {
			return err
		}
		rel, err := filepath.Rel(dir, active)
		files = append(files, rel)
		return nil
	})
	return files, err
}
337953
func (s *ConfigurationService) ListConfigurations(p *ListConfigurationsParams) (*ListConfigurationsResponse, error) {
	resp, err := s.cs.newRequest("listConfigurations", p.toURLValues())
	if err != nil {
		return nil, err
	}

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

	return &r, nil
}
835964
func listVMs(c context.Context, q database.QueryerContext, req *crimson.ListVMsRequest) ([]*crimson.VM, error) {
	ipv4s, err := parseIPv4s(req.Ipv4S)
	if err != nil {
		return nil, err
	}

	stmt := squirrel.Select(
		"hv.name",
		"hv.vlan_id",
		"hp.name",
		"hp.vlan_id",
		"o.name",
		"v.description",
		"v.deployment_ticket",
		"i.ipv4",
		"v.state",
	)
	stmt = stmt.From("vms v, hostnames hv, physical_hosts p, hostnames hp, oses o, ips i").
		Where("v.hostname_id = hv.id").
		Where("v.physical_host_id = p.id").
		Where("p.hostname_id = hp.id").
		Where("v.os_id = o.id").
		Where("i.hostname_id = hv.id")
	stmt = selectInString(stmt, "hv.name", req.Names)
	stmt = selectInInt64(stmt, "hv.vlan_id", req.Vlans)
	stmt = selectInInt64(stmt, "i.ipv4", ipv4s)
	stmt = selectInString(stmt, "hp.name", req.Hosts)
	stmt = selectInInt64(stmt, "hp.vlan_id", req.HostVlans)
	stmt = selectInString(stmt, "o.name", req.Oses)
	stmt = selectInState(stmt, "v.state", req.States)
	query, args, err := stmt.ToSql()
	if err != nil {
		return nil, errors.Annotate(err, "failed to generate statement").Err()
	}

	rows, err := q.QueryContext(c, query, args...)
	if err != nil {
		return nil, errors.Annotate(err, "failed to fetch VMs").Err()
	}
	defer rows.Close()
	var vms []*crimson.VM
	for rows.Next() {
		v := &crimson.VM{}
		var ipv4 common.IPv4
		if err = rows.Scan(
			&v.Name,
			&v.Vlan,
			&v.Host,
			&v.HostVlan,
			&v.Os,
			&v.Description,
			&v.DeploymentTicket,
			&ipv4,
			&v.State,
		); err != nil {
			return nil, errors.Annotate(err, "failed to fetch VM").Err()
		}
		v.Ipv4 = ipv4.String()
		vms = append(vms, v)
	}
	return vms, nil
}