Start to inflate NWFilter REST api
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
use crate::controllers::{HttpResult, LibVirtReq};
|
||||
use crate::libvirt_lib_structures::XMLUuid;
|
||||
use crate::libvirt_rest_structures::NetworkFilter;
|
||||
use actix_web::{web, HttpResponse};
|
||||
|
||||
#[derive(serde::Serialize, serde::Deserialize)]
|
||||
@ -18,19 +19,16 @@ pub async fn list(client: LibVirtReq) -> HttpResult {
|
||||
Ok(l) => l,
|
||||
};
|
||||
|
||||
/*let networks = networks
|
||||
.into_iter()
|
||||
.map(|n| NetworkInfo::from_xml(n).unwrap())
|
||||
.collect::<Vec<_>>();*/
|
||||
// TODO : turn into lib structure
|
||||
println!("{:#?}", networks);
|
||||
let networks = networks
|
||||
.into_iter()
|
||||
.map(|n| NetworkFilter::from_xml(n).unwrap())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
Ok(HttpResponse::Ok().body(format!("{:#?}", networks)))
|
||||
Ok(HttpResponse::Ok().json(networks))
|
||||
}
|
||||
|
||||
/// Get the information about a single network filter
|
||||
pub async fn get_single(client: LibVirtReq, req: web::Path<NetworkFilterID>) -> HttpResult {
|
||||
let nwfilter = client.get_single_network_filter(req.uid).await?;
|
||||
// TODO : turn into lib structure
|
||||
Ok(HttpResponse::Ok().body(format!("{:#?}", nwfilter)))
|
||||
let nwfilter = NetworkFilter::from_xml(client.get_single_network_filter(req.uid).await?)?;
|
||||
Ok(HttpResponse::Ok().json(nwfilter))
|
||||
}
|
||||
|
Reference in New Issue
Block a user