22 lines
599 B
C#
22 lines
599 B
C#
namespace PS.IPAM.Cmdlets;
|
|
using System.Management.Automation;
|
|
using PS.IPAM.Helpers;
|
|
|
|
[Cmdlet(VerbsCommon.Close, "Session")]
|
|
public class CloseSessionCmdlet : PSCmdlet
|
|
{
|
|
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));
|
|
}
|
|
}
|
|
}
|