Skip to content

Commit

Permalink
Increased JSON conversion depth
Browse files Browse the repository at this point in the history
New objects for SP increased nesting beyond 5 levels, increased depth
parameter to compensate.
Fixed some cmdlets that were calling old function names
  • Loading branch information
ahaydon committed Dec 13, 2016
1 parent 4f12868 commit a746a26
Showing 1 changed file with 30 additions and 31 deletions.
61 changes: 30 additions & 31 deletions Qlik-Cli.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ function Add-QlikProxy {
$vp = Get-QlikVirtualProxy -raw $VirtualProxyId

$proxy.settings.virtualProxies += $vp
$json = $proxy | ConvertTo-Json -Compress -Depth 5
$json = $proxy | ConvertTo-Json -Compress -Depth 10
return Invoke-QlikPut "/qrs/proxyservice/$ProxyId" $json
}
}
Expand Down Expand Up @@ -357,7 +357,7 @@ function Export-QlikCertificates {
If( $certificatePassword ) { $body.certificatePassword = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto([System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($CertificatePassword)) }
If( $includeSecretsKey ) { $body.includeSecretsKey = $true }
If( $exportFormat ) { $body.exportFormat = $exportFormat }
$json = $body | ConvertTo-Json -Compress -Depth 5
$json = $body | ConvertTo-Json -Compress -Depth 10

return Invoke-QlikPost "/qrs/certificatedistribution/exportcertificates" $json
}
Expand Down Expand Up @@ -542,7 +542,7 @@ function Get-QlikLicenseAudit {
}
If( $includeNonGrantingRules ) { $params.includeNonGrantingRules = $true }
If( $resourceId ) { $params.resourceFilter = "id eq $resourceId" }
$json = $params | ConvertTo-Json -Compress -Depth 5
$json = $params | ConvertTo-Json -Compress -Depth 10
If( $raw ) { $rawOutput = $true }
return Invoke-QlikPost "/qrs/systemrule/license/audit" $json
}
Expand Down Expand Up @@ -864,7 +864,7 @@ function Get-QlikValidEngines {
proxyPrefix = $proxyPrefix;
appId = $appId;
loadBalancingPurpose = $loadBalancingPurpose
} | ConvertTo-Json -Compress -Depth 5)
} | ConvertTo-Json -Compress -Depth 10)

If( $raw ) { $rawOutput = $true }
Invoke-QlikPost "/qrs/loadbalancing/validengines" $json
Expand Down Expand Up @@ -931,7 +931,7 @@ function Import-QlikExtension {
PROCESS {
$Path = "/qrs/extension/upload"
if($Password) { $Path += "?password=$Password" }
return Upload-RestUri -Path $Path -FilePath $ExtensionPath
return Invoke-QlikUpload -Path $Path -FilePath $ExtensionPath
}
}

Expand All @@ -945,7 +945,7 @@ function Import-QlikObject {
PROCESS {
$object | foreach {
$path = "/qrs/{0}" -F $_.schemaPath
$json = $_ | ConvertTo-Json -Compress -Depth 5
$json = $_ | ConvertTo-Json -Compress -Depth 10
Invoke-QlikPost $path $json
}
}
Expand Down Expand Up @@ -1072,7 +1072,7 @@ function New-QlikCustomProperty {
objectTypes = $objectTypes
}
if($ChoiceValues) { $json.Add("ChoiceValues", $ChoiceValues) }
$json = $json | ConvertTo-Json -Compress -Depth 5
$json = $json | ConvertTo-Json -Compress -Depth 10

return Invoke-QlikPost "/qrs/custompropertydefinition" $json
}
Expand Down Expand Up @@ -1115,7 +1115,7 @@ function New-QlikDataConnection {
$json.tags = $prop
}

$json = $json | ConvertTo-Json -Compress -Depth 5
$json = $json | ConvertTo-Json -Compress -Depth 10

