Skip to content

Commit

Permalink
Add documentation to contingency search function for Interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
ByteOtter committed Sep 4, 2024
1 parent a6090ce commit df2053e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/publisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
17 changes: 8 additions & 9 deletions src/publisher/publisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use thanix_client::{
VirtualizationVirtualMachinesListQuery, VirtualizationVirtualMachinesListResponse,
},
types::{
self, DeviceWithConfigContext, VirtualMachineWithConfigContext,
DeviceWithConfigContext, VirtualMachineWithConfigContext,
WritableDeviceWithConfigContextRequest, WritableIPAddressRequest, WritableInterfaceRequest,
},
util::ThanixClient,
Expand Down Expand Up @@ -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
Expand All @@ -166,6 +158,13 @@ fn interface_exists(state: &ThanixClient, id: &Option<i64>) -> 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,
Expand Down

0 comments on commit df2053e

Please sign in to comment.