NetboxPS/Functions/DCIM/FrontPorts/Remove-NetboxDCIMFrontPort.ps1
sheffsix ec1eb869b3 Reformatting using OTBS
Also working on defining tags by slug as an extra parameter, which appears
only in Add-NetboxDCIMRearPort currently
2023-03-15 13:55:41 +00:00

35 lines
No EOL
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 {
}
}