using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Amazon.Lambda.Tools
{
///
/// Class representing ImageTag associated with a image based lambda
///
public class LambdaImageTagData
{
public string Repo { get; set; }
public string Tag { get; set; }
///
/// Parse input imagetag to retrieve image repo and image tag
///
/// Format: repoName:TagName
public static bool TryParse(string text, out LambdaImageTagData data)
{
if (string.IsNullOrEmpty(text))
{
data = null;
return false;
}
if (text.Contains(":"))
{
var textArray = text.Split(':');
data = new LambdaImageTagData { Repo = textArray[0], Tag = textArray[1] };
return true;
}
data = new LambdaImageTagData { Repo = text, Tag = null };
return true;
}
}
}