// List is only used in cache warming up. So here just pass through
// to APISIX.
List is only used in cache warming up. So here just pass through
to APISIX.
// List is only used in cache warming up . So here just pass through // to APISIX .
func (r *routeClient) List(ctx context.Context) ([]*v1.Route, error) {
	log.Debugw("try to list routes in APISIX",
		zap.String("cluster", r.clusterName),
		zap.String("url", r.url),
	)
	routeItems, err := r.cluster.listResource(ctx, r.url)
	if err != nil {
		log.Errorf("failed to list routes: %s", err)
		return nil, err
	}
	var items []*v1.Route
	for i, item := range routeItems.Node.Items {
		route, err := item.route(r.clusterName)
		if err != nil {
			log.Errorw("failed to convert route item",
				zap.String("url", r.url),
				zap.String("route_key", item.Key),
				zap.Error(err),
			)
			return nil, err
		}
		items = append(items, route)
		log.Debugf("list route #%d, body: %s", i, string(item.Value))
	}
	return items, nil
}
func ( r * routeClient ) List ( ctx context . Context ) ( [ ] * v1 . Route , error ) { log . Debugw ( " " , zap . String ( " " , r . clusterName ) , zap . String ( " " , r . url ) , ) routeItems , err := r . cluster . listResource ( ctx , r . url ) if err != nil { log . Errorf ( " " , err ) return nil , err } var items [ ] * v1 . Route for i , item := range routeItems . Node . Items { route , err := item . route ( r . clusterName ) if err != nil { log . Errorw ( " " , zap . String ( " " , r . url ) , zap . String ( " " , item . Key ) , zap . Error ( err ) , ) return nil , err } items = append ( items , route ) log . Debugf ( " " , i , string ( item . Value ) ) } return items , nil }
List is only used in cache warming up.
List is only used in cache warming up .