src/Public/Get-ProcessRules.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

Function Get-ProcessRules{
    param([Parameter(Mandatory=$false)] $Config = (Get-ProcessConfigFile))
    
    $RulesYml = (Get-Content $Config -ErrorAction SilentlyContinue | ConvertFrom-Yaml).rules

    if( ! $RulesYml ){
        Write-Warning "No Rules found!"
        return
    }


    $Rules = @()

    foreach($r in $RulesYml){
        $Rules += [PSCustomObject] [Ordered]@{
            selector = $r.selector
            priority = [CpuPriority]$r.priority
            affinity = [CpuAffinity]$r.affinity
        }
    }
    return $Rules
}