mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-16 03:05:47 +00:00
Site(DCIM): Add New-NetboxDCIMSite for Add DCIM Site
This commit is contained in:
parent
c38c827f19
commit
1e6bd6b011
1 changed files with 86 additions and 0 deletions
86
Functions/DCIM/Sites/New-NetboxDCIMSite.ps1
Normal file
86
Functions/DCIM/Sites/New-NetboxDCIMSite.ps1
Normal file
|
|
@ -0,0 +1,86 @@
|
||||||
|
<#
|
||||||
|
.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 New-NetboxDCIMSite {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
Create a new Site to Netbox
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Create a new Site to Netbox
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
New-NetboxDCIMSite -name MySite
|
||||||
|
|
||||||
|
Add new Site MySite on Netbox
|
||||||
|
|
||||||
|
#>
|
||||||
|
|
||||||
|
[CmdletBinding(ConfirmImpact = 'Low',
|
||||||
|
SupportsShouldProcess = $true)]
|
||||||
|
[OutputType([pscustomobject])]
|
||||||
|
param
|
||||||
|
(
|
||||||
|
[Parameter(Mandatory = $true)]
|
||||||
|
[string]$Name,
|
||||||
|
|
||||||
|
[string]$Slug,
|
||||||
|
|
||||||
|
[string]$Facility,
|
||||||
|
|
||||||
|
[uint32]$ASN,
|
||||||
|
|
||||||
|
[decimal]$Latitude,
|
||||||
|
|
||||||
|
[decimal]$Longitude,
|
||||||
|
|
||||||
|
[string]$Contact_Name,
|
||||||
|
|
||||||
|
[string]$Contact_Phone,
|
||||||
|
|
||||||
|
[string]$Contact_Email,
|
||||||
|
|
||||||
|
[int]$Tenant_Group,
|
||||||
|
|
||||||
|
[int]$Tenant,
|
||||||
|
|
||||||
|
[string]$Status,
|
||||||
|
|
||||||
|
[uint32]$Region,
|
||||||
|
|
||||||
|
[string]$Description,
|
||||||
|
|
||||||
|
[string]$Comments,
|
||||||
|
|
||||||
|
[switch]$Raw
|
||||||
|
)
|
||||||
|
|
||||||
|
process {
|
||||||
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'sites'))
|
||||||
|
$Method = 'POST'
|
||||||
|
|
||||||
|
if (-not $PSBoundParameters.ContainsKey('slug')) {
|
||||||
|
$PSBoundParameters.Add('slug', $name)
|
||||||
|
}
|
||||||
|
|
||||||
|
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||||
|
|
||||||
|
$URI = BuildNewURI -Segments $URIComponents.Segments
|
||||||
|
|
||||||
|
if ($PSCmdlet.ShouldProcess($name, 'Create new Site')) {
|
||||||
|
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue