public virtual async Task <KongvergeConfiguration> FromKong(IKongAdminReader kongReader) { Log.Information("Reading configuration from Kong"); Log.Verbose("Getting plugins from Kong"); var plugins = await kongReader.GetPlugins(); Log.Verbose("Getting services from Kong"); var services = await kongReader.GetServices(); Log.Verbose("Getting routes from Kong"); var routes = await kongReader.GetRoutes(); foreach (var existingService in services) { PopulateServiceTree(existingService, routes, plugins); } return(new KongvergeConfiguration { Services = services.ToArray(), GlobalConfig = new GlobalConfig { Plugins = plugins.Where(x => x.IsGlobal()).ToArray() } }); }
public ExportWorkflow( IKongAdminReader kongReader, IOptions <Settings> configuration, ConfigFileWriter configWriter, ConfigBuilder configBuilder) : base(kongReader, configuration) { _configWriter = configWriter; _configBuilder = configBuilder; }
public ExportWorkflow( IKongAdminReader kongReader, ExportWorkflowArguments arguments, ConfigFileWriter configWriter, ConfigBuilder configBuilder) : base(kongReader) { _arguments = arguments; _configWriter = configWriter; _configBuilder = configBuilder; }
public KongvergeWorkflow( IKongAdminReader kongReader, IOptions <Settings> configuration, IKongAdminWriter kongWriter, ConfigFileReader configReader, ConfigBuilder configBuilder) : base(kongReader, configuration) { _kongWriter = kongWriter; _configReader = configReader; _configBuilder = configBuilder; }
public KongvergeWorkflow( IKongAdminReader kongReader, KongvergeWorkflowArguments arguments, IKongAdminWriter kongWriter, ConfigFileReader configReader, ConfigBuilder configBuilder) : base(kongReader) { _arguments = arguments; _kongWriter = kongWriter; _configReader = configReader; _configBuilder = configBuilder; }
public IDictionary <string, AsyncLazy <KongSchema> > GetSchemas(IKongAdminReader kongReader) { return(Plugins.Available .Where(x => x.Value) .Select(x => $"plugins/{x.Key}") .Append("plugins") .Append("consumers") .Append("routes") .Append("services") .Append("certificates") .ToDictionary(x => x, x => new AsyncLazy <KongSchema>(() => kongReader.GetSchema(x)))); }
public virtual async Task <KongvergeConfiguration> FromKong(IKongAdminReader kongReader, IReadOnlyCollection <string> ignoreTags) { ignoreTags ??= Array.Empty <string>(); Log.Information("Reading configuration from Kong"); Log.Verbose("Getting consumers from Kong"); var consumers = IgnoreByTag(ignoreTags, await kongReader.GetConsumers()); Log.Verbose("Getting plugins from Kong"); var plugins = IgnoreByTag(ignoreTags, await kongReader.GetPlugins()); Log.Verbose("Getting services from Kong"); var services = IgnoreByTag(ignoreTags, await kongReader.GetServices()); Log.Verbose("Getting routes from Kong"); var routes = IgnoreByTag(ignoreTags, await kongReader.GetRoutes()); foreach (var consumer in consumers) { consumer.Plugins = plugins.Where(x => x.Consumer?.Id == consumer.Id).ToArray(); } foreach (var service in services) { PopulateServiceTree(service, routes, plugins); } var configuration = new KongvergeConfiguration { Services = services.ToArray(), GlobalConfig = new GlobalConfig { Plugins = plugins.Where(x => x.IsGlobal()).ToArray(), Consumers = consumers.ToArray() } }; Log.Information($"Configuration from Kong: {configuration}"); return(configuration); }
public virtual async Task <KongvergeConfiguration> FromKong(IKongAdminReader kongReader) { var plugins = await kongReader.GetPlugins(); var services = await kongReader.GetServices(); var routes = await kongReader.GetRoutes(); foreach (var existingService in services) { PopulateServiceTree(existingService, routes, plugins); } return(new KongvergeConfiguration { Services = services.ToArray(), GlobalConfig = new ExtendibleKongObject { Plugins = plugins.Where(x => x.IsGlobal()).ToArray() } }); }
protected Workflow(IKongAdminReader kongReader, IOptions <Settings> configuration) { KongReader = kongReader; Configuration = configuration.Value; }
protected Workflow(IKongAdminReader kongReader) { KongReader = kongReader; }
public TestWorkflow(IKongAdminReader kongReader) : base(kongReader) { }