up
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Mirror Thin Bundle Sign & Verify / mirror-sign (push) Has been cancelled
api-governance / spectral-lint (push) Has been cancelled
Some checks failed
AOC Guard CI / aoc-guard (push) Has been cancelled
AOC Guard CI / aoc-verify (push) Has been cancelled
Docs CI / lint-and-preview (push) Has been cancelled
Mirror Thin Bundle Sign & Verify / mirror-sign (push) Has been cancelled
api-governance / spectral-lint (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using StellaOps.Policy.Engine.AdvisoryAI;
|
||||
|
||||
namespace StellaOps.Policy.Engine.Endpoints;
|
||||
|
||||
public static class AdvisoryAiKnobsEndpoint
|
||||
{
|
||||
public static IEndpointRouteBuilder MapAdvisoryAiKnobs(this IEndpointRouteBuilder routes)
|
||||
{
|
||||
routes.MapGet("/policy/advisory-ai/knobs", GetAsync)
|
||||
.WithName("PolicyEngine.AdvisoryAI.Knobs.Get");
|
||||
|
||||
routes.MapPut("/policy/advisory-ai/knobs", PutAsync)
|
||||
.WithName("PolicyEngine.AdvisoryAI.Knobs.Put");
|
||||
|
||||
return routes;
|
||||
}
|
||||
|
||||
private static IResult GetAsync(AdvisoryAiKnobsService service)
|
||||
{
|
||||
var profile = service.Get();
|
||||
return Results.Json(profile);
|
||||
}
|
||||
|
||||
private static IResult PutAsync(
|
||||
[FromBody] IReadOnlyList<AdvisoryAiKnob> knobs,
|
||||
AdvisoryAiKnobsService service)
|
||||
{
|
||||
if (knobs is null || knobs.Count == 0)
|
||||
{
|
||||
return Results.BadRequest(new { message = "knobs are required" });
|
||||
}
|
||||
|
||||
var profile = service.Set(knobs);
|
||||
return Results.Json(profile);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user