mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-08-12 23:26:53 +00:00
refactor: remove redundant System.Text.Json attributes from models
The codebase uses Newtonsoft.Json (JObject.Parse + ToObject<T>) exclusively. Removed all [JsonPropertyName] attributes and [System.Text.Json.Serialization. JsonIgnore] attributes from 41 model files, along with the now-unused using System.Text.Json.Serialization imports. [JsonProperty] (Newtonsoft) attributes remain as the sole serialization annotations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PSProxmoxVE.Core.Models.Network;
|
||||
@@ -12,105 +11,90 @@ public class PveNetwork
|
||||
/// <summary>
|
||||
/// The interface name (e.g., "vmbr0", "eth0", "bond0").
|
||||
/// </summary>
|
||||
[JsonPropertyName("iface")]
|
||||
[JsonProperty("iface")]
|
||||
public string Iface { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The interface type (e.g., "bridge", "bond", "eth", "vlan", "OVSBridge").
|
||||
/// </summary>
|
||||
[JsonPropertyName("type")]
|
||||
[JsonProperty("type")]
|
||||
public string? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The IPv4 address assigned to this interface.
|
||||
/// </summary>
|
||||
[JsonPropertyName("address")]
|
||||
[JsonProperty("address")]
|
||||
public string? Address { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The IPv4 netmask for this interface.
|
||||
/// </summary>
|
||||
[JsonPropertyName("netmask")]
|
||||
[JsonProperty("netmask")]
|
||||
public string? Netmask { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The IPv4 default gateway associated with this interface.
|
||||
/// </summary>
|
||||
[JsonPropertyName("gateway")]
|
||||
[JsonProperty("gateway")]
|
||||
public string? Gateway { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Space-separated list of physical ports attached to this bridge.
|
||||
/// </summary>
|
||||
[JsonPropertyName("bridge_ports")]
|
||||
[JsonProperty("bridge_ports")]
|
||||
public string? BridgePorts { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Space-separated list of slave interfaces for bond/team interfaces.
|
||||
/// </summary>
|
||||
[JsonPropertyName("slaves")]
|
||||
[JsonProperty("slaves")]
|
||||
public string? BondSlaves { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// VLAN ID for VLAN sub-interfaces.
|
||||
/// </summary>
|
||||
[JsonPropertyName("vlan-id")]
|
||||
[JsonProperty("vlan-id")]
|
||||
public int? VlanId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The Maximum Transmission Unit in bytes.
|
||||
/// </summary>
|
||||
[JsonPropertyName("mtu")]
|
||||
[JsonProperty("mtu")]
|
||||
public int? Mtu { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the interface is brought up automatically at boot (1) or not (0).
|
||||
/// </summary>
|
||||
[JsonPropertyName("autostart")]
|
||||
[JsonProperty("autostart")]
|
||||
public int? Autostart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the interface is currently active/up (1) or down (0).
|
||||
/// </summary>
|
||||
[JsonPropertyName("active")]
|
||||
[JsonProperty("active")]
|
||||
public int? Active { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional comment or description for this interface.
|
||||
/// </summary>
|
||||
[JsonPropertyName("comments")]
|
||||
[JsonProperty("comments")]
|
||||
public string? Comments { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// IPv4 address in CIDR notation (e.g., "192.168.1.1/24").
|
||||
/// </summary>
|
||||
[JsonPropertyName("cidr")]
|
||||
[JsonProperty("cidr")]
|
||||
public string? Cidr { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether VLAN-aware bridging is enabled on this bridge (1) or not (0).
|
||||
/// </summary>
|
||||
[JsonPropertyName("bridge_vlan_aware")]
|
||||
[JsonProperty("bridge_vlan_aware")]
|
||||
public int? BridgeVlanAware { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The bonding mode for bond interfaces (e.g., "active-backup", "802.3ad", "balance-rr").
|
||||
/// </summary>
|
||||
[JsonPropertyName("bond_mode")]
|
||||
[JsonProperty("bond_mode")]
|
||||
public string? BondMode { get; set; }
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PSProxmoxVE.Core.Models.Network;
|
||||
@@ -12,35 +11,30 @@ public class PveSdnController
|
||||
/// <summary>
|
||||
/// The controller identifier.
|
||||
/// </summary>
|
||||
[JsonPropertyName("controller")]
|
||||
[JsonProperty("controller")]
|
||||
public string Controller { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The controller type (e.g. "evpn", "bgp").
|
||||
/// </summary>
|
||||
[JsonPropertyName("type")]
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The Autonomous System Number for BGP/EVPN.
|
||||
/// </summary>
|
||||
[JsonPropertyName("asn")]
|
||||
[JsonProperty("asn")]
|
||||
public int? Asn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Comma-separated list of BGP peer addresses.
|
||||
/// </summary>
|
||||
[JsonPropertyName("peers")]
|
||||
[JsonProperty("peers")]
|
||||
public string? Peers { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The node this controller is configured on.
|
||||
/// </summary>
|
||||
[JsonPropertyName("node")]
|
||||
[JsonProperty("node")]
|
||||
public string? Node { get; set; }
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PSProxmoxVE.Core.Models.Network;
|
||||
@@ -12,42 +11,36 @@ public class PveSdnDns
|
||||
/// <summary>
|
||||
/// The DNS plugin identifier.
|
||||
/// </summary>
|
||||
[JsonPropertyName("dns")]
|
||||
[JsonProperty("dns")]
|
||||
public string Dns { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The DNS plugin type (e.g. "powerdns").
|
||||
/// </summary>
|
||||
[JsonPropertyName("type")]
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The URL of the DNS service API.
|
||||
/// </summary>
|
||||
[JsonPropertyName("url")]
|
||||
[JsonProperty("url")]
|
||||
public string? Url { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The API key for the DNS service.
|
||||
/// </summary>
|
||||
[JsonPropertyName("key")]
|
||||
[JsonProperty("key")]
|
||||
public string? Key { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The IPv6 reverse zone mask length.
|
||||
/// </summary>
|
||||
[JsonPropertyName("reversemaskv6")]
|
||||
[JsonProperty("reversemaskv6")]
|
||||
public int? ReverseMaskV6 { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The TTL (time-to-live) for DNS records.
|
||||
/// </summary>
|
||||
[JsonPropertyName("ttl")]
|
||||
[JsonProperty("ttl")]
|
||||
public int? Ttl { get; set; }
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PSProxmoxVE.Core.Models.Network;
|
||||
@@ -12,35 +11,30 @@ public class PveSdnIpam
|
||||
/// <summary>
|
||||
/// The IPAM plugin identifier.
|
||||
/// </summary>
|
||||
[JsonPropertyName("ipam")]
|
||||
[JsonProperty("ipam")]
|
||||
public string Ipam { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The IPAM type (e.g. "pve", "netbox", "phpipam").
|
||||
/// </summary>
|
||||
[JsonPropertyName("type")]
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The URL of the external IPAM service (for netbox/phpipam types).
|
||||
/// </summary>
|
||||
[JsonPropertyName("url")]
|
||||
[JsonProperty("url")]
|
||||
public string? Url { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The API token for the external IPAM service.
|
||||
/// </summary>
|
||||
[JsonPropertyName("token")]
|
||||
[JsonProperty("token")]
|
||||
public string? Token { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The configuration section identifier.
|
||||
/// </summary>
|
||||
[JsonPropertyName("section")]
|
||||
[JsonProperty("section")]
|
||||
public int? Section { get; set; }
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PSProxmoxVE.Core.Models.Network;
|
||||
@@ -13,56 +12,48 @@ public class PveSdnSubnet
|
||||
/// <summary>
|
||||
/// The subnet CIDR (e.g. "10.0.0.0/24" or "2001:db8::/64").
|
||||
/// </summary>
|
||||
[JsonPropertyName("subnet")]
|
||||
[JsonProperty("subnet")]
|
||||
public string Subnet { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The VNet this subnet belongs to.
|
||||
/// </summary>
|
||||
[JsonPropertyName("vnet")]
|
||||
[JsonProperty("vnet")]
|
||||
public string? Vnet { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The gateway IP address for this subnet.
|
||||
/// </summary>
|
||||
[JsonPropertyName("gateway")]
|
||||
[JsonProperty("gateway")]
|
||||
public string? Gateway { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether SNAT (source NAT) is enabled for this subnet.
|
||||
/// </summary>
|
||||
[JsonPropertyName("snat")]
|
||||
[JsonProperty("snat")]
|
||||
public int? Snat { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The DNS zone name for this subnet.
|
||||
/// </summary>
|
||||
[JsonPropertyName("dnszoneprefix")]
|
||||
[JsonProperty("dnszoneprefix")]
|
||||
public string? DnsZonePrefix { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The DHCP range configurations for automatic IP assignment.
|
||||
/// </summary>
|
||||
[JsonPropertyName("dhcp-range")]
|
||||
[JsonProperty("dhcp-range")]
|
||||
public string[]? DhcpRanges { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The subnet type identifier used internally by PVE.
|
||||
/// </summary>
|
||||
[JsonPropertyName("type")]
|
||||
[JsonProperty("type")]
|
||||
public string? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional comment or description.
|
||||
/// </summary>
|
||||
[JsonPropertyName("comments")]
|
||||
[JsonProperty("comments")]
|
||||
public string? Comments { get; set; }
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PSProxmoxVE.Core.Models.Network;
|
||||
@@ -13,42 +12,36 @@ public class PveSdnVnet
|
||||
/// <summary>
|
||||
/// The unique VNet identifier.
|
||||
/// </summary>
|
||||
[JsonPropertyName("vnet")]
|
||||
[JsonProperty("vnet")]
|
||||
public string Vnet { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The SDN zone this VNet belongs to.
|
||||
/// </summary>
|
||||
[JsonPropertyName("zone")]
|
||||
[JsonProperty("zone")]
|
||||
public string? Zone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The VLAN or VXLAN tag associated with this VNet.
|
||||
/// </summary>
|
||||
[JsonPropertyName("tag")]
|
||||
[JsonProperty("tag")]
|
||||
public int? Tag { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An optional human-readable alias for this VNet.
|
||||
/// </summary>
|
||||
[JsonPropertyName("alias")]
|
||||
[JsonProperty("alias")]
|
||||
public string? Alias { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether VLAN-aware mode is enabled on this VNet (1) or not (0).
|
||||
/// </summary>
|
||||
[JsonPropertyName("vlanaware")]
|
||||
[JsonProperty("vlanaware")]
|
||||
public int? VlanAware { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional comment or description for this SDN VNet.
|
||||
/// </summary>
|
||||
[JsonPropertyName("comments")]
|
||||
[JsonProperty("comments")]
|
||||
public string? Comments { get; set; }
|
||||
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
using System.Text.Json.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PSProxmoxVE.Core.Models.Network;
|
||||
@@ -13,70 +12,60 @@ public class PveSdnZone
|
||||
/// <summary>
|
||||
/// The unique zone identifier.
|
||||
/// </summary>
|
||||
[JsonPropertyName("zone")]
|
||||
[JsonProperty("zone")]
|
||||
public string Zone { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The zone type (e.g., "simple", "vlan", "qinq", "vxlan", "evpn").
|
||||
/// </summary>
|
||||
[JsonPropertyName("type")]
|
||||
[JsonProperty("type")]
|
||||
public string? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The DNS server address associated with this zone.
|
||||
/// </summary>
|
||||
[JsonPropertyName("dns")]
|
||||
[JsonProperty("dns")]
|
||||
public string? Dns { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The reverse DNS zone name for this SDN zone.
|
||||
/// </summary>
|
||||
[JsonPropertyName("reversedns")]
|
||||
[JsonProperty("reversedns")]
|
||||
public string? Reversedns { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The DNS zone name used for forward lookups.
|
||||
/// </summary>
|
||||
[JsonPropertyName("dnszone")]
|
||||
[JsonProperty("dnszone")]
|
||||
public string? DnsZone { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The IPAM plugin to use for IP address management in this zone.
|
||||
/// </summary>
|
||||
[JsonPropertyName("ipam")]
|
||||
[JsonProperty("ipam")]
|
||||
public string? Ipam { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The Maximum Transmission Unit in bytes for this zone.
|
||||
/// </summary>
|
||||
[JsonPropertyName("mtu")]
|
||||
[JsonProperty("mtu")]
|
||||
public int? Mtu { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Comma-separated list of nodes that participate in this SDN zone.
|
||||
/// </summary>
|
||||
[JsonPropertyName("nodes")]
|
||||
[JsonProperty("nodes")]
|
||||
public string? Nodes { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Indicates whether the zone has pending (unapplied) configuration changes (1) or not (0).
|
||||
/// </summary>
|
||||
[JsonPropertyName("pending")]
|
||||
[JsonProperty("pending")]
|
||||
public int? Pending { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Optional comment or description for this SDN zone.
|
||||
/// </summary>
|
||||
[JsonPropertyName("comments")]
|
||||
[JsonProperty("comments")]
|
||||
public string? Comments { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user