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,21 +1,17 @@
|
||||
namespace PS.IPAM.Cmdlets;
|
||||
|
||||
using System.Management.Automation;
|
||||
using PS.IPAM.Helpers;
|
||||
|
||||
/// <summary>
|
||||
/// Closes the current phpIPAM API session.
|
||||
/// </summary>
|
||||
[Cmdlet(VerbsCommon.Close, "Session")]
|
||||
public class CloseSessionCmdlet : PSCmdlet
|
||||
public class CloseSessionCmdlet : BaseCmdlet
|
||||
{
|
||||
protected override void ProcessRecord()
|
||||
{
|
||||
try
|
||||
{
|
||||
RequestHelper.InvokeRequest("DELETE", controllers.user, null, null, null, null)
|
||||
.GetAwaiter().GetResult();
|
||||
SessionManager.CloseSession();
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
WriteError(new ErrorRecord(ex, "CloseSessionError", ErrorCategory.InvalidOperation, null));
|
||||
}
|
||||
SessionManager.CloseSession();
|
||||
WriteVerbose("Session closed successfully.");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user