in src/Cli/func/Helpers/AzureHelper.cs [632:694]
public static async Task PrintFunctionsInfo(Site functionApp, string accessToken, string managementURL, bool showKeys)
{
if (functionApp.IsKubeApp)
{
ColoredConsole.Write("Waiting for the functions host up and running ");
await WaitUntilFunctionAppReadyAsync(functionApp, accessToken, managementURL);
}
ArmArrayWrapper<FunctionInfo> functions = await GetFunctions(functionApp, accessToken, managementURL);
functions = await GetFunctions(functionApp, accessToken, managementURL);
ColoredConsole.WriteLine(TitleColor($"Functions in {functionApp.SiteName}:"));
if (functionApp.IsKubeApp && !functions.Value.Any())
{
ColoredConsole.WriteLine(WarningColor(
$"The deployment succeeded. Waiting for {Constants.DefaultRestartedWorkerProcessUptimeWithin / 1000} sec to fetch the list of functions deployed in the function app."));
}
foreach (var function in functions.Value.Select(v => v.Properties))
{
var trigger = function
.Config?["bindings"]
?.FirstOrDefault(o => o["type"]?.ToString().IndexOf("Trigger", StringComparison.OrdinalIgnoreCase) != -1)
?["type"];
trigger = trigger ?? "No Trigger Found";
var showFunctionKey = showKeys;
var authLevel = function
.Config?["bindings"]
?.FirstOrDefault(o => !string.IsNullOrEmpty(o["authLevel"]?.ToString()))
?["authLevel"];
if (authLevel != null && authLevel.ToString().Equals("anonymous", StringComparison.OrdinalIgnoreCase))
{
showFunctionKey = false;
}
ColoredConsole.WriteLine($" {function.Name} - [{VerboseColor(trigger.ToString())}]");
if (!string.IsNullOrEmpty(function.InvokeUrlTemplate))
{
var invokeUrlUrlTemplate = function.InvokeUrlTemplate;
if (!string.IsNullOrEmpty(invokeUrlUrlTemplate) && !invokeUrlUrlTemplate.Contains(functionApp.HostName))
{
invokeUrlUrlTemplate = invokeUrlUrlTemplate.Replace($"{functionApp.SiteName}.azurewebsites.net", $"{functionApp.HostName}");
}
// If there's a key available and the key is requested, add it to the url
var key = showFunctionKey ? await GetFunctionKey(function.Name, functionApp.SiteId, accessToken, managementURL) : null;
if (!string.IsNullOrEmpty(key))
{
ColoredConsole.WriteLine($" Invoke url: {VerboseColor($"{invokeUrlUrlTemplate}?code={key}")}");
}
else
{
ColoredConsole.WriteLine($" Invoke url: {VerboseColor(invokeUrlUrlTemplate)}");
}
}
ColoredConsole.WriteLine();
}
}