in Webapp/SDAF/Controllers/RestHelper.cs [190:222]
public async Task<string[]> GetTemplateFileNames(string scopePath)
{
string getUri = $"{sampleUrl}/contents/{scopePath}?ref=main";
using HttpResponseMessage response = client.GetAsync(getUri).Result;
string responseBody = await response.Content.ReadAsStringAsync();
HandleResponse(response, responseBody);
List<string> fileNames = [];
JsonElement values = JsonDocument.Parse(responseBody).RootElement;
foreach (var value in values.EnumerateArray())
{
string type = value.GetProperty("type").GetString();
string path = value.GetProperty("path").GetString();
if (type == "dir")
{
string[] subFiles = await GetTemplateFileNames(path);
foreach (string subFile in subFiles)
{
fileNames.Add(subFile);
}
}
else if (type == "file")
{
if (path.EndsWith(".tfvars"))
{
fileNames.Add(path);
}
}
}
return fileNames.ToArray();
}