]> git.proxmox.com Git - proxmox-backup.git/commitdiff
fix non-camel-case enums
authorWolfgang Bumiller <w.bumiller@errno.eu>
Thu, 5 Jan 2023 09:57:11 +0000 (10:57 +0100)
committerWolfgang Bumiller <w.bumiller@errno.eu>
Thu, 5 Jan 2023 10:13:46 +0000 (11:13 +0100)
This should have never been started to begin with...

15 files changed:
pbs-api-types/src/network.rs
pbs-config/src/network/mod.rs
src/api2/access/user.rs
src/api2/config/access/openid.rs
src/api2/config/acme.rs
src/api2/config/changer.rs
src/api2/config/datastore.rs
src/api2/config/drive.rs
src/api2/config/media_pool.rs
src/api2/config/remote.rs
src/api2/config/sync.rs
src/api2/config/traffic_control.rs
src/api2/node/config.rs
src/api2/node/dns.rs
src/api2/node/network.rs

index 4b0671c59316045daad636a0892000d2fd721ff9..361c20e4ba4fe9939fbd01890ad0e00708dfc6c6 100644 (file)
@@ -1,3 +1,5 @@
+use std::fmt;
+
 use serde::{Deserialize, Serialize};
 
 use proxmox_schema::*;
@@ -59,42 +61,64 @@ pub enum NetworkConfigMethod {
 #[api()]
 #[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case")]
-#[allow(non_camel_case_types)]
 #[repr(u8)]
 /// Linux Bond Mode
 pub enum LinuxBondMode {
     /// Round-robin policy
-    balance_rr = 0,
+    BalanceRr = 0,
     /// Active-backup policy
-    active_backup = 1,
+    ActiveBackup = 1,
     /// XOR policy
-    balance_xor = 2,
+    BalanceXor = 2,
     /// Broadcast policy
-    broadcast = 3,
+    Broadcast = 3,
     /// IEEE 802.3ad Dynamic link aggregation
     #[serde(rename = "802.3ad")]
-    ieee802_3ad = 4,
+    Ieee802_3ad = 4,
     /// Adaptive transmit load balancing
-    balance_tlb = 5,
+    BalanceTlb = 5,
     /// Adaptive load balancing
-    balance_alb = 6,
+    BalanceAlb = 6,
+}
+
+impl fmt::Display for LinuxBondMode {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.write_str(match self {
+            LinuxBondMode::BalanceRr => "balance-rr",
+            LinuxBondMode::ActiveBackup => "active-backup",
+            LinuxBondMode::BalanceXor => "balance-xor",
+            LinuxBondMode::Broadcast => "broadcast",
+            LinuxBondMode::Ieee802_3ad => "802.3ad",
+            LinuxBondMode::BalanceTlb => "balance-tlb",
+            LinuxBondMode::BalanceAlb => "balance-alb",
+        })
+    }
 }
 
 #[api()]
 #[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case")]
-#[allow(non_camel_case_types)]
 #[repr(u8)]
 /// Bond Transmit Hash Policy for LACP (802.3ad)
 pub enum BondXmitHashPolicy {
     /// Layer 2
-    layer2 = 0,
+    Layer2 = 0,
     /// Layer 2+3
     #[serde(rename = "layer2+3")]
-    layer2_3 = 1,
+    Layer2_3 = 1,
     /// Layer 3+4
     #[serde(rename = "layer3+4")]
-    layer3_4 = 2,
+    Layer3_4 = 2,
+}
+
+impl fmt::Display for BondXmitHashPolicy {
+    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+        f.write_str(match self {
+            BondXmitHashPolicy::Layer2 => "layer2",
+            BondXmitHashPolicy::Layer2_3 => "layer2+3",
+            BondXmitHashPolicy::Layer3_4 => "layer3+4",
+        })
+    }
 }
 
 #[api()]
index a05a554d034ef2889c6e4e43aa2fc53e45218315..e2008b7c2282f020abb36984dcab8e6d58b11008 100644 (file)
@@ -36,31 +36,11 @@ pub fn bond_mode_from_str(s: &str) -> Result<LinuxBondMode, Error> {
         .map_err(|_: value::Error| format_err!("invalid bond_mode '{}'", s))
 }
 
