Beispiel #1
0
        public virtual async Task <GlobalConfigurationDto> CreateAsync(GlobalCreateDto input)
        {
            await _routeGroupChecker.CheckActiveAsync(input.AppId);

            var globalConfiguration = new GlobalConfiguration(_snowflakeIdGenerator.NextId(),
                                                              input.BaseUrl, input.AppId);

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

            ApplyGlobalConfigurationOptions(globalConfiguration, input);

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

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

            return(ObjectMapper.Map <GlobalConfiguration, GlobalConfigurationDto>(globalConfiguration));
        }
        public virtual async Task <GlobalConfigurationDto> CreateAsync(GlobalCreateDto globalCreateDto)
        {
            await _routeGroupChecker.CheckActiveAsync(globalCreateDto.AppId);

            var globalConfiguration = new GlobalConfiguration(_snowflakeIdGenerator.NextId(),
                                                              globalCreateDto.BaseUrl, globalCreateDto.AppId);

            globalConfiguration.RequestIdKey          = globalCreateDto.RequestIdKey;
            globalConfiguration.DownstreamScheme      = globalCreateDto.DownstreamScheme;
            globalConfiguration.DownstreamHttpVersion = globalCreateDto.DownstreamHttpVersion;

            ApplyGlobalConfigurationOptions(globalConfiguration, globalCreateDto);

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

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

            return(ObjectMapper.Map <GlobalConfiguration, GlobalConfigurationDto>(globalConfiguration));
        }
 public async Task <GlobalConfigurationDto> CreateAsync(GlobalCreateDto input)
 {
     return(await GlobalConfigurationAppService.CreateAsync(input));
 }