2022-12-06 13:34:52 -05:00
|
|
|
|
|
2021-03-25 16:52:08 -04:00
|
|
|
|
function Get-NetboxCircuitProvider {
|
|
|
|
|
|
[CmdletBinding(DefaultParameterSetName = 'Query')]
|
|
|
|
|
|
param
|
|
|
|
|
|
(
|
|
|
|
|
|
[Parameter(ParameterSetName = 'ById',
|
|
|
|
|
|
Mandatory = $true)]
|
2023-07-28 16:17:23 -04:00
|
|
|
|
[uint64[]]$Id,
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2021-03-25 16:52:08 -04:00
|
|
|
|
[Parameter(ParameterSetName = 'Query',
|
|
|
|
|
|
Mandatory = $false)]
|
|
|
|
|
|
[string]$Name,
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2021-03-25 16:52:08 -04:00
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
|
|
|
|
[string]$Query,
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2021-03-25 16:52:08 -04:00
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
|
|
|
|
[string]$Slug,
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2021-03-25 16:52:08 -04:00
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
|
|
|
|
[string]$ASN,
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2021-03-25 16:52:08 -04:00
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
|
|
|
|
[string]$Account,
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2021-03-25 16:52:08 -04:00
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
|
|
|
|
[uint16]$Limit,
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2021-03-25 16:52:08 -04:00
|
|
|
|
[Parameter(ParameterSetName = 'Query')]
|
|
|
|
|
|
[uint16]$Offset,
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2021-03-25 16:52:08 -04:00
|
|
|
|
[switch]$Raw
|
|
|
|
|
|
)
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2021-03-25 16:52:08 -04:00
|
|
|
|
switch ($PSCmdlet.ParameterSetName) {
|
|
|
|
|
|
'ById' {
|
|
|
|
|
|
foreach ($i in $ID) {
|
|
|
|
|
|
$Segments = [System.Collections.ArrayList]::new(@('circuits', 'providers', $i))
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2021-03-25 16:52:08 -04:00
|
|
|
|
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName "Id"
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2021-03-25 16:52:08 -04:00
|
|
|
|
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2021-03-25 16:52:08 -04:00
|
|
|
|
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2021-03-25 16:52:08 -04:00
|
|
|
|
default {
|
|
|
|
|
|
$Segments = [System.Collections.ArrayList]::new(@('circuits', 'providers'))
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2021-03-25 16:52:08 -04:00
|
|
|
|
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2021-03-25 16:52:08 -04:00
|
|
|
|
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
2021-07-23 22:06:42 +02:00
|
|
|
|
|
2021-03-25 16:52:08 -04:00
|
|
|
|
InvokeNetboxRequest -URI $URI -Raw:$Raw
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|