NetboxPS/Functions/DCIM/Platform/Set-NetboxDCIMPlatform.ps1

51 lines
1.2 KiB
PowerShell
Raw Normal View History

2024-10-05 18:39:45 +02:00
function Set-NetboxDCIMPlatform {
[CmdletBinding(ConfirmImpact = 'Medium',
SupportsShouldProcess = $true)]
[OutputType([pscustomobject])]
param
(
[Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true)]
[uint64[]]$Id,
[string]$Name,
[ValidateLength(1, 100)]
[ValidatePattern('^[-a-zA-Z0-9_]+$')]
[string]$Slug,
[uint64]$Manufacturer,
[uint64]$Config_Template,
[string]$Description,
[uint64[]]$Tags,
[switch]$Force
)
begin {
}
process {
foreach ($FrontPortID in $Id) {
$CurrentPlatform = Get-NetboxDCIMPlatform -Id $FrontPortID -ErrorAction Stop
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'platforms', $CurrentPlatform.Id))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
$URI = BuildNewURI -Segments $Segments
if ($Force -or $pscmdlet.ShouldProcess("Platform ID $($CurrentPlatform.Id)", "Set")) {
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
}
}
}
end {
}
}