using System;
using System.Collections.Generic;
using System.Text;
namespace Amazon.Lambda.Tools
{
///
/// This class contains the runtime package store information from a collection of Lambda layers.
///
public class LayerPackageInfo
{
public IList Items { get; } = new List();
///
/// Generates the value that must be set for the DOTNET_SHARED_STORE environment variable.
///
///
public string GenerateDotnetSharedStoreValue()
{
var sb = new StringBuilder();
var processedDirectories = new HashSet();
foreach(var item in Items)
{
if (processedDirectories.Contains(item.Directory))
continue;
processedDirectories.Add(item.Directory);
if (sb.Length > 0)
sb.Append(":");
sb.Append($"/opt/{item.Directory}/");
}
return sb.ToString();
}
public class LayerPackageInfoItem
{
///
/// The directory under /opt folder in the Lambda environment that the store will be placed/
///
public string Directory { get; set; }
///
/// Local file path the artifact.xml file that list the NuGet packages in the Layer.
///
public string ManifestPath { get; set; }
}
}
}