mirror of
https://github.com/nicotsx/ironmount.git
synced 2025-12-10 12:10:51 +01:00
feat: manual health check
This commit is contained in:
@@ -16,6 +16,7 @@ import {
|
||||
unmountVolumeDto,
|
||||
updateVolumeBody,
|
||||
updateVolumeDto,
|
||||
healthCheckDto,
|
||||
} from "./volume.dto";
|
||||
import { volumeService } from "./volume.service";
|
||||
|
||||
@@ -112,4 +113,10 @@ export const volumeController = new Hono()
|
||||
const { error, status } = await volumeService.unmountVolume(name);
|
||||
|
||||
return c.json({ error, status }, error ? 500 : 200);
|
||||
})
|
||||
.post("/:name/health-check", healthCheckDto, async (c) => {
|
||||
const { name } = c.req.param();
|
||||
const { error, status } = await volumeService.checkHealth(name);
|
||||
|
||||
return c.json({ error, status }, 200);
|
||||
});
|
||||
|
||||
@@ -259,6 +259,31 @@ export const unmountVolumeDto = describeRoute({
|
||||
},
|
||||
});
|
||||
|
||||
export const healthCheckResponse = type({
|
||||
error: "string?",
|
||||
status: type.enumerated("mounted", "unmounted", "error"),
|
||||
});
|
||||
|
||||
export const healthCheckDto = describeRoute({
|
||||
description: "Perform a health check on a volume",
|
||||
operationId: "healthCheckVolume",
|
||||
validateResponse: true,
|
||||
tags: ["Volumes"],
|
||||
responses: {
|
||||
200: {
|
||||
description: "Volume health check result",
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: resolver(healthCheckResponse),
|
||||
},
|
||||
},
|
||||
},
|
||||
404: {
|
||||
description: "Volume not found",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
/**
|
||||
* Get containers using a volume
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user