aboutsummaryrefslogtreecommitdiff
path: root/src/api/admin/macros.rs
diff options
context:
space:
mode:
authorAlex Auvolat <lx@deuxfleurs.fr>2025-01-29 12:06:58 +0100
committerAlex Auvolat <lx@deuxfleurs.fr>2025-01-29 19:26:16 +0100
commit4f0b923c4f2bc9be80bf1e7ca61cc66c354cc7e0 (patch)
tree97cf8f30bf22e576aa55a92778678f99eb9b4437 /src/api/admin/macros.rs
parent420bbc162dffd1246544168cf2e935efc60c5c98 (diff)
downloadgarage-4f0b923c4f2bc9be80bf1e7ca61cc66c354cc7e0.tar.gz
garage-4f0b923c4f2bc9be80bf1e7ca61cc66c354cc7e0.zip
admin api: small fixes
Diffstat (limited to 'src/api/admin/macros.rs')
-rw-r--r--src/api/admin/macros.rs19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/api/admin/macros.rs b/src/api/admin/macros.rs
index d68ba37f..7082577f 100644
--- a/src/api/admin/macros.rs
+++ b/src/api/admin/macros.rs
@@ -14,7 +14,7 @@ macro_rules! admin_endpoints {
)*
}
- #[derive(Serialize, Deserialize)]
+ #[derive(Serialize)]
#[serde(untagged)]
pub enum AdminApiResponse {
$(
@@ -22,6 +22,13 @@ macro_rules! admin_endpoints {
)*
}
+ #[derive(Serialize, Deserialize)]
+ pub enum TaggedAdminApiResponse {
+ $(
+ $endpoint( [<$endpoint Response>] ),
+ )*
+ }
+
impl AdminApiRequest {
pub fn name(&self) -> &'static str {
match self {
@@ -35,6 +42,16 @@ macro_rules! admin_endpoints {
}
}
+ impl AdminApiResponse {
+ fn tagged(self) -> TaggedAdminApiResponse {
+ match self {
+ $(
+ Self::$endpoint(res) => TaggedAdminApiResponse::$endpoint(res),
+ )*
+ }
+ }
+ }
+
#[async_trait]
impl EndpointHandler for AdminApiRequest {
type Response = AdminApiResponse;