58 lines
1.9 KiB
C#
Raw Normal View History

2023-09-13 10:03:11 +02:00
using KubernetesWorkflow;
using Logging;
2025-01-16 11:31:50 +01:00
using WebUtils;
namespace Core
{
2023-09-13 10:03:11 +02:00
public class EntryPoint
{
private readonly IToolsFactory toolsFactory;
private readonly PluginManager manager = new PluginManager();
2025-01-16 11:31:50 +01:00
public EntryPoint(ILog log, Configuration configuration, string fileManagerRootFolder, IWebCallTimeSet webCallTimeSet, IK8sTimeSet k8STimeSet)
{
2025-01-16 11:31:50 +01:00
toolsFactory = new ToolsFactory(log, configuration, fileManagerRootFolder, webCallTimeSet, k8STimeSet);
Tools = toolsFactory.CreateTools();
manager.InstantiatePlugins(PluginFinder.GetPluginTypes(), toolsFactory);
}
public EntryPoint(ILog log, Configuration configuration, string fileManagerRootFolder)
2025-01-16 11:31:50 +01:00
: this(log, configuration, fileManagerRootFolder, new DefaultWebCallTimeSet(), new DefaultK8sTimeSet())
{
}
2023-09-13 10:03:11 +02:00
public IPluginTools Tools { get; }
2023-09-13 10:03:11 +02:00
public void Announce()
{
2023-09-13 10:03:11 +02:00
manager.AnnouncePlugins();
}
2023-09-13 16:06:05 +02:00
public Dictionary<string, string> GetPluginMetadata()
{
return manager.GatherPluginMetadata().Get();
}
public CoreInterface CreateInterface()
{
return new CoreInterface(this);
}
/// <summary>
/// Deletes kubernetes and tracked file resources.
/// when `waitTillDone` is true, this function will block until resources are deleted.
/// </summary>
public void Decommission(bool deleteKubernetesResources, bool deleteTrackedFiles, bool waitTillDone)
{
manager.DecommissionPlugins(deleteKubernetesResources, deleteTrackedFiles, waitTillDone);
Tools.Decommission(deleteKubernetesResources, deleteTrackedFiles, waitTillDone);
}
internal T GetPlugin<T>() where T : IProjectPlugin
{
return manager.GetPlugin<T>();
}
}
}