diff --git a/Functions/Helpers/InvokeNetboxRequest.ps1 b/Functions/Helpers/InvokeNetboxRequest.ps1 index 9a82048..5750730 100644 --- a/Functions/Helpers/InvokeNetboxRequest.ps1 +++ b/Functions/Helpers/InvokeNetboxRequest.ps1 @@ -95,13 +95,11 @@ function InvokeNetboxRequest { if ($Raw) { Write-Verbose "Returning raw result by choice" return $result - } - else { + } else { if ($result.psobject.Properties.Name.Contains('results')) { Write-Verbose "Found Results property on data, returning results directly" return $result.Results - } - else { + } else { Write-Verbose "Did NOT find results property on data, returning raw result" return $result } diff --git a/Functions/Setup/Connect-NetboxAPI.ps1 b/Functions/Setup/Connect-NetboxAPI.ps1 index 6bc0d03..e732f16 100644 --- a/Functions/Setup/Connect-NetboxAPI.ps1 +++ b/Functions/Setup/Connect-NetboxAPI.ps1 @@ -58,8 +58,7 @@ if (-not $Credential) { try { $Credential = Get-NetboxCredential -ErrorAction Stop - } - catch { + } catch { # Credentials are not set... Try to obtain from the user if (-not ($Credential = Get-Credential -UserName 'username-not-applicable' -Message "Enter token for Netbox")) { throw "Token is necessary to connect to a Netbox API." @@ -106,14 +105,12 @@ try { Write-Verbose "Verifying API connectivity..." $null = VerifyAPIConnectivity - } - catch { + } catch { Write-Verbose "Failed to connect. Generating error" Write-Verbose $_.Exception.Message if (($_.Exception.Response) -and ($_.Exception.Response.StatusCode -eq 403)) { throw "Invalid token" - } - else { + } else { throw $_ } } diff --git a/Functions/Setup/Set-NetboxInvokeParams.ps1 b/Functions/Setup/Set-NetboxInvokeParams.ps1 index ca5dbf5..b82ef6d 100644 --- a/Functions/Setup/Set-NetboxInvokeParams.ps1 +++ b/Functions/Setup/Set-NetboxInvokeParams.ps1 @@ -2,8 +2,7 @@ function Set-NetboxInvokeParams { [CmdletBinding(ConfirmImpact = 'Low', SupportsShouldProcess = $true)] [OutputType([string])] - param - ( + param( [Parameter(Mandatory = $true)] [array]$InvokeParams )