functions/public/Get-PSIPAML2Domain.ps1

function Get-PSIPAML2Domain {
    [CmdletBinding(DefaultParameterSetName="ByID")]
    param (
        [parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0)]
        [ValidateScript({ $_ -match "^\d+$" })]
        [ValidateNotNullOrEmpty()]
        [string]
        $Id
    )
    process {
        [string[]]$visiblePropertiesList = @('Id','Name','Description')
        $visibleProperties = [System.Management.Automation.PSPropertySet]::new('DefaultDisplayPropertySet',$visiblePropertiesList)

        $_params = @{
            Controller = "l2domains"
            Method     = "GET"
        }
        $_identifiers = @($Id)
        
        $_params.Add("Identifiers",$_identifiers)

        Invoke-PSIPAMRequest @_params | `
            Add-Member -MemberType MemberSet -Name PSStandardMembers -Value $visibleProperties -PassThru
    }
}
Export-ModuleMember -Function Get-PSIPAML2Domain