mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 18:02:29 +00:00
35 lines
841 B
PowerShell
35 lines
841 B
PowerShell
|
|
function Remove-NetboxDCIMFrontPort {
|
|||
|
|
|
|||
|
|
[CmdletBinding(ConfirmImpact = 'High',
|
|||
|
|
SupportsShouldProcess = $true)]
|
|||
|
|
param
|
|||
|
|
(
|
|||
|
|
[Parameter(Mandatory = $true,
|
|||
|
|
ValueFromPipelineByPropertyName = $true)]
|
|||
|
|
[uint16[]]$Id,
|
|||
|
|
|
|||
|
|
[switch]$Force
|
|||
|
|
)
|
|||
|
|
|
|||
|
|
begin {
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
process {
|
|||
|
|
foreach ($FrontPortID in $Id) {
|
|||
|
|
$CurrentPort = Get-NetboxDCIMFrontPort -Id $FrontPortID -ErrorAction Stop
|
|||
|
|
|
|||
|
|
if ($Force -or $pscmdlet.ShouldProcess("Name: $($CurrentPort.Name) | ID: $($CurrentPort.Id)", "Remove")) {
|
|||
|
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'front-ports', $CurrentPort.Id))
|
|||
|
|
|
|||
|
|
$URI = BuildNewURI -Segments $Segments
|
|||
|
|
|
|||
|
|
InvokeNetboxRequest -URI $URI -Method DELETE
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
end {
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|