functions/Get-ZGHost.ps1
|
function Get-ZGHost { [CmdletBinding(DefaultParameterSetName = 'ByNull')] param ( [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $True, ParameterSetName = 'ByGroupIds')] [long[]] $GroupId, [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $True, ParameterSetName = 'ByHostIds')] [long[]] $HostId ) Begin { $parameters = @{ output = "extend" selectGroups = "extend" selectInterfaces = "extend" } switch ($PSCmdlet.ParameterSetName) { 'ByGroupIds' { $parameters.groupids = $GroupId } 'ByHostIds' { $parameters.hostids = $HostId } } } Process { $response = Invoke-ZGRequest -Method "POST" -Body @{ "method" = "host.get" "params" = $parameters "auth" = $script:RequestAuth } $response.result } } |