2021-07-23 22:06:42 +02:00
|
|
|
|
<#
|
2020-03-23 12:18:01 -04:00
|
|
|
|
.NOTES
|
|
|
|
|
|
===========================================================================
|
|
|
|
|
|
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
|
|
|
|
|
Created on: 3/23/2020 12:12
|
|
|
|
|
|
Created by: Claussen
|
|
|
|
|
|
Organization: NEOnet
|
|
|
|
|
|
Filename: Remove-NetboxDCIMInterfaceConnection.ps1
|
|
|
|
|
|
===========================================================================
|
|
|
|
|
|
.DESCRIPTION
|
|
|
|
|
|
A description of the file.
|
|
|
|
|
|
#>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function Remove-NetboxDCIMInterfaceConnection {
|
|
|
|
|
|
[CmdletBinding(ConfirmImpact = 'High',
|
|
|
|
|
|
SupportsShouldProcess = $true)]
|
|
|
|
|
|
[OutputType([void])]
|
|
|
|
|
|
param
|
|
|
|
|
|
(
|
|
|
|
|
|
[Parameter(Mandatory = $true,
|
|
|
|
|
|
ValueFromPipelineByPropertyName = $true)]
|
|
|
|
|
|
[uint16[]]$Id,
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2020-03-23 12:18:01 -04:00
|
|
|
|
[switch]$Force
|
|
|
|
|
|
)
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2020-03-23 12:18:01 -04:00
|
|
|
|
begin {
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2020-03-23 12:18:01 -04:00
|
|
|
|
}
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2020-03-23 12:18:01 -04:00
|
|
|
|
process {
|
|
|
|
|
|
foreach ($ConnectionID in $Id) {
|
|
|
|
|
|
$CurrentConnection = Get-NetboxDCIMInterfaceConnection -Id $ConnectionID -ErrorAction Stop
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2020-03-23 12:18:01 -04:00
|
|
|
|
if ($Force -or $pscmdlet.ShouldProcess("Connection ID $($ConnectionID.Id)", "REMOVE")) {
|
|
|
|
|
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'interface-connections', $CurrentConnection.Id))
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2020-03-23 12:18:01 -04:00
|
|
|
|
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id', 'Force'
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2020-03-23 12:18:01 -04:00
|
|
|
|
$URI = BuildNewURI -Segments $URIComponents.Segments
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2020-03-23 12:18:01 -04:00
|
|
|
|
InvokeNetboxRequest -URI $URI -Method DELETE
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2020-03-23 12:18:01 -04:00
|
|
|
|
end {
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2020-03-23 12:18:01 -04:00
|
|
|
|
}
|
|
|
|
|
|
}
|