Skip to content

Commit

Permalink
Remove Validator suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
nadzyah committed Jan 31, 2024
1 parent 64ffcea commit 36a5517
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 39 deletions.
26 changes: 13 additions & 13 deletions client/hwlib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ use models::rbody::{
use models::software;

fn get_certified_system_sample() -> CertifiedResponse {
let kernel_package = software::KernelPackageValidator {
let kernel_package = software::KernelPackage {
name: "Linux".to_string(),
version: "5.4.0-42-generic".to_string(),
signature: "Sample Signature".to_string(),
};

CertifiedResponse {
status: "Certified".to_string(),
os: software::OSValidator {
os: software::OS {
distributor: "Ubuntu".to_string(),
description: "Ubuntu 20.04.1 LTS".to_string(),
version: "20.04".to_string(),
codename: "focal".to_string(),
kernel: kernel_package,
loaded_modules: vec!["module1".to_string(), "module2".to_string()],
},
bios: devices::BiosValidator {
bios: devices::Bios {
firmware_revision: "1.0".to_string(),
release_date: "2020-01-01".to_string(),
revision: "rev1".to_string(),
Expand All @@ -37,53 +37,53 @@ fn get_certified_system_sample() -> CertifiedResponse {
fn get_related_certified_system_exists_sample() -> RelatedCertifiedSystemExistsResponse {
RelatedCertifiedSystemExistsResponse {
status: "Partially Certified".to_string(),
board: devices::BoardValidator {
board: devices::Board {
manufacturer: "Sample Manufacturer".to_string(),
product_name: "Sample Product".to_string(),
version: "v1.0".to_string(),
},
chassis: Some(devices::ChassisValidator {
chassis: Some(devices::Chassis {
chassis_type: "Sample Type".to_string(),
manufacturer: "Sample Manufacturer".to_string(),
sku: "Sample SKU".to_string(),
version: "v1.0".to_string(),
}),
processor: Some(vec![devices::ProcessorValidator {
processor: Some(vec![devices::Processor {
family: "Sample Family".to_string(),
frequency: 3.5,
manufacturer: "Sample Manufacturer".to_string(),
version: "v1.0".to_string(),
}]),
gpu: Some(vec![devices::GPUValidator {
gpu: Some(vec![devices::GPU {
family: "Sample Family".to_string(),
manufacturer: "Sample Manufacturer".to_string(),
version: "v1.0".to_string(),
}]),
audio: Some(vec![devices::AudioValidator {
audio: Some(vec![devices::Audio {
model: "Sample Model".to_string(),
vendor: "Sample Vendor".to_string(),
}]),
video: Some(vec![devices::VideoCaptureValidator {
video: Some(vec![devices::VideoCapture {
model: "Sample Model".to_string(),
vendor: "Sample Vendor".to_string(),
}]),
network: Some(vec![devices::NetworkAdapterValidator {
network: Some(vec![devices::NetworkAdapter {
bus: "Sample Bus".to_string(),
id: "Sample ID".to_string(),
model: "Sample Model".to_string(),
vendor: "Sample Vendor".to_string(),
capacity: 1000,
}]),
wireless: Some(vec![devices::WirelessAdapterValidator {
wireless: Some(vec![devices::WirelessAdapter {
model: "Sample Model".to_string(),
vendor: "Sample Vendor".to_string(),
}]),
pci_peripherals: Some(vec![devices::PCIPeripheralValidator {
pci_peripherals: Some(vec![devices::PCIPeripheral {
name: "Sample Name".to_string(),
pci_id: "Sample ID".to_string(),
vendor: "Sample Vendor".to_string(),
}]),
usb_peripherals: Some(vec![devices::USBPeripheralValidator {
usb_peripherals: Some(vec![devices::USBPeripheral {
name: "Sample Name".to_string(),
usb_id: "Sample ID".to_string(),
vendor: "Sample Vendor".to_string(),
Expand Down
22 changes: 11 additions & 11 deletions client/hwlib/src/models/devices.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use serde::{Deserialize, Serialize};

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

#[derive(Serialize, Deserialize)]
pub struct BiosValidator {
pub struct Bios {
pub firmware_revision: String,
pub release_date: String,
pub revision: String,
Expand All @@ -16,29 +16,29 @@ pub struct BiosValidator {
}

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

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

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

#[derive(Serialize, Deserialize)]
pub struct NetworkAdapterValidator {
pub struct NetworkAdapter {
pub bus: String,
pub id: String,
pub model: String,
Expand All @@ -47,35 +47,35 @@ pub struct NetworkAdapterValidator {
}

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

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

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

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

#[derive(Serialize, Deserialize)]
pub struct WirelessAdapterValidator {
pub struct WirelessAdapter {
pub model: String,
pub vendor: String,
}
24 changes: 12 additions & 12 deletions client/hwlib/src/models/rbody.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use crate::models::software;
#[derive(Serialize, Deserialize)]
pub struct CertifiedResponse {
pub status: String,
pub os: software::OSValidator,
pub bios: devices::BiosValidator,
pub os: software::OS,
pub bios: devices::Bios,
}

#[derive(Serialize, Deserialize)]
Expand All @@ -18,16 +18,16 @@ pub struct NotSeenResponse {
#[derive(Serialize, Deserialize)]
pub struct RelatedCertifiedSystemExistsResponse {
pub status: String,
pub board: devices::BoardValidator,
pub chassis: Option<devices::ChassisValidator>,
pub processor: Option<Vec<devices::ProcessorValidator>>,
pub gpu: Option<Vec<devices::GPUValidator>>,
pub audio: Option<Vec<devices::AudioValidator>>,
pub video: Option<Vec<devices::VideoCaptureValidator>>,
pub network: Option<Vec<devices::NetworkAdapterValidator>>,
pub wireless: Option<Vec<devices::WirelessAdapterValidator>>,
pub pci_peripherals: Option<Vec<devices::PCIPeripheralValidator>>,
pub usb_peripherals: Option<Vec<devices::USBPeripheralValidator>>,
pub board: devices::Board,
pub chassis: Option<devices::Chassis>,
pub processor: Option<Vec<devices::Processor>>,
pub gpu: Option<Vec<devices::GPU>>,
pub audio: Option<Vec<devices::Audio>>,
pub video: Option<Vec<devices::VideoCapture>>,
pub network: Option<Vec<devices::NetworkAdapter>>,
pub wireless: Option<Vec<devices::WirelessAdapter>>,
pub pci_peripherals: Option<Vec<devices::PCIPeripheral>>,
pub usb_peripherals: Option<Vec<devices::USBPeripheral>>,
}

#[derive(Serialize, Deserialize)]
Expand Down
6 changes: 3 additions & 3 deletions client/hwlib/src/models/software.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
use serde::{Deserialize, Serialize};

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

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

0 comments on commit 36a5517

Please sign in to comment.