Functions/Internal/Compare-DatabricksCluster.ps1


Function Compare-DatabricksCluster{
    Param(
        [parameter(Mandatory = $true)]$cluster,
        [parameter(Mandatory = $true)]$ExistingClusterConfig
        
    )
            $sourceConfigOrderedHashtable = $cluster | ConvertTo-OrderedHashtableFromPSCustomObject
            $targetConfigOrderedHashtable = $ExistingClusterConfig | ConvertTo-OrderedHashtableFromPSCustomObject

            $sourceConfigOrderedObject = New-Object PSObject -Property $sourceConfigOrderedHashtable
            $targetConfigOrderedObject = New-Object PSObject -Property $targetConfigOrderedHashtable
            
            Compare-Object -ReferenceObject $sourceConfigOrderedObject.PSObject.Properties `
                -DifferenceObject $targetConfigOrderedObject.PSObject.Properties `
                -OutVariable Diffs
return $Diffs
}