processes path tree relevant predicates
(r *Route, predicateList []*eskip.Predicate)
| 460 | |
| 461 | // processes path tree relevant predicates |
| 462 | func processTreePredicates(r *Route, predicateList []*eskip.Predicate) error { |
| 463 | // backwards compatibility |
| 464 | if r.Path != "" { |
| 465 | predicateList = append(predicateList, &eskip.Predicate{Name: predicates.PathName, Args: []interface{}{r.Path}}) |
| 466 | } |
| 467 | |
| 468 | if !validTreePredicates(predicateList) { |
| 469 | return fmt.Errorf("multiple tree predicates (Path, PathSubtree) in the route: %s", r.Id) |
| 470 | } |
| 471 | |
| 472 | for _, p := range predicateList { |
| 473 | switch p.Name { |
| 474 | case predicates.PathName: |
| 475 | path, err := processPathOrSubTree(p) |
| 476 | if err != nil { |
| 477 | return err |
| 478 | } |
| 479 | r.path = path |
| 480 | case predicates.PathSubtreeName: |
| 481 | pst, err := processPathOrSubTree(p) |
| 482 | if err != nil { |
| 483 | return err |
| 484 | } |
| 485 | r.pathSubtree = pst |
| 486 | } |
| 487 | } |
| 488 | |
| 489 | return nil |
| 490 | } |
| 491 | |
| 492 | // ValidateRoute processes a route definition through all configured preprocessors |
| 493 | // and validates that all resulting routes can be successfully processed. |
no test coverage detected
searching dependent graphs…