NetboxPS/Functions/DCIM/Platform/Remove-NetboxDCIMPlatform.ps1

35 lines
851 B
PowerShell
Raw Normal View History

2024-10-05 18:39:45 +02:00
function Remove-NetboxDCIMPlatform {
[CmdletBinding(ConfirmImpact = 'High',
SupportsShouldProcess = $true)]
param
(
[Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true)]
[uint64[]]$Id,
[switch]$Force
)
begin {
}
process {
foreach ($PlatformID in $Id) {
$CurrentPlatform = Get-NetboxDCIMPlatform -Id $PlatformID -ErrorAction Stop
if ($Force -or $pscmdlet.ShouldProcess("Name: $($CurrentPlatform.Name) | ID: $($CurrentPlatform.Id)", "Remove")) {
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'platforms', $CurrentPlatform.Id))
$URI = BuildNewURI -Segments $Segments
InvokeNetboxRequest -URI $URI -Method DELETE
}
}
}
end {
}
}