Public/Get-IAMCoreSyncJob.ps1

function Get-IAMCoreSyncJob {
    [CmdletBinding()]
    param (
        [Parameter(Mandatory = $false, ValueFromPipelineByPropertyName = $true)]
        [ValidatePattern("^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$")] # Is a guid connector object id
        [string]$Id
    )

    process {
        if ($PSCmdlet.MyInvocation.BoundParameters.ContainsKey("Id")) {
            Write-Verbose "Getting IAM Core sync job with ID '$Id'"
            $Result = Invoke-RestMethod -Uri "$Script:APIRoot/sync/jobs/$Id" -Headers (Get-IAMCoreHeader) -Method Get

            if ($Result.IsSuccess) {
                return $Result.Data
            }
            else {
                throw "Failed to get IAM Core sync job '$Id': $($Result.ErrorMessage)"
            }
        }
        else {
            Write-Verbose "Getting all IAM Core sync jobs"
            $Result = Invoke-RestMethod -Uri "$Script:APIRoot/sync/jobs/" -Headers (Get-IAMCoreHeader) -Method Get

            if ($Result.IsSuccess) {
                return $Result.Data
            }
            else {
                throw "Failed to get IAM Core sync jobs: $($Result.ErrorMessage)"
            }
        }
    }
}