NetboxPS/Functions/IPAM/VLAN/New-NetboxIPAMVLAN.ps1
Ben Claussen cfb53cf933
Version 1.3.0 (#3)
* Add `OPTIONS` method validation

* Remove parameter validation as workaround for CHOICES API endpoint until further testing

* Add help block for Get-NetboxTenant

* SkipConnectedCheck for Get-NetboxAPIDefinition

* Correct help block for New-NetboxIPAMAddress

* Add parameter position 0 for 'Address' in Get-NetboxIPAMAddress

* Allow pipeline input for Address parameter in New-NetboxIPAMAddress

* Update parameter types

* Add parameter sets and logic for ID/Query searches

* Add Get-NetboxDCIMSite

* Update psproj

* Update deploy.ps1

* Move Get-NetboxCircuit

* Add Circuit cmdlets
- New-NetboxCircuit
- Get-NetboxCircuitProvider
- Get-NetboxCircuitTermination
- Get-NetboxCircuitType

* Update deploy script output path

* Update Set-NetboxIPAMAddress
- Replace Interface parameter with Assigned_Object_Type and Assigned_Object_Id
- Add validation logic for Assigned_Object_ parameters
- Change Status parameter to string

* Add Get-ModelDefinition function

* Update psproj

* Update deploy.ps1 variables

* Update exported files

* Remove references to `_choices` API calls

* Add Postman collection

* Add Postman collection

* Update deploy.ps1

* Add Set-NetboxIPAMPrefix function

* Increment version to 1.3.0

Co-authored-by: Ben Claussen <claussen@neonet.org>
2021-03-25 16:52:08 -04:00

79 lines
No EOL
1.9 KiB
PowerShell

function New-NetboxIPAMVLAN {
<#
.SYNOPSIS
Create a new VLAN
.DESCRIPTION
Create a new VLAN in Netbox with a status of Active by default.
.PARAMETER VID
The VLAN ID.
.PARAMETER Name
The name of the VLAN.
.PARAMETER Status
Status of the VLAN. Defaults to Active
.PARAMETER Tenant
Tenant ID
.PARAMETER Role
Role such as anycast, loopback, etc... Defaults to nothing
.PARAMETER Description
Description of IP address
.PARAMETER Custom_Fields
Custom field hash table. Will be validated by the API service
.PARAMETER Raw
Return raw results from API service
.PARAMETER Address
IP address in CIDR notation: 192.168.1.1/24
.EXAMPLE
PS C:\> Create-NetboxIPAMAddress
.NOTES
Additional information about the function.
#>
[CmdletBinding()]
[OutputType([pscustomobject])]
param
(
[Parameter(Mandatory = $true)]
[uint16]$VID,
[Parameter(Mandatory = $true)]
[string]$Name,
[object]$Status = 'Active',
[uint16]$Tenant,
[object]$Role,
[string]$Description,
[hashtable]$Custom_Fields,
[switch]$Raw
)
# $PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -VLANStatus
#
# if ($null -ne $Role) {
# $PSBoundParameters.Role = ValidateIPAMChoice -ProvidedValue $Role -IPAddressRole
# }
$segments = [System.Collections.ArrayList]::new(@('ipam', 'vlans'))
$URIComponents = BuildURIComponents -URISegments $segments -ParametersDictionary $PSBoundParameters
$URI = BuildNewURI -Segments $URIComponents.Segments
InvokeNetboxRequest -URI $URI -Method POST -Body $URIComponents.Parameters -Raw:$Raw
}