-pub fn bond_mode_to_str(mode: LinuxBondMode) -> &'static str {
-    match mode {
-        LinuxBondMode::balance_rr => "balance-rr",
-        LinuxBondMode::active_backup => "active-backup",
-        LinuxBondMode::balance_xor => "balance-xor",
-        LinuxBondMode::broadcast => "broadcast",
-        LinuxBondMode::ieee802_3ad => "802.3ad",
-        LinuxBondMode::balance_tlb => "balance-tlb",
-        LinuxBondMode::balance_alb => "balance-alb",
-    }
-}
-
 pub fn bond_xmit_hash_policy_from_str(s: &str) -> Result<BondXmitHashPolicy, Error> {
     BondXmitHashPolicy::deserialize(s.into_deserializer())
         .map_err(|_: value::Error| format_err!("invalid bond_xmit_hash_policy '{}'", s))
 }
 
-pub fn bond_xmit_hash_policy_to_str(policy: &BondXmitHashPolicy) -> &'static str {
-    match policy {
-        BondXmitHashPolicy::layer2 => "layer2",
-        BondXmitHashPolicy::layer2_3 => "layer2+3",
-        BondXmitHashPolicy::layer3_4 => "layer3+4",
-    }
-}
-
 // Write attributes not depending on address family
 fn write_iface_attributes(iface: &Interface, w: &mut dyn Write) -> Result<(), Error> {
     static EMPTY_LIST: Vec<String> = Vec::new();
@@ -78,21 +58,17 @@ fn write_iface_attributes(iface: &Interface, w: &mut dyn Write) -> Result<(), Er
             }
         }
         NetworkInterfaceType::Bond => {
-            let mode = iface.bond_mode.unwrap_or(LinuxBondMode::balance_rr);
-            writeln!(w, "\tbond-mode {}", bond_mode_to_str(mode))?;
+            let mode = iface.bond_mode.unwrap_or(LinuxBondMode::BalanceRr);
+            writeln!(w, "\tbond-mode {mode}")?;
             if let Some(primary) = &iface.bond_primary {
-                if mode == LinuxBondMode::active_backup {
+                if mode == LinuxBondMode::ActiveBackup {
                     writeln!(w, "\tbond-primary {}", primary)?;
                 }
             }
 
             if let Some(xmit_policy) = &iface.bond_xmit_hash_policy {
-                if mode == LinuxBondMode::ieee802_3ad || mode == LinuxBondMode::balance_xor {
-                    writeln!(
-                        w,
-                        "\tbond_xmit_hash_policy {}",
-                        bond_xmit_hash_policy_to_str(xmit_policy)
-                    )?;
+                if mode == LinuxBondMode::Ieee802_3ad || mode == LinuxBondMode::BalanceXor {
+                    writeln!(w, "\tbond_xmit_hash_policy {xmit_policy}")?;
                 }
             }
 
index 2264f8e8b6f8b78f3998e6603e812c1445b7ff49..62d9d697db25fb0e6da66d18865f989a2f448eb7 100644 (file)
@@ -189,16 +189,15 @@ pub fn read_user(userid: Userid, rpcenv: &mut dyn RpcEnvironment) -> Result<User
 #[api()]
 #[derive(Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case")]
-#[allow(non_camel_case_types)]
 pub enum DeletableProperty {
     /// Delete the comment property.
-    comment,
+    Comment,
     /// Delete the firstname property.
-    firstname,
+    Firstname,
     /// Delete the lastname property.
-    lastname,
+    Lastname,
     /// Delete the email property.
-    email,
+    Email,
 }
 
 #[api(
@@ -261,10 +260,10 @@ pub fn update_user(
     if let Some(delete) = delete {
         for delete_prop in delete {
             match delete_prop {
-                DeletableProperty::comment => data.comment = None,
-                DeletableProperty::firstname => data.firstname = None,
-                DeletableProperty::lastname => data.lastname = None,
-                DeletableProperty::email => data.email = None,
+                DeletableProperty::Comment => data.comment = None,
+                DeletableProperty::Firstname => data.firstname = None,
+                DeletableProperty::Lastname => data.lastname = None,
+                DeletableProperty::Email => data.email = None,
             }
         }
     }
index 92cc6685d7b33fddea95733df9e7a918c76dc059..bb39b574254f79f4e6025ddb7babf40daba61bfa 100644 (file)
@@ -146,21 +146,20 @@ pub fn read_openid_realm(
 #[api()]
 #[derive(Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case")]
-#[allow(non_camel_case_types)]
 /// Deletable property name
 pub enum DeletableProperty {
     /// Delete the client key.
-    client_key,
+    ClientKey,
     /// Delete the comment property.
-    comment,
+    Comment,
     /// Delete the autocreate property
-    autocreate,
+    Autocreate,
     /// Delete the scopes property
-    scopes,
+    Scopes,
     /// Delete the prompt property
-    prompt,
+    Prompt,
     /// Delete the acr_values property
-    acr_values,
+    AcrValues,
 }
 
 #[api(
@@ -215,22 +214,22 @@ pub fn update_openid_realm(
     if let Some(delete) = delete {
         for delete_prop in delete {
             match delete_prop {
-                DeletableProperty::client_key => {
+                DeletableProperty::ClientKey => {
                     config.client_key = None;
                 }
-                DeletableProperty::comment => {
+                DeletableProperty::Comment => {
                     config.comment = None;
                 }
-                DeletableProperty::autocreate => {
+                DeletableProperty::Autocreate => {
                     config.autocreate = None;
                 }
-                DeletableProperty::scopes => {
+                DeletableProperty::Scopes => {
                     config.scopes = None;
                 }
-                DeletableProperty::prompt => {
+                DeletableProperty::Prompt => {
                     config.prompt = None;
                 }
-                DeletableProperty::acr_values => {
+                DeletableProperty::AcrValues => {
                     config.acr_values = None;
                 }
             }
index b1fa7a0aeff7a771593d61bb395af5418d31b511..3ea18493da271d7c8e6c439b0461871a99cf530f 100644 (file)
@@ -633,13 +633,12 @@ pub fn delete_plugin(id: String) -> Result<(), Error> {
 #[api()]
 #[derive(Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case")]
-#[allow(non_camel_case_types)]
 /// Deletable property name
 pub enum DeletableProperty {
     /// Delete the disable property
-    disable,
+    Disable,
     /// Delete the validation-delay property
-    validation_delay,
+    ValidationDelay,
 }
 
 #[api(
@@ -711,10 +710,10 @@ pub fn update_plugin(
             if let Some(delete) = delete {
                 for delete_prop in delete {
                     match delete_prop {
-                        DeletableProperty::validation_delay => {
+                        DeletableProperty::ValidationDelay => {
                             plugin.core.validation_delay = None;
                         }
-                        DeletableProperty::disable => {
+                        DeletableProperty::Disable => {
                             plugin.core.disable = None;
                         }
                     }
index 8bd9984812fd3677113b98942f2adae9f835a22b..01908e3bddfb05041186333cee3e4778756b69c8 100644 (file)
@@ -133,12 +133,11 @@ pub fn list_changers(
 }
 #[api()]
 #[derive(Serialize, Deserialize)]
-#[allow(non_camel_case_types)]
 #[serde(rename_all = "kebab-case")]
 /// Deletable property name
 pub enum DeletableProperty {
     /// Delete export-slots.
-    export_slots,
+    ExportSlots,
 }
 
 #[api(
@@ -192,7 +191,7 @@ pub fn update_changer(
     if let Some(delete) = delete {
         for delete_prop in delete {
             match delete_prop {
-                DeletableProperty::export_slots => {
+                DeletableProperty::ExportSlots => {
                     data.export_slots = None;
                 }
             }
index 677650b985f84c02cbc1bacf0c7a1a6cd2316c97..5e013c39d3057a50f5612b1dbe3c3ee0965b0ced 100644 (file)
@@ -165,37 +165,36 @@ pub fn read_datastore(
 #[api()]
 #[derive(Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case")]
-#[allow(non_camel_case_types)]
 /// Deletable property name
 pub enum DeletableProperty {
     /// Delete the comment property.
-    comment,
+    Comment,
     /// Delete the garbage collection schedule.
-    gc_schedule,
+    GcSchedule,
     /// Delete the prune job schedule.
-    prune_schedule,
+    PruneSchedule,
     /// Delete the keep-last property
-    keep_last,
+    KeepLast,
     /// Delete the keep-hourly property
-    keep_hourly,
+    KeepHourly,
     /// Delete the keep-daily property
-    keep_daily,
+    KeepDaily,
     /// Delete the keep-weekly property
-    keep_weekly,
+    KeepWeekly,
     /// Delete the keep-monthly property
-    keep_monthly,
+    KeepMonthly,
     /// Delete the keep-yearly property
-    keep_yearly,
+    KeepYearly,
     /// Delete the verify-new property
-    verify_new,
+    VerifyNew,
     /// Delete the notify-user property
-    notify_user,
+    NotifyUser,
     /// Delete the notify property
-    notify,
+    Notify,
     /// Delete the tuning property
-    tuning,
+    Tuning,
     /// Delete the maintenance-mode property
-    maintenance_mode,
+    MaintenanceMode,
 }
 
 #[api(
@@ -249,46 +248,46 @@ pub fn update_datastore(
     if let Some(delete) = delete {
         for delete_prop in delete {
             match delete_prop {
-                DeletableProperty::comment => {
+                DeletableProperty::Comment => {
                     data.comment = None;
                 }
-                DeletableProperty::gc_schedule => {
+                DeletableProperty::GcSchedule => {
                     data.gc_schedule = None;
                 }
-                DeletableProperty::prune_schedule => {
+                DeletableProperty::PruneSchedule => {
                     data.prune_schedule = None;
                 }
-                DeletableProperty::keep_last => {
+                DeletableProperty::KeepLast => {
                     data.keep.keep_last = None;
                 }
-                DeletableProperty::keep_hourly => {
+                DeletableProperty::KeepHourly => {
                     data.keep.keep_hourly = None;
                 }
-                DeletableProperty::keep_daily => {
+                DeletableProperty::KeepDaily => {
                     data.keep.keep_daily = None;
                 }
-                DeletableProperty::keep_weekly => {
+                DeletableProperty::KeepWeekly => {
                     data.keep.keep_weekly = None;
                 }
-                DeletableProperty::keep_monthly => {
+                DeletableProperty::KeepMonthly => {
                     data.keep.keep_monthly = None;
                 }
-                DeletableProperty::keep_yearly => {
+                DeletableProperty::KeepYearly => {
                     data.keep.keep_yearly = None;
                 }
-                DeletableProperty::verify_new => {
+                DeletableProperty::VerifyNew => {
                     data.verify_new = None;
                 }
-                DeletableProperty::notify => {
+                DeletableProperty::Notify => {
                     data.notify = None;
                 }
-                DeletableProperty::notify_user => {
+                DeletableProperty::NotifyUser => {
                     data.notify_user = None;
                 }
-                DeletableProperty::tuning => {
+                DeletableProperty::Tuning => {
                     data.tuning = None;
                 }
-                DeletableProperty::maintenance_mode => {
+                DeletableProperty::MaintenanceMode => {
                     data.maintenance_mode = None;
                 }
             }
index 5de84d0fc53b6b4a021c8047fbc96700936759b6..02589aaf5d241d49191417af8d95d00b5313645a 100644 (file)
@@ -134,14 +134,13 @@ pub fn list_drives(
 
 #[api()]
 #[derive(Serialize, Deserialize)]
-#[allow(non_camel_case_types)]
 #[serde(rename_all = "kebab-case")]
 /// Deletable property name
 pub enum DeletableProperty {
     /// Delete the changer property.
-    changer,
+    Changer,
     /// Delete the changer-drivenum property.
-    changer_drivenum,
+    ChangerDrivenum,
 }
 
 #[api(
@@ -195,11 +194,11 @@ pub fn update_drive(
     if let Some(delete) = delete {
         for delete_prop in delete {
             match delete_prop {
-                DeletableProperty::changer => {
+                DeletableProperty::Changer => {
                     data.changer = None;
                     data.changer_drivenum = None;
                 }
-                DeletableProperty::changer_drivenum => {
+                DeletableProperty::ChangerDrivenum => {
                     data.changer_drivenum = None;
                 }
             }
index 9833db525d5978973e44d89e97b9bd8b4946e601..79e2e9c5aa0a7275760c0d29b243b4d2e2caed95 100644 (file)
@@ -103,19 +103,18 @@ pub fn get_config(name: String) -> Result<MediaPoolConfig, Error> {
 
 #[api()]
 #[derive(Serialize, Deserialize)]
-#[allow(non_camel_case_types)]
 /// Deletable property name
 pub enum DeletableProperty {
     /// Delete media set allocation policy.
-    allocation,
+    Allocation,
     /// Delete pool retention policy
-    retention,
+    Retention,
     /// Delete media set naming template
-    template,
+    Template,
     /// Delete encryption fingerprint
-    encrypt,
+    Encrypt,
     /// Delete comment
-    comment,
+    Comment,
 }
 
 #[api(
@@ -158,19 +157,19 @@ pub fn update_pool(
     if let Some(delete) = delete {
         for delete_prop in delete {
             match delete_prop {
-                DeletableProperty::allocation => {
+                DeletableProperty::Allocation => {
                     data.allocation = None;
                 }
-                DeletableProperty::retention => {
+                DeletableProperty::Retention => {
                     data.retention = None;
                 }
-                DeletableProperty::template => {
+                DeletableProperty::Template => {
                     data.template = None;
                 }
-                DeletableProperty::encrypt => {
+                DeletableProperty::Encrypt => {
                     data.encrypt = None;
                 }
-                DeletableProperty::comment => {
+                DeletableProperty::Comment => {
                     data.comment = None;
                 }
             }
index 1646699db6d3881c9a81573aa156d57fe2b27e1f..fb97b3e1633e869d3ff67c92b53f006a0ba3e792 100644 (file)
@@ -133,15 +133,14 @@ pub fn read_remote(
 
 #[api()]
 #[derive(Serialize, Deserialize)]
-#[allow(non_camel_case_types)]
 /// Deletable property name
 pub enum DeletableProperty {
     /// Delete the comment property.
-    comment,
+    Comment,
     /// Delete the fingerprint property.
-    fingerprint,
+    Fingerprint,
     /// Delete the port property.
-    port,
+    Port,
 }
 
 #[api(
@@ -200,13 +199,13 @@ pub fn update_remote(
     if let Some(delete) = delete {
         for delete_prop in delete {
             match delete_prop {
-                DeletableProperty::comment => {
+                DeletableProperty::Comment => {
                     data.config.comment = None;
                 }
-                DeletableProperty::fingerprint => {
+                DeletableProperty::Fingerprint => {
                     data.config.fingerprint = None;
                 }
-                DeletableProperty::port => {
+                DeletableProperty::Port => {
                     data.config.port = None;
                 }
             }
index dc08081673e45e49c0060e5e057b02b155275d01..bd7373df09375d165198cc84d65d1797e4a30b50 100644 (file)
@@ -189,33 +189,32 @@ pub fn read_sync_job(id: String, rpcenv: &mut dyn RpcEnvironment) -> Result<Sync
 #[api()]
 #[derive(Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case")]
-#[allow(non_camel_case_types)]
 /// Deletable property name
 pub enum DeletableProperty {
     /// Delete the owner property.
-    owner,
+    Owner,
     /// Delete the comment property.
-    comment,
+    Comment,
     /// Delete the job schedule.
-    schedule,
+    Schedule,
     /// Delete the remove-vanished flag.
-    remove_vanished,
+    RemoveVanished,
     /// Delete the group_filter property.
-    group_filter,
+    GroupFilter,
     /// Delete the rate_in property.
-    rate_in,
+    RateIn,
     /// Delete the burst_in property.
-    burst_in,
+    BurstIn,
     /// Delete the rate_out property.
-    rate_out,
+    RateOut,
     /// Delete the burst_out property.
-    burst_out,
+    BurstOut,
     /// Delete the ns property,
-    ns,
+    Ns,
     /// Delete the remote_ns property,
-    remote_ns,
+    RemoteNs,
     /// Delete the max_depth property,
-    max_depth,
+    MaxDepth,
 }
 
 #[api(
@@ -274,40 +273,40 @@ pub fn update_sync_job(
     if let Some(delete) = delete {
         for delete_prop in delete {
             match delete_prop {
-                DeletableProperty::owner => {
+                DeletableProperty::Owner => {
                     data.owner = None;
                 }
-                DeletableProperty::comment => {
+                DeletableProperty::Comment => {
                     data.comment = None;
                 }
-                DeletableProperty::schedule => {
+                DeletableProperty::Schedule => {
                     data.schedule = None;
                 }
-                DeletableProperty::remove_vanished => {
+                DeletableProperty::RemoveVanished => {
                     data.remove_vanished = None;
                 }
-                DeletableProperty::group_filter => {
+                DeletableProperty::GroupFilter => {
                     data.group_filter = None;
                 }
-                DeletableProperty::rate_in => {
+                DeletableProperty::RateIn => {
                     data.limit.rate_in = None;
                 }
-                DeletableProperty::rate_out => {
+                DeletableProperty::RateOut => {
                     data.limit.rate_out = None;
                 }
-                DeletableProperty::burst_in => {
+                DeletableProperty::BurstIn => {
                     data.limit.burst_in = None;
                 }
-                DeletableProperty::burst_out => {
+                DeletableProperty::BurstOut => {
                     data.limit.burst_out = None;
                 }
-                DeletableProperty::ns => {
+                DeletableProperty::Ns => {
                     data.ns = None;
                 }
-                DeletableProperty::remote_ns => {
+                DeletableProperty::RemoteNs => {
                     data.remote_ns = None;
                 }
-                DeletableProperty::max_depth => {
+                DeletableProperty::MaxDepth => {
                     data.max_depth = None;
                 }
             }
index 56903643d8fad85b0bea866eed7f132720dcc0d2..30ea40ecfc24522cdd37fdc4663aec8320414cc7 100644 (file)
@@ -101,22 +101,21 @@ pub fn read_traffic_control(
 
 #[api()]
 #[derive(Serialize, Deserialize)]
-#[allow(non_camel_case_types)]
 #[serde(rename_all = "kebab-case")]
 /// Deletable property name
 pub enum DeletableProperty {
     /// Delete the rate_in property.
-    rate_in,
+    RateIn,
     /// Delete the burst_in property.
-    burst_in,
+    BurstIn,
     /// Delete the rate_out property.
-    rate_out,
+    RateOut,
     /// Delete the burst_out property.
-    burst_out,
+    BurstOut,
     /// Delete the comment property.
-    comment,
+    Comment,
     /// Delete the timeframe property
-    timeframe,
+    Timeframe,
 }
 
 // fixme: use  TrafficControlUpdater
@@ -170,22 +169,22 @@ pub fn update_traffic_control(
     if let Some(delete) = delete {
         for delete_prop in delete {
             match delete_prop {
-                DeletableProperty::rate_in => {
+                DeletableProperty::RateIn => {
                     data.limit.rate_in = None;
                 }
-                DeletableProperty::rate_out => {
+                DeletableProperty::RateOut => {
                     data.limit.rate_out = None;
                 }
-                DeletableProperty::burst_in => {
+                DeletableProperty::BurstIn => {
                     data.limit.burst_in = None;
                 }
-                DeletableProperty::burst_out => {
+                DeletableProperty::BurstOut => {
                     data.limit.burst_out = None;
                 }
-                DeletableProperty::comment => {
+                DeletableProperty::Comment => {
                     data.comment = None;
                 }
-                DeletableProperty::timeframe => {
+                DeletableProperty::Timeframe => {
                     data.timeframe = None;
                 }
             }
index 1ebf4efb62ade5c06da7af02901f76e0e4ff3213..86a73cf8687f967c390ce75179b6acdb2be99e03 100644 (file)
@@ -37,37 +37,36 @@ pub fn get_node_config(rpcenv: &mut dyn RpcEnvironment) -> Result<NodeConfig, Er
 #[api()]
 #[derive(Serialize, Deserialize)]
 #[serde(rename_all = "kebab-case")]
-#[allow(non_camel_case_types)]
 /// Deletable property name
 pub enum DeletableProperty {
     /// Delete the acme property.
-    acme,
+    Acme,
     /// Delete the acmedomain0 property.
-    acmedomain0,
+    Acmedomain0,
     /// Delete the acmedomain1 property.
-    acmedomain1,
+    Acmedomain1,
     /// Delete the acmedomain2 property.
-    acmedomain2,
+    Acmedomain2,
     /// Delete the acmedomain3 property.
-    acmedomain3,
+    Acmedomain3,
     /// Delete the acmedomain4 property.
-    acmedomain4,
+    Acmedomain4,
     /// Delete the http-proxy property.
-    http_proxy,
+    HttpProxy,
     /// Delete the email-from property.
-    email_from,
+    EmailFrom,
     /// Delete the ciphers-tls-1.3 property.
     #[serde(rename = "ciphers-tls-1.3")]
-    ciphers_tls_1_3,
+    CiphersTls1_3,
     /// Delete the ciphers-tls-1.2 property.
     #[serde(rename = "ciphers-tls-1.2")]
-    ciphers_tls_1_2,
+    CiphersTls1_2,
     /// Delete the default-lang property.
-    default_lang,
+    DefaultLang,
     /// Delete any description
-    description,
+    Description,
     /// Delete the task-log-max-days property
-    task_log_max_days,
+    TaskLogMaxDays,
 }
 
 #[api(
@@ -117,43 +116,43 @@ pub fn update_node_config(
     if let Some(delete) = delete {
         for delete_prop in delete {
             match delete_prop {
-                DeletableProperty::acme => {
+                DeletableProperty::Acme => {
                     config.acme = None;
                 }
-                DeletableProperty::acmedomain0 => {
+                DeletableProperty::Acmedomain0 => {
                     config.acmedomain0 = None;
                 }
-                DeletableProperty::acmedomain1 => {
+                DeletableProperty::Acmedomain1 => {
                     config.acmedomain1 = None;
                 }
-                DeletableProperty::acmedomain2 => {
+                DeletableProperty::Acmedomain2 => {
                     config.acmedomain2 = None;
                 }
-                DeletableProperty::acmedomain3 => {
+                DeletableProperty::Acmedomain3 => {
                     config.acmedomain3 = None;
                 }
-                DeletableProperty::acmedomain4 => {
+                DeletableProperty::Acmedomain4 => {
                     config.acmedomain4 = None;
                 }
-                DeletableProperty::http_proxy => {
+                DeletableProperty::HttpProxy => {
                     config.http_proxy = None;
                 }
-                DeletableProperty::email_from => {
+                DeletableProperty::EmailFrom => {
                     config.email_from = None;
                 }
-                DeletableProperty::ciphers_tls_1_3 => {
+                DeletableProperty::CiphersTls1_3 => {
                     config.ciphers_tls_1_3 = None;
                 }
-                DeletableProperty::ciphers_tls_1_2 => {
+                DeletableProperty::CiphersTls1_2 => {
                     config.ciphers_tls_1_2 = None;
                 }
-                DeletableProperty::default_lang => {
+                DeletableProperty::DefaultLang => {
                     config.default_lang = None;
                 }
-                DeletableProperty::description => {
+                DeletableProperty::Description => {
                     config.description = None;
                 }
-                DeletableProperty::task_log_max_days => {
+                DeletableProperty::TaskLogMaxDays => {
                     config.task_log_max_days = None;
                 }
             }
index bc97b8be351868a7b1c3a1a90f193fa1cadaa9f3..6804a102f34e4b1db2b2cc9f88ecdb877b400248 100644 (file)
@@ -22,15 +22,14 @@ static RESOLV_CONF_FN: &str = "/etc/resolv.conf";
 
 #[api()]
 #[derive(Serialize, Deserialize)]
-#[allow(non_camel_case_types)]
 /// Deletable property name
 pub enum DeletableProperty {
     /// Delete first nameserver entry
-    dns1,
+    Dns1,
     /// Delete second nameserver entry
-    dns2,
+    Dns2,
     /// Delete third nameserver entry
-    dns3,
+    Dns3,
 }
 
 pub fn read_etc_resolv_conf() -> Result<Value, Error> {
@@ -146,13 +145,13 @@ pub fn update_dns(
         for delete_prop in delete {
             let config = config.as_object_mut().unwrap();
             match delete_prop {
-                DeletableProperty::dns1 => {
+                DeletableProperty::Dns1 => {
                     config.remove("dns1");
                 }
-                DeletableProperty::dns2 => {
+                DeletableProperty::Dns2 => {
                     config.remove("dns2");
                 }
-                DeletableProperty::dns3 => {
+                DeletableProperty::Dns3 => {
                     config.remove("dns3");
                 }
             }
index d4be3b46f2b9c368d0dbe6a3918dedc1fce073dd..fef0a6cbbebb251079d7e2cdd2214ad4d632e5e1 100644 (file)
@@ -356,13 +356,13 @@ pub fn create_interface(
             if let Some(mode) = bond_mode {
                 interface.bond_mode = bond_mode;
                 if bond_primary.is_some() {
-                    if mode != LinuxBondMode::active_backup {
+                    if mode != LinuxBondMode::ActiveBackup {
                         bail!("bond-primary is only valid with Active/Backup mode");
                     }
                     interface.bond_primary = bond_primary;
                 }
                 if bond_xmit_hash_policy.is_some() {
-                    if mode != LinuxBondMode::ieee802_3ad && mode != LinuxBondMode::balance_xor {
+                    if mode != LinuxBondMode::Ieee802_3ad && mode != LinuxBondMode::BalanceXor {
                         bail!("bond_xmit_hash_policy is only valid with LACP(802.3ad) or balance-xor mode");
                     }
                     interface.bond_xmit_hash_policy = bond_xmit_hash_policy;
@@ -400,40 +400,39 @@ pub fn create_interface(
 
 #[api()]
 #[derive(Serialize, Deserialize)]
-#[allow(non_camel_case_types)]
 /// Deletable property name
 pub enum DeletableProperty {
     /// Delete the IPv4 address property.
-    cidr,
+    Cidr,
     /// Delete the IPv6 address property.
-    cidr6,
+    Cidr6,
     /// Delete the IPv4 gateway property.
-    gateway,
+    Gateway,
     /// Delete the IPv6 gateway property.
-    gateway6,
+    Gateway6,
     /// Delete the whole IPv4 configuration entry.
-    method,
+    Method,
     /// Delete the whole IPv6 configuration entry.
-    method6,
+    Method6,
     /// Delete IPv4 comments
-    comments,
+    Comments,
     /// Delete IPv6 comments
-    comments6,
+    Comments6,
     /// Delete mtu.
-    mtu,
+    Mtu,
     /// Delete autostart flag
-    autostart,
+    Autostart,
     /// Delete bridge ports (set to 'none')
-    bridge_ports,
+    BridgePorts,
     /// Delete bridge-vlan-aware flag
-    bridge_vlan_aware,
+    BridgeVlanAware,
     /// Delete bond-slaves (set to 'none')
-    slaves,
+    Slaves,
     /// Delete bond-primary
     #[serde(rename = "bond-primary")]
-    bond_primary,
+    BondPrimary,
     /// Delete bond transmit hash policy
-    bond_xmit_hash_policy,
+    BondXmitHashPolicy,
 }
 
 #[api(
@@ -595,49 +594,49 @@ pub fn update_interface(
     if let Some(delete) = delete {
         for delete_prop in delete {
             match delete_prop {
-                DeletableProperty::cidr => {
+                DeletableProperty::Cidr => {
                     interface.cidr = None;
                 }
-                DeletableProperty::cidr6 => {
+                DeletableProperty::Cidr6 => {
                     interface.cidr6 = None;
                 }
-                DeletableProperty::gateway => {
+                DeletableProperty::Gateway => {
                     interface.gateway = None;
                 }
-                DeletableProperty::gateway6 => {
+                DeletableProperty::Gateway6 => {
                     interface.gateway6 = None;
                 }
-                DeletableProperty::method => {
+                DeletableProperty::Method => {
                     interface.method = None;
                 }
-                DeletableProperty::method6 => {
+                DeletableProperty::Method6 => {
                     interface.method6 = None;
                 }
-                DeletableProperty::comments => {
+                DeletableProperty::Comments => {
                     interface.comments = None;
                 }
-                DeletableProperty::comments6 => {
+                DeletableProperty::Comments6 => {
                     interface.comments6 = None;
                 }
-                DeletableProperty::mtu => {
+                DeletableProperty::Mtu => {
                     interface.mtu = None;
                 }
-                DeletableProperty::autostart => {
+                DeletableProperty::Autostart => {
                     interface.autostart = false;
                 }
-                DeletableProperty::bridge_ports => {
+                DeletableProperty::BridgePorts => {
                     set_bridge_ports(interface, Vec::new())?;
                 }
-                DeletableProperty::bridge_vlan_aware => {
+                DeletableProperty::BridgeVlanAware => {
                     interface.bridge_vlan_aware = None;
                 }
-                DeletableProperty::slaves => {
+                DeletableProperty::Slaves => {
                     set_bond_slaves(interface, Vec::new())?;
                 }
-                DeletableProperty::bond_primary => {
+                DeletableProperty::BondPrimary => {
                     interface.bond_primary = None;
                 }
-                DeletableProperty::bond_xmit_hash_policy => interface.bond_xmit_hash_policy = None,
+                DeletableProperty::BondXmitHashPolicy => interface.bond_xmit_hash_policy = None,
             }
         }
     }
@@ -668,13 +667,13 @@ pub fn update_interface(
     if let Some(mode) = bond_mode {
         interface.bond_mode = bond_mode;
         if bond_primary.is_some() {
-            if mode != LinuxBondMode::active_backup {
+            if mode != LinuxBondMode::ActiveBackup {
                 bail!("bond-primary is only valid with Active/Backup mode");
             }
             interface.bond_primary = bond_primary;
         }
         if bond_xmit_hash_policy.is_some() {
-            if mode != LinuxBondMode::ieee802_3ad && mode != LinuxBondMode::balance_xor {
+            if mode != LinuxBondMode::Ieee802_3ad && mode != LinuxBondMode::BalanceXor {
                 bail!("bond_xmit_hash_policy is only valid with LACP(802.3ad) or balance-xor mode");
             }
             interface.bond_xmit_hash_policy = bond_xmit_hash_policy;