Can get information about a single network
This commit is contained in:
		@@ -4,8 +4,8 @@ use crate::libvirt_rest_structures::NetworkInfo;
 | 
			
		||||
use actix_web::{web, HttpResponse};
 | 
			
		||||
 | 
			
		||||
#[derive(serde::Serialize, serde::Deserialize)]
 | 
			
		||||
struct NetworkID {
 | 
			
		||||
    id: XMLUuid,
 | 
			
		||||
pub struct NetworkID {
 | 
			
		||||
    uid: XMLUuid,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Create a new network
 | 
			
		||||
@@ -17,9 +17,9 @@ pub async fn create(client: LibVirtReq, req: web::Json<NetworkInfo>) -> HttpResu
 | 
			
		||||
            return Ok(HttpResponse::BadRequest().body(e.to_string()));
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
    let id = client.update_network(network).await?;
 | 
			
		||||
    let uid = client.update_network(network).await?;
 | 
			
		||||
 | 
			
		||||
    Ok(HttpResponse::Ok().json(NetworkID { id }))
 | 
			
		||||
    Ok(HttpResponse::Ok().json(NetworkID { uid }))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Get the list of networks
 | 
			
		||||
@@ -33,3 +33,10 @@ pub async fn list(client: LibVirtReq) -> HttpResult {
 | 
			
		||||
 | 
			
		||||
    Ok(HttpResponse::Ok().json(networks))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Get the information about a single network
 | 
			
		||||
pub async fn get_single(client: LibVirtReq, req: web::Path<NetworkID>) -> HttpResult {
 | 
			
		||||
    let network = NetworkInfo::from_xml(client.get_single_network(req.uid).await?)?;
 | 
			
		||||
 | 
			
		||||
    Ok(HttpResponse::Ok().json(network))
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user