lib/Classes/Public/SNSession.ps1
class SNSession { ## A Name parameter to identify the session in other -SNSessions functions [String]$Name # SN Server hostname [String]$SNServer # SNVersion drives the selection of compatible APIs to use [String]$SNVersion # Logged in SN User's Context (indicates loggedin-ness) [PSCustomObject]$UserContext # SNRestSession Variable. Maintained by the Invoke-RestMethod function's capability [Microsoft.PowerShell.Commands.WebRequestSession]$SNRestSession ## Tracks non-changing items to reduce HTTP lookups, and increase speed of scripts. ## DataCache is expected to be a k/v pair, where the V could be another k/v pair, ## However, it's implementation will be more of the nature to hold the list of object calls from the API ## like 'credentials' = @(@{...},@{...}); 'actions' = @(@{...},@{...}) ## Get-SN* functions will cache unless a -NoCache switch is provided [Hashtable]$DataCache ## Should PowerShell ignore the SSL Cert on the SN Server? [Bool]$AllowInsecureSSL SNSession() { $this.Name = 'Default' $this.AllowInsecureSSL = $false $this.DataCache = @{} $this.UserContext = $null } SNSession([String]$_name = 'Default') { $this.Name = $_name $this.AllowInsecureSSL = $false $this.DataCache = @{} $this.UserContext = $null } SNSession([String]$_name = 'Default', [String]$_server, [Bool]$_allowInsecureSSL = $false) { $this.Name = $_name $this.AllowInsecureSSL = $_allowInsecureSSL $this.SNServer = $_server $this.DataCache = @{} $this.UserContext = $null } } |