2023-09-14 15:26:46 +02:00
|
|
|
|
using KubernetesWorkflow;
|
2023-11-12 10:07:23 +01:00
|
|
|
|
using KubernetesWorkflow.Types;
|
2023-09-14 15:26:46 +02:00
|
|
|
|
|
|
|
|
|
namespace Core
|
2023-09-12 14:50:18 +02:00
|
|
|
|
{
|
2023-09-13 08:55:04 +02:00
|
|
|
|
public sealed class CoreInterface
|
2023-09-12 14:50:18 +02:00
|
|
|
|
{
|
2023-09-13 08:55:04 +02:00
|
|
|
|
private readonly EntryPoint entryPoint;
|
2023-09-12 14:50:18 +02:00
|
|
|
|
|
2023-09-13 08:55:04 +02:00
|
|
|
|
internal CoreInterface(EntryPoint entryPoint)
|
2023-09-12 14:50:18 +02:00
|
|
|
|
{
|
2023-09-13 08:55:04 +02:00
|
|
|
|
this.entryPoint = entryPoint;
|
2023-09-12 14:50:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
2023-09-13 08:55:04 +02:00
|
|
|
|
public T GetPlugin<T>() where T : IProjectPlugin
|
2023-09-12 14:50:18 +02:00
|
|
|
|
{
|
2023-09-13 08:55:04 +02:00
|
|
|
|
return entryPoint.GetPlugin<T>();
|
2023-09-12 14:50:18 +02:00
|
|
|
|
}
|
2023-09-14 15:26:46 +02:00
|
|
|
|
|
2023-09-25 08:47:19 +02:00
|
|
|
|
public IKnownLocations GetKnownLocations()
|
|
|
|
|
{
|
|
|
|
|
return entryPoint.Tools.CreateWorkflow().GetAvailableLocations();
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-14 15:26:46 +02:00
|
|
|
|
public IDownloadedLog DownloadLog(IHasContainer containerSource, int? tailLines = null)
|
|
|
|
|
{
|
|
|
|
|
return DownloadLog(containerSource.Container, tailLines);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public IDownloadedLog DownloadLog(RunningContainer container, int? tailLines = null)
|
|
|
|
|
{
|
|
|
|
|
var workflow = entryPoint.Tools.CreateWorkflow();
|
2024-08-01 10:39:06 +02:00
|
|
|
|
return workflow.DownloadContainerLog(container, tailLines);
|
2023-09-14 15:26:46 +02:00
|
|
|
|
}
|
2023-09-15 12:25:10 +02:00
|
|
|
|
|
2023-09-15 12:36:35 +02:00
|
|
|
|
public string ExecuteContainerCommand(IHasContainer containerSource, string command, params string[] args)
|
|
|
|
|
{
|
|
|
|
|
return ExecuteContainerCommand(containerSource.Container, command, args);
|
|
|
|
|
}
|
|
|
|
|
|
2023-09-15 12:25:10 +02:00
|
|
|
|
public string ExecuteContainerCommand(RunningContainer container, string command, params string[] args)
|
|
|
|
|
{
|
|
|
|
|
var workflow = entryPoint.Tools.CreateWorkflow();
|
|
|
|
|
return workflow.ExecuteCommand(container, command, args);
|
|
|
|
|
}
|
2023-09-14 15:26:46 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public interface IHasContainer
|
|
|
|
|
{
|
|
|
|
|
RunningContainer Container { get; }
|
2023-09-12 14:50:18 +02:00
|
|
|
|
}
|
|
|
|
|
}
|