Correct variable references in ShouldProcess

This commit is contained in:
Ben Claussen 2023-11-09 12:04:05 -05:00
parent b441e02e2b
commit 59a28faff5
4 changed files with 8 additions and 8 deletions

View file

@ -6,16 +6,16 @@ function Get-NetboxAPIDefinition {
[ValidateSet('json', 'yaml', IgnoreCase = $true)]
[string]$Format = 'json'
)
#$URI = "https://netbox.neonet.org/api/schema/?format=json"
$Segments = [System.Collections.ArrayList]::new(@('schema'))
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary @{
'format' = $Format.ToLower()
}
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters -SkipConnectedCheck
InvokeNetboxRequest -URI $URI
}

View file

@ -60,7 +60,7 @@ function New-NetboxContactRole {
$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
}
}

View file

@ -88,7 +88,7 @@ function New-NetboxContact {
$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
}
}

View file

@ -106,7 +106,7 @@ function Set-NetboxContact {
$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')) {
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw