Can query hypervisor information

This commit is contained in:
2023-09-06 18:54:38 +02:00
parent fbe11af121
commit 57c023b45b
14 changed files with 253 additions and 9 deletions

View File

@ -1,5 +1,7 @@
use crate::actors::libvirt_actor::HypervisorInfo;
use crate::app_config::AppConfig;
use crate::constants;
use crate::controllers::{HttpResult, LibVirtReq};
use crate::extractors::local_auth_extractor::LocalAuthEnabled;
use actix_web::{HttpResponse, Responder};
@ -23,3 +25,14 @@ pub async fn static_config(local_auth: LocalAuthEnabled) -> impl Responder {
iso_max_size: constants::ISO_MAX_SIZE,
})
}
#[derive(serde::Serialize)]
struct ServerInfo {
hypervisor: HypervisorInfo,
}
pub async fn server_info(client: LibVirtReq) -> HttpResult {
Ok(HttpResponse::Ok().json(ServerInfo {
hypervisor: client.get_info().await?,
}))
}