mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-16 03:05:47 +00:00
Added Set-NetboxDCIMFrontPort function
This commit is contained in:
parent
e449565f54
commit
c179bd434f
1 changed files with 67 additions and 0 deletions
67
Functions/DCIM/FrontPorts/Set-NetboxDCIMFrontPort.ps1
Normal file
67
Functions/DCIM/FrontPorts/Set-NetboxDCIMFrontPort.ps1
Normal file
|
|
@ -0,0 +1,67 @@
|
||||||
|
|
||||||
|
function Set-NetboxDCIMFrontPort
|
||||||
|
{
|
||||||
|
[CmdletBinding(ConfirmImpact = 'Medium',
|
||||||
|
SupportsShouldProcess = $true)]
|
||||||
|
[OutputType([pscustomobject])]
|
||||||
|
param
|
||||||
|
(
|
||||||
|
[Parameter(Mandatory = $true,
|
||||||
|
ValueFromPipelineByPropertyName = $true)]
|
||||||
|
[uint16[]]$Id,
|
||||||
|
|
||||||
|
[uint16]$Device,
|
||||||
|
|
||||||
|
[uint16]$Module,
|
||||||
|
|
||||||
|
[string]$Name,
|
||||||
|
|
||||||
|
[string]$Label,
|
||||||
|
|
||||||
|
[string]$Type,
|
||||||
|
|
||||||
|
[ValidatePattern('^[0-9a-f]{6}$')]
|
||||||
|
[string]$Color,
|
||||||
|
|
||||||
|
[uint16]$Rear_Port,
|
||||||
|
|
||||||
|
[uint16]$Rear_Port_Position,
|
||||||
|
|
||||||
|
[string]$Description,
|
||||||
|
|
||||||
|
[bool]$Mark_Connected,
|
||||||
|
|
||||||
|
[uint16[]]$Tags,
|
||||||
|
|
||||||
|
[switch]$Force
|
||||||
|
)
|
||||||
|
|
||||||
|
begin
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
process
|
||||||
|
{
|
||||||
|
foreach ($FrontPortID in $Id)
|
||||||
|
{
|
||||||
|
$CurrentPort = Get-NetboxDCIMFrontPort -Id $FrontPortID -ErrorAction Stop
|
||||||
|
|
||||||
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'front-ports', $CurrentPort.Id))
|
||||||
|
|
||||||
|
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
|
||||||
|
|
||||||
|
$URI = BuildNewURI -Segments $Segments
|
||||||
|
|
||||||
|
if ($Force -or $pscmdlet.ShouldProcess("Front Port ID $($CurrentPort.Id)", "Set"))
|
||||||
|
{
|
||||||
|
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue