// List existing apps transfers.
//
// lr is an optional ListRange that sets the Range options for the paginated
// list of results.
438800
func (c *Client) AppTransferList(lr *ListRange) ([]AppTransfer, error) {
	req, err := c.NewRequest("GET", "/account/app-transfers", nil, nil)
	if err != nil {
		return nil, err
	}

	if lr != nil {
		lr.SetHeader(req)
	}

	var appTransfersRes []AppTransfer
	return appTransfersRes, c.DoReq(req, &appTransfersRes)
}
452879
func (s *store) List(ctx context.Context, key, resourceVersion string, pred storage.SelectionPredicate, listObj runtime.Object) error {
	trace := utiltrace.New(fmt.Sprintf("List etcd3: key=%v, resourceVersion=%s, limit: %d, continue: %s", key, resourceVersion, pred.Limit, pred.Continue))
	defer trace.LogIfLong(500 * time.Millisecond)
	listPtr, err := meta.GetItemsPtr(listObj)
	if err != nil {
		return err
	}
	v, err := conversion.EnforcePtr(listPtr)
	if err != nil || v.Kind() != reflect.Slice {
		panic("need ptr to slice")
	}

	if s.pathPrefix != "" {
		key = path.Join(s.pathPrefix, key)
	}
	// We need to make sure the key ended with "/" so that we only get children "directories".
	// e.g. if we have key "/a", "/a/b", "/ab", getting keys with prefix "/a" will return all three,
	// while with prefix "/a/" will return only "/a/b" which is the correct answer.
	if !strings.HasSuffix(key, "/") {
		key += "/"
	}
	keyPrefix := key

	// set the appropriate clientv3 options to filter the returned data set
	var paging bool
	options := make([]clientv3.OpOption, 0, 4)
	if s.pagingEnabled && pred.Limit > 0 {
		paging = true
		options = append(options, clientv3.WithLimit(pred.Limit))
	}

	var returnedRV, continueRV int64
	var continueKey string
	switch {
	case s.pagingEnabled && len(pred.Continue) > 0:
		continueKey, continueRV, err = decodeContinue(pred.Continue, keyPrefix)
		if err != nil {
			return apierrors.NewBadRequest(fmt.Sprintf("invalid continue token: %v", err))
		}

		if len(resourceVersion) > 0 && resourceVersion != "0" {
			return apierrors.NewBadRequest("specifying resource version is not allowed when using continue")
		}

		rangeEnd := clientv3.GetPrefixRangeEnd(keyPrefix)
		options = append(options, clientv3.WithRange(rangeEnd))
		key = continueKey

		// If continueRV > 0, the LIST request needs a specific resource version.
		// continueRV==0 is invalid.
		// If continueRV < 0, the request is for the latest resource version.
		if continueRV > 0 {
			options = append(options, clientv3.WithRev(continueRV))
			returnedRV = continueRV
		}
	case s.pagingEnabled && pred.Limit > 0:
		if len(resourceVersion) > 0 {
			fromRV, err := s.versioner.ParseResourceVersion(resourceVersion)
			if err != nil {
				return apierrors.NewBadRequest(fmt.Sprintf("invalid resource version: %v", err))
			}
			if fromRV > 0 {
				options = append(options, clientv3.WithRev(int64(fromRV)))
			}
			returnedRV = int64(fromRV)
		}

		rangeEnd := clientv3.GetPrefixRangeEnd(keyPrefix)
		options = append(options, clientv3.WithRange(rangeEnd))

	default:
		if len(resourceVersion) > 0 {
			fromRV, err := s.versioner.ParseResourceVersion(resourceVersion)
			if err != nil {
				return apierrors.NewBadRequest(fmt.Sprintf("invalid resource version: %v", err))
			}
			if fromRV > 0 {
				options = append(options, clientv3.WithRev(int64(fromRV)))
			}
			returnedRV = int64(fromRV)
		}

		options = append(options, clientv3.WithPrefix())
	}

	// loop until we have filled the requested limit from etcd or there are no more results
	var lastKey []byte
	var hasMore bool
	for {
		startTime := time.Now()
		getResp, err := s.client.KV.Get(ctx, key, options...)
		metrics.RecordEtcdRequestLatency("list", getTypeName(listPtr), startTime)
		if err != nil {
			return interpretListError(err, len(pred.Continue) > 0, continueKey, keyPrefix)
		}
		hasMore = getResp.More

		if len(getResp.Kvs) == 0 && getResp.More {
			return fmt.Errorf("no results were found, but etcd indicated there were more values remaining")
		}

		// avoid small allocations for the result slice, since this can be called in many
		// different contexts and we don't know how significantly the result will be filtered
		if pred.Empty() {
			growSlice(v, len(getResp.Kvs))
		} else {
			growSlice(v, 2048, len(getResp.Kvs))
		}

		// take items from the response until the bucket is full, filtering as we go
		for _, kv := range getResp.Kvs {
			if paging && int64(v.Len()) >= pred.Limit {
				hasMore = true
				break
			}
			lastKey = kv.Key

			data, _, err := s.transformer.TransformFromStorage(kv.Value, authenticatedDataString(kv.Key))
			if err != nil {
				return storage.NewInternalErrorf("unable to transform key %q: %v", kv.Key, err)
			}

			if err := appendListItem(v, data, uint64(kv.ModRevision), pred, s.codec, s.versioner); err != nil {
				return err
			}
		}

		// indicate to the client which resource version was returned
		if returnedRV == 0 {
			returnedRV = getResp.Header.Revision
		}

		// no more results remain or we didn't request paging
		if !hasMore || !paging {
			break
		}
		// we're paging but we have filled our bucket
		if int64(v.Len()) >= pred.Limit {
			break
		}
		key = string(lastKey) + "\x00"
	}

	// instruct the client to begin querying from immediately after the last key we returned
	// we never return a key that the client wouldn't be allowed to see
	if hasMore {
		// we want to start immediately after the last key
		next, err := encodeContinue(string(lastKey)+"\x00", keyPrefix, returnedRV)
		if err != nil {
			return err
		}
		return s.versioner.UpdateList(listObj, uint64(returnedRV), next)
	}

	// no continuation
	return s.versioner.UpdateList(listObj, uint64(returnedRV), "")
}
8339
func (p *paymentService) List(ctx context.Context, req *paymentpb.ListRequest) (*paymentpb.ChargeList, error) {

	if err := validation.Validate(req); err != nil {
		return nil, err
	}

	slice := &charges{}

	n, err := storage.Handler().List(slice, object.ListOpt{
		Limit: req.GetLimit(),
		Page:  req.GetPage(),
		Sort:  object.SortNatural,
	})

	if err != nil {
		return nil, err
	}

	return &paymentpb.ChargeList{Charges: *slice, Total: int32(n)}, nil

}
152231
func (t *Transferer) List(project string, statuses ...Status) ([]*storagetransfer.TransferJob, error) {
	var jobs []*storagetransfer.TransferJob
	var token string

	body, err := json.Marshal(struct {
		ProjectID   string   `json:"project_id"`
		JobStatuses []Status `json:"job_statuses,omitempty"`
	}{
		ProjectID:   project,
		JobStatuses: statuses,
	})

	if err != nil {
		return nil, err
	}

	for {
		call := t.svc.List().Filter(string(body))
		if token != "" {
			call = call.PageToken(token)
		}

		resp, err := call.Do()
		if err != nil {
			return nil, err
		}

		for _, job := range resp.TransferJobs {
			jobs = append(jobs, job)
		}

		token = resp.NextPageToken
		if token == "" {
			break
		}
	}
	return jobs, nil
}
1042889
func (r *marathonClient) ListApplications(v url.Values) ([]string, error) {
	applications, err := r.Applications(v)
	if err != nil {
		return nil, err
	}
	var list []string
	for _, application := range applications.Apps {
		list = append(list, application.ID)
	}

	return list, nil
}
31091
func (s *ingressLister) List(selector labels.Selector) (ret []*v1beta1.Ingress, err error) {
	err = cache.ListAll(s.indexer, selector, func(m interface{}) {
		ret = append(ret, m.(*v1beta1.Ingress))
	})
	return ret, err
}
345477
func (d *DataBagService) List() (data *DataBagListResult, err error) {
	path := fmt.Sprintf("data")
	err = d.client.magicRequestDecoder("GET", path, nil, &data)
	return
}
853648
func (s *ScansService) List(ctx context.Context, opt *ScansListOpts) (*scan.ScanList, error) {
	scanList := &scan.ScanList{}
	return scanList, s.client.List(ctx, scansUrl, opt, scanList)
}
597224
func List(client *gophercloud.ServiceClient, opts ListOpts) pagination.Pager {
	return os.List(client, opts)
}
333252
func List(c *client.Client, app string) (api.Config, error) {
	u := fmt.Sprintf("/v1/apps/%s/config/", app)

	body, err := c.BasicRequest("GET", u, nil)

	if err != nil {
		return api.Config{}, err
	}

	config := api.Config{}
	if err = json.Unmarshal([]byte(body), &config); err != nil {
		return api.Config{}, err
	}

	return config, nil
}
1307131
func (s *PlansService) List(ctx context.Context, opt *PlansListOpts) (*plan.PlanList, error) {
	planList := &plan.PlanList{}
	return planList, s.client.List(ctx, plansUrl, opt, planList)
}
725283
func (c *memoryStore) List() []*Sandbox {
	sandboxes := History(c.all())
	sandboxes.sort()
	return sandboxes
}
984851
func (c *SpaceCodebasesController) List(ctx *app.ListSpaceCodebasesContext) error {
	offset, limit := computePagingLimits(ctx.PageOffset, ctx.PageLimit)
	var codebases []codebase.Codebase
	var count int
	err := application.Transactional(c.db, func(appl application.Application) error {
		err := appl.Spaces().CheckExists(ctx, ctx.SpaceID)
		if err != nil {
			return err
		}

		codebases, count, err = appl.Codebases().List(ctx, ctx.SpaceID, &offset, &limit)
		return err
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	res := &app.CodebaseList{
		Data:  ConvertCodebases(ctx.Request, codebases),
		Meta:  &app.CodebaseListMeta{TotalCount: count},
		Links: &app.PagingLinks{},
	}
	setPagingLinks(res.Links, buildAbsoluteURL(ctx.Request), len(codebases), offset, limit, count)
	return ctx.OK(res)
}
655439
func (c Client) ListResources(applications []string) ([]resource.ApplicationResources, error) {
	args, err := newListResourcesArgs(applications)
	if err != nil {
		return nil, errors.Trace(err)
	}

	var apiResults params.ResourcesResults
	if err := c.FacadeCall("ListResources", &args, &apiResults); err != nil {
		return nil, errors.Trace(err)
	}

	if len(apiResults.Results) != len(applications) {
		// We don't bother returning the results we *did* get since
		// something bad happened on the server.
		return nil, errors.Errorf("got invalid data from server (expected %d results, got %d)", len(applications), len(apiResults.Results))
	}

	var errs []error
	results := make([]resource.ApplicationResources, len(applications))
	for i := range applications {
		apiResult := apiResults.Results[i]

		result, err := api.APIResult2ApplicationResources(apiResult)
		if err != nil {
			errs = append(errs, errors.Trace(err))
		}
		results[i] = result
	}
	if err := resolveErrors(errs); err != nil {
		return nil, errors.Trace(err)
	}

	return results, nil
}
443977
func (a *API) List(args params.BackupsListArgs) (params.BackupsListResult, error) {
	var result params.BackupsListResult

	backups, closer := newBackups(a.backend)
	defer closer.Close()

	metaList, err := backups.List()
	if err != nil {
		return result, errors.Trace(err)
	}

	result.List = make([]params.BackupsMetadataResult, len(metaList))
	for i, meta := range metaList {
		result.List[i] = CreateResult(meta, "")
	}

	return result, nil
}
321280
func (r *Region) List(args *structs.GenericRequest, reply *[]string) error {
	*reply = r.srv.Regions()
	return nil
}
1282479
func (c *SpaceTrackerQueriesController) List(ctx *app.ListSpaceTrackerQueriesContext) error {
	var trackerQueries []remoteworkitem.TrackerQuery
	err := application.Transactional(c.db, func(appl application.Application) error {
		err := appl.Spaces().CheckExists(ctx, ctx.SpaceID)
		if err != nil {
			return err
		}
		trackerQueries, err = appl.TrackerQueries().List(ctx, ctx.SpaceID)
		return err
	})
	if err != nil {
		return jsonapi.JSONErrorResponse(ctx, err)
	}
	return ctx.ConditionalEntities(trackerQueries, c.config.GetCacheControlTrackerQueries, func() error {
		res := &app.TrackerQueryList{}
		res.Data = ConvertTrackerQueriesToApp(c.db, ctx.Request, trackerQueries)
		return ctx.OK(res)
	})
}