func convertEskipToInnkeeper(routes []*eskip.Route) (data []*jsonRoute) { for _, r := range routes { id := eskip.GenerateIfNeeded(r.Id) host := convertHost(r) method := convertMethod(r) pathMatch := convertPathMatcher(r) headerMatchers := convertHeaderMatchers(r) predicates := convertEskipPredicates(r) filters := convertFil(r) endpoint := convertEndpoint(r) match := &matcher{ HostMatcher: host, PathMatcher: pathMatch, MethodMatcher: method, HeaderMatchers: headerMatchers} ro := &routeDef{ Matcher: *match, Predicates: predicates, Filters: filters, Endpoint: endpoint} d := &jsonRoute{ Name: id, Route: *ro} data = append(data, d) } return }
func (c *Client) UpsertAll(routes []*eskip.Route) error { for _, r := range routes { r.Id = eskip.GenerateIfNeeded(r.Id) err := c.Upsert(r) if err != nil { return err } } return nil }