From cceb8fe76510a11baf6b659c197c63c53e5895c1 Mon Sep 17 00:00:00 2001 From: Ben Claussen Date: Thu, 9 Nov 2023 11:07:43 -0500 Subject: [PATCH] Update Get-NetboxAPIDefinition for new path - Add $Format parameter for json or yaml --- .../Setup/Support/Get-NetboxAPIDefinition.ps1 | 24 ++++++++++++------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/Functions/Setup/Support/Get-NetboxAPIDefinition.ps1 b/Functions/Setup/Support/Get-NetboxAPIDefinition.ps1 index 1e42f7a..5c8095a 100644 --- a/Functions/Setup/Support/Get-NetboxAPIDefinition.ps1 +++ b/Functions/Setup/Support/Get-NetboxAPIDefinition.ps1 @@ -1,15 +1,21 @@  function Get-NetboxAPIDefinition { [CmdletBinding()] - param () - - #$URI = "https://netbox.neonet.org/api/docs/?format=openapi" - - $Segments = [System.Collections.ArrayList]::new(@('docs')) - - $URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary @{'format' = 'openapi' } - + param + ( + [ValidateSet('json', 'yaml', IgnoreCase = $true)] + [string]$Format = 'json' + ) + + #$URI = "https://netbox.neonet.org/api/schema/?format=json" + + $Segments = [System.Collections.ArrayList]::new(@('schema')) + + $URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary @{ + 'format' = $Format.ToLower() + } + $URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters -SkipConnectedCheck - + InvokeNetboxRequest -URI $URI }