Functions/Remove-DatabricksClustersLibrariesFromConfig.ps1
<#
.SYNOPSIS Removees DataBricks Cluster(s) from configuration json file(s) to a workspace .DESCRIPTION Removes DataBricks Cluster(s) from configuration json file(s) to a workspace .PARAMETER config Configuration json file from the environment used to workout whether to remove a clusters from a folder or file(s) .EXAMPLE Remove-DatabricksClustersLibrariesFromConfig -config $config .NOTES Author: Sabin IO #> Function Remove-DatabricksClustersLibrariesFromConfig { [cmdletbinding()] Param( [parameter(Mandatory = $true)]$config ) try { if (($config.librariesUninstall) -and ($config.librariesUninstall.Length -ge 1)) { Write-Verbose "[Removing] clusters libraries by config" foreach ($libraryConfig in $config.librariesUninstall) { $ClusterId = Get-CachedDatabricksClusterId -ClusterName $libraryConfig.cluster_name $librariesConfig.PSObject.Properties.Remove('cluster_name') $librariesConfig | Add-Member -NotePropertyName 'cluster_id' -NotePropertyValue $ClusterId Remove-DatabricksClusterLibrariesFromWorkspaceByName -librariesConfig $libraryConfig } } } catch { throw $_.Exception } } |