Can create networks
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
use crate::libvirt_lib_structures::DomainXMLUuid;
|
||||
use crate::libvirt_lib_structures::XMLUuid;
|
||||
use crate::utils::rand_utils::rand_str;
|
||||
use crate::utils::time_utils::time;
|
||||
use actix::{Actor, Addr, AsyncContext, Context, Handler, Message};
|
||||
@ -19,7 +19,7 @@ enum VNCTokenError {
|
||||
#[derive(Debug, Clone)]
|
||||
struct VNCToken {
|
||||
token: String,
|
||||
vm: DomainXMLUuid,
|
||||
vm: XMLUuid,
|
||||
expire: u64,
|
||||
}
|
||||
|
||||
@ -45,7 +45,7 @@ impl Actor for VNCTokensActor {
|
||||
|
||||
#[derive(Message)]
|
||||
#[rtype(result = "anyhow::Result<String>")]
|
||||
pub struct IssueTokenReq(DomainXMLUuid);
|
||||
pub struct IssueTokenReq(XMLUuid);
|
||||
|
||||
impl Handler<IssueTokenReq> for VNCTokensActor {
|
||||
type Result = anyhow::Result<String>;
|
||||
@ -63,11 +63,11 @@ impl Handler<IssueTokenReq> for VNCTokensActor {
|
||||
}
|
||||
|
||||
#[derive(Message)]
|
||||
#[rtype(result = "anyhow::Result<DomainXMLUuid>")]
|
||||
#[rtype(result = "anyhow::Result<XMLUuid>")]
|
||||
pub struct ConsumeTokenReq(String);
|
||||
|
||||
impl Handler<ConsumeTokenReq> for VNCTokensActor {
|
||||
type Result = anyhow::Result<DomainXMLUuid>;
|
||||
type Result = anyhow::Result<XMLUuid>;
|
||||
|
||||
fn handle(&mut self, msg: ConsumeTokenReq, _ctx: &mut Self::Context) -> Self::Result {
|
||||
log::debug!("Attempt to consume a token {:?}", msg.0);
|
||||
@ -97,12 +97,12 @@ impl VNCTokensManager {
|
||||
}
|
||||
|
||||
/// Issue a new VNC access token for a domain
|
||||
pub async fn issue_token(&self, id: DomainXMLUuid) -> anyhow::Result<String> {
|
||||
pub async fn issue_token(&self, id: XMLUuid) -> anyhow::Result<String> {
|
||||
self.0.send(IssueTokenReq(id)).await?
|
||||
}
|
||||
|
||||
/// Consume a VNC access token
|
||||
pub async fn consume_token(&self, token: String) -> anyhow::Result<DomainXMLUuid> {
|
||||
pub async fn consume_token(&self, token: String) -> anyhow::Result<XMLUuid> {
|
||||
self.0.send(ConsumeTokenReq(token)).await?
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user