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