feat(models): implement typed response models for PVE 8.x and 9.x

Add C# model classes for all PVE API resources: nodes, VMs, VM config,
containers, storage, network interfaces, SDN zones/vnets, users, roles,
permissions, snapshots, tasks, and cluster status. All models use dual
JSON attributes (System.Text.Json + Newtonsoft.Json), nullable optional
fields, and human-readable ToString() overrides.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Clint Branham
2026-03-17 15:45:06 -05:00
parent 2c7e90d185
commit 4ac38f7714
20 changed files with 2085 additions and 0 deletions
@@ -0,0 +1,41 @@
using System.Text.Json.Serialization;
using Newtonsoft.Json;
namespace PSProxmoxVE.Core.Models.Users;
/// <summary>
/// Represents a Proxmox VE role as returned by the /access/roles endpoint.
/// Roles are named collections of privileges that can be assigned to users or groups via ACLs.
/// </summary>
public class PveRole
{
/// <summary>
/// The unique role identifier (e.g., "Administrator", "PVEVMAdmin", "PVEDatastoreUser").
/// </summary>
[JsonPropertyName("roleid")]
[JsonProperty("roleid")]
public string RoleId { get; set; } = string.Empty;
/// <summary>
/// Comma-separated list of privilege strings assigned to this role
/// (e.g., "VM.Allocate,VM.Config.Disk,Datastore.AllocateSpace").
/// </summary>
[JsonPropertyName("privs")]
[JsonProperty("privs")]
public string? Privileges { get; set; }
/// <summary>
/// Indicates whether this is a built-in / special role (1) that cannot be deleted,
/// or a custom role (0).
/// </summary>
[JsonPropertyName("special")]
[JsonProperty("special")]
public int? Special { get; set; }
/// <inheritdoc />
public override string ToString()
{
var specialStr = Special is 1 ? " [built-in]" : string.Empty;
return $"Role: {RoleId}{specialStr} | Privs: {Privileges ?? "none"}";
}
}