src/Get-HighWindsHost.ps1
function Get-HighWindsHost { Param( [Parameter(Mandatory)] [String] $Token, [Parameter(Mandatory)] [String] $AccountHash, [Parameter()] [String] $HostHash ) if ($HostHash) { $Path = "/api/v1/accounts/$AccountHash/hosts/$HostHash" } else { $Path = "/api/v1/accounts/$AccountHash/hosts" } $URI = 'https://striketracker.highwinds.com' + $Path $Headers = @{ 'Content-Type' = 'application/json' 'Accept' = 'application/json' 'Authorization' = "Bearer $Token" } try { $Result = Invoke-RestMethod -Method GET -Uri $URI -Headers $Headers -Proxy $env:https_proxy if ($HostHash) { return $Result } else { return $Result.List } } catch { throw $_ } } |