Added assembly name and root namespace to project file; updated session and vlan classes with new properties; modified module manifest to reference DLL and updated exported cmdlets; corrected property name in address class.
This commit is contained in:
21
classlib/Cmdlets/CloseSessionCmdlet.cs
Normal file
21
classlib/Cmdlets/CloseSessionCmdlet.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
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));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user