mirror of
https://github.com/deuxfleurs-org/garage.git
synced 2026-08-27 15:37:03 +00:00
admin api: small fixes
This commit is contained in:
+18
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user