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) {
|
if ($Raw) {
|
||||||
Write-Verbose "Returning raw result by choice"
|
Write-Verbose "Returning raw result by choice"
|
||||||
return $result
|
return $result
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if ($result.psobject.Properties.Name.Contains('results')) {
|
if ($result.psobject.Properties.Name.Contains('results')) {
|
||||||
Write-Verbose "Found Results property on data, returning results directly"
|
Write-Verbose "Found Results property on data, returning results directly"
|
||||||
return $result.Results
|
return $result.Results
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Write-Verbose "Did NOT find results property on data, returning raw result"
|
Write-Verbose "Did NOT find results property on data, returning raw result"
|
||||||
return $result
|
return $result
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,8 +58,7 @@
|
||||||
if (-not $Credential) {
|
if (-not $Credential) {
|
||||||
try {
|
try {
|
||||||
$Credential = Get-NetboxCredential -ErrorAction Stop
|
$Credential = Get-NetboxCredential -ErrorAction Stop
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
# Credentials are not set... Try to obtain from the user
|
# Credentials are not set... Try to obtain from the user
|
||||||
if (-not ($Credential = Get-Credential -UserName 'username-not-applicable' -Message "Enter token for Netbox")) {
|
if (-not ($Credential = Get-Credential -UserName 'username-not-applicable' -Message "Enter token for Netbox")) {
|
||||||
throw "Token is necessary to connect to a Netbox API."
|
throw "Token is necessary to connect to a Netbox API."
|
||||||
|
|
@ -106,14 +105,12 @@
|
||||||
try {
|
try {
|
||||||
Write-Verbose "Verifying API connectivity..."
|
Write-Verbose "Verifying API connectivity..."
|
||||||
$null = VerifyAPIConnectivity
|
$null = VerifyAPIConnectivity
|
||||||
}
|
} catch {
|
||||||
catch {
|
|
||||||
Write-Verbose "Failed to connect. Generating error"
|
Write-Verbose "Failed to connect. Generating error"
|
||||||
Write-Verbose $_.Exception.Message
|
Write-Verbose $_.Exception.Message
|
||||||
if (($_.Exception.Response) -and ($_.Exception.Response.StatusCode -eq 403)) {
|
if (($_.Exception.Response) -and ($_.Exception.Response.StatusCode -eq 403)) {
|
||||||
throw "Invalid token"
|
throw "Invalid token"
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
throw $_
|
throw $_
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,7 @@ function Set-NetboxInvokeParams {
|
||||||
[CmdletBinding(ConfirmImpact = 'Low',
|
[CmdletBinding(ConfirmImpact = 'Low',
|
||||||
SupportsShouldProcess = $true)]
|
SupportsShouldProcess = $true)]
|
||||||
[OutputType([string])]
|
[OutputType([string])]
|
||||||
param
|
param(
|
||||||
(
|
|
||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $true)]
|
||||||
[array]$InvokeParams
|
[array]$InvokeParams
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue