Exemple #1
0
        public async Task <ReRouteDto> UpdateAsync(ReRouteDto routeDto)
        {
            await CheckPolicyAsync();

            var reRoute = await _reRouteRepository.GetByReRouteIdAsync(routeDto.ReRouteId);

            reRoute.DangerousAcceptAnyServerCertificateValidator = routeDto.DangerousAcceptAnyServerCertificateValidator;
            reRoute.DownstreamScheme = routeDto.DownstreamScheme;
            reRoute.Key                    = routeDto.Key;
            reRoute.Priority               = routeDto.Priority;
            reRoute.RequestIdKey           = routeDto.RequestIdKey;
            reRoute.ReRouteIsCaseSensitive = routeDto.ReRouteIsCaseSensitive;
            reRoute.ServiceName            = routeDto.ServiceName;
            reRoute.Timeout                = routeDto.Timeout;
            reRoute.UpstreamHost           = routeDto.UpstreamHost;

            reRoute.ModifyRouteInfo(routeDto.ReRouteName, routeDto.DownstreamPathTemplate,
                                    routeDto.UpstreamPathTemplate, routeDto.UpstreamHttpMethod, routeDto.DownstreamHostAndPorts);
            ApplyReRouteOptions(reRoute, routeDto);

            reRoute = await _reRouteRepository.UpdateAsync(reRoute, true);

            var reRouteDto = ObjectMapper.Map <ReRoute, ReRouteDto>(reRoute);

            await _distributedEventBus.PublishAsync(new OcelotConfigChangeCommand("ReRoute", "Modify"));

            return(reRouteDto);
        }
        public async Task <ReRouteDto> UpdateAsync(ReRouteUpdateDto routeUpdateDto)
        {
            var reRoute = await _reRouteRepository.GetByReRouteIdAsync(long.Parse(routeUpdateDto.ReRouteId));

            reRoute.DangerousAcceptAnyServerCertificateValidator = routeUpdateDto.DangerousAcceptAnyServerCertificateValidator;
            reRoute.DownstreamScheme = routeUpdateDto.DownstreamScheme;
            reRoute.Key                    = routeUpdateDto.Key;
            reRoute.Priority               = routeUpdateDto.Priority;
            reRoute.RequestIdKey           = routeUpdateDto.RequestIdKey;
            reRoute.ReRouteIsCaseSensitive = routeUpdateDto.ReRouteIsCaseSensitive;
            reRoute.ServiceName            = routeUpdateDto.ServiceName;
            reRoute.ServiceNamespace       = routeUpdateDto.ServiceNamespace;
            reRoute.Timeout                = routeUpdateDto.Timeout;
            reRoute.UpstreamHost           = routeUpdateDto.UpstreamHost;
            reRoute.DownstreamHttpVersion  = routeUpdateDto.DownstreamHttpVersion;

            reRoute.SetDownstreamHeader(routeUpdateDto.DownstreamHeaderTransform);
            reRoute.SetQueriesParamter(routeUpdateDto.AddQueriesToRequest);
            reRoute.SetRequestClaims(routeUpdateDto.AddClaimsToRequest);
            reRoute.SetRequestHeader(routeUpdateDto.AddHeadersToRequest);
            reRoute.SetRouteClaims(routeUpdateDto.RouteClaimsRequirement);
            reRoute.SetUpstreamHeader(routeUpdateDto.UpstreamHeaderTransform);
            reRoute.SetChangeDownstreamPath(routeUpdateDto.ChangeDownstreamPathTemplate);
            reRoute.SetDelegatingHandler(routeUpdateDto.DelegatingHandlers);

            ApplyReRouteOptions(reRoute, routeUpdateDto);

            reRoute = await _reRouteRepository.UpdateAsync(reRoute, true);

            var reRouteDto = ObjectMapper.Map <ReRoute, ReRouteDto>(reRoute);

            await _eventPublisher.PublishAsync(ApigatewayConfigChangeCommand.EventName, new ApigatewayConfigChangeCommand("ReRoute", "Modify"));

            return(reRouteDto);
        }
Exemple #3
0
        public async Task <ReRouteDto> UpdateAsync(ReRouteUpdateDto input)
        {
            var reRoute = await _reRouteRepository.GetByReRouteIdAsync(long.Parse(input.ReRouteId));

            reRoute.SetRouteName(input.ReRouteName);
            reRoute.DangerousAcceptAnyServerCertificateValidator = input.DangerousAcceptAnyServerCertificateValidator;
            reRoute.DownstreamScheme = input.DownstreamScheme;
            reRoute.Key                    = input.Key;
            reRoute.Priority               = input.Priority;
            reRoute.RequestIdKey           = input.RequestIdKey;
            reRoute.ReRouteIsCaseSensitive = input.ReRouteIsCaseSensitive;
            reRoute.ServiceName            = input.ServiceName;
            reRoute.ServiceNamespace       = input.ServiceNamespace;
            reRoute.Timeout                = input.Timeout;
            reRoute.UpstreamHost           = input.UpstreamHost;
            reRoute.DownstreamHttpVersion  = input.DownstreamHttpVersion;

            reRoute.SetDownstreamHeader(input.DownstreamHeaderTransform);
            reRoute.SetQueriesParamter(input.AddQueriesToRequest);
            reRoute.SetRequestClaims(input.AddClaimsToRequest);
            reRoute.SetRequestHeader(input.AddHeadersToRequest);
            reRoute.SetRouteClaims(input.RouteClaimsRequirement);
            reRoute.SetUpstreamHeader(input.UpstreamHeaderTransform);
            reRoute.SetChangeDownstreamPath(input.ChangeDownstreamPathTemplate);
            reRoute.SetDelegatingHandler(input.DelegatingHandlers);

            ApplyReRouteOptions(reRoute, input);

            reRoute = await _reRouteRepository.UpdateAsync(reRoute, true);

            var reRouteDto = ObjectMapper.Map <ReRoute, ReRouteDto>(reRoute);

            await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData(reRoute.AppId, "ReRoute", "Modify"));

            return(reRouteDto);
        }