2023-03-17 19:27:55 +00:00
|
|
|
|
function Remove-NetboxDCIMRearPort {
|
|
|
|
|
|
|
|
|
|
|
|
[CmdletBinding(ConfirmImpact = 'High',
|
|
|
|
|
|
SupportsShouldProcess = $true)]
|
|
|
|
|
|
param
|
|
|
|
|
|
(
|
|
|
|
|
|
[Parameter(Mandatory = $true,
|
|
|
|
|
|
ValueFromPipelineByPropertyName = $true)]
|
2023-07-28 16:17:23 -04:00
|
|
|
|
[uint64[]]$Id,
|
2023-03-17 19:27:55 +00:00
|
|
|
|
|
|
|
|
|
|
[switch]$Force
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
begin {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
process {
|
|
|
|
|
|
foreach ($RearPortID in $Id) {
|
|
|
|
|
|
$CurrentPort = Get-NetboxDCIMRearPort -Id $RearPortID -ErrorAction Stop
|
|
|
|
|
|
|
|
|
|
|
|
if ($Force -or $pscmdlet.ShouldProcess("Name: $($CurrentPort.Name) | ID: $($CurrentPort.Id)", "Remove")) {
|
|
|
|
|
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'rear-ports', $CurrentPort.Id))
|
|
|
|
|
|
|
|
|
|
|
|
$URI = BuildNewURI -Segments $Segments
|
|
|
|
|
|
|
|
|
|
|
|
InvokeNetboxRequest -URI $URI -Method DELETE
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
end {
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|