cs-codex-dist-tests/Framework/KubernetesWorkflow/Recipe/RecipeComponentFactory.cs

37 lines
1.1 KiB
C#
Raw Normal View History

2023-04-12 11:53:55 +00:00
using System.Globalization;
using Utils;
2023-04-12 11:53:55 +00:00
namespace KubernetesWorkflow.Recipe
2023-04-12 11:53:55 +00:00
{
public class RecipeComponentFactory
{
private NumberSource internalNumberSource = new NumberSource(8080);
private static NumberSource externalNumberSource = new NumberSource(30000);
2023-04-12 11:53:55 +00:00
public Port CreatePort(int number, string tag, PortProtocol protocol)
2023-08-11 07:37:30 +00:00
{
return new Port(number, tag, protocol);
2023-08-11 07:37:30 +00:00
}
public Port CreateInternalPort(string tag, PortProtocol protocol)
2023-04-12 11:53:55 +00:00
{
return new Port(internalNumberSource.GetNextNumber(), tag, protocol);
}
public Port CreateExternalPort(string tag, PortProtocol protocol)
{
return new Port(externalNumberSource.GetNextNumber(), tag, protocol);
2023-04-12 11:53:55 +00:00
}
public EnvVar CreateEnvVar(string name, int value)
{
return CreateEnvVar(name, value.ToString(CultureInfo.InvariantCulture));
}
public EnvVar CreateEnvVar(string name, string value)
{
return new EnvVar(name, value);
}
}
}