Functions/Get-CachedDatabricksClusterId.ps1



Function Get-CachedDatabricksClusterId{
    param($ClusterName)

    if ($null -eq $ClusterIdCache){
        $global:ClusterIdCache = @{}
    }
    if (-not  $global:ClusterIdCache.ContainsKey($ClusterName)){
        $global:ClusterIdCache.$ClusterName = Get-DatabricksClusters | Where-Object { $_.cluster_name -eq $ClusterName } | Select-Object -ExpandProperty "cluster_id" 
    }
    return @{Id= $global:ClusterIdCache.$ClusterName}.Id
}