From 673259fb6ff01c76f419079ff0b4e827c249f100 Mon Sep 17 00:00:00 2001 From: Eliza Weisman Date: Tue, 15 Oct 2024 13:35:08 -0700 Subject: [PATCH] allow having multiple UUIDs --- ereporter/api/src/lib.rs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/ereporter/api/src/lib.rs b/ereporter/api/src/lib.rs index 94936eb3d7..0ec3858f6f 100644 --- a/ereporter/api/src/lib.rs +++ b/ereporter/api/src/lib.rs @@ -20,29 +20,36 @@ pub trait EreporterApi { /// Get a list of ereports, paginated by sequence number. #[endpoint { method = GET, - path = "/ereports" + path = "/ereports/{reporter_id}" }] async fn ereports_list( request_context: RequestContext, + path: dropshot::Path, query: Query>, ) -> Result>, HttpError>; - /// Informs the reporter that it may freely discard ereports with sequence - /// numbers less than or equal to `seq`. + /// Informs the reporter with the given UUID that it may freely discard + /// ereports with sequence numbers less than or equal to `seq`. #[endpoint { method = DELETE, - path = "/ereports/{seq}" + path = "/ereports/{reporter_id}/{seq}" }] async fn ereports_truncate( request_context: RequestContext, - path: dropshot::Path, + path: dropshot::Path, ) -> Result; } -/// Path parameter to select a sequence number for -/// [`EreporterApi::ereports_truncate`]. +/// Path parameters to the [`EreporterAPi::ereports_list`] endpoint. #[derive(Clone, Copy, Debug, Deserialize, JsonSchema, Serialize)] -pub struct SeqPathParam { +pub struct ListPathParams { + pub reporter_id: Uuid, +} + +/// Path parameters to the [`EreporterApi::ereports_truncate`] endpoint. +#[derive(Clone, Copy, Debug, Deserialize, JsonSchema, Serialize)] +pub struct TruncatePathParams { + pub reporter_id: Uuid, pub seq: Generation, }