Esempio n. 1
0
        public async Task <GlobalConfigurationDto> UpdateAsync(GlobalUpdateDto input)
        {
            var globalConfiguration = await _globalConfigRepository.GetByItemIdAsync(input.ItemId);

            globalConfiguration.BaseUrl               = input.BaseUrl;
            globalConfiguration.RequestIdKey          = input.RequestIdKey;
            globalConfiguration.DownstreamScheme      = input.DownstreamScheme;
            globalConfiguration.DownstreamHttpVersion = input.DownstreamHttpVersion;

            ApplyGlobalConfigurationOptions(globalConfiguration, input);

            globalConfiguration = await _globalConfigRepository.UpdateAsync(globalConfiguration, true);

            await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData(globalConfiguration.AppId, "Global", "Modify"));

            return(ObjectMapper.Map <GlobalConfiguration, GlobalConfigurationDto>(globalConfiguration));
        }
        public async Task <GlobalConfigurationDto> UpdateAsync(GlobalUpdateDto globalUpdateDto)
        {
            var globalConfiguration = await _globalConfigRepository.GetByItemIdAsync(globalUpdateDto.ItemId);

            globalConfiguration.BaseUrl               = globalUpdateDto.BaseUrl;
            globalConfiguration.RequestIdKey          = globalUpdateDto.RequestIdKey;
            globalConfiguration.DownstreamScheme      = globalUpdateDto.DownstreamScheme;
            globalConfiguration.DownstreamHttpVersion = globalUpdateDto.DownstreamHttpVersion;

            ApplyGlobalConfigurationOptions(globalConfiguration, globalUpdateDto);

            globalConfiguration = await _globalConfigRepository.UpdateAsync(globalConfiguration, true);

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

            return(ObjectMapper.Map <GlobalConfiguration, GlobalConfigurationDto>(globalConfiguration));
        }
        public async Task <GlobalConfigurationDto> UpdateAsync(GlobalConfigurationDto configurationDto)
        {
            await CheckPolicyAsync();

            var globalConfiguration = await _globalConfigRepository.GetByItemIdAsync(configurationDto.ItemId);

            globalConfiguration.BaseUrl          = configurationDto.BaseUrl;
            globalConfiguration.RequestIdKey     = configurationDto.RequestIdKey;
            globalConfiguration.DownstreamScheme = configurationDto.DownstreamScheme;

            ApplyGlobalConfigurationOptions(globalConfiguration, configurationDto);

            globalConfiguration = await _globalConfigRepository.UpdateAsync(globalConfiguration, true);

            await _eventPublisher.PublishAsync(ApiGatewayDomainConsts.Events_OcelotConfigChanged, Clock.Now);

            return(ObjectMapper.Map <GlobalConfiguration, GlobalConfigurationDto>(globalConfiguration));
        }