2023-04-12 11:53:55 +00:00
|
|
|
|
using System.Globalization;
|
2023-04-12 13:11:36 +00:00
|
|
|
|
using Utils;
|
2023-04-12 11:53:55 +00:00
|
|
|
|
|
2023-11-12 09:07:23 +00:00
|
|
|
|
namespace KubernetesWorkflow.Recipe
|
2023-04-12 11:53:55 +00:00
|
|
|
|
{
|
|
|
|
|
public class RecipeComponentFactory
|
|
|
|
|
{
|
|
|
|
|
private NumberSource portNumberSource = new NumberSource(8080);
|
|
|
|
|
|
2023-10-25 12:23:07 +00:00
|
|
|
|
public Port CreatePort(int number, string tag, PortProtocol protocol)
|
2023-08-11 07:37:30 +00:00
|
|
|
|
{
|
2023-10-25 12:23:07 +00:00
|
|
|
|
return new Port(number, tag, protocol);
|
2023-08-11 07:37:30 +00:00
|
|
|
|
}
|
|
|
|
|
|
2023-10-25 12:23:07 +00:00
|
|
|
|
public Port CreatePort(string tag, PortProtocol protocol)
|
2023-04-12 11:53:55 +00:00
|
|
|
|
{
|
2023-10-25 12:23:07 +00:00
|
|
|
|
return new Port(portNumberSource.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);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|