use std::borrow::Cow;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub struct MachineGuid(String);
impl MachineGuid {
pub fn new(value: String) -> Self {
Self(value)
}
pub fn as_str(&self) -> &str {
&self.0
}
pub fn into_inner(self) -> String {
self.0
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum SnapshotSection {
Identity,
Os,
Guids,
Bios,
LogicalDisks,
PhysicalDisks,
Network,
Users,
}
#[derive(Debug, Clone)]
pub struct SnapshotSectionError {
pub section: SnapshotSection,
pub message: Cow<'static, str>,
}
#[derive(Debug, Clone)]
pub struct HostSnapshot {
pub identity: HostIdentity,
pub os: OsInfo,
pub guids: GuidInfo,
pub bios: Option<BiosInfo>,
pub logical_disks: Vec<LogicalDiskInfo>,
pub physical_disks: Vec<PhysicalDiskInfo>,
pub networks: Vec<NetworkInterfaceInfo>,
pub users: Vec<UserInfo>,
pub section_errors: Vec<SnapshotSectionError>,
}
#[derive(Debug, Clone)]
pub struct HostIdentity {
pub hostname: String,
}
#[derive(Debug, Clone)]
pub struct OsInfo {
pub product_name: Option<String>,
pub release_label: Option<String>,
pub build_number: u32,
pub major_version: u32,
pub minor_version: u32,
}
#[derive(Debug, Clone)]
pub struct GuidInfo {
pub machine_guid: Option<MachineGuid>,
pub firmware_guid: Option<String>,
}
#[derive(Debug, Clone)]
pub struct BiosInfo {
pub vendor: Option<String>,
pub version: Option<String>,
pub release_date: Option<String>,
pub system_manufacturer: Option<String>,
pub system_product_name: Option<String>,
}
#[derive(Debug, Clone)]
pub struct LogicalDiskInfo {
pub root: String,
pub volume_label: Option<String>,
pub file_system: Option<String>,
pub total_bytes: u64,
pub free_bytes_available: u64,
pub total_free_bytes: u64,
}
#[derive(Debug, Clone)]
pub struct PhysicalDiskInfo {
pub path: String,
pub size_bytes: u64,
}
#[derive(Debug, Clone)]
pub struct NetworkInterfaceInfo {
pub name: String,
pub mac_address: Option<String>,
pub addresses: Vec<String>,
}
#[derive(Debug, Clone)]
pub struct UserInfo {
pub username: String,
pub sid: Option<String>,
pub source: &'static str,
}