Skip to content

Commit

Permalink
Add data validators
Browse files Browse the repository at this point in the history
  • Loading branch information
nadzyah committed Jan 30, 2024
1 parent 4eddec0 commit 94b1699
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 17 deletions.
28 changes: 14 additions & 14 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@
members = [
"client/hwctl",
"client/hwlib"
]
]

resolver = "2"
4 changes: 2 additions & 2 deletions client/hwlib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hwlib"
description = "collects and sends hardware information to hi-api to find testing status of the device model"
description = "collects and sends hardware information to hwapi to find testing status of the device model"
license = "GPL-3.0-only"
version = "0.1.0"
edition = "2021"
Expand All @@ -9,6 +9,6 @@ edition = "2021"

[dependencies]
reqwest = { version = "0.11.23", features = ["json"] }
serde = { version = "1.0.195", features = ["derive"] }
serde = { version = "1.0.196", features = ["derive"] }
smbios-lib = "0.9.1"
tokio = "1.35.1"
88 changes: 88 additions & 0 deletions client/hwlib/src/models/devices.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
use serde::(Serialize, Deserialize);


#[derive(Serialize, Deserialize)]
pub struct AudioValidator {
model: String,
vendor: String,
}


#[derive(Serialize, Deserialize)]
pub struct BiosValidator {
firmware_revision: String,
release_date: String,
revision: String,
vendor: String,
version: String,
}


#[derive(Serialize, Deserialize)]
pub struct BoardValidator {
manufacturer: String,
product_name: String,
version: String
}


#[derive(Serialize, Deserialize)]
pub struct ChassisValidator {
chassis_type: String,
manufacturer: String,
sku: String,
version: String,
}

#[derive(Serialize, Deserialize)]
pub struct GPUValidator {
family: String,
manufacturer: String,
version: String,
}

#[derive(Serialize, Deserialize)]
pub struct NetworkAdapterValidator {

bus: String,
id: String,
model: String,
vendor: String,
capacity: i32,
}

#[derive(Serialize, Deserialize)]
pub struct PCIPeripheralValidator {
pci_id: String,
name: String,
vendor: String,
}

#[derive(Serialize, Deserialize)]
pub struct ProcessorValidator {
family: String,
frequency: f64,
manufacturer: String,
version: String,
}

#[derive(Serialize, Deserialize)]
pub struct USBPeripheralValidator {
usb_id: String,
name: String,
vendor: String,
}

#[derive(Serialize, Deserialize)]
pub struct VideoCaptureValidator {

model: String,
vendor: String,
}

#[derive(Serialize, Deserialize)]
pub struct WirelessAdapterValidator {

model: String,
vendor: String,
}
18 changes: 18 additions & 0 deletions client/hwlib/src/models/software.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use serde::{Serialize, Deserialize};

#[derive(Serialize, Deserialize, Debug)]
pub struct KernelPackageValidator {
name: String,
version: String,
signature: String,
}

#[derive(Serialize, Deserialize, Debug)]
pub struct OSValidator {
distributor: String,
description: String,
version: String,
codename: String,
kernel: KernelPackageValidator,
loaded_modules: Vec<String>,
}

0 comments on commit 94b1699

Please sign in to comment.