mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 09:52:29 +00:00
49 lines
No EOL
1.3 KiB
PowerShell
49 lines
No EOL
1.3 KiB
PowerShell
|
|
function Get-NetboxDCIMDeviceRole {
|
|
[CmdletBinding()]
|
|
param
|
|
(
|
|
[uint16]$Limit,
|
|
|
|
[uint16]$Offset,
|
|
|
|
[Parameter(ParameterSetName = 'ById')]
|
|
[uint16[]]$Id,
|
|
|
|
[string]$Name,
|
|
|
|
[string]$Slug,
|
|
|
|
[string]$Color,
|
|
|
|
[bool]$VM_Role,
|
|
|
|
[switch]$Raw
|
|
)
|
|
|
|
switch ($PSCmdlet.ParameterSetName) {
|
|
'ById' {
|
|
foreach ($DRId in $Id) {
|
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'device-roles', $DRId))
|
|
|
|
$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', 'device-roles'))
|
|
|
|
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Raw'
|
|
|
|
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
|
|
|
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
|
}
|
|
}
|
|
} |