fix: opnsense definitions more accurate for various resources such as ProxyGeneral, System, StaticMap, Job, etc. Also fixed brocade crate export and some warnings
This commit is contained in:
parent
43b04edbae
commit
a0a8d5277c
@ -19,7 +19,7 @@ use serde::Serialize;
|
||||
mod fast_iron;
|
||||
mod network_operating_system;
|
||||
mod shell;
|
||||
mod ssh;
|
||||
pub mod ssh;
|
||||
|
||||
#[derive(Default, Clone, Debug)]
|
||||
pub struct BrocadeOptions {
|
||||
|
||||
@ -152,10 +152,10 @@ impl PhysicalHost {
|
||||
pub fn parts_list(&self) -> String {
|
||||
let PhysicalHost {
|
||||
id,
|
||||
category,
|
||||
category: _,
|
||||
network,
|
||||
storage,
|
||||
labels,
|
||||
labels: _,
|
||||
memory_modules,
|
||||
cpus,
|
||||
} = self;
|
||||
@ -226,8 +226,8 @@ impl PhysicalHost {
|
||||
speed_mhz,
|
||||
manufacturer,
|
||||
part_number,
|
||||
serial_number,
|
||||
rank,
|
||||
serial_number: _,
|
||||
rank: _,
|
||||
} = mem;
|
||||
parts_list.push_str(&format!(
|
||||
"\n{}Gb, {}Mhz, Manufacturer ({}), Part Number ({})",
|
||||
|
||||
@ -121,7 +121,7 @@ mod test {
|
||||
#[test]
|
||||
fn deployment_to_dynamic_roundtrip() {
|
||||
// Create a sample Deployment with nested structures
|
||||
let mut deployment = Deployment {
|
||||
let deployment = Deployment {
|
||||
metadata: ObjectMeta {
|
||||
name: Some("my-deployment".to_string()),
|
||||
labels: Some({
|
||||
|
||||
@ -8,7 +8,6 @@ mod tftp;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub use management::*;
|
||||
use opnsense_config_xml::Host;
|
||||
use tokio::sync::RwLock;
|
||||
|
||||
use crate::{executors::ExecutorError, topology::LogicalHost};
|
||||
|
||||
@ -195,7 +195,7 @@ pub struct System {
|
||||
pub disablechecksumoffloading: u8,
|
||||
pub disablesegmentationoffloading: u8,
|
||||
pub disablelargereceiveoffloading: u8,
|
||||
pub ipv6allow: u8,
|
||||
pub ipv6allow: Option<u8>,
|
||||
pub powerd_ac_mode: String,
|
||||
pub powerd_battery_mode: String,
|
||||
pub powerd_normal_mode: String,
|
||||
@ -226,6 +226,7 @@ pub struct System {
|
||||
pub dns6gw: Option<String>,
|
||||
pub dns7gw: Option<String>,
|
||||
pub dns8gw: Option<String>,
|
||||
pub prefer_ipv4: Option<String>,
|
||||
pub dnsallowoverride: u8,
|
||||
pub dnsallowoverride_exclude: Option<MaybeString>,
|
||||
}
|
||||
@ -329,6 +330,7 @@ pub struct Range {
|
||||
pub struct StaticMap {
|
||||
pub mac: String,
|
||||
pub ipaddr: String,
|
||||
pub cid: Option<MaybeString>,
|
||||
pub hostname: String,
|
||||
pub descr: Option<MaybeString>,
|
||||
pub winsserver: MaybeString,
|
||||
@ -764,9 +766,19 @@ pub struct Jobs {
|
||||
pub struct Job {
|
||||
#[yaserde(attribute = true)]
|
||||
pub uuid: MaybeString,
|
||||
#[yaserde(rename = "name")]
|
||||
pub name: MaybeString,
|
||||
pub name: Option<MaybeString>,
|
||||
// Add other fields as needed
|
||||
pub origin: Option<MaybeString>,
|
||||
pub enabled: Option<MaybeString>,
|
||||
pub minutes: Option<MaybeString>,
|
||||
pub hours: Option<MaybeString>,
|
||||
pub days: Option<MaybeString>,
|
||||
pub months: Option<MaybeString>,
|
||||
pub weekdays: Option<MaybeString>,
|
||||
pub who: Option<MaybeString>,
|
||||
pub command: Option<MaybeString>,
|
||||
pub parameters: Option<MaybeString>,
|
||||
pub description: Option<MaybeString>,
|
||||
}
|
||||
|
||||
#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)]
|
||||
@ -895,28 +907,28 @@ pub struct Proxy {
|
||||
#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)]
|
||||
pub struct ProxyGeneral {
|
||||
pub enabled: i8,
|
||||
pub error_pages: String,
|
||||
pub error_pages: Option<MaybeString>,
|
||||
#[yaserde(rename = "icpPort")]
|
||||
pub icp_port: MaybeString,
|
||||
pub logging: Logging,
|
||||
#[yaserde(rename = "alternateDNSservers")]
|
||||
pub alternate_dns_servers: MaybeString,
|
||||
#[yaserde(rename = "dnsV4First")]
|
||||
pub dns_v4_first: i8,
|
||||
pub dns_v4_first: Option<MaybeString>,
|
||||
#[yaserde(rename = "forwardedForHandling")]
|
||||
pub forwarded_for_handling: String,
|
||||
pub forwarded_for_handling: Option<MaybeString>,
|
||||
#[yaserde(rename = "uriWhitespaceHandling")]
|
||||
pub uri_whitespace_handling: String,
|
||||
pub uri_whitespace_handling: Option<MaybeString>,
|
||||
#[yaserde(rename = "enablePinger")]
|
||||
pub enable_pinger: i8,
|
||||
#[yaserde(rename = "useViaHeader")]
|
||||
pub use_via_header: i8,
|
||||
pub use_via_header: Option<MaybeString>,
|
||||
#[yaserde(rename = "suppressVersion")]
|
||||
pub suppress_version: i32,
|
||||
pub suppress_version: Option<MaybeString>,
|
||||
#[yaserde(rename = "connecttimeout")]
|
||||
pub connect_timeout: MaybeString,
|
||||
pub connect_timeout: Option<MaybeString>,
|
||||
#[yaserde(rename = "VisibleEmail")]
|
||||
pub visible_email: String,
|
||||
pub visible_email: Option<MaybeString>,
|
||||
#[yaserde(rename = "VisibleHostname")]
|
||||
pub visible_hostname: MaybeString,
|
||||
pub cache: Cache,
|
||||
@ -953,7 +965,7 @@ pub struct LocalCache {
|
||||
pub cache_mem: i32,
|
||||
pub maximum_object_size: MaybeString,
|
||||
pub maximum_object_size_in_memory: MaybeString,
|
||||
pub memory_cache_mode: String,
|
||||
pub memory_cache_mode: MaybeString,
|
||||
pub size: i32,
|
||||
pub l1: i32,
|
||||
pub l2: i32,
|
||||
@ -965,13 +977,13 @@ pub struct LocalCache {
|
||||
pub struct Traffic {
|
||||
pub enabled: i32,
|
||||
#[yaserde(rename = "maxDownloadSize")]
|
||||
pub max_download_size: i32,
|
||||
pub max_download_size: MaybeString,
|
||||
#[yaserde(rename = "maxUploadSize")]
|
||||
pub max_upload_size: i32,
|
||||
pub max_upload_size: MaybeString,
|
||||
#[yaserde(rename = "OverallBandwidthTrotteling")]
|
||||
pub overall_bandwidth_trotteling: i32,
|
||||
pub overall_bandwidth_trotteling: MaybeString,
|
||||
#[yaserde(rename = "perHostTrotteling")]
|
||||
pub per_host_trotteling: i32,
|
||||
pub per_host_trotteling: MaybeString,
|
||||
}
|
||||
|
||||
#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)]
|
||||
@ -988,7 +1000,7 @@ pub struct ParentProxy {
|
||||
|
||||
#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)]
|
||||
pub struct Forward {
|
||||
pub interfaces: String,
|
||||
pub interfaces: MaybeString,
|
||||
pub port: i32,
|
||||
pub sslbumpport: i32,
|
||||
pub sslbump: i32,
|
||||
@ -1033,9 +1045,9 @@ pub struct Acl {
|
||||
pub google_apps: MaybeString,
|
||||
pub youtube: MaybeString,
|
||||
#[yaserde(rename = "safePorts")]
|
||||
pub safe_ports: String,
|
||||
pub safe_ports: MaybeString,
|
||||
#[yaserde(rename = "sslPorts")]
|
||||
pub ssl_ports: String,
|
||||
pub ssl_ports: MaybeString,
|
||||
#[yaserde(rename = "remoteACLs")]
|
||||
pub remote_acls: RemoteAcls,
|
||||
}
|
||||
@ -1051,9 +1063,9 @@ pub struct RemoteAcls {
|
||||
pub struct Icap {
|
||||
pub enable: i32,
|
||||
#[yaserde(rename = "RequestURL")]
|
||||
pub request_url: String,
|
||||
pub request_url: MaybeString,
|
||||
#[yaserde(rename = "ResponseURL")]
|
||||
pub response_url: String,
|
||||
pub response_url: MaybeString,
|
||||
#[yaserde(rename = "SendClientIP")]
|
||||
pub send_client_ip: i32,
|
||||
#[yaserde(rename = "SendUsername")]
|
||||
@ -1061,7 +1073,7 @@ pub struct Icap {
|
||||
#[yaserde(rename = "EncodeUsername")]
|
||||
pub encode_username: i32,
|
||||
#[yaserde(rename = "UsernameHeader")]
|
||||
pub username_header: String,
|
||||
pub username_header: MaybeString,
|
||||
#[yaserde(rename = "EnablePreview")]
|
||||
pub enable_preview: i32,
|
||||
#[yaserde(rename = "PreviewSize")]
|
||||
@ -1076,9 +1088,9 @@ pub struct Authentication {
|
||||
pub method: MaybeString,
|
||||
#[yaserde(rename = "authEnforceGroup")]
|
||||
pub auth_enforce_group: MaybeString,
|
||||
pub realm: String,
|
||||
pub credentialsttl: i32, // This field is already in snake_case
|
||||
pub children: i32,
|
||||
pub realm: MaybeString,
|
||||
pub credentialsttl: MaybeString, // This field is already in snake_case
|
||||
pub children: MaybeString,
|
||||
}
|
||||
|
||||
#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)]
|
||||
@ -1293,6 +1305,7 @@ pub struct WireguardServerItem {
|
||||
pub peers: String,
|
||||
pub endpoint: MaybeString,
|
||||
pub peer_dns: MaybeString,
|
||||
pub debug: Option<MaybeString>,
|
||||
}
|
||||
|
||||
#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)]
|
||||
@ -1477,6 +1490,7 @@ pub struct Ppp {
|
||||
pub ports: Option<MaybeString>,
|
||||
pub username: Option<MaybeString>,
|
||||
pub password: Option<MaybeString>,
|
||||
pub provider: Option<MaybeString>,
|
||||
}
|
||||
|
||||
#[derive(Default, PartialEq, Debug, YaSerialize, YaDeserialize)]
|
||||
|
||||
@ -86,10 +86,7 @@ impl<'a> DhcpConfigLegacyISC<'a> {
|
||||
mac,
|
||||
ipaddr: ipaddr.to_string(),
|
||||
hostname,
|
||||
descr: Default::default(),
|
||||
winsserver: Default::default(),
|
||||
dnsserver: Default::default(),
|
||||
ntpserver: Default::default(),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
existing_mappings.push(static_map);
|
||||
@ -126,9 +123,7 @@ impl<'a> DhcpConfigLegacyISC<'a> {
|
||||
ipaddr: entry["ipaddr"].as_str().unwrap_or_default().to_string(),
|
||||
hostname: entry["hostname"].as_str().unwrap_or_default().to_string(),
|
||||
descr: entry["descr"].as_str().map(MaybeString::from),
|
||||
winsserver: MaybeString::default(),
|
||||
dnsserver: MaybeString::default(),
|
||||
ntpserver: MaybeString::default(),
|
||||
..Default::default()
|
||||
})
|
||||
.collect();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user