mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 09:52:29 +00:00
Correct variable references in ShouldProcess
This commit is contained in:
parent
b441e02e2b
commit
59a28faff5
4 changed files with 8 additions and 8 deletions
|
|
@ -6,16 +6,16 @@ function Get-NetboxAPIDefinition {
|
||||||
[ValidateSet('json', 'yaml', IgnoreCase = $true)]
|
[ValidateSet('json', 'yaml', IgnoreCase = $true)]
|
||||||
[string]$Format = 'json'
|
[string]$Format = 'json'
|
||||||
)
|
)
|
||||||
|
|
||||||
#$URI = "https://netbox.neonet.org/api/schema/?format=json"
|
#$URI = "https://netbox.neonet.org/api/schema/?format=json"
|
||||||
|
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('schema'))
|
$Segments = [System.Collections.ArrayList]::new(@('schema'))
|
||||||
|
|
||||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary @{
|
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary @{
|
||||||
'format' = $Format.ToLower()
|
'format' = $Format.ToLower()
|
||||||
}
|
}
|
||||||
|
|
||||||
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters -SkipConnectedCheck
|
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters -SkipConnectedCheck
|
||||||
|
|
||||||
InvokeNetboxRequest -URI $URI
|
InvokeNetboxRequest -URI $URI
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ function New-NetboxContactRole {
|
||||||
|
|
||||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||||
|
|
||||||
if ($PSCmdlet.ShouldProcess($Address, 'Create new contact')) {
|
if ($PSCmdlet.ShouldProcess($Name, 'Create new contact')) {
|
||||||
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ function New-NetboxContact {
|
||||||
|
|
||||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||||
|
|
||||||
if ($PSCmdlet.ShouldProcess($Address, 'Create new contact')) {
|
if ($PSCmdlet.ShouldProcess($Name, 'Create new contact')) {
|
||||||
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ function Set-NetboxContact {
|
||||||
|
|
||||||
$URI = BuildNewURI -Segments $URIComponents.Segments
|
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||||
|
|
||||||
$CurrentContact = Get-NetboxContact -Id $ContactId
|
$CurrentContact = Get-NetboxContact -Id $ContactId -ErrorAction Stop
|
||||||
|
|
||||||
if ($Force -or $PSCmdlet.ShouldProcess($CurrentContact.Name, 'Update contact')) {
|
if ($Force -or $PSCmdlet.ShouldProcess($CurrentContact.Name, 'Update contact')) {
|
||||||
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue