mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-15 02:35:46 +00:00
Added Remove-NetboxDCIMFrontPort function
This commit is contained in:
parent
c179bd434f
commit
9b2b978a7b
1 changed files with 42 additions and 0 deletions
42
Functions/DCIM/FrontPorts/Remove-NetboxDCIMFrontPort.ps1
Normal file
42
Functions/DCIM/FrontPorts/Remove-NetboxDCIMFrontPort.ps1
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
|
||||
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
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue