Class UpdateHandlers

Class Documentation

class UpdateHandlers

HTTP handlers for software update endpoints (/updates).

All endpoints are server-level (no entity path). Without a loaded backend plugin, every handler short-circuits with 501 Not Implemented.

PR-403 commit 22: 8 routes migrated to typed Result<TResponse>(TypedRequest [, TBody]) signatures. The POST/PUT routes that emit 201/202 + Location use the attachments variant so the framework still owns body serialization while the handler controls status code and headers.

Public Functions

UpdateHandlers(HandlerContext &ctx, UpdateManager *update_manager)
http::Result<dto::UpdateList> get_updates(const http::TypedRequest &req)

GET /updates - returns a Collection-shaped list of registered update IDs.

http::Result<dto::UpdateDetail> get_update(const http::TypedRequest &req)

GET /updates/{update_id} - returns the opaque metadata object the plugin stored at registration time.

http::Result<std::pair<dto::UpdateRegisterResponse, http::ResponseAttachments>> post_update(const http::TypedRequest &req, dto::UpdateRegisterRequest body)

POST /updates - register a new update descriptor. On success returns the UpdateRegisterResponse body with a 201 status override and a Location: /api/v1/updates/<id> header.

http::Result<http::NoContent> del_update(const http::TypedRequest &req)

DELETE /updates/{update_id} - 204 No Content on success.

http::Result<std::pair<http::NoContent, http::ResponseAttachments>> put_prepare(const http::TypedRequest &req)

PUT /updates/{update_id}/prepare - 202 Accepted + Location: .../status header, kicks the background prepare task.

http::Result<std::pair<http::NoContent, http::ResponseAttachments>> put_execute(const http::TypedRequest &req)

PUT /updates/{update_id}/execute - 202 Accepted + Location: .../status header, kicks the background execute task.

http::Result<std::pair<http::NoContent, http::ResponseAttachments>> put_automated(const http::TypedRequest &req)

PUT /updates/{update_id}/automated - 202 Accepted + Location: .../status header, kicks the background prepare+execute task.

http::Result<dto::UpdateStatus> get_status(const http::TypedRequest &req)

GET /updates/{update_id}/status - returns the current async-task state.