return Invoke-QlikPost "/qrs/dataconnection" $json
}
Expand Down Expand Up @@ -1154,7 +1154,7 @@ function New-QlikNode {
schedulerEnabled=$schedulerEnabled.IsPresent;
printingEnabled=$printingEnabled.IsPresent;
}
} | ConvertTo-Json -Compress -Depth 5)
} | ConvertTo-Json -Compress -Depth 10)
$container = Invoke-QlikPost "/qrs/servernodeconfiguration/container" $json
#Write-Host "http://localhost:4570/certificateSetup"
return Invoke-QlikGet "/qrs/servernoderegistration/start/$($container.configuration.id)"
Expand Down Expand Up @@ -1188,7 +1188,7 @@ function New-QlikRule {

PROCESS {
If( $object ) {
$json = $object | ConvertTo-Json -Compress -Depth 5
$json = $object | ConvertTo-Json -Compress -Depth 10
} else {
# category is case-sensitive so convert to Title Case
$category = (Get-Culture).TextInfo.ToTitleCase($category.ToLower())
Expand Down Expand Up @@ -1259,7 +1259,7 @@ function New-QlikStream {
$stream.tags = $prop
}

$json = $stream | ConvertTo-Json -Compress -Depth 5
$json = $stream | ConvertTo-Json -Compress -Depth 10

return Invoke-QlikPost '/qrs/stream' $json
}
Expand All @@ -1275,7 +1275,7 @@ function New-QlikTag {
PROCESS {
$json = (@{
name=$name;
} | ConvertTo-Json -Compress -Depth 5)
} | ConvertTo-Json -Compress -Depth 10)

return Invoke-QlikPost '/qrs/tag' $json
}
Expand All @@ -1290,7 +1290,7 @@ function New-QlikUserAccessGroup {
PROCESS {
$json = (@{
name=$name
} | ConvertTo-Json -Compress -Depth 5)
} | ConvertTo-Json -Compress -Depth 10)

return Invoke-QlikPost "/qrs/License/UserAccessGroup" $json
}
Expand Down Expand Up @@ -1329,10 +1329,9 @@ function New-QlikUserDirectory {
configuredError=$configuredError;
operationalError=$operationalError;
settings=$settings
} | ConvertTo-Json -Compress -Depth 5)
} | ConvertTo-Json -Compress -Depth 10)

return Post-RestUri "/qrs/UserDirectory" $json
return Invoke-QlikPost "/qrs/License/UserAccessGroup" $json
return Invoke-QlikPost "/qrs/UserDirectory" $json
}
}

Expand Down Expand Up @@ -1382,7 +1381,7 @@ function New-QlikVirtualProxy {
loadBalancingServerNodes=$engines;
sessionCookieHeaderName=$sessionCookieHeaderName;
websocketCrossOriginWhiteList=$websocketCrossOriginWhiteList;
} | ConvertTo-Json -Compress -Depth 5)
} | ConvertTo-Json -Compress -Depth 10)

return Invoke-QlikPost "/qrs/virtualproxyconfig" $json
}
Expand Down Expand Up @@ -1675,9 +1674,9 @@ function Sync-QlikUserDirectory {
)

PROCESS {
$json = ConvertTo-Json -Compress -Depth 5 $guid
$json = ConvertTo-Json -Compress -Depth 10 $guid

return Post-RestUri "/qrs/userdirectoryconnector/syncuserdirectories" $json
return Invoke-QlikPost "/qrs/userdirectoryconnector/syncuserdirectories" $json
}
}

Expand Down Expand Up @@ -1723,7 +1722,7 @@ function Update-QlikApp {
$app.tags = $prop
}

$json = $app | ConvertTo-Json -Compress -Depth 5
$json = $app | ConvertTo-Json -Compress -Depth 10
return Invoke-QlikPut "/qrs/app/$id" $json
}
}
Expand All @@ -1747,7 +1746,7 @@ function Update-QlikCustomProperty {
if( $valueType ) { $prop.valueType = $valueType }
if( $choiceValues ) { $prop.choiceValues = $choiceValues }
if( $objectTypes ) { $prop.objectTypes = $objectTypes }
$json = $prop | ConvertTo-Json -Compress -Depth 5
$json = $prop | ConvertTo-Json -Compress -Depth 10
return Invoke-QlikPut "/qrs/custompropertydefinition/$id" $json
}
}
Expand All @@ -1764,7 +1763,7 @@ function Update-QlikDataConnection {
PROCESS {
$qdc = Get-QlikDataConnection -raw $id
$qdc.connectionstring = $ConnectionString
$json = $qdc | ConvertTo-Json -Compress -Depth 5
$json = $qdc | ConvertTo-Json -Compress -Depth 10
return Invoke-QlikPut "/qrs/dataconnection/$id" $json
}
}
Expand Down Expand Up @@ -1813,7 +1812,7 @@ function Update-QlikEngine {
}
$engine.settings.allowDataLineage = $AllowDataLineage
$engine.settings.standardReload = $StandardReload
$json = $engine | ConvertTo-Json -Compress -Depth 5
$json = $engine | ConvertTo-Json -Compress -Depth 10
return Invoke-QlikPut -Path "/qrs/engineservice/$id" -Body $json
}
}
Expand Down Expand Up @@ -1863,7 +1862,7 @@ function Update-QlikNode {
If( $psBoundParameters.ContainsKey("proxyEnabled") ) { $node.proxyEnabled = $proxyEnabled.IsPresent }
If( $psBoundParameters.ContainsKey("schedulerEnabled") ) { $node.schedulerEnabled = $schedulerEnabled.IsPresent }
If( $psBoundParameters.ContainsKey("printingEnabled") ) { $node.printingEnabled = $printingEnabled.IsPresent }
$json = $node | ConvertTo-Json -Compress -Depth 5
$json = $node | ConvertTo-Json -Compress -Depth 10
return Invoke-QlikPut "/qrs/servernodeconfiguration/$id" $json
}
}
Expand Down Expand Up @@ -1918,8 +1917,8 @@ function Update-QlikProxy {
if ($maxHeaderSizeBytes) { $proxy.settings.maxHeaderSizeBytes = $maxHeaderSizeBytes }
if ($maxHeaderLines) { $proxy.settings.maxHeaderLines = $maxHeaderLines }
if ($restListenPort) { $proxy.settings.restListenPort = $restListenPort }
$json = $proxy | ConvertTo-Json -Compress -Depth 5
return Put-RestUri -Path "/qrs/proxyservice/$id" $json
$json = $proxy | ConvertTo-Json -Compress -Depth 10
return Invoke-QlikPut "/qrs/proxyservice/$id" $json
}
}

Expand Down Expand Up @@ -1965,7 +1964,7 @@ function Update-QlikRule {
If( $comment ) { $systemrule.comment = $comment }
If( $psBoundParameters.ContainsKey("disabled") ) { $systemrule.disabled = $disabled.IsPresent }

$json = $systemrule | ConvertTo-Json -Compress -Depth 5
$json = $systemrule | ConvertTo-Json -Compress -Depth 10
return Invoke-QlikPut "/qrs/systemrule/$id" $json
}
}
Expand Down Expand Up @@ -2005,7 +2004,7 @@ function Update-QlikScheduler {
if($engineTimeout) {
$scheduler.settings.engineTimeout = $engineTimeout
}
$json = $scheduler | ConvertTo-Json -Compress -Depth 5
$json = $scheduler | ConvertTo-Json -Compress -Depth 10
return Invoke-QlikPut "/qrs/schedulerservice/$id" $json
}
}
Expand All @@ -2030,7 +2029,7 @@ function Update-QlikReloadTask {
$task.enabled = $Enabled
$task.taskSessionTimeout = $TaskSessionTimeout
$task.maxRetries = $MaxRetries
$json = $task | ConvertTo-Json -Compress -Depth 5
$json = $task | ConvertTo-Json -Compress -Depth 10
return Invoke-QlikPut -Path "/qrs/reloadtask/$id" -Body $json
}
}
Expand All @@ -2055,7 +2054,7 @@ function Update-QlikUser {
If( $tags ) {
$user.tags = GetTags $tags
}
$json = $user | ConvertTo-Json -Compress -Depth 5
$json = $user | ConvertTo-Json -Compress -Depth 10
return Invoke-QlikPut "/qrs/user/$id" $json
}
}
Expand Down Expand Up @@ -2109,7 +2108,7 @@ function Update-QlikVirtualProxy {
)
$proxy.loadBalancingServerNodes = $engines
}
$json = $proxy | ConvertTo-Json -Compress -Depth 5
$json = $proxy | ConvertTo-Json -Compress -Depth 10
return Invoke-QlikPut "/qrs/virtualproxyconfig/$id" $json
}
}
Expand Down

0 comments on commit a746a26

Please sign in to comment.