RunningService.cs
1 using KubernetesWorkflow.Recipe; 2 3 namespace KubernetesWorkflow.Types 4 { 5 public class RunningService 6 { 7 public RunningService(string name, List<ContainerRecipePortMapEntry> result) 8 { 9 Name = name; 10 Result = result; 11 } 12 13 public string Name { get; } 14 public List<ContainerRecipePortMapEntry> Result { get; } 15 16 public Port? GetServicePortForRecipeAndTag(ContainerRecipe recipe, string tag) 17 { 18 return GetServicePortsForRecipe(recipe).SingleOrDefault(p => p.Tag == tag); 19 } 20 21 public Port[] GetServicePortsForRecipe(ContainerRecipe recipe) 22 { 23 return Result 24 .Where(p => p.RecipeNumber == recipe.Number) 25 .SelectMany(p => p.Ports) 26 .ToArray(); 27 } 28 } 29 }