Refactor IPAM model classes to use records for Address, Subnetwork, Vlan, Vrf, Section, Tag, Domain, Nameserver, and Session; enhance documentation and implement value equality for records.
This commit is contained in:
@@ -1,77 +1,35 @@
|
||||
namespace PS.IPAM;
|
||||
namespace PS.IPAM;
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
/// <summary>
|
||||
/// Represents an IP address entry in phpIPAM.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Address {
|
||||
public int Id { get; }
|
||||
public int SubnetId { get; }
|
||||
public string Ip { get; }
|
||||
public bool IsGateway { get; }
|
||||
public string Description { get; }
|
||||
public string Hostname { get; }
|
||||
public string MAC { get; }
|
||||
public string Owner { get; }
|
||||
public int TagId { get; }
|
||||
public int DeviceId { get; }
|
||||
public string Location { get; }
|
||||
public string Port { get; }
|
||||
public string Note { get; }
|
||||
public DateTime? LastSeen { get; }
|
||||
public bool ExcludePing { get; }
|
||||
public bool PTRignore { get; }
|
||||
public int PTR { get; }
|
||||
public string FirewallAddressObject { get; }
|
||||
public DateTime? EditDate { get; }
|
||||
public int CustomerId { get; }
|
||||
public Object? ExtendedData { get; }
|
||||
|
||||
public Address(
|
||||
int id,
|
||||
int subnetId,
|
||||
string ip,
|
||||
bool is_gateway,
|
||||
string description,
|
||||
string hostname,
|
||||
string mac,
|
||||
string owner,
|
||||
int tag,
|
||||
int deviceId,
|
||||
string location,
|
||||
string port,
|
||||
string note,
|
||||
DateTime? lastSeen,
|
||||
bool excludePing,
|
||||
bool PTRignore,
|
||||
int PTR,
|
||||
string firewallAddressObject,
|
||||
DateTime? editDate,
|
||||
int customer_id,
|
||||
Object? extendedData
|
||||
) {
|
||||
this.Id = id;
|
||||
this.SubnetId = subnetId;
|
||||
this.Ip = ip;
|
||||
this.IsGateway = is_gateway;
|
||||
this.Description = description;
|
||||
this.Hostname = hostname;
|
||||
this.MAC = mac;
|
||||
this.Owner = owner;
|
||||
this.TagId = tag;
|
||||
this.DeviceId = deviceId;
|
||||
this.Location = location;
|
||||
this.Port = port;
|
||||
this.Note = note;
|
||||
this.LastSeen = lastSeen;
|
||||
this.ExcludePing = excludePing;
|
||||
this.PTRignore = PTRignore;
|
||||
this.PTR = PTR;
|
||||
this.FirewallAddressObject = firewallAddressObject;
|
||||
this.EditDate = editDate;
|
||||
this.CustomerId = customer_id;
|
||||
this.ExtendedData = extendedData;
|
||||
}
|
||||
|
||||
public override string ToString() {
|
||||
return this.Ip;
|
||||
}
|
||||
}
|
||||
public sealed record Address(
|
||||
int Id,
|
||||
int SubnetId,
|
||||
string Ip,
|
||||
bool IsGateway,
|
||||
string Description,
|
||||
string Hostname,
|
||||
string MAC,
|
||||
string Owner,
|
||||
int TagId,
|
||||
int DeviceId,
|
||||
string Location,
|
||||
string Port,
|
||||
string Note,
|
||||
DateTime? LastSeen,
|
||||
bool ExcludePing,
|
||||
bool PTRIgnore,
|
||||
int PTR,
|
||||
string FirewallAddressObject,
|
||||
DateTime? EditDate,
|
||||
int CustomerId,
|
||||
Dictionary<string, object>? ExtendedData = null
|
||||
)
|
||||
{
|
||||
public override string ToString() => Ip;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user