Public/Discovery/Get-SCAStandingAccess.ps1

function Get-SCAStandingAccess {
    <#
    .SYNOPSIS
        Lists cloud identities with standing (persistent) access, as detected by Cloud Discovery.
    .DESCRIPTION
        Calls POST /detections/cloud-service-entitlements/list on the Cloud Discovery Service API.
        This is a search-style operation implemented as POST; it is idempotent (a pure query) so
        Invoke-SCARequest retries it on transient failures the same way it would a GET.
    .PARAMETER Provider
        Filter results to a single cloud service provider (AWS, Azure, or GCP).
    .PARAMETER Filter
        Additional raw filter fields merged into the request body's filters object, for filters
        not yet exposed as a named parameter. See the StandingAccessFilters schema at the link
        below for the current filter fields.
    .PARAMETER Session
        A psSCA.Session object or session name. Defaults to the current default session.
    .EXAMPLE
        Get-SCAStandingAccess -Provider AWS

        Lists AWS identities with standing access.
    .INPUTS
        None.
    .OUTPUTS
        psSCA.StandingAccess
    .LINK
        https://api-docs.cyberark.com/cds-api/docs/cds-api
    #>

    [CmdletBinding()]
    [OutputType('psSCA.StandingAccess')]
    param(
        [Parameter()]
        [ValidateSet('AWS', 'Azure', 'GCP')]
        [string]$Provider,

        [Parameter()]
        [hashtable]$Filter,

        [Parameter()]
        [object]$Session
    )

    $filters = if ($Filter) { $Filter.Clone() } else { @{} }
    if ($Provider) { $filters['cloudProvider'] = $Provider }

    $body = @{ filters = $filters }

    Invoke-SCARequest -Session $Session -Service 'CDS' -Method POST -Path '/detections/cloud-service-entitlements/list' `
        -Body $body -Operation 'Get-SCAStandingAccess' -TypeName 'psSCA.StandingAccess' -Idempotent
}