mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 09:52:29 +00:00
* Site(DCIM): Fix Get without parameter * Site(DCIM): Fix indent (use 4 spaces for header) * Site(DCIM): Add New-NetboxDCIMSite for Add DCIM Site * Site(DCIM): Add Remove-NetboxDCIMSite for Remove DCIM Site
64 lines
No EOL
1.5 KiB
PowerShell
64 lines
No EOL
1.5 KiB
PowerShell
<#
|
|
.NOTES
|
|
===========================================================================
|
|
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.181
|
|
Created on: 2020-10-02 15:52
|
|
Created by: Claussen
|
|
Organization: NEOnet
|
|
Filename: New-NetboxDCIMSite.ps1
|
|
===========================================================================
|
|
.DESCRIPTION
|
|
A description of the file.
|
|
#>
|
|
|
|
|
|
function Remove-NetboxDCIMSite {
|
|
<#
|
|
.SYNOPSIS
|
|
Remove a Site
|
|
|
|
.DESCRIPTION
|
|
Remove a DCIM Site from Netbox
|
|
|
|
.EXAMPLE
|
|
Remove-NetboxDCIMSite -Id 1
|
|
|
|
Remove DCM Site with id 1
|
|
|
|
.EXAMPLE
|
|
Get-NetboxDCIMSite -name My Site | Remove-NetboxDCIMSite -confirm:$false
|
|
|
|
Remove DCM Site with name My Site without confirmation
|
|
|
|
#>
|
|
|
|
[CmdletBinding(ConfirmImpact = 'High',
|
|
SupportsShouldProcess = $true)]
|
|
param
|
|
(
|
|
[Parameter(Mandatory = $true,
|
|
ValueFromPipelineByPropertyName = $true)]
|
|
[uint]$Id
|
|
|
|
)
|
|
|
|
begin {
|
|
|
|
}
|
|
|
|
process {
|
|
$CurrentSite = Get-NetboxDCIMSite -Id $Id -ErrorAction Stop
|
|
|
|
if ($pscmdlet.ShouldProcess("$($CurrentSite.Name)/$($CurrentSite.Id)", "Remove Site")) {
|
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'sites', $CurrentSite.Id))
|
|
|
|
$URI = BuildNewURI -Segments $Segments
|
|
|
|
InvokeNetboxRequest -URI $URI -Method DELETE
|
|
}
|
|
}
|
|
|
|
end {
|
|
|
|
}
|
|
} |