CoreInterface.cs
1 using KubernetesWorkflow; 2 using KubernetesWorkflow.Types; 3 using Logging; 4 5 namespace Core 6 { 7 public sealed class CoreInterface 8 { 9 private readonly EntryPoint entryPoint; 10 11 internal CoreInterface(EntryPoint entryPoint) 12 { 13 this.entryPoint = entryPoint; 14 } 15 16 public T GetPlugin<T>() where T : IProjectPlugin 17 { 18 return entryPoint.GetPlugin<T>(); 19 } 20 21 public IKnownLocations GetKnownLocations() 22 { 23 return entryPoint.Tools.CreateWorkflow().GetAvailableLocations(); 24 } 25 26 public IDownloadedLog DownloadLog(IHasContainer containerSource, int? tailLines = null) 27 { 28 return DownloadLog(containerSource.Container, tailLines); 29 } 30 31 public IDownloadedLog DownloadLog(RunningContainer container, int? tailLines = null) 32 { 33 var workflow = entryPoint.Tools.CreateWorkflow(); 34 return workflow.DownloadContainerLog(container, tailLines); 35 } 36 37 public string ExecuteContainerCommand(IHasContainer containerSource, string command, params string[] args) 38 { 39 return ExecuteContainerCommand(containerSource.Container, command, args); 40 } 41 42 public string ExecuteContainerCommand(RunningContainer container, string command, params string[] args) 43 { 44 var workflow = entryPoint.Tools.CreateWorkflow(); 45 return workflow.ExecuteCommand(container, command, args); 46 } 47 } 48 49 public interface IHasContainer 50 { 51 RunningContainer Container { get; } 52 } 53 }