mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-07-26 07:58:14 +00:00
239aee630f
ASP.NET Minimal API project that simulates the Proxmox VE API using existing JSON fixtures. Supports ticket and API token auth, request tracking for assertions, self-signed HTTPS, and all major API endpoints. Designed for programmatic test startup via MockPveServer.Start(). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
29 lines
1.1 KiB
C#
29 lines
1.1 KiB
C#
using Microsoft.AspNetCore.Builder;
|
|
using Microsoft.AspNetCore.Http;
|
|
|
|
namespace PSProxmoxVE.MockServer.Routes;
|
|
|
|
public static class StorageRoutes
|
|
{
|
|
public static WebApplication MapStorageRoutes(this WebApplication app)
|
|
{
|
|
app.MapGet("/api2/json/storage", () =>
|
|
Results.Content(MockPveServer.GetFixture("pve9_storage"), "application/json"));
|
|
|
|
app.MapGet("/api2/json/nodes/{node}/storage/{storage}/content", (string node, string storage) =>
|
|
Results.Content(MockPveServer.GetFixture("pve9_storage_content"), "application/json"));
|
|
|
|
app.MapPost("/api2/json/nodes/{node}/storage/{storage}/upload", (string node, string storage) =>
|
|
Results.Content($"{{\"data\":\"{MockPveServer.GenerateUpid(node, "upload")}\"}}", "application/json"))
|
|
.DisableAntiforgery();
|
|
|
|
app.MapPost("/api2/json/storage", () =>
|
|
Results.Content("{\"data\":null}", "application/json"));
|
|
|
|
app.MapDelete("/api2/json/storage/{storage}", (string storage) =>
|
|
Results.Content("{\"data\":null}", "application/json"));
|
|
|
|
return app;
|
|
}
|
|
}
|