public virtual void AddReRoutes(string name, string upstreamPathTemplate, string upstreamHost, string downstreamScheme, string downstreamPathTemplate, List <string> upstreamHttpMethods = null, Dictionary <string, int> downstreamHostAndPorts = null) { var reRoute = new OcelotReRoute( Id, name, upstreamPathTemplate, upstreamHost, downstreamScheme, downstreamPathTemplate ); if (upstreamHttpMethods != null) { foreach (var item in upstreamHttpMethods) { reRoute.AddUpstreamHttpMethod(item); } } if (downstreamHostAndPorts != null) { foreach (var item in downstreamHostAndPorts) { reRoute.AddDownstreamHostAndPort(item.Key, item.Value); } } ReRoutes.Add(reRoute); }
public List <string> Resolve(OcelotReRoute source, OcelotReRouteDto destination, List <string> destMember, ResolutionContext context) { if (source == null || source.DelegatingHandlers == null) { return(null); } return(source.DelegatingHandlers.Select(c => c.Delegating).ToList()); }
public List <string> Resolve(OcelotReRoute source, OcelotReRouteDto destination, List <string> destMember, ResolutionContext context) { if (source == null || source.UpstreamHttpMethods == null) { return(null); } return(source.UpstreamHttpMethods.Select(c => c.Method).ToList()); }
public List <ReRouteDelegatingHandler> Resolve(OcelotReRouteDto source, OcelotReRoute destination, List <ReRouteDelegatingHandler> destMember, ResolutionContext context) { if (source == null || source.DelegatingHandlers == null) { return(null); } foreach (var item in source.DelegatingHandlers) { destination.AddDelegatingHandler(item); } return(destination.DelegatingHandlers); }
public List <ReRouteDownstreamHostAndPort> Resolve(OcelotReRouteDto source, OcelotReRoute destination, List <ReRouteDownstreamHostAndPort> destMember, ResolutionContext context) { if (source == null || source.DownstreamHostAndPorts == null) { return(null); } foreach (var item in source.DownstreamHostAndPorts) { destination.AddDownstreamHostAndPort(item.Host, item.Port.Value); } return(destination.DownstreamHostAndPorts); }
public List <ReRouteUpstreamHttpMethod> Resolve(OcelotReRouteDto source, OcelotReRoute destination, List <ReRouteUpstreamHttpMethod> destMember, ResolutionContext context) { if (source == null || source.UpstreamHttpMethods == null) { return(null); } foreach (var item in source.UpstreamHttpMethods) { destination.AddUpstreamHttpMethod(item); } return(destination.UpstreamHttpMethods); }
public List <ReRouteDownstreamHostAndPortDto> Resolve(OcelotReRoute source, OcelotReRouteDto destination, List <ReRouteDownstreamHostAndPortDto> destMember, ResolutionContext context) { if (source == null || source.DownstreamHostAndPorts == null) { return(null); } List <ReRouteDownstreamHostAndPortDto> dto = new List <ReRouteDownstreamHostAndPortDto>(); foreach (var item in source.DownstreamHostAndPorts) { dto.Add(new ReRouteDownstreamHostAndPortDto { Host = item.Host, Port = item.Port }); } return(dto); }