using System.Text.Json.Serialization; using Newtonsoft.Json; namespace PSProxmoxVE.Core.Models.Firewall; /// /// Represents Proxmox VE firewall options as returned by /// the firewall/options endpoints at cluster, node, VM, or container level. /// public class PveFirewallOptions { /// /// Whether the firewall is enabled (1) or disabled (0). /// [JsonPropertyName("enable")] [JsonProperty("enable")] public int? Enable { get; set; } /// /// Default policy for incoming traffic (ACCEPT, DROP, REJECT). /// [JsonPropertyName("policy_in")] [JsonProperty("policy_in")] public string? PolicyIn { get; set; } /// /// Default policy for outgoing traffic (ACCEPT, DROP, REJECT). /// [JsonPropertyName("policy_out")] [JsonProperty("policy_out")] public string? PolicyOut { get; set; } /// /// Log level for incoming traffic (nolog, emerg, alert, crit, err, warning, notice, info, debug). /// [JsonPropertyName("log_level_in")] [JsonProperty("log_level_in")] public string? LogLevelIn { get; set; } /// /// Log level for outgoing traffic. /// [JsonPropertyName("log_level_out")] [JsonProperty("log_level_out")] public string? LogLevelOut { get; set; } /// /// Whether to allow DHCP traffic (VM/container level). /// [JsonPropertyName("dhcp")] [JsonProperty("dhcp")] public int? Dhcp { get; set; } /// /// Whether to allow NDP (IPv6 Neighbor Discovery Protocol). /// [JsonPropertyName("ndp")] [JsonProperty("ndp")] public int? Ndp { get; set; } /// /// Whether to allow Router Advertisement. /// [JsonPropertyName("radv")] [JsonProperty("radv")] public int? Radv { get; set; } /// /// Whether to enable MAC address filter (VM/container level). /// [JsonPropertyName("macfilter")] [JsonProperty("macfilter")] public int? MacFilter { get; set; } /// /// Whether to enable IP filter (VM/container level). /// [JsonPropertyName("ipfilter")] [JsonProperty("ipfilter")] public int? IpFilter { get; set; } /// public override string ToString() { var state = Enable == 1 ? "Enabled" : "Disabled"; return $"Firewall: {state} | In: {PolicyIn ?? "N/A"} | Out: {PolicyOut ?? "N/A"}"; } }