mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 01:42:28 +00:00
* 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>
98 lines
No EOL
2.6 KiB
PowerShell
98 lines
No EOL
2.6 KiB
PowerShell
<#
|
|
.NOTES
|
|
===========================================================================
|
|
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
|
Created on: 3/23/2020 12:11
|
|
Created by: Claussen
|
|
Organization: NEOnet
|
|
Filename: Set-NetboxDCIMInterface.ps1
|
|
===========================================================================
|
|
.DESCRIPTION
|
|
A description of the file.
|
|
#>
|
|
|
|
|
|
function Set-NetboxDCIMInterface {
|
|
[CmdletBinding()]
|
|
[OutputType([pscustomobject])]
|
|
param
|
|
(
|
|
[Parameter(Mandatory = $true,
|
|
ValueFromPipelineByPropertyName = $true)]
|
|
[uint16[]]$Id,
|
|
|
|
[uint16]$Device,
|
|
|
|
[string]$Name,
|
|
|
|
[bool]$Enabled,
|
|
|
|
[object]$Form_Factor,
|
|
|
|
[uint16]$MTU,
|
|
|
|
[string]$MAC_Address,
|
|
|
|
[bool]$MGMT_Only,
|
|
|
|
[uint16]$LAG,
|
|
|
|
[string]$Description,
|
|
|
|
[ValidateSet('Access', 'Tagged', 'Tagged All', '100', '200', '300', IgnoreCase = $true)]
|
|
[string]$Mode,
|
|
|
|
[ValidateRange(1, 4094)]
|
|
[uint16]$Untagged_VLAN,
|
|
|
|
[ValidateRange(1, 4094)]
|
|
[uint16[]]$Tagged_VLANs
|
|
)
|
|
|
|
begin {
|
|
# if ($null -ne $Form_Factor) {
|
|
# $PSBoundParameters.Form_Factor = ValidateDCIMChoice -ProvidedValue $Form_Factor -InterfaceFormFactor
|
|
# }
|
|
|
|
if (-not [System.String]::IsNullOrWhiteSpace($Mode)) {
|
|
$PSBoundParameters.Mode = switch ($Mode) {
|
|
'Access' {
|
|
100
|
|
break
|
|
}
|
|
|
|
'Tagged' {
|
|
200
|
|
break
|
|
}
|
|
|
|
'Tagged All' {
|
|
300
|
|
break
|
|
}
|
|
|
|
default {
|
|
$_
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
process {
|
|
foreach ($InterfaceId in $Id) {
|
|
$CurrentInterface = Get-NetboxDCIMInterface -Id $InterfaceId -ErrorAction Stop
|
|
|
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'interfaces', $CurrentInterface.Id))
|
|
|
|
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
|
|
|
|
$URI = BuildNewURI -Segments $Segments
|
|
|
|
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
|
|
}
|
|
}
|
|
|
|
end {
|
|
|
|
}
|
|
} |