mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 18:02:29 +00:00
96 lines
No EOL
2.3 KiB
PowerShell
96 lines
No EOL
2.3 KiB
PowerShell
|
|
function Get-NetboxIPAMRole {
|
|
<#
|
|
.SYNOPSIS
|
|
Get IPAM Prefix/VLAN roles
|
|
|
|
.DESCRIPTION
|
|
A role indicates the function of a prefix or VLAN. For example, you might define Data, Voice, and Security roles. Generally, a prefix will be assigned the same functional role as the VLAN to which it is assigned (if any).
|
|
|
|
.PARAMETER Id
|
|
Unique ID
|
|
|
|
.PARAMETER Query
|
|
Search query
|
|
|
|
.PARAMETER Name
|
|
Role name
|
|
|
|
.PARAMETER Slug
|
|
Role URL slug
|
|
|
|
.PARAMETER Brief
|
|
Brief format
|
|
|
|
.PARAMETER Limit
|
|
Result limit
|
|
|
|
.PARAMETER Offset
|
|
Result offset
|
|
|
|
.PARAMETER Raw
|
|
A description of the Raw parameter.
|
|
|
|
.EXAMPLE
|
|
PS C:\> Get-NetboxIPAMRole
|
|
|
|
.NOTES
|
|
Additional information about the function.
|
|
#>
|
|
|
|
[CmdletBinding()]
|
|
param
|
|
(
|
|
[Parameter(ParameterSetName = 'Query',
|
|
Position = 0)]
|
|
[string]$Name,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[string]$Query,
|
|
|
|
[Parameter(ParameterSetName = 'ByID')]
|
|
[uint64[]]$Id,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[string]$Slug,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[switch]$Brief,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[uint16]$Limit,
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
[uint16]$Offset,
|
|
|
|
[switch]$Raw
|
|
)
|
|
|
|
switch ($PSCmdlet.ParameterSetName) {
|
|
'ById' {
|
|
foreach ($Role_ID in $Id) {
|
|
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'roles', $Role_ID))
|
|
|
|
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
|
|
|
|
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
|
|
|
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
|
}
|
|
|
|
break
|
|
}
|
|
|
|
default {
|
|
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'roles'))
|
|
|
|
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
|
|
|
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
|
|
|
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
|
|
|
break
|
|
}
|
|
}
|
|
} |