diff --git a/PSSailpoint/Configuration.ps1 b/PSSailpoint/Configuration.ps1 index fd38a6dd1..38721eff4 100644 --- a/PSSailpoint/Configuration.ps1 +++ b/PSSailpoint/Configuration.ps1 @@ -146,7 +146,7 @@ function Set-DefaultConfiguration { If ($BaseUrl) { # validate URL $URL = $BaseUrl -as [System.URI] - if (!($null -ne $URL.AbsoluteURI -and $URL.Scheme -match '[http|https]')) { + if (!($null -ne $URL.AbsoluteURI -and $URL.Scheme -match '^https?$')) { throw "Invalid URL '$($BaseUrl)' cannot be used in the base URL." } $Script:Configuration["BaseUrl"] = $BaseUrl @@ -172,15 +172,15 @@ function Set-DefaultConfiguration { $Script:Configuration['ClientSecret'] = $ClientSecret } - If ($RetryIntervalSeconds) { + If ($PSBoundParameters.ContainsKey('RetryIntervalSeconds')) { $Script:Configuration['RetryIntervalSeconds'] = $RetryIntervalSeconds } - If ($MaximumRetryCount) { + If ($PSBoundParameters.ContainsKey('MaximumRetryCount')) { $Script:Configuration['MaximumRetryCount'] = $MaximumRetryCount } - If ($Experimental) { + If ($PSBoundParameters.ContainsKey('Experimental')) { $Script:Configuration['Experimental'] = $Experimental } @@ -189,7 +189,7 @@ function Set-DefaultConfiguration { throw "Incorrect Proxy type '$($Proxy.GetType().FullName)'. Must be System.Net.WebProxy or System.Net.SystemWebProxy or System.Net.WebRequest+WebProxyWrapperOpaque." } $Script:Configuration['Proxy'] = $Proxy - } else { + } elseif ($PSBoundParameters.ContainsKey('Proxy')) { $Script:Configuration['Proxy'] = $null } @@ -321,5 +321,5 @@ function Get-Config { return $LocalConfig } - return $Configuration + return $Script:Configuration } diff --git a/PSSailpoint/Pagination.ps1 b/PSSailpoint/Pagination.ps1 index 5883b7e9a..339405847 100644 --- a/PSSailpoint/Pagination.ps1 +++ b/PSSailpoint/Pagination.ps1 @@ -71,10 +71,12 @@ function Invoke-PaginateSearch { Param( [Parameter(Mandatory = $false)] [ValidateNotNull()] - [ValidateScript({ ($_.sort | Measure-Object).Count -eq 1 }, + [ValidateScript({ ($_.sort | Measure-Object).Count -eq 1 }, ErrorMessage = "Error! The required `Search` parameter must include exactly one sort parameter to paginate properly.")] [PSCustomObject] $Search, + [Parameter(Mandatory = $false)] + [string]$Function = "Search-Post", [Int32]$Increment = 250, [Int32]$Limit = 10000, [Switch]$WithHttpInfo @@ -101,7 +103,7 @@ function Invoke-PaginateSearch { Write-Debug "SearchAfter=$SearchAfter" } - $Result = Search-Post -Limit $Increment -Search $Search -WithHttpInfo + $Result = & $Function -Limit $Increment -Search $Search -WithHttpInfo Write-Debug "Retrieved $(($Result.Response | Measure-Object).Count) Results" diff --git a/PSSailpoint/tests/Validation.Tests.ps1 b/PSSailpoint/tests/Validation.Tests.ps1 index 03bd59698..2d1a315f4 100644 --- a/PSSailpoint/tests/Validation.Tests.ps1 +++ b/PSSailpoint/tests/Validation.Tests.ps1 @@ -21,7 +21,7 @@ Describe 'V3' { "identities" ], "query": { - "query": "*", + "query": "*" }, "sort": ["-name"] } @@ -46,7 +46,7 @@ Describe 'V3' { Describe 'Beta' { It 'Returns results for Get-BetaAccounts' { - $Response = Get-Accounts -WithHttpInfo + $Response = Get-BetaAccounts -WithHttpInfo $Response.Response | Should -Not -BeNullOrEmpty $Response.StatusCode | Should -Be 200 diff --git a/sdk-resources/postscript.js b/sdk-resources/postscript.js index 0e56eacd1..eebf6bace 100644 --- a/sdk-resources/postscript.js +++ b/sdk-resources/postscript.js @@ -67,9 +67,7 @@ const createDir = async (srcDir, dirName) => { const moveFiles = async (srcPath, destPath, filename = null) => { try { - if (!await fs.stat(destPath)) { - await fs.mkdir(destPath, { recursive: true }); - } + await fs.mkdir(destPath, { recursive: true }); if (filename) { const filePath = path.join(srcPath, filename); diff --git a/sdk-resources/resources/api_client.mustache b/sdk-resources/resources/api_client.mustache index 7fdd0c7a7..4838e0976 100644 --- a/sdk-resources/resources/api_client.mustache +++ b/sdk-resources/resources/api_client.mustache @@ -104,7 +104,7 @@ function Invoke-{{{apiNamePrefix}}}ApiClient { # construct URL query string $HttpValues = [System.Web.HttpUtility]::ParseQueryString([String]::Empty) foreach ($Parameter in $QueryParameters.GetEnumerator()) { - if ($Parameter.Value.Count -gt 1) { // array + if ($Parameter.Value.Count -gt 1) { # array foreach ($Value in $Parameter.Value) { $HttpValues.Add($Parameter.Key + '[]', $Value) } diff --git a/sdk-resources/resources/configuration.mustache b/sdk-resources/resources/configuration.mustache index ffc9ca50d..a7e3dde0a 100644 --- a/sdk-resources/resources/configuration.mustache +++ b/sdk-resources/resources/configuration.mustache @@ -132,7 +132,7 @@ function Set-{{{apiNamePrefix}}}Configuration { If ($BaseUrl) { # validate URL $URL = $BaseUrl -as [System.URI] - if (!($null -ne $URL.AbsoluteURI -and $URL.Scheme -match '[http|https]')) { + if (!($null -ne $URL.AbsoluteURI -and $URL.Scheme -match '^https?$')) { throw "Invalid URL '$($BaseUrl)' cannot be used in the base URL." } $Script:Configuration["BaseUrl"] = $BaseUrl diff --git a/sdk-resources/resources/model_anyof.mustache b/sdk-resources/resources/model_anyof.mustache index 1021ad5c8..78ba300a4 100644 --- a/sdk-resources/resources/model_anyof.mustache +++ b/sdk-resources/resources/model_anyof.mustache @@ -68,7 +68,7 @@ function ConvertFrom-{{{apiNamePrefix}}}JsonTo{{{classname}}} { {{/mappedModels}} {{/discriminator}} {{#anyOf}} - if ($match -ne 0) { # no match yet + if ($match -eq 0) { # no match yet # try to match {{{.}}} defined in the anyOf schemas try { $matchInstance = ConvertFrom-{{{apiNamePrefix}}}JsonTo{{{.}}} $Json