mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-08-13 07:36:52 +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,5 +1,4 @@
|
||||
using System;
|
||||
using System.Text.Json.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace PSProxmoxVE.Core.Models.Nodes;
|
||||
@@ -13,91 +12,78 @@ public class PveNodeStatus
|
||||
/// <summary>
|
||||
/// The name of the node.
|
||||
/// </summary>
|
||||
[JsonPropertyName("node")]
|
||||
[JsonProperty("node")]
|
||||
public string Node { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The current status of the node (e.g., "online" or "offline").
|
||||
/// </summary>
|
||||
[JsonPropertyName("status")]
|
||||
[JsonProperty("status")]
|
||||
public string Status { get; set; } = string.Empty;
|
||||
|
||||
/// <summary>
|
||||
/// The total number of CPU cores available on the node.
|
||||
/// </summary>
|
||||
[JsonPropertyName("maxcpu")]
|
||||
[JsonProperty("maxcpu")]
|
||||
public int? CpuCount { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Total memory in bytes available on the node.
|
||||
/// </summary>
|
||||
[JsonPropertyName("maxmem")]
|
||||
[JsonProperty("maxmem")]
|
||||
public long? MemoryTotal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Memory currently in use on the node, in bytes.
|
||||
/// </summary>
|
||||
[JsonPropertyName("mem")]
|
||||
[JsonProperty("mem")]
|
||||
public long? MemoryUsed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Node uptime in seconds.
|
||||
/// </summary>
|
||||
[JsonPropertyName("uptime")]
|
||||
[JsonProperty("uptime")]
|
||||
public long? Uptime { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The version of Proxmox VE running on the node.
|
||||
/// </summary>
|
||||
[JsonPropertyName("pveversion")]
|
||||
[JsonProperty("pveversion")]
|
||||
public string? PveVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The Linux kernel version running on the node.
|
||||
/// </summary>
|
||||
[JsonPropertyName("kversion")]
|
||||
[JsonProperty("kversion")]
|
||||
public string? KernelVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The 1-minute, 5-minute, and 15-minute load averages for the node.
|
||||
/// </summary>
|
||||
[JsonPropertyName("loadavg")]
|
||||
[JsonProperty("loadavg")]
|
||||
public double[]? LoadAverage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Total root filesystem size in bytes.
|
||||
/// </summary>
|
||||
[JsonPropertyName("rootfs.total")]
|
||||
[JsonProperty("rootfs.total")]
|
||||
public long? DiskTotal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used root filesystem space in bytes.
|
||||
/// </summary>
|
||||
[JsonPropertyName("rootfs.used")]
|
||||
[JsonProperty("rootfs.used")]
|
||||
public long? DiskUsed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Current CPU utilization as a fraction between 0.0 and 1.0.
|
||||
/// </summary>
|
||||
[JsonPropertyName("cpu")]
|
||||
[JsonProperty("cpu")]
|
||||
public double? CpuUsage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Memory utilization as a percentage (0–100), computed from MemoryUsed / MemoryTotal.
|
||||
/// </summary>
|
||||
[System.Text.Json.Serialization.JsonIgnore]
|
||||
[Newtonsoft.Json.JsonIgnore]
|
||||
public double? MemoryUsage =>
|
||||
MemoryTotal.HasValue && MemoryTotal.Value > 0 && MemoryUsed.HasValue
|
||||
@@ -107,28 +93,24 @@ public class PveNodeStatus
|
||||
/// <summary>
|
||||
/// Total swap space in bytes.
|
||||
/// </summary>
|
||||
[JsonPropertyName("swap.total")]
|
||||
[JsonProperty("swap.total")]
|
||||
public long? SwapTotal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Used swap space in bytes.
|
||||
/// </summary>
|
||||
[JsonPropertyName("swap.used")]
|
||||
[JsonProperty("swap.used")]
|
||||
public long? SwapUsed { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Total bytes received over the network since boot.
|
||||
/// </summary>
|
||||
[JsonPropertyName("netin")]
|
||||
[JsonProperty("netin")]
|
||||
public long? NetworkIn { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Total bytes transmitted over the network since boot.
|
||||
/// </summary>
|
||||
[JsonPropertyName("netout")]
|
||||
[JsonProperty("netout")]
|
||||
public long? NetworkOut { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user