34 lines
822 B
C#
34 lines
822 B
C#
|
|
using Microsoft.AspNetCore.Mvc;
|
||
|
|
using w4c_workflows.Filters;
|
||
|
|
using w4c_workflows.Services.Execution;
|
||
|
|
|
||
|
|
namespace w4c_workflows.Controllers;
|
||
|
|
|
||
|
|
/// <summary>
|
||
|
|
/// The runtime registry surface: which execution languages are available on the
|
||
|
|
/// worker host. Authenticates with the tenant operator key like the rest of the
|
||
|
|
/// control plane.
|
||
|
|
/// </summary>
|
||
|
|
[ApiController]
|
||
|
|
[Route("api/languages")]
|
||
|
|
public class RuntimesController : ControllerBase
|
||
|
|
{
|
||
|
|
private readonly RuntimeRegistry _runtimes;
|
||
|
|
|
||
|
|
public RuntimesController(RuntimeRegistry runtimes)
|
||
|
|
{
|
||
|
|
_runtimes = runtimes;
|
||
|
|
}
|
||
|
|
|
||
|
|
[HttpGet]
|
||
|
|
[RequireScope("read")]
|
||
|
|
public IActionResult List() => Ok(_runtimes.All.Select(r => new
|
||
|
|
{
|
||
|
|
r.Id,
|
||
|
|
r.DisplayName,
|
||
|
|
r.DefaultFunction,
|
||
|
|
r.Extension,
|
||
|
|
r.Available,
|
||
|
|
}));
|
||
|
|
}
|