forked from NationTech/harmony
feat(harmony): add lamp server module and refactor dhcpd tests
Implement LAMP server module with basic configuration. Refactor and remove commented out Dhcpd struct and associated tests in opnsense/xml_utils. Ensure codebase adheres to best practices and maintainability standards.
This commit is contained in:
@@ -3,7 +3,7 @@ use std::sync::{Arc, RwLock};
|
||||
use log::info;
|
||||
|
||||
use super::{
|
||||
interpret::{Interpret, InterpretError, Outcome},
|
||||
interpret::{InterpretError, Outcome},
|
||||
inventory::Inventory,
|
||||
score::Score,
|
||||
topology::HAClusterTopology,
|
||||
|
||||
@@ -14,7 +14,7 @@ pub use http::*;
|
||||
pub use network::*;
|
||||
pub use tftp::*;
|
||||
|
||||
use std::{net::IpAddr, sync::Arc};
|
||||
use std::net::IpAddr;
|
||||
|
||||
pub type IpAddress = IpAddr;
|
||||
|
||||
|
||||
70
harmony/src/modules/lamp.rs
Normal file
70
harmony/src/modules/lamp.rs
Normal file
@@ -0,0 +1,70 @@
|
||||
use async_trait::async_trait;
|
||||
|
||||
use crate::{
|
||||
data::{Id, Version},
|
||||
interpret::{Interpret, InterpretError, InterpretName, InterpretStatus, Outcome},
|
||||
inventory::Inventory,
|
||||
modules::k8s::deployment::K8sDeploymentScore,
|
||||
score::Score,
|
||||
topology::HAClusterTopology,
|
||||
};
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct LAMPScore {
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
impl Score for LAMPScore {
|
||||
fn create_interpret(&self) -> Box<dyn Interpret> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn name(&self) -> String {
|
||||
"LampScore".to_string()
|
||||
}
|
||||
|
||||
fn clone_box(&self) -> Box<dyn Score> {
|
||||
Box::new(self.clone())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct LAMPInterpret {
|
||||
score: LAMPScore,
|
||||
}
|
||||
|
||||
#[async_trait]
|
||||
impl Interpret for LAMPInterpret {
|
||||
async fn execute(
|
||||
&self,
|
||||
inventory: &Inventory,
|
||||
topology: &HAClusterTopology,
|
||||
) -> Result<Outcome, InterpretError> {
|
||||
let deployment_score = K8sDeploymentScore {
|
||||
name: self.score.name.clone(),
|
||||
image: "local_image".to_string(),
|
||||
};
|
||||
|
||||
deployment_score
|
||||
.create_interpret()
|
||||
.execute(inventory, topology)
|
||||
.await?;
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn get_name(&self) -> InterpretName {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn get_version(&self) -> Version {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn get_status(&self) -> InterpretStatus {
|
||||
todo!()
|
||||
}
|
||||
|
||||
fn get_children(&self) -> Vec<Id> {
|
||||
todo!()
|
||||
}
|
||||
}
|
||||
@@ -7,3 +7,4 @@ pub mod load_balancer;
|
||||
pub mod okd;
|
||||
pub mod opnsense;
|
||||
pub mod tftp;
|
||||
pub mod lamp;
|
||||
|
||||
Reference in New Issue
Block a user