Public/Connectors/Get-SIAConnector.ps1

function Get-SIAConnector {
    <#
    .SYNOPSIS
        Lists SIA connectors.
    .DESCRIPTION
        Retrieves every connector registered on the tenant, following
        continuation tokens automatically unless -NoAutoPaging is specified or
        auto-pagination is turned off in Set-SIAModuleConfiguration.
    .PARAMETER NoAutoPaging
        Return only the first page of results instead of retrieving every page.
    .EXAMPLE
        Get-SIAConnector

        Lists every connector on the tenant.
    .EXAMPLE
        Get-SIAConnector | Where-Object status -eq 'Active'

        Finds connectors currently reporting an active status.
    .INPUTS
        None.
    .OUTPUTS
        psSIA.Connector
    .LINK
        https://api-docs.cyberark.com/secure-infra-access/docs/sia-connector-api
    #>

    [CmdletBinding()]
    [OutputType('psSIA.Connector')]
    param(
        [switch]$NoAutoPaging
    )

    $stopAfterFirstPage = $NoAutoPaging -or -not $script:SIAModuleConfig.AutoPagination
    $firstPage = Invoke-SIARequest -Method GET -Path '/api/connectors'

    Get-SIAPagination -FirstPage $firstPage -NoAutoPaging:$stopAfterFirstPage -NextPageRequest {
        param($token)
        Invoke-SIARequest -Method GET -Path '/api/connectors' -QueryParameter @{ continuationToken = $token }
    } | ForEach-Object { $_.items } | ConvertFrom-SIAResponse -TypeName 'psSIA.Connector'
}