-
Notifications
You must be signed in to change notification settings - Fork 213
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for uploading large PBIX reports (#332)
* Add support for uploading large PBIX reports * Added getting server configurations related to the maximum possible size of the uploaded file * Add tests * Resolve review points * Resolve review points Co-authored-by: Maksim Melnikov (Akvelon INC) <[email protected]>
- Loading branch information
1 parent
ef3aa0d
commit 60db0c7
Showing
5 changed files
with
225 additions
and
19 deletions.
There are no files selected for viewing
91 changes: 91 additions & 0 deletions
91
ReportingServicesTools/Functions/Admin/Rest/Get-RsRestPublicServerSetting.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
function Get-RsRestPublicServerSetting | ||
{ | ||
<# | ||
.SYNOPSIS | ||
This function gets the public settings of the RS server. | ||
.DESCRIPTION | ||
This function gets the value of the specified property from the public settings of the RS server. | ||
.PARAMETER Property | ||
Specify the name of the property. | ||
.PARAMETER ReportPortalUri | ||
Specify the Report Portal URL to your SQL Server Reporting Services Instance. | ||
.PARAMETER RestApiVersion | ||
Specify the version of REST Endpoint to use. Valid values are: "v2.0". | ||
.PARAMETER Credential | ||
Specify the credentials to use when connecting to the Report Server. | ||
.PARAMETER WebSession | ||
Specify the session to be used when making calls to REST Endpoint. | ||
.EXAMPLE | ||
Get-RsRestPublicServerSetting -Property "MaxFileSizeMb" | ||
Description | ||
----------- | ||
Gets the value of the property "MaxFileSizeMb" from the Report Server located at http://localhost/reports. | ||
#> | ||
|
||
[CmdletBinding()] | ||
param | ||
( | ||
[Parameter(Mandatory = $True)] | ||
[string] | ||
$Property, | ||
|
||
[string] | ||
$ReportPortalUri, | ||
|
||
[Alias('ApiVersion')] | ||
[ValidateSet("v2.0")] | ||
[string] | ||
$RestApiVersion = "v2.0", | ||
|
||
[Alias('ReportServerCredentials')] | ||
[System.Management.Automation.PSCredential] | ||
$Credential, | ||
|
||
[Microsoft.PowerShell.Commands.WebRequestSession] | ||
$WebSession | ||
) | ||
Begin | ||
{ | ||
$WebSession = New-RsRestSessionHelper -BoundParameters $PSBoundParameters | ||
$ReportPortalUri = Get-RsPortalUriHelper -WebSession $WebSession | ||
$systemPropertiesUri = $ReportPortalUri + "api/$RestApiVersion/System/Properties?properties={0}" | ||
} | ||
Process | ||
{ | ||
try | ||
{ | ||
Write-Verbose "Getting server configuration - $Property" | ||
|
||
$uri = [String]::Format($systemPropertiesUri, $Property) | ||
|
||
if ($Credential -ne $null) | ||
{ | ||
$response = Invoke-RestMethod -Uri $uri -Method Get -WebSession $WebSession -Credential $Credential -Verbose:$false | ||
} | ||
else | ||
{ | ||
$response = Invoke-RestMethod -Uri $uri -Method Get -WebSession $WebSession -UseDefaultCredentials -Verbose:$false | ||
} | ||
|
||
if ($response -ne $null -and $response.value -ne $null -and $response.value[0] -ne $null -and $response.value[0].Name -eq $Property) | ||
{ | ||
return $response.value[0].Value | ||
} | ||
else | ||
{ | ||
return $null | ||
} | ||
} | ||
catch | ||
{ | ||
Write-Error (New-Object System.Exception("Failed to get server setting: $($_.Exception.Message)", $_.Exception)) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright (c) 2020 Microsoft Corporation. All Rights Reserved. | ||
# Licensed under the MIT License (MIT) | ||
|
||
Describe "Get-RsRestPublicServerSetting" { | ||
Context "Get Catalog Item Policy"{ | ||
$reportPortalUri = if ($env:PesterPortalUrl -eq $null) { 'http://localhost/reports' } else { $env:PesterPortalUrl } | ||
|
||
It "Should get MaxFileSizeMb property" { | ||
$property = Get-RsRestPublicServerSetting -ReportPortalUri $reportPortalUri -Property "MaxFileSizeMb" | ||
$property | Should -Not -BeNullOrEmpty | ||
$property | Should -Be '1000' | ||
} | ||
|
||
It "Should get ShowDownloadMenu property" { | ||
$property = Get-RsRestPublicServerSetting -ReportPortalUri $reportPortalUri -Property "ShowDownloadMenu" | ||
$property | Should -Not -BeNullOrEmpty | ||
$property | Should -Be 'true' | ||
} | ||
|
||
It "Should not get BadRandomProperty property" { | ||
Get-RsRestPublicServerSetting -ReportPortalUri $reportPortalUri -Property "BadRandomProperty" | Should -BeNullOrEmpty | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters