Correct brace formatting

This commit is contained in:
Ben Claussen 2021-07-22 10:28:22 -04:00
parent 989c5eaac2
commit 06d758d7b3
3 changed files with 6 additions and 12 deletions

View file

@ -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
}

View file

@ -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 $_
}
}

View file

@ -2,8 +2,7 @@ function Set-NetboxInvokeParams {
[CmdletBinding(ConfirmImpact = 'Low',
SupportsShouldProcess = $true)]
[OutputType([string])]
param
(
param(
[Parameter(Mandatory = $true)]
[array]$InvokeParams
)