resources/scheduler.ps1
function Get-QlikScheduler { [CmdletBinding()] param ( [parameter(Position=0)] [string]$id, [string]$filter, [switch]$count, [switch]$full, [switch]$raw ) PROCESS { $path = "/qrs/schedulerservice" If( $id ) { $path += "/$id" } If( $full ) { $path += "/full" } If( $count -And (-not ($id -And $full)) ) { $path += "/count" } If( $raw ) { $rawOutput = $true } return Invoke-QlikGet $path $filter } } function Update-QlikScheduler { [CmdletBinding()] param ( [parameter(Mandatory=$true,ValueFromPipeline=$True,ValueFromPipelinebyPropertyName=$True,Position=0)] [string]$id, [ValidateSet("master","slave","both")] [alias("type")] [string]$schedulerServiceType, [ValidateRange(1,256)] [Int]$maxConcurrentEngines, [ValidateRange(10,10080)] [Int]$engineTimeout ) PROCESS { $scheduler = Get-QlikScheduler $id Write-Verbose $schedulerServiceType If( $schedulerServiceType -ne $null ) { switch ($schedulerServiceType) { master { $sched_type = 0 } slave { $sched_type = 1 } both { $sched_type = 2 } } $scheduler.settings.schedulerServiceType = $sched_type } if($maxConcurrentEngines) { $scheduler.settings.maxConcurrentEngines = $maxConcurrentEngines } if($engineTimeout) { $scheduler.settings.engineTimeout = $engineTimeout } $json = $scheduler | ConvertTo-Json -Compress -Depth 10 return Invoke-QlikPut "/qrs/schedulerservice/$id" $json } } |