mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-15 02:35:46 +00:00
Add Set-NetboxDCIMRearPort function
This commit is contained in:
parent
0557939548
commit
813f5b7bdc
1 changed files with 62 additions and 0 deletions
62
Functions/DCIM/RearPorts/Set-NetboxDCIMRearPort.ps1
Normal file
62
Functions/DCIM/RearPorts/Set-NetboxDCIMRearPort.ps1
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
|
||||
function Set-NetboxDCIMRearPort
|
||||
{
|
||||
[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,
|
||||
|
||||
[string]$Color,
|
||||
|
||||
[uint16]$Positions,
|
||||
|
||||
[string]$Description,
|
||||
|
||||
[bool]$Mark_Connected,
|
||||
|
||||
[uint16[]]$Tags
|
||||
)
|
||||
|
||||
begin
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
process
|
||||
{
|
||||
foreach ($RearPortID in $Id)
|
||||
{
|
||||
$CurrentPort = Get-NetboxDCIMRearPort -Id $RearPortID -ErrorAction Stop
|
||||
|
||||
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'rear-ports', $CurrentPort.Id))
|
||||
|
||||
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
|
||||
|
||||
$URI = BuildNewURI -Segments $Segments
|
||||
|
||||
if ($Force -or $pscmdlet.ShouldProcess("Rear Port ID $($CurrentPort.Id)", "Set"))
|
||||
{
|
||||
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
end
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue