Functions/Get-WorkspaceFolderContents.ps1

Function Get-WorkspaceFolderContents {
    [cmdletbinding()]
    param($Path,  $bearerToken)
    Try {
        $uri = "https://$($config.region).azuredatabricks.net/api/2.0/workspace/list?path=$($path)"
        Write-Host "Requesting URI $uri"
        $Response = Invoke-RestMethod -Method Get -Uri $uri -Headers @{Authorization = "Bearer $bearerToken" } 
    }
    Catch {
        $ResError = $_.ErrorDetails.Message
        Write-Warning $ResError
        Write-Host "Folder might not exist if this is the first time run."
    }
    return $Response
}