use crate::{error::VmRuntimeResult, model::VmView};
pub trait VmProvider: Send + Sync + 'static {
fn create_vm(&self, vm_id: &str) -> VmRuntimeResult<()>;
fn start_vm(&self, vm_id: &str) -> VmRuntimeResult<()>;
fn stop_vm(&self, vm_id: &str) -> VmRuntimeResult<()>;
fn snapshot_vm(&self, vm_id: &str, snapshot_id: &str) -> VmRuntimeResult<()>;
fn destroy_vm(&self, vm_id: &str) -> VmRuntimeResult<()>;
}
pub trait VmQuery: Send + Sync + 'static {
fn list_vms(&self) -> VmRuntimeResult<Vec<VmView>>;
fn get_vm(&self, vm_id: &str) -> VmRuntimeResult<Option<VmView>>;
fn list_snapshots(&self, vm_id: &str) -> VmRuntimeResult<Option<Vec<String>>>;
}
pub trait VmRuntime: VmProvider + VmQuery {}
impl<T> VmRuntime for T where T: VmProvider + VmQuery {}