2021-07-23 22:06:42 +02:00
|
|
|
|
<#
|
2018-05-23 11:10:40 -04:00
|
|
|
|
.NOTES
|
|
|
|
|
|
===========================================================================
|
2020-03-23 12:18:01 -04:00
|
|
|
|
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
|
|
|
|
|
|
Created on: 3/23/2020 12:07
|
|
|
|
|
|
Created by: Claussen
|
2018-05-23 11:10:40 -04:00
|
|
|
|
Organization: NEOnet
|
2020-03-23 12:18:01 -04:00
|
|
|
|
Filename: Get-NetboxDCIMDeviceRole.ps1
|
2018-05-23 11:10:40 -04:00
|
|
|
|
===========================================================================
|
|
|
|
|
|
.DESCRIPTION
|
|
|
|
|
|
A description of the file.
|
|
|
|
|
|
#>
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-03-23 12:18:01 -04:00
|
|
|
|
function Get-NetboxDCIMDeviceRole {
|
2018-05-23 16:47:31 -04:00
|
|
|
|
[CmdletBinding()]
|
|
|
|
|
|
param
|
|
|
|
|
|
(
|
|
|
|
|
|
[uint16]$Limit,
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2018-05-23 16:47:31 -04:00
|
|
|
|
[uint16]$Offset,
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2018-05-23 16:47:31 -04:00
|
|
|
|
[Parameter(ParameterSetName = 'ById')]
|
|
|
|
|
|
[uint16[]]$Id,
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2018-05-23 16:47:31 -04:00
|
|
|
|
[string]$Name,
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2018-05-23 16:47:31 -04:00
|
|
|
|
[string]$Slug,
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2020-03-23 12:18:01 -04:00
|
|
|
|
[string]$Color,
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2020-03-23 12:18:01 -04:00
|
|
|
|
[bool]$VM_Role,
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2018-05-23 16:47:31 -04:00
|
|
|
|
[switch]$Raw
|
|
|
|
|
|
)
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2018-05-23 16:47:31 -04:00
|
|
|
|
switch ($PSCmdlet.ParameterSetName) {
|
|
|
|
|
|
'ById' {
|
2020-03-23 12:18:01 -04:00
|
|
|
|
foreach ($DRId in $Id) {
|
|
|
|
|
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'device-roles', $DRId))
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2018-05-23 16:47:31 -04:00
|
|
|
|
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id', 'Raw'
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2018-05-23 16:47:31 -04:00
|
|
|
|
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2018-05-23 16:47:31 -04:00
|
|
|
|
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
|
|
|
|
|
}
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2018-05-23 16:47:31 -04:00
|
|
|
|
break
|
|
|
|
|
|
}
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2018-05-23 16:47:31 -04:00
|
|
|
|
default {
|
2020-03-23 12:18:01 -04:00
|
|
|
|
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'device-roles'))
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2018-05-23 16:47:31 -04:00
|
|
|
|
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Raw'
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2018-05-23 16:47:31 -04:00
|
|
|
|
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2018-05-23 16:47:31 -04:00
|
|
|
|
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2020-03-23 12:18:01 -04:00
|
|
|
|
}
|