Functions/BloxOneDDI/Get-B1DHCPOptionGroup.ps1
function Get-B1DHCPOptionGroup { <# .SYNOPSIS Retrieves a list of DHCP option groups from BloxOneDDI .DESCRIPTION This function is used to query a list DHCP option groups from BloxOneDDI. .PARAMETER Name The name of the DHCP group to filter by .PARAMETER Strict Use strict filter matching. By default, filters are searched using wildcards where possible. Using strict matching will only return results matching exactly what is entered in the applicable parameters. .PARAMETER Fields Specify a list of fields to return. The default is to return all fields. .EXAMPLE PS> Get-B1DHCPOptionGroup -Name "Telephony Options" .FUNCTIONALITY BloxOneDDI .FUNCTIONALITY DHCP #> param( [String]$Name, [String[]]$Fields, [Switch]$Strict = $false ) $MatchType = Match-Type $Strict [System.Collections.ArrayList]$Filters = @() [System.Collections.ArrayList]$QueryFilters = @() if ($Name) { $Filters.Add("name$MatchType`"$Name`"") | Out-Null } if ($Filters) { $Filter = Combine-Filters $Filters $QueryFilters.Add("_filter=$Filter") | Out-Null } if ($Fields) { $Fields += "id" $QueryFilters.Add("_fields=$($Fields -join ",")") | Out-Null } if ($QueryFilters) { $QueryString = ConvertTo-QueryString $QueryFilters } if ($QueryString) { Query-CSP -Method GET -Uri "dhcp/option_group$($QueryString)" | Select-Object -ExpandProperty results -ErrorAction SilentlyContinue } else { Query-CSP -Method GET -Uri "dhcp/option_group" | Select-Object -ExpandProperty results -ErrorAction SilentlyContinue } } |