Skip to content

Commit

Permalink
implement machine info to device translation
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteOtter committed Mar 7, 2024
1 parent 5ae4f35 commit 83ab777
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
1 change: 0 additions & 1 deletion src/configuration/config_template.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ airflow = "Front to rear" # Direction of airflow
# rack = 0 # ID of the rack the device is mounted in if any
# position = 0 # Position of the device within the rack if any


# TODO

# Custom parameters about the system, which fall under the "custom_fields" section.
Expand Down
23 changes: 22 additions & 1 deletion src/publisher/translator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,32 @@ use crate::{configuration::config_parser::ConfigData, Machine};

/// Translate the machine information to a `WritableDeviceWithConfigContextRequest` required by
/// NetBox's API.
///
/// # Parameters
///
/// - `machine: &Machine` - Collected information about the device
/// - `config_data: ConfigData` - Additional information about the device provided by config file
/// or CLI
///
/// # Returns
///
/// - `device: WritableDeviceWithConfigContextRequest` - Payload for machine creation request
pub fn information_to_device(
machine: &Machine,
config_data: ConfigData,
) -> WritableDeviceWithConfigContextRequest {
todo!()
// let device: WritableDeviceWithConfigContextRequest = WritableDeviceWithConfigContextRequest {
// name: Some(config_data.system.name),
// device_type: config_data.system.device_type,
// role: config_data.system.device_role,
// tenant: config_data.system.tenant,
// };
// device
todo!()
}

fn get_platform_id(machine: &Machine) -> Option<i64> {
todo!("Get platform by name an return platform id!")
}

pub fn information_to_vm(machine: &Machine) -> WritableVirtualMachineWithConfigContextRequest {
Expand Down

0 comments on commit 83ab777

Please sign in to comment.