function Get-L2Domain { [CmdletBinding(DefaultParameterSetName="NoParams")] [OutputType([PS.IPAM.Domain])] param ( [parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByID")] [ValidateScript({ $_ -match "^\d+$" })] [ValidateNotNullOrEmpty()] [int] $Id ) process { $_params = @{ Controller = [PS.IPAM.controllers]::l2domains Method = [PS.IPAM.methods]::GET Type = [PS.IPAM.types]::Domain } switch ($PSCmdlet.ParameterSetName) { "ByID" { $_identifiers = @($Id) } } $_params.Add("Identifiers",$_identifiers) Invoke-Request @_params } } Export-ModuleMember -Function Get-L2Domain