too much for one commit

This commit is contained in:
Nils Blomgren
2026-05-13 14:01:32 +02:00
parent a96dd33039
commit 328d494530
394 changed files with 98104 additions and 78 deletions

View File

@@ -0,0 +1,51 @@
using EntKube.SharedKernel.Contracts;
using EntKube.SharedKernel.Domain;
using Microsoft.AspNetCore.Mvc;
namespace EntKube.Clusters.Features.ClusterSettings;
/// <summary>
/// Maps the cluster settings endpoints:
/// GET /api/clusters/{id}/settings — read current settings from the live cluster
/// PUT /api/clusters/{id}/settings — update settings on the live cluster
///
/// These endpoints let the UI's Settings tab fetch and save cluster-level
/// configuration like allowed container registries without going through
/// the component configure flow.
/// </summary>
public static class ClusterSettingsEndpoint
{
public static void Map(IEndpointRouteBuilder app)
{
app.MapGet("/api/clusters/{id:guid}/settings", async (
Guid id,
[FromServices] GetClusterSettingsHandler handler,
CancellationToken ct) =>
{
Result<ClusterSettingsDto> result = await handler.HandleAsync(id, ct);
if (result.IsFailure)
{
return Results.BadRequest(ApiResponse<ClusterSettingsDto>.Fail(result.Error!));
}
return Results.Ok(ApiResponse<ClusterSettingsDto>.Ok(result.Value!));
});
app.MapPut("/api/clusters/{id:guid}/settings", async (
Guid id,
[FromBody] UpdateClusterSettingsRequest request,
[FromServices] UpdateClusterSettingsHandler handler,
CancellationToken ct) =>
{
Result result = await handler.HandleAsync(id, request, ct);
if (result.IsFailure)
{
return Results.BadRequest(ApiResponse<object>.Fail(result.Error!));
}
return Results.Ok(ApiResponse<object>.Ok(new { }));
});
}
}