mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 18:02:29 +00:00
50 lines
No EOL
1.3 KiB
PowerShell
50 lines
No EOL
1.3 KiB
PowerShell
|
|
function Get-NetboxDCIMPlatform {
|
|
[CmdletBinding()]
|
|
[OutputType([pscustomobject])]
|
|
param
|
|
(
|
|
[uint16]$Limit,
|
|
|
|
[uint16]$Offset,
|
|
|
|
[Parameter(ParameterSetName = 'ById')]
|
|
[uint16[]]$Id,
|
|
|
|
[string]$Name,
|
|
|
|
[string]$Slug,
|
|
|
|
[uint16]$Manufacturer_Id,
|
|
|
|
[string]$Manufacturer,
|
|
|
|
[switch]$Raw
|
|
)
|
|
|
|
switch ($PSCmdlet.ParameterSetName) {
|
|
'ById' {
|
|
foreach ($PlatformID in $Id) {
|
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'platforms', $PlatformID))
|
|
|
|
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id', 'Raw'
|
|
|
|
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
|
|
|
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
|
}
|
|
|
|
break
|
|
}
|
|
|
|
default {
|
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'platforms'))
|
|
|
|
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Raw'
|
|
|
|
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
|
|
|
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
|
}
|
|
}
|
|
} |