resources/stream.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
function Get-QlikStream { [CmdletBinding()] param ( [parameter(Position = 0)] [string]$id, [string]$filter, [switch]$full, [switch]$raw ) PROCESS { $path = "/qrs/stream" If ( $id ) { $path += "/$id" } If ( $full ) { $path += "/full" } If ( $raw ) { $rawOutput = $true } return Invoke-QlikGet $path $filter } } function New-QlikStream { [CmdletBinding()] param ( [parameter(Mandatory = $true, Position = 0)] [string]$name, [object]$owner, [string[]]$customProperties, [string[]]$tags ) PROCESS { $stream = @{ name = $name; } if ($PSBoundParameters.ContainsKey("customProperties")) { $stream.customProperties = @(GetCustomProperties $customProperties) } if ($PSBoundParameters.ContainsKey("tags")) { $stream.tags = @(GetTags $tags) } if ($PSBoundParameters.ContainsKey("owner")) { $stream.owner = GetUser $owner } $json = $stream | ConvertTo-Json -Compress -Depth 10 return Invoke-QlikPost '/qrs/stream' $json } } function Remove-QlikStream { [CmdletBinding()] param ( [parameter(Position = 0, ValueFromPipelinebyPropertyName = $true)] [string]$id ) PROCESS { return Invoke-QlikDelete "/qrs/stream/$id" } } function Update-QlikStream { [CmdletBinding()] param ( [parameter(Mandatory = $true, ValueFromPipeline = $True, ValueFromPipelinebyPropertyName = $True, Position = 0)] [string]$id, [string]$name, [object]$owner, [object[]]$customProperties, [object[]]$tags ) PROCESS { $stream = Get-QlikStream $id -raw if ($PSBoundParameters.ContainsKey("name")) { $stream.name = $name } if ($PSBoundParameters.ContainsKey("customProperties")) { $stream.customProperties = @(GetCustomProperties $customProperties $stream.customProperties) } if ($PSBoundParameters.ContainsKey("tags")) { $stream.tags = @(GetTags $tags $stream.tags) } if ($PSBoundParameters.ContainsKey("owner")) { $stream.owner = GetUser $owner } $json = $stream | ConvertTo-Json -Compress -Depth 10 return Invoke-QlikPut "/qrs/stream/$id" $json } } |