From 72f9777767dfa8735529c215a23e905db31a8a70 Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Thu, 18 Jun 2020 17:23:38 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=B5=81=E9=87=8F=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E6=8E=A5=E5=8F=A3=E5=8F=82=E6=95=B0=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E7=9A=84bug;=E4=BF=AE=E5=A4=8D=E4=B8=8D?= =?UTF-8?q?=E5=90=8CAppId=E4=B8=8B=E4=B8=8D=E8=83=BD=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E7=9B=B8=E5=90=8C=E8=B7=AF=E7=94=B1=E5=90=8D=E7=A7=B0=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...UN.ApiGateway.Application.Contracts.csproj | 7 + .../Ocelot/AggregateReRouteAppService.cs | 10 +- .../Ocelot/GlobalConfigurationAppService.cs | 4 +- .../ApiGateway/Ocelot/ReRouteAppService.cs | 12 +- .../LINGYUN.ApiGateway.Domain.Shared.csproj | 7 + .../ApigatewayConfigChangeEventData.cs | 4 +- ...GatewayDbContextModelCreatingExtensions.cs | 2 +- .../LINGYUN.ApiGateway.HttpApi.Client.csproj | 7 + .../MessageServiceDomainAutoMapperProfile.cs | 1 + .../ApigatewayConfigChangeEventHandler.cs | 58 ++ .../IOcelotConfigurationChangedEvent.cs | 9 - .../OcelotConfigurationChangedEvent.cs | 50 - ...02_Modify-ReRoute-Index-Unique.Designer.cs | 881 ++++++++++++++++++ ...00618090102_Modify-ReRoute-Index-Unique.cs | 33 + ...ApiHostMigrationsDbContextModelSnapshot.cs | 6 +- vueJs/src/lang/zh.ts | 3 +- .../components/RouteCreateOrEditForm.vue | 13 +- 17 files changed, 1029 insertions(+), 78 deletions(-) create mode 100644 aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/LINGYUN/ApiGateway/EventBus/ApigatewayConfigChangeEventHandler.cs delete mode 100644 aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/LINGYUN/ApiGateway/EventBus/IOcelotConfigurationChangedEvent.cs delete mode 100644 aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/LINGYUN/ApiGateway/EventBus/OcelotConfigurationChangedEvent.cs create mode 100644 aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/Migrations/20200618090102_Modify-ReRoute-Index-Unique.Designer.cs create mode 100644 aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/Migrations/20200618090102_Modify-ReRoute-Index-Unique.cs diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application.Contracts/LINGYUN.ApiGateway.Application.Contracts.csproj b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application.Contracts/LINGYUN.ApiGateway.Application.Contracts.csproj index 24a4fe1a7..6cb8dfaf8 100644 --- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application.Contracts/LINGYUN.ApiGateway.Application.Contracts.csproj +++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application.Contracts/LINGYUN.ApiGateway.Application.Contracts.csproj @@ -3,6 +3,13 @@ netstandard2.0 + true + 2.9.0 + LINGYUN + + + + D:\LocalNuget diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/AggregateReRouteAppService.cs b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/AggregateReRouteAppService.cs index 4e7f1bf42..037cf17bd 100644 --- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/AggregateReRouteAppService.cs +++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/AggregateReRouteAppService.cs @@ -74,7 +74,7 @@ namespace LINGYUN.ApiGateway.Ocelot } aggregateRoute = await _aggregateReRouteRepository.InsertAsync(aggregateRoute); - await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData("AggregateRoute", "Create")); + await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData(aggregateRoute.AppId, "AggregateRoute", "Create")); return ObjectMapper.Map(aggregateRoute); } @@ -104,7 +104,7 @@ namespace LINGYUN.ApiGateway.Ocelot aggregateRoute = await _aggregateReRouteRepository.UpdateAsync(aggregateRoute, true); - await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData("AggregateRoute", "Update")); + await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData(aggregateRoute.AppId, "AggregateRoute", "Update")); return ObjectMapper.Map(aggregateRoute); } @@ -116,7 +116,7 @@ namespace LINGYUN.ApiGateway.Ocelot var aggregateRoute = await _aggregateReRouteRepository.GetByRouteIdAsync(routeId); await _aggregateReRouteRepository.DeleteAsync(aggregateRoute); - await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData("AggregateRoute", "Delete")); + await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData(aggregateRoute.AppId, "AggregateRoute", "Delete")); } [Authorize(ApiGatewayPermissions.AggregateRoute.ManageRouteConfig)] @@ -131,7 +131,7 @@ namespace LINGYUN.ApiGateway.Ocelot await _aggregateReRouteRepository.UpdateAsync(aggregateRoute); - await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData("AggregateRoute", "AddRouteConfig")); + await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData(aggregateRoute.AppId, "AggregateRoute", "AddRouteConfig")); return ObjectMapper.Map(aggregateRouteConfig); } @@ -145,7 +145,7 @@ namespace LINGYUN.ApiGateway.Ocelot await _aggregateReRouteRepository.UpdateAsync(aggregateRoute); - await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData("AggregateRoute", "DeleteRouteConfig")); + await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData(aggregateRoute.AppId, "AggregateRoute", "DeleteRouteConfig")); } } } diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/GlobalConfigurationAppService.cs b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/GlobalConfigurationAppService.cs index 32a8eb72e..483411fff 100644 --- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/GlobalConfigurationAppService.cs +++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/GlobalConfigurationAppService.cs @@ -55,7 +55,7 @@ namespace LINGYUN.ApiGateway.Ocelot globalConfiguration = await _globalConfigRepository.InsertAsync(globalConfiguration, true); - await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData("Global", "Create")); + await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData(globalConfiguration.AppId, "Global", "Create")); return ObjectMapper.Map(globalConfiguration); } @@ -74,7 +74,7 @@ namespace LINGYUN.ApiGateway.Ocelot globalConfiguration = await _globalConfigRepository.UpdateAsync(globalConfiguration, true); - await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData("Global", "Modify")); + await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData(globalConfiguration.AppId, "Global", "Modify")); return ObjectMapper.Map(globalConfiguration); } diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/ReRouteAppService.cs b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/ReRouteAppService.cs index e8db3b79f..441b16a51 100644 --- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/ReRouteAppService.cs +++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Application/LINGYUN/ApiGateway/Ocelot/ReRouteAppService.cs @@ -36,7 +36,7 @@ namespace LINGYUN.ApiGateway.Ocelot var reRouteDto = ObjectMapper.Map(reRoute); - await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData("ReRoute", "Create")); + await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData(reRoute.AppId, "ReRoute", "Create")); return reRouteDto; } @@ -73,7 +73,7 @@ namespace LINGYUN.ApiGateway.Ocelot var reRouteDto = ObjectMapper.Map(reRoute); - await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData("ReRoute", "Modify")); + await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData(reRoute.AppId, "ReRoute", "Modify")); return reRouteDto; } @@ -115,9 +115,11 @@ namespace LINGYUN.ApiGateway.Ocelot [Authorize(ApiGatewayPermissions.Route.Delete)] public async Task DeleteAsync(ReRouteGetByIdInputDto routeGetById) { - await _reRouteRepository.DeleteAsync(x => x.ReRouteId.Equals(routeGetById.RouteId)); + var reRoute = await _reRouteRepository.GetByReRouteIdAsync(routeGetById.RouteId); + + await _reRouteRepository.DeleteAsync(reRoute); - await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData("ReRoute", "Delete")); + await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData(reRoute.AppId, "ReRoute", "Delete")); } [Authorize(ApiGatewayPermissions.Route.Delete)] @@ -127,7 +129,7 @@ namespace LINGYUN.ApiGateway.Ocelot await _reRouteRepository.DeleteAsync(x => x.AppId.Equals(routeGetByAppId.AppId)); - await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData("ReRoute", "Clean")); + await DistributedEventBus.PublishAsync(new ApigatewayConfigChangeEventData(routeGetByAppId.AppId, "ReRoute", "Clean")); } protected virtual void ApplyReRouteOptions(ReRoute reRoute, ReRouteDtoBase routeDto) diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Domain.Shared/LINGYUN.ApiGateway.Domain.Shared.csproj b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Domain.Shared/LINGYUN.ApiGateway.Domain.Shared.csproj index 9e3de3ff0..a5f697ea2 100644 --- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Domain.Shared/LINGYUN.ApiGateway.Domain.Shared.csproj +++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Domain.Shared/LINGYUN.ApiGateway.Domain.Shared.csproj @@ -3,6 +3,13 @@ netstandard2.0 + true + 2.9.0 + LINGYUN + + + + D:\LocalNuget diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Domain.Shared/LINGYUN/ApiGateway/EventBus/ApigatewayConfigChangeEventData.cs b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Domain.Shared/LINGYUN/ApiGateway/EventBus/ApigatewayConfigChangeEventData.cs index 718a4ce90..9c7bf60d3 100644 --- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Domain.Shared/LINGYUN/ApiGateway/EventBus/ApigatewayConfigChangeEventData.cs +++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.Domain.Shared/LINGYUN/ApiGateway/EventBus/ApigatewayConfigChangeEventData.cs @@ -5,6 +5,7 @@ namespace LINGYUN.ApiGateway.EventBus public class ApigatewayConfigChangeEventData { public DateTime DateTime { get; set; } + public string AppId { get; set; } public string Method { get; set; } public string Object { get; set; } protected ApigatewayConfigChangeEventData() @@ -12,8 +13,9 @@ namespace LINGYUN.ApiGateway.EventBus } - public ApigatewayConfigChangeEventData(string @object, string @method) + public ApigatewayConfigChangeEventData(string appId, string @object, string @method) { + AppId = appId; DateTime = DateTime.Now; Object = @object; Method = @method; diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/EntityFrameworkCore/ApiGatewayDbContextModelCreatingExtensions.cs b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/EntityFrameworkCore/ApiGatewayDbContextModelCreatingExtensions.cs index 9b790c06a..698ffce84 100644 --- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/EntityFrameworkCore/ApiGatewayDbContextModelCreatingExtensions.cs +++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.EntityFrameworkCore/LINGYUN/ApiGateway/EntityFrameworkCore/ApiGatewayDbContextModelCreatingExtensions.cs @@ -304,7 +304,7 @@ namespace LINGYUN.ApiGateway.EntityFrameworkCore e.Property(x => x.DownstreamHostAndPorts).HasMaxLength(1000); e.Property(x => x.DelegatingHandlers).HasMaxLength(1000); - e.HasIndex(i => new { i.DownstreamPathTemplate, i.UpstreamPathTemplate }).IsUnique(); + e.HasIndex(i => new { i.AppId, i.DownstreamPathTemplate, i.UpstreamPathTemplate }).IsUnique(); e.ConfigureConcurrencyStamp(); e.ConfigureExtraProperties(); diff --git a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.HttpApi.Client/LINGYUN.ApiGateway.HttpApi.Client.csproj b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.HttpApi.Client/LINGYUN.ApiGateway.HttpApi.Client.csproj index 684658912..52ee8fc99 100644 --- a/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.HttpApi.Client/LINGYUN.ApiGateway.HttpApi.Client.csproj +++ b/aspnet-core/modules/apigateway/LINGYUN.ApiGateway.HttpApi.Client/LINGYUN.ApiGateway.HttpApi.Client.csproj @@ -3,6 +3,13 @@ netstandard2.0 + true + 2.9.0 + LINGYUN + + + + D:\LocalNuget diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs index dc161472f..3c8bfdc0b 100644 --- a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.Domain/LINGYUN/Abp/MessageService/Mapper/MessageServiceDomainAutoMapperProfile.cs @@ -17,6 +17,7 @@ namespace LINGYUN.Abp.MessageService.Mapper .ForMember(dto => dto.Id, map => map.MapFrom(src => src.NotificationId)) .ForMember(dto => dto.Name, map => map.MapFrom(src => src.NotificationName)) .ForMember(dto => dto.CateGory, map => map.MapFrom(src => src.NotificationCateGory)) + .ForMember(dto => dto.Lifetime, map => map.Ignore()) .ForMember(dto => dto.NotificationType, map => map.MapFrom(src => src.Type)) .ForMember(dto => dto.NotificationSeverity, map => map.MapFrom(src => src.Severity)) .ForMember(dto => dto.Data, map => map.MapFrom((src, nfi) => diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/LINGYUN/ApiGateway/EventBus/ApigatewayConfigChangeEventHandler.cs b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/LINGYUN/ApiGateway/EventBus/ApigatewayConfigChangeEventHandler.cs new file mode 100644 index 000000000..63b3513b6 --- /dev/null +++ b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/LINGYUN/ApiGateway/EventBus/ApigatewayConfigChangeEventHandler.cs @@ -0,0 +1,58 @@ +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Ocelot.Configuration.Creator; +using Ocelot.Configuration.Repository; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.DependencyInjection; +using Volo.Abp.EventBus.Distributed; + +namespace LINGYUN.ApiGateway.EventBus +{ + public class ApigatewayConfigChangeEventHandler : IDistributedEventHandler, ITransientDependency + { + protected ApiGatewayOptions Options { get; } + private readonly ILogger _logger; + + private readonly IFileConfigurationRepository _fileConfigRepo; + private readonly IInternalConfigurationRepository _internalConfigRepo; + private readonly IInternalConfigurationCreator _internalConfigCreator; + public ApigatewayConfigChangeEventHandler( + IOptions options, + IFileConfigurationRepository fileConfigRepo, + IInternalConfigurationRepository internalConfigRepo, + IInternalConfigurationCreator internalConfigCreator, + ILogger logger) + { + _fileConfigRepo = fileConfigRepo; + _internalConfigRepo = internalConfigRepo; + _internalConfigCreator = internalConfigCreator; + _logger = logger; + + Options = options.Value; + } + + public async Task HandleEventAsync(ApigatewayConfigChangeEventData eventData) + { + if (Options.AppId.Equals(eventData.AppId)) + { + var fileConfig = await _fileConfigRepo.Get(); + + if (fileConfig.IsError) + { + _logger.LogWarning($"error geting file config, errors are {string.Join(",", fileConfig.Errors.Select(x => x.Message))}"); + return; + } + else + { + var config = await _internalConfigCreator.Create(fileConfig.Data); + if (!config.IsError) + { + _internalConfigRepo.AddOrReplace(config.Data); + } + } + _logger.LogInformation("ocelot configuration changed on {0}", eventData.DateTime); + } + } + } +} diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/LINGYUN/ApiGateway/EventBus/IOcelotConfigurationChangedEvent.cs b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/LINGYUN/ApiGateway/EventBus/IOcelotConfigurationChangedEvent.cs deleted file mode 100644 index c688c091b..000000000 --- a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/LINGYUN/ApiGateway/EventBus/IOcelotConfigurationChangedEvent.cs +++ /dev/null @@ -1,9 +0,0 @@ -using System.Threading.Tasks; - -namespace LINGYUN.ApiGateway.EventBus -{ - public interface IOcelotConfigurationChangedEvent - { - Task OnOcelotConfigurationChanged(ApigatewayConfigChangeEventData changeCommand); - } -} diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/LINGYUN/ApiGateway/EventBus/OcelotConfigurationChangedEvent.cs b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/LINGYUN/ApiGateway/EventBus/OcelotConfigurationChangedEvent.cs deleted file mode 100644 index 579a1818b..000000000 --- a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.Host/LINGYUN/ApiGateway/EventBus/OcelotConfigurationChangedEvent.cs +++ /dev/null @@ -1,50 +0,0 @@ -using Microsoft.Extensions.Logging; -using Ocelot.Configuration.Creator; -using Ocelot.Configuration.Repository; -using System.Linq; -using System.Threading.Tasks; -using Volo.Abp.DependencyInjection; -using Volo.Abp.EventBus.Distributed; - -namespace LINGYUN.ApiGateway.EventBus -{ - public class OcelotConfigurationChangedEvent : IDistributedEventHandler, ITransientDependency - { - private readonly ILogger _logger; - - private readonly IFileConfigurationRepository _fileConfigRepo; - private readonly IInternalConfigurationRepository _internalConfigRepo; - private readonly IInternalConfigurationCreator _internalConfigCreator; - public OcelotConfigurationChangedEvent( - IFileConfigurationRepository fileConfigRepo, - IInternalConfigurationRepository internalConfigRepo, - IInternalConfigurationCreator internalConfigCreator, - ILogger logger) - { - _fileConfigRepo = fileConfigRepo; - _internalConfigRepo = internalConfigRepo; - _internalConfigCreator = internalConfigCreator; - _logger = logger; - } - - public async Task HandleEventAsync(ApigatewayConfigChangeEventData eventData) - { - var fileConfig = await _fileConfigRepo.Get(); - - if (fileConfig.IsError) - { - _logger.LogWarning($"error geting file config, errors are {string.Join(",", fileConfig.Errors.Select(x => x.Message))}"); - return; - } - else - { - var config = await _internalConfigCreator.Create(fileConfig.Data); - if (!config.IsError) - { - _internalConfigRepo.AddOrReplace(config.Data); - } - } - _logger.LogInformation("ocelot configuration changed on {0}", eventData.DateTime); - } - } -} diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/Migrations/20200618090102_Modify-ReRoute-Index-Unique.Designer.cs b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/Migrations/20200618090102_Modify-ReRoute-Index-Unique.Designer.cs new file mode 100644 index 000000000..e92a50cc1 --- /dev/null +++ b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/Migrations/20200618090102_Modify-ReRoute-Index-Unique.Designer.cs @@ -0,0 +1,881 @@ +// +using System; +using LINGYUN.ApiGateway.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; + +namespace LINGYUN.ApiGateway.HttpApi.Host.Migrations +{ + [DbContext(typeof(HttpApiHostMigrationsDbContext))] + [Migration("20200618090102_Modify-ReRoute-Index-Unique")] + partial class ModifyReRouteIndexUnique + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "3.1.4") + .HasAnnotation("Relational:MaxIdentifierLength", 64); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.AggregateReRoute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Aggregator") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("AppId") + .IsRequired() + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Name") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Priority") + .HasColumnType("int"); + + b.Property("ReRouteId") + .HasColumnType("bigint"); + + b.Property("ReRouteIsCaseSensitive") + .ValueGeneratedOnAdd() + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("ReRouteKeys") + .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") + .HasMaxLength(1000); + + b.Property("UpstreamHost") + .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") + .HasMaxLength(1000); + + b.Property("UpstreamHttpMethod") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("UpstreamPathTemplate") + .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") + .HasMaxLength(1000); + + b.HasKey("Id"); + + b.ToTable("AppApiGatewayAggregate"); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.AggregateReRouteConfig", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AggregateReRouteId") + .HasColumnType("int"); + + b.Property("JsonPath") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("Parameter") + .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") + .HasMaxLength(1000); + + b.Property("ReRouteId") + .HasColumnType("bigint"); + + b.Property("ReRouteKey") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.HasIndex("AggregateReRouteId"); + + b.ToTable("AppApiGatewayAggregateConfig"); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.AuthenticationOptions", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AllowedScopes") + .HasColumnType("varchar(200) CHARACTER SET utf8mb4") + .HasMaxLength(200); + + b.Property("AuthenticationProviderKey") + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("ReRouteId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("ReRouteId") + .IsUnique(); + + b.ToTable("AppApiGatewayAuthOptions"); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.CacheOptions", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("ReRouteId") + .HasColumnType("bigint"); + + b.Property("Region") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("TtlSeconds") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ReRouteId") + .IsUnique(); + + b.ToTable("AppApiGatewayCacheOptions"); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.DynamicReRoute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AppId") + .IsRequired() + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DownstreamHttpVersion") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("DynamicReRouteId") + .HasColumnType("bigint"); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("ServiceName") + .IsRequired() + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.HasKey("Id"); + + b.ToTable("AppApiGatewayDynamicReRoute"); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.GlobalConfiguration", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AppId") + .IsRequired() + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("BaseUrl") + .IsRequired() + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DownstreamHttpVersion") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("DownstreamScheme") + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsDeleted") + .ValueGeneratedOnAdd() + .HasColumnName("IsDeleted") + .HasColumnType("tinyint(1)") + .HasDefaultValue(false); + + b.Property("ItemId") + .HasColumnType("bigint"); + + b.Property("RequestIdKey") + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.HasKey("Id"); + + b.ToTable("AppApiGatewayGlobalConfiguration"); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.Headers", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Key") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("ReRouteId") + .HasColumnType("bigint"); + + b.Property("Value") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.HasKey("Id"); + + b.ToTable("AppApiGatewayHeaders"); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.HostAndPort", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Host") + .IsRequired() + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("Port") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("ReRouteId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.ToTable("AppApiGatewayHostAndPort"); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.HttpHandlerOptions", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AllowAutoRedirect") + .HasColumnType("tinyint(1)"); + + b.Property("ItemId") + .HasColumnType("bigint"); + + b.Property("MaxConnectionsPerServer") + .HasColumnType("int"); + + b.Property("ReRouteId") + .HasColumnType("bigint"); + + b.Property("UseCookieContainer") + .HasColumnType("tinyint(1)"); + + b.Property("UseProxy") + .HasColumnType("tinyint(1)"); + + b.Property("UseTracing") + .HasColumnType("tinyint(1)"); + + b.HasKey("Id"); + + b.HasIndex("ItemId") + .IsUnique(); + + b.HasIndex("ReRouteId") + .IsUnique(); + + b.ToTable("AppApiGatewayHttpOptions"); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.LoadBalancerOptions", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("Expiry") + .HasColumnType("int"); + + b.Property("ItemId") + .HasColumnType("bigint"); + + b.Property("Key") + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("ReRouteId") + .HasColumnType("bigint"); + + b.Property("Type") + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.HasKey("Id"); + + b.HasIndex("ItemId") + .IsUnique(); + + b.HasIndex("ReRouteId") + .IsUnique(); + + b.ToTable("AppApiGatewayBalancerOptions"); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.QoSOptions", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("DurationOfBreak") + .HasColumnType("int"); + + b.Property("ExceptionsAllowedBeforeBreaking") + .HasColumnType("int"); + + b.Property("ItemId") + .HasColumnType("bigint"); + + b.Property("ReRouteId") + .HasColumnType("bigint"); + + b.Property("TimeoutValue") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ItemId") + .IsUnique(); + + b.HasIndex("ReRouteId") + .IsUnique(); + + b.ToTable("AppApiGatewayQoSOptions"); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.RateLimitOptions", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("ClientIdHeader") + .ValueGeneratedOnAdd() + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50) + .HasDefaultValue("ClientId"); + + b.Property("DisableRateLimitHeaders") + .HasColumnType("tinyint(1)"); + + b.Property("HttpStatusCode") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(429); + + b.Property("ItemId") + .HasColumnType("bigint"); + + b.Property("QuotaExceededMessage") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("RateLimitCounterPrefix") + .ValueGeneratedOnAdd() + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50) + .HasDefaultValue("ocelot"); + + b.HasKey("Id"); + + b.HasIndex("ItemId") + .IsUnique(); + + b.ToTable("AppApiGatewayRateLimitOptions"); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.RateLimitRule", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("ClientWhitelist") + .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") + .HasMaxLength(1000); + + b.Property("DynamicReRouteId") + .HasColumnType("bigint"); + + b.Property("EnableRateLimiting") + .HasColumnType("tinyint(1)"); + + b.Property("Limit") + .HasColumnType("bigint"); + + b.Property("Period") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("PeriodTimespan") + .HasColumnType("double"); + + b.Property("ReRouteId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("DynamicReRouteId") + .IsUnique(); + + b.HasIndex("ReRouteId") + .IsUnique(); + + b.ToTable("AppApiGatewayRateLimitRule"); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.ReRoute", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("AddClaimsToRequest") + .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") + .HasMaxLength(1000); + + b.Property("AddHeadersToRequest") + .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") + .HasMaxLength(1000); + + b.Property("AddQueriesToRequest") + .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") + .HasMaxLength(1000); + + b.Property("AppId") + .IsRequired() + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("ChangeDownstreamPathTemplate") + .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") + .HasMaxLength(1000); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("DangerousAcceptAnyServerCertificateValidator") + .HasColumnType("tinyint(1)"); + + b.Property("DelegatingHandlers") + .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") + .HasMaxLength(1000); + + b.Property("DownstreamHeaderTransform") + .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") + .HasMaxLength(1000); + + b.Property("DownstreamHostAndPorts") + .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") + .HasMaxLength(1000); + + b.Property("DownstreamHttpMethod") + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("DownstreamHttpVersion") + .HasColumnType("varchar(30) CHARACTER SET utf8mb4") + .HasMaxLength(30); + + b.Property("DownstreamPathTemplate") + .IsRequired() + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("DownstreamScheme") + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("Key") + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("Priority") + .HasColumnType("int"); + + b.Property("ReRouteId") + .HasColumnType("bigint"); + + b.Property("ReRouteIsCaseSensitive") + .HasColumnType("tinyint(1)"); + + b.Property("ReRouteName") + .IsRequired() + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("RequestIdKey") + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("RouteClaimsRequirement") + .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") + .HasMaxLength(1000); + + b.Property("ServiceName") + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("ServiceNamespace") + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("Timeout") + .HasColumnType("int"); + + b.Property("UpstreamHeaderTransform") + .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") + .HasMaxLength(1000); + + b.Property("UpstreamHost") + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("UpstreamHttpMethod") + .IsRequired() + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("UpstreamPathTemplate") + .IsRequired() + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.HasKey("Id"); + + b.HasIndex("AppId", "DownstreamPathTemplate", "UpstreamPathTemplate") + .IsUnique(); + + b.ToTable("AppApiGatewayReRoute"); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.RouteGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("char(36)"); + + b.Property("AppId") + .IsRequired() + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("AppIpAddress") + .IsRequired() + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("AppName") + .IsRequired() + .HasColumnType("varchar(100) CHARACTER SET utf8mb4") + .HasMaxLength(100); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnName("ConcurrencyStamp") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("CreationTime") + .HasColumnName("CreationTime") + .HasColumnType("datetime(6)"); + + b.Property("CreatorId") + .HasColumnName("CreatorId") + .HasColumnType("char(36)"); + + b.Property("DeleterId") + .HasColumnType("char(36)"); + + b.Property("DeletionTime") + .HasColumnType("datetime(6)"); + + b.Property("Description") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("ExtraProperties") + .HasColumnName("ExtraProperties") + .HasColumnType("longtext CHARACTER SET utf8mb4"); + + b.Property("IsActive") + .HasColumnType("tinyint(1)"); + + b.Property("IsDeleted") + .HasColumnType("tinyint(1)"); + + b.Property("LastModificationTime") + .HasColumnName("LastModificationTime") + .HasColumnType("datetime(6)"); + + b.Property("LastModifierId") + .HasColumnName("LastModifierId") + .HasColumnType("char(36)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.HasKey("Id"); + + b.HasIndex("AppId", "AppName", "AppIpAddress"); + + b.ToTable("AppApiGatewayRouteGroup"); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.SecurityOptions", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("IPAllowedList") + .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") + .HasMaxLength(1000); + + b.Property("IPBlockedList") + .HasColumnType("varchar(1000) CHARACTER SET utf8mb4") + .HasMaxLength(1000); + + b.Property("ReRouteId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("ReRouteId") + .IsUnique(); + + b.ToTable("AppApiGatewaySecurityOptions"); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.ServiceDiscoveryProvider", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + b.Property("ConfigurationKey") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("Host") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("ItemId") + .HasColumnType("bigint"); + + b.Property("Namespace") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.Property("PollingInterval") + .HasColumnType("int"); + + b.Property("Port") + .HasColumnType("int"); + + b.Property("Scheme") + .HasColumnType("varchar(50) CHARACTER SET utf8mb4") + .HasMaxLength(50); + + b.Property("Token") + .HasColumnType("varchar(256) CHARACTER SET utf8mb4") + .HasMaxLength(256); + + b.Property("Type") + .HasColumnType("varchar(128) CHARACTER SET utf8mb4") + .HasMaxLength(128); + + b.HasKey("Id"); + + b.HasIndex("ItemId") + .IsUnique(); + + b.ToTable("AppApiGatewayDiscovery"); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.AggregateReRouteConfig", b => + { + b.HasOne("LINGYUN.ApiGateway.Ocelot.AggregateReRoute", null) + .WithMany("ReRouteKeysConfig") + .HasForeignKey("AggregateReRouteId"); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.AuthenticationOptions", b => + { + b.HasOne("LINGYUN.ApiGateway.Ocelot.ReRoute", "ReRoute") + .WithOne("AuthenticationOptions") + .HasForeignKey("LINGYUN.ApiGateway.Ocelot.AuthenticationOptions", "ReRouteId") + .HasPrincipalKey("LINGYUN.ApiGateway.Ocelot.ReRoute", "ReRouteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.CacheOptions", b => + { + b.HasOne("LINGYUN.ApiGateway.Ocelot.ReRoute", "ReRoute") + .WithOne("CacheOptions") + .HasForeignKey("LINGYUN.ApiGateway.Ocelot.CacheOptions", "ReRouteId") + .HasPrincipalKey("LINGYUN.ApiGateway.Ocelot.ReRoute", "ReRouteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.HttpHandlerOptions", b => + { + b.HasOne("LINGYUN.ApiGateway.Ocelot.GlobalConfiguration", "GlobalConfiguration") + .WithOne("HttpHandlerOptions") + .HasForeignKey("LINGYUN.ApiGateway.Ocelot.HttpHandlerOptions", "ItemId") + .HasPrincipalKey("LINGYUN.ApiGateway.Ocelot.GlobalConfiguration", "ItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("LINGYUN.ApiGateway.Ocelot.ReRoute", "ReRoute") + .WithOne("HttpHandlerOptions") + .HasForeignKey("LINGYUN.ApiGateway.Ocelot.HttpHandlerOptions", "ReRouteId") + .HasPrincipalKey("LINGYUN.ApiGateway.Ocelot.ReRoute", "ReRouteId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.LoadBalancerOptions", b => + { + b.HasOne("LINGYUN.ApiGateway.Ocelot.GlobalConfiguration", "GlobalConfiguration") + .WithOne("LoadBalancerOptions") + .HasForeignKey("LINGYUN.ApiGateway.Ocelot.LoadBalancerOptions", "ItemId") + .HasPrincipalKey("LINGYUN.ApiGateway.Ocelot.GlobalConfiguration", "ItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("LINGYUN.ApiGateway.Ocelot.ReRoute", "ReRoute") + .WithOne("LoadBalancerOptions") + .HasForeignKey("LINGYUN.ApiGateway.Ocelot.LoadBalancerOptions", "ReRouteId") + .HasPrincipalKey("LINGYUN.ApiGateway.Ocelot.ReRoute", "ReRouteId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.QoSOptions", b => + { + b.HasOne("LINGYUN.ApiGateway.Ocelot.GlobalConfiguration", "GlobalConfiguration") + .WithOne("QoSOptions") + .HasForeignKey("LINGYUN.ApiGateway.Ocelot.QoSOptions", "ItemId") + .HasPrincipalKey("LINGYUN.ApiGateway.Ocelot.GlobalConfiguration", "ItemId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("LINGYUN.ApiGateway.Ocelot.ReRoute", "ReRoute") + .WithOne("QoSOptions") + .HasForeignKey("LINGYUN.ApiGateway.Ocelot.QoSOptions", "ReRouteId") + .HasPrincipalKey("LINGYUN.ApiGateway.Ocelot.ReRoute", "ReRouteId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.RateLimitOptions", b => + { + b.HasOne("LINGYUN.ApiGateway.Ocelot.GlobalConfiguration", "GlobalConfiguration") + .WithOne("RateLimitOptions") + .HasForeignKey("LINGYUN.ApiGateway.Ocelot.RateLimitOptions", "ItemId") + .HasPrincipalKey("LINGYUN.ApiGateway.Ocelot.GlobalConfiguration", "ItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.RateLimitRule", b => + { + b.HasOne("LINGYUN.ApiGateway.Ocelot.DynamicReRoute", "DynamicReRoute") + .WithOne("RateLimitRule") + .HasForeignKey("LINGYUN.ApiGateway.Ocelot.RateLimitRule", "DynamicReRouteId") + .HasPrincipalKey("LINGYUN.ApiGateway.Ocelot.DynamicReRoute", "DynamicReRouteId") + .OnDelete(DeleteBehavior.Cascade); + + b.HasOne("LINGYUN.ApiGateway.Ocelot.ReRoute", "ReRoute") + .WithOne("RateLimitOptions") + .HasForeignKey("LINGYUN.ApiGateway.Ocelot.RateLimitRule", "ReRouteId") + .HasPrincipalKey("LINGYUN.ApiGateway.Ocelot.ReRoute", "ReRouteId") + .OnDelete(DeleteBehavior.Cascade); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.SecurityOptions", b => + { + b.HasOne("LINGYUN.ApiGateway.Ocelot.ReRoute", "ReRoute") + .WithOne("SecurityOptions") + .HasForeignKey("LINGYUN.ApiGateway.Ocelot.SecurityOptions", "ReRouteId") + .HasPrincipalKey("LINGYUN.ApiGateway.Ocelot.ReRoute", "ReRouteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.ServiceDiscoveryProvider", b => + { + b.HasOne("LINGYUN.ApiGateway.Ocelot.GlobalConfiguration", "GlobalConfiguration") + .WithOne("ServiceDiscoveryProvider") + .HasForeignKey("LINGYUN.ApiGateway.Ocelot.ServiceDiscoveryProvider", "ItemId") + .HasPrincipalKey("LINGYUN.ApiGateway.Ocelot.GlobalConfiguration", "ItemId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/Migrations/20200618090102_Modify-ReRoute-Index-Unique.cs b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/Migrations/20200618090102_Modify-ReRoute-Index-Unique.cs new file mode 100644 index 000000000..eef1c3614 --- /dev/null +++ b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/Migrations/20200618090102_Modify-ReRoute-Index-Unique.cs @@ -0,0 +1,33 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace LINGYUN.ApiGateway.HttpApi.Host.Migrations +{ + public partial class ModifyReRouteIndexUnique : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_AppApiGatewayReRoute_DownstreamPathTemplate_UpstreamPathTemp~", + table: "AppApiGatewayReRoute"); + + migrationBuilder.CreateIndex( + name: "IX_AppApiGatewayReRoute_AppId_DownstreamPathTemplate_UpstreamPa~", + table: "AppApiGatewayReRoute", + columns: new[] { "AppId", "DownstreamPathTemplate", "UpstreamPathTemplate" }, + unique: true); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropIndex( + name: "IX_AppApiGatewayReRoute_AppId_DownstreamPathTemplate_UpstreamPa~", + table: "AppApiGatewayReRoute"); + + migrationBuilder.CreateIndex( + name: "IX_AppApiGatewayReRoute_DownstreamPathTemplate_UpstreamPathTemp~", + table: "AppApiGatewayReRoute", + columns: new[] { "DownstreamPathTemplate", "UpstreamPathTemplate" }, + unique: true); + } + } +} diff --git a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/Migrations/HttpApiHostMigrationsDbContextModelSnapshot.cs b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/Migrations/HttpApiHostMigrationsDbContextModelSnapshot.cs index 8485ba7cc..b0dc27b8e 100644 --- a/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/Migrations/HttpApiHostMigrationsDbContextModelSnapshot.cs +++ b/aspnet-core/services/apigateway/LINGYUN.ApiGateway.HttpApi.Host/Migrations/HttpApiHostMigrationsDbContextModelSnapshot.cs @@ -4,6 +4,7 @@ using LINGYUN.ApiGateway.EntityFrameworkCore; using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Volo.Abp.EntityFrameworkCore; namespace LINGYUN.ApiGateway.HttpApi.Host.Migrations { @@ -14,7 +15,8 @@ namespace LINGYUN.ApiGateway.HttpApi.Host.Migrations { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("ProductVersion", "3.1.3") + .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql) + .HasAnnotation("ProductVersion", "3.1.4") .HasAnnotation("Relational:MaxIdentifierLength", 64); modelBuilder.Entity("LINGYUN.ApiGateway.Ocelot.AggregateReRoute", b => @@ -603,7 +605,7 @@ namespace LINGYUN.ApiGateway.HttpApi.Host.Migrations b.HasKey("Id"); - b.HasIndex("DownstreamPathTemplate", "UpstreamPathTemplate") + b.HasIndex("AppId", "DownstreamPathTemplate", "UpstreamPathTemplate") .IsUnique(); b.ToTable("AppApiGatewayReRoute"); diff --git a/vueJs/src/lang/zh.ts b/vueJs/src/lang/zh.ts index 230393785..9f451ed92 100644 --- a/vueJs/src/lang/zh.ts +++ b/vueJs/src/lang/zh.ts @@ -392,7 +392,8 @@ export default { enableRateLimiting: '启用流量控制', rateLimitCount: '最大请求数量', period: '速率限制时间', - periodTimespan: '允许错开时间重试', + periodTimespan: '允许错开时间重试(s)', + clientWhitelist: '客户端白名单', ipAllowedList: 'Ip白名单', ipBlockedList: 'Ip黑名单', authenticationProviderKey: '身份认证程序', diff --git a/vueJs/src/views/admin/apigateway/components/RouteCreateOrEditForm.vue b/vueJs/src/views/admin/apigateway/components/RouteCreateOrEditForm.vue index 33b1d16d0..97bf93482 100644 --- a/vueJs/src/views/admin/apigateway/components/RouteCreateOrEditForm.vue +++ b/vueJs/src/views/admin/apigateway/components/RouteCreateOrEditForm.vue @@ -442,14 +442,15 @@ /> - + - @@ -471,6 +472,14 @@ v-model="apiGateWayRoute.rateLimitOptions.period" /> + + +