mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-17 03:35:46 +00:00
51 lines
No EOL
1.2 KiB
PowerShell
51 lines
No EOL
1.2 KiB
PowerShell
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 {
|
|
|
|
}
|
|
} |