mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 18:02:29 +00:00
Correct brace formatting
This commit is contained in:
parent
989c5eaac2
commit
06d758d7b3
3 changed files with 6 additions and 12 deletions
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 $_
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,8 +2,7 @@ function Set-NetboxInvokeParams {
|
|||
[CmdletBinding(ConfirmImpact = 'Low',
|
||||
SupportsShouldProcess = $true)]
|
||||
[OutputType([string])]
|
||||
param
|
||||
(
|
||||
param(
|
||||
[Parameter(Mandatory = $true)]
|
||||
[array]$InvokeParams
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue