diff --git a/Functions/DCIM/RearPorts/Remove-NetboxDCIMRearPort.ps1 b/Functions/DCIM/RearPorts/Remove-NetboxDCIMRearPort.ps1 new file mode 100644 index 0000000..0d3ae1c --- /dev/null +++ b/Functions/DCIM/RearPorts/Remove-NetboxDCIMRearPort.ps1 @@ -0,0 +1,42 @@ + +function Remove-NetboxDCIMRearPort +{ + + [CmdletBinding(ConfirmImpact = 'High', + SupportsShouldProcess = $true)] + param + ( + [Parameter(Mandatory = $true, + ValueFromPipelineByPropertyName = $true)] + [uint16[]]$Id, + + [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 + { + + } +} \ No newline at end of file