ahaydon / Qlik-Cli-Windows

Qlik-Cli for Windows
https://adamhaydon.uk/Qlik-Cli-Windows/
GNU General Public License v2.0
110 stars 51 forks source link

Please add task name to Update-QlikReloadTask in resources/task.ps1 #187

Open simonaubertbd opened 2 years ago

simonaubertbd commented 2 years ago

Very useful to rename task

function Update-QlikReloadTask {
    [CmdletBinding()]
    param (
        [parameter(Mandatory = $true, ValueFromPipeline = $True, ValueFromPipelinebyPropertyName = $True, Position = 0)]
        [string]$id,
        [Bool]$Enabled,
    [string]$Name,
        [ValidateRange(1, 2147483647)]
        [Int]$TaskSessionTimeout,
        [ValidateRange(0, 20)]
        [Int]$MaxRetries,
        [string[]]$customProperties,
        [string[]]$tags
    )

    PROCESS {
        $task = Get-QlikReloadTask -Id $id -raw
        If ( $psBoundParameters.ContainsKey("Enabled") ) { $task.enabled = $Enabled }
    If ( $psBoundParameters.ContainsKey("Name") ) { $task.name = $Name }
        If ( $psBoundParameters.ContainsKey("TaskSessionTimeout") ) { $task.taskSessionTimeout = $TaskSessionTimeout }
        If ( $psBoundParameters.ContainsKey("MaxRetries") ) { $task.maxRetries = $MaxRetries }
        if ($PSBoundParameters.ContainsKey("customProperties")) { $task.customProperties = @(GetCustomProperties $customProperties) }
        if ($PSBoundParameters.ContainsKey("tags")) { $task.tags = @(GetTags $tags) }

        $json = $task | ConvertTo-Json -Compress -Depth 10
        return Invoke-QlikPut -path "/qrs/reloadtask/$id" -body $json
    }
}