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:
2026-01-19 17:25:18 +03:00
parent 694822f0d6
commit f56784f2aa
44 changed files with 1601 additions and 1905 deletions

View File

@@ -1,33 +1,27 @@
namespace PS.IPAM;
using System;
using System.Management.Automation;
/// <summary>
/// Represents an authenticated session with phpIPAM API.
/// </summary>
[Serializable]
public class Session {
public AuthType AuthType { get; }
public string Token { get; set; }
public string AppID { get; }
public string URL { get; }
public DateTime? Expires { get; set; }
public object? Credentials { get; }
public Session(
AuthType authType,
string token,
string appId,
string url,
DateTime? expires,
object? credentials
) {
AuthType = authType;
Token = token;
AppID = appId;
URL = url;
Expires = expires;
Credentials = credentials;
}
public sealed record Session(
AuthType AuthType,
string Token,
string AppID,
string URL,
DateTime? Expires,
object? Credentials
)
{
/// <summary>
/// Gets or sets the current authentication token.
/// </summary>
public string Token { get; set; } = Token;
public override string ToString()
{
return base.ToString();
}
}
/// <summary>
/// Gets or sets the token expiration time.
/// </summary>
public DateTime? Expires { get; set; } = Expires;
}