Public/Get-PrismOva.ps1

function Get-PrismOva {
    <#
    .SYNOPSIS
        Lists OVAs, or gets the details of a single OVA.
 
    .DESCRIPTION
        With no -ExtId, lists all accessible OVAs using the v4 "List OVAs" endpoint,
        supporting OData paging/filtering/ordering/selection.
 
        With -ExtId, retrieves the details of a single OVA using the "Get an OVA"
        endpoint.
 
    .NOTES
        Implements:
          GET /vmm/v{ApiVersion}/content/ovas (operationId: listOvas)
          GET /vmm/v{ApiVersion}/content/ovas/{extId} (operationId: getOvaById)
 
        Uses the selected session's ApiVersion for both endpoints.
 
    .PARAMETER PrismSession
        The server/FQDN of the PrismSession to use. May be omitted when only one session exists.
 
    .PARAMETER ExtId
        The external identifier (UUID) of the OVA to retrieve.
 
    .PARAMETER Page
        ($page) Zero-based page number of the result set.
 
    .PARAMETER Limit
        ($limit) Maximum number of records to return (1-100, default 50).
 
    .PARAMETER Filter
        ($filter) An OData filter expression, e.g. "name eq 'LinuxServer_2.1_OVA'".
 
    .PARAMETER OrderBy
        ($orderby) An OData order-by expression, e.g. "name desc".
 
    .PARAMETER Select
        ($select) An OData select expression listing the properties to return.
 
    .EXAMPLE
        Get-PrismOva
 
    .EXAMPLE
        Get-PrismOva -ExtId '6e3e5679-b356-42fb-b2f7-1601a61656c8'
 
    .OUTPUTS
        The API response. For a list, the .data property contains the array of OVAs.
    #>


    [CmdletBinding(DefaultParameterSetName = 'List')]
    param(
        [Parameter(Mandatory = $false,
            HelpMessage = 'Prism Session Name')][string]$PrismSession,

        [Parameter(Mandatory = $true,
            ParameterSetName = 'ById',
            ValueFromPipeline = $true,
            ValueFromPipelineByPropertyName = $true,
            HelpMessage = 'OVA external identifier (UUID)')]
        [Alias('Id', 'OvaExtId')][string]$ExtId,

        [Parameter(ParameterSetName = 'List')][int]$Page,
        [Parameter(ParameterSetName = 'List')][ValidateRange(1, 100)][int]$Limit,
        [Parameter(ParameterSetName = 'List')][string]$Filter,
        [Parameter(ParameterSetName = 'List')][string]$OrderBy,
        [Parameter(ParameterSetName = 'List')][string]$Select
    )

    process {
        $PrismSessionConfig = Get-PrismSession $PrismSession
        $ovaPath = 'vmm/v{0}/content/ovas' -f $PrismSessionConfig.ApiVersion

        if ($PSCmdlet.ParameterSetName -eq 'ById') {
            $RequestSplat = @{
                PrismSession = $PrismSession
                Method       = 'GET'
                Path         = ('{0}/{1}' -f $ovaPath, $ExtId)
            }
            return Invoke-PrismRequest @RequestSplat
        }

        $query = @{
            '$page'    = $PSBoundParameters.ContainsKey('Page')  ? $Page  : $null
            '$limit'   = $PSBoundParameters.ContainsKey('Limit') ? $Limit : $null
            '$filter'  = $Filter
            '$orderby' = $OrderBy
            '$select'  = $Select
        }

        $RequestSplat = @{
            PrismSession = $PrismSession
            Method       = 'GET'
            Path         = $ovaPath
            Query        = $query
        }
        $Response = Invoke-PrismRequest @RequestSplat
        $Response.data
    }
}