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,8 +1,13 @@
|
||||
namespace PS.IPAM;
|
||||
|
||||
using System;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a nameserver configuration in phpIPAM.
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
public class Nameserver {
|
||||
public sealed record Nameserver
|
||||
{
|
||||
public int Id { get; }
|
||||
public string Name { get; }
|
||||
public string[] NameServers { get; }
|
||||
@@ -16,13 +21,15 @@ public class Nameserver {
|
||||
string nameServers,
|
||||
string description,
|
||||
string permissions,
|
||||
DateTime? editDate
|
||||
) {
|
||||
this.Id = id;
|
||||
this.Name = name;
|
||||
this.NameServers = nameServers.Split(new char[] {';'});
|
||||
this.Description = description;
|
||||
this.Permissions = permissions;
|
||||
this.EditDate = editDate;
|
||||
DateTime? editDate)
|
||||
{
|
||||
Id = id;
|
||||
Name = name;
|
||||
NameServers = nameServers?.Split(';', StringSplitOptions.RemoveEmptyEntries) ?? Array.Empty<string>();
|
||||
Description = description;
|
||||
Permissions = permissions;
|
||||
EditDate = editDate;
|
||||
}
|
||||
}
|
||||
|
||||
public override string ToString() => Name;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user