mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 09:52:29 +00:00
38 lines
No EOL
1.1 KiB
PowerShell
38 lines
No EOL
1.1 KiB
PowerShell
|
|
function Remove-NetboxDCIMInterfaceConnection {
|
|
[CmdletBinding(ConfirmImpact = 'High',
|
|
SupportsShouldProcess = $true)]
|
|
[OutputType([void])]
|
|
param
|
|
(
|
|
[Parameter(Mandatory = $true,
|
|
ValueFromPipelineByPropertyName = $true)]
|
|
[uint16[]]$Id,
|
|
|
|
[switch]$Force
|
|
)
|
|
|
|
begin {
|
|
|
|
}
|
|
|
|
process {
|
|
foreach ($ConnectionID in $Id) {
|
|
$CurrentConnection = Get-NetboxDCIMInterfaceConnection -Id $ConnectionID -ErrorAction Stop
|
|
|
|
if ($Force -or $pscmdlet.ShouldProcess("Connection ID $($ConnectionID.Id)", "REMOVE")) {
|
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'interface-connections', $CurrentConnection.Id))
|
|
|
|
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id', 'Force'
|
|
|
|
$URI = BuildNewURI -Segments $URIComponents.Segments
|
|
|
|
InvokeNetboxRequest -URI $URI -Method DELETE
|
|
}
|
|
}
|
|
}
|
|
|
|
end {
|
|
|
|
}
|
|
} |