From df2053e15440a8a339947d04db5ee51ec6cd81ef Mon Sep 17 00:00:00 2001 From: ByteOtter Date: Wed, 4 Sep 2024 13:16:34 +0200 Subject: [PATCH] Add documentation to contingency search function for Interfaces --- src/publisher.rs | 2 +- src/publisher/publisher.rs | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/publisher.rs b/src/publisher.rs index cc6442a..dcf5cdc 100644 --- a/src/publisher.rs +++ b/src/publisher.rs @@ -2,4 +2,4 @@ pub mod api_client; // TODO make this non-public pub mod publisher; pub mod publisher_exceptions; pub mod trans_validation; -pub mod translator; // make this not public // TODO make this non-public // TODO: make this non-public +pub mod translator; diff --git a/src/publisher/publisher.rs b/src/publisher/publisher.rs index 4b78ec6..06abb06 100644 --- a/src/publisher/publisher.rs +++ b/src/publisher/publisher.rs @@ -13,7 +13,7 @@ use thanix_client::{ VirtualizationVirtualMachinesListQuery, VirtualizationVirtualMachinesListResponse, }, types::{ - self, DeviceWithConfigContext, VirtualMachineWithConfigContext, + DeviceWithConfigContext, VirtualMachineWithConfigContext, WritableDeviceWithConfigContextRequest, WritableIPAddressRequest, WritableInterfaceRequest, }, util::ThanixClient, @@ -144,14 +144,6 @@ pub fn register_machine( Ok(()) } -/// Creates a new machine in NetBox by calling the `translator` module to translate the `machine` parameter -/// struct into the correct data type required by the API. -fn create_machine(client: &ThanixClient, machine: &Machine) -> Result<(), NetBoxApiError> { - println!("Creating new machine in NetBox..."); - // let payload = translator::information_to_device(machine); - Ok(()) -} - /// Checks if a given network interface ID corresponds to a interface which already exsists. /// /// # Parameter @@ -166,6 +158,13 @@ fn interface_exists(state: &ThanixClient, id: &Option) -> bool { todo!("check if interface exists must be implemented!"); } +// HACK +/// Contingency function to search for the previously created Network Interface, when the response +/// given my NetBox cannot be serialized correctly therefore no Interface ID is returned. +/// +/// # Parameters +/// * `state: &ThanixClient` - The client to communicate with the API. +/// * `payload: &WritableInterfaceRequest` - The API request payload. fn cont_search_nwi( state: &ThanixClient, payload: &WritableInterfaceRequest,