Remove parameter validation as workaround for CHOICES API endpoint until further testing

This commit is contained in:
Ben Claussen 2020-05-04 12:36:46 -04:00
parent c9077abd51
commit 657a8405bc
25 changed files with 294 additions and 190 deletions

View file

@ -64,21 +64,21 @@ function New-NetboxDCIMDevice {
)
#endregion Parameters
if ($null -ne $Device_Role) {
# Validate device role?
}
if ($null -ne $Device_Type) {
# Validate device type?
}
if ($null -ne $Status) {
$PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
}
if ($null -ne $Face) {
$PSBoundParameters.Face = ValidateDCIMChoice -ProvidedValue $Face -DeviceFace
}
# if ($null -ne $Device_Role) {
# # Validate device role?
# }
#
# if ($null -ne $Device_Type) {
# # Validate device type?
# }
#
# if ($null -ne $Status) {
# $PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
# }
#
# if ($null -ne $Face) {
# $PSBoundParameters.Face = ValidateDCIMChoice -ProvidedValue $Face -DeviceFace
# }
$Segments = [System.Collections.ArrayList]::new(@('dcim', 'devices'))

View file

@ -64,13 +64,13 @@ function Set-NetboxDCIMDevice {
)
begin {
if ($null -ne $Status) {
$PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
}
if ($null -ne $Face) {
$PSBoundParameters.Face = ValidateDCIMChoice -ProvidedValue $Face -DeviceFace
}
# if ($null -ne $Status) {
# $PSBoundParameters.Status = ValidateDCIMChoice -ProvidedValue $Status -DeviceStatus
# }
#
# if ($null -ne $Face) {
# $PSBoundParameters.Face = ValidateDCIMChoice -ProvidedValue $Face -DeviceFace
# }
}
process {

View file

@ -47,9 +47,9 @@ function Add-NetboxDCIMInterface {
[uint16[]]$Tagged_VLANs
)
if ($null -ne $Form_Factor) {
$PSBoundParameters.Form_Factor = ValidateDCIMChoice -ProvidedValue $Form_Factor -InterfaceFormFactor
}
# if ($null -ne $Form_Factor) {
# $PSBoundParameters.Form_Factor = ValidateDCIMChoice -ProvidedValue $Form_Factor -InterfaceFormFactor
# }
if (-not [System.String]::IsNullOrWhiteSpace($Mode)) {
$PSBoundParameters.Mode = switch ($Mode) {

View file

@ -50,9 +50,9 @@ function Set-NetboxDCIMInterface {
)
begin {
if ($null -ne $Form_Factor) {
$PSBoundParameters.Form_Factor = ValidateDCIMChoice -ProvidedValue $Form_Factor -InterfaceFormFactor
}
# if ($null -ne $Form_Factor) {
# $PSBoundParameters.Form_Factor = ValidateDCIMChoice -ProvidedValue $Form_Factor -InterfaceFormFactor
# }
if (-not [System.String]::IsNullOrWhiteSpace($Mode)) {
$PSBoundParameters.Mode = switch ($Mode) {

View file

@ -60,9 +60,9 @@ function Set-NetboxDCIMInterfaceConnection {
)
begin {
if ($null -ne $Connection_Status) {
$PSBoundParameters.Connection_Status = ValidateDCIMChoice -ProvidedValue $Connection_Status -InterfaceConnectionStatus
}
# if ($null -ne $Connection_Status) {
# $PSBoundParameters.Connection_Status = ValidateDCIMChoice -ProvidedValue $Connection_Status -InterfaceConnectionStatus
# }
if ((@($ID).Count -gt 1) -and ($Interface_A -or $Interface_B)) {
throw "Cannot set multiple connections to the same interface"

View file

@ -1,60 +1,83 @@
function Get-NetboxIPAMAddress {
[CmdletBinding()]
[CmdletBinding(DefaultParameterSetName = 'Query')]
param
(
[Parameter(ParameterSetName = 'Query')]
[string]$Address,
[Parameter(ParameterSetName = 'ByID')]
[uint16[]]$Id,
[Parameter(ParameterSetName = 'Query')]
[string]$Query,
[Parameter(ParameterSetName = 'Query')]
[object]$Family,
[Parameter(ParameterSetName = 'Query')]
[uint16]$Parent,
[Parameter(ParameterSetName = 'Query')]
[byte]$Mask_Length,
[Parameter(ParameterSetName = 'Query')]
[string]$VRF,
[Parameter(ParameterSetName = 'Query')]
[uint16]$VRF_Id,
[Parameter(ParameterSetName = 'Query')]
[string]$Tenant,
[Parameter(ParameterSetName = 'Query')]
[uint16]$Tenant_Id,
[Parameter(ParameterSetName = 'Query')]
[string]$Device,
[Parameter(ParameterSetName = 'Query')]
[uint16]$Device_ID,
[Parameter(ParameterSetName = 'Query')]
[string]$Virtual_Machine,
[Parameter(ParameterSetName = 'Query')]
[uint16]$Virtual_Machine_Id,
[Parameter(ParameterSetName = 'Query')]
[uint16]$Interface_Id,
[Parameter(ParameterSetName = 'Query')]
[object]$Status,
[Parameter(ParameterSetName = 'Query')]
[object]$Role,
[Parameter(ParameterSetName = 'Query')]
[uint16]$Limit,
[Parameter(ParameterSetName = 'Query')]
[uint16]$Offset,
[switch]$Raw
)
if ($null -ne $Family) {
$PSBoundParameters.Family = ValidateIPAMChoice -ProvidedValue $Family -IPAddressFamily
switch ($PSCmdlet.ParameterSetName) {
'ById' {
foreach ($IP_ID in $Id) {
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses', $IP_ID))
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id'
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $uri -Raw:$Raw
}
if ($null -ne $Status) {
$PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -IPAddressStatus
}
if ($null -ne $Role) {
$PSBoundParameters.Role = ValidateIPAMChoice -ProvidedValue $Role -IPAddressRole
break
}
default {
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses'))
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
@ -62,4 +85,8 @@
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $uri -Raw:$Raw
break
}
}
}

View file

@ -47,6 +47,9 @@ function New-NetboxIPAMAddress {
.PARAMETER Description
Description of IP address
.PARAMETER Force
A description of the Force parameter.
.PARAMETER Raw
Return raw results from API service
@ -57,7 +60,8 @@ function New-NetboxIPAMAddress {
Additional information about the function.
#>
[CmdletBinding()]
[CmdletBinding(ConfirmImpact = 'Low',
SupportsShouldProcess = $true)]
[OutputType([pscustomobject])]
param
(
@ -80,20 +84,35 @@ function New-NetboxIPAMAddress {
[string]$Description,
[switch]$Force,
[switch]$Raw
)
$PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -IPAddressStatus
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses'))
$Method = 'POST'
if ($null -ne $Role) {
$PSBoundParameters.Role = ValidateIPAMChoice -ProvidedValue $Role -IPAddressRole
}
$segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses'))
$URIComponents = BuildURIComponents -URISegments $segments -ParametersDictionary $PSBoundParameters
# # Value validation
# $ModelDefinition = GetModelDefinitionFromURIPath -Segments $Segments -Method $Method
# $EnumProperties = GetModelEnumProperties -ModelDefinition $ModelDefinition
#
# foreach ($Property in $EnumProperties.Keys) {
# if ($PSBoundParameters.ContainsKey($Property)) {
# Write-Verbose "Validating property [$Property] with value [$($PSBoundParameters.$Property)]"
# $PSBoundParameters.$Property = ValidateValue -ModelDefinition $ModelDefinition -Property $Property -ProvidedValue $PSBoundParameters.$Property
# }
# }
#
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
$URI = BuildNewURI -Segments $URIComponents.Segments
InvokeNetboxRequest -URI $URI -Method POST -Body $URIComponents.Parameters -Raw:$Raw
if ($Force -or $PSCmdlet.ShouldProcess($Address, 'Create new IP address')) {
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
}
}

View file

@ -43,9 +43,6 @@ function Remove-NetboxIPAMAddress {
[switch]$Force
)
begin {
}
process {
foreach ($IPId in $Id) {
$CurrentIP = Get-NetboxIPAMAddress -Id $IPId -ErrorAction Stop
@ -59,7 +56,4 @@ function Remove-NetboxIPAMAddress {
}
}
}
end {
}
}

View file

@ -43,20 +43,31 @@ function Set-NetboxIPAMAddress {
)
begin {
if ($Status) {
$PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -IPAddressStatus
}
if ($Role) {
$PSBoundParameters.Role = ValidateIPAMChoice -ProvidedValue $Role -IPAddressRole
}
# Write-Verbose "Validating enum properties"
# $Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses', 0))
$Method = 'PATCH'
#
# # Value validation
# $ModelDefinition = GetModelDefinitionFromURIPath -Segments $Segments -Method $Method
# $EnumProperties = GetModelEnumProperties -ModelDefinition $ModelDefinition
#
# foreach ($Property in $EnumProperties.Keys) {
# if ($PSBoundParameters.ContainsKey($Property)) {
# Write-Verbose "Validating property [$Property] with value [$($PSBoundParameters.$Property)]"
# $PSBoundParameters.$Property = ValidateValue -ModelDefinition $ModelDefinition -Property $Property -ProvidedValue $PSBoundParameters.$Property
# } else {
# Write-Verbose "User did not provide a value for [$Property]"
# }
# }
#
# Write-Verbose "Finished enum validation"
}
process {
foreach ($IPId in $Id) {
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses', $IPId))
Write-Verbose "Obtaining IPs from ID $IPId"
Write-Verbose "Obtaining IP from ID $IPId"
$CurrentIP = Get-NetboxIPAMAddress -Id $IPId -ErrorAction Stop
if ($Force -or $PSCmdlet.ShouldProcess($CurrentIP.Address, 'Set')) {
@ -64,11 +75,8 @@ function Set-NetboxIPAMAddress {
$URI = BuildNewURI -Segments $URIComponents.Segments
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method PATCH
InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method $Method
}
}
}
end {
}
}

View file

@ -13,37 +13,67 @@
function Get-NetboxIPAMAggregate {
[CmdletBinding()]
[CmdletBinding(DefaultParameterSetName = 'Query')]
param
(
[uint16]$Limit,
[uint16]$Offset,
[object]$Family,
[datetime]$Date_Added,
[uint16[]]$Id,
[Parameter(ParameterSetName = 'Query')]
[string]$Query,
[Parameter(ParameterSetName = 'ByID')]
[uint16[]]$Id,
[Parameter(ParameterSetName = 'Query')]
[string]$Prefix,
[Parameter(ParameterSetName = 'Query')]
[object]$Family,
[Parameter(ParameterSetName = 'Query')]
[uint16]$RIR_Id,
[Parameter(ParameterSetName = 'Query')]
[string]$RIR,
[Parameter(ParameterSetName = 'Query')]
[datetime]$Date_Added,
[Parameter(ParameterSetName = 'Query')]
[uint16]$Limit,
[Parameter(ParameterSetName = 'Query')]
[uint16]$Offset,
[switch]$Raw
)
if ($null -ne $Family) {
$PSBoundParameters.Family = ValidateIPAMChoice -ProvidedValue $Family -AggregateFamily
}
# if ($null -ne $Family) {
# $PSBoundParameters.Family = ValidateIPAMChoice -ProvidedValue $Family -AggregateFamily
# }
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'aggregates'))
switch ($PSCmdlet.ParameterSetName) {
'ById' {
foreach ($IP_ID in $Id) {
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'aggregates', $IP_ID))
$URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters
$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', 'aggregates'))
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $uri -Raw:$Raw
break
}
}
}

View file

@ -93,7 +93,7 @@ function Get-NetboxIPAMPrefix {
Additional information about the function.
#>
[CmdletBinding()]
[CmdletBinding(DefaultParameterSetName = 'Query')]
param
(
[string]$Prefix,

View file

@ -40,7 +40,7 @@ function New-NetboxIPAMPrefix {
[switch]$Raw
)
$PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -PrefixStatus
# $PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -PrefixStatus
<#
# As of 2018/10/18, this does not appear to be a validated IPAM choice

View file

@ -41,11 +41,11 @@ function Get-NetboxIPAMRole {
[CmdletBinding()]
param
(
[uint16[]]$Id,
[string]$Name,
[string]$Query,
[string]$Name,
[uint16[]]$Id,
[string]$Slug,

View file

@ -16,10 +16,6 @@ function Get-NetboxIPAMVLAN {
[CmdletBinding()]
param
(
[uint16]$Limit,
[uint16]$Offset,
[uint16]$VID,
[uint16[]]$Id,
@ -52,6 +48,10 @@ function Get-NetboxIPAMVLAN {
[uint16]$Role_Id,
[uint16]$Limit,
[uint16]$Offset,
[switch]$Raw
)

View file

@ -63,11 +63,11 @@
[switch]$Raw
)
$PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -VLANStatus
if ($null -ne $Role) {
$PSBoundParameters.Role = ValidateIPAMChoice -ProvidedValue $Role -IPAddressRole
}
# $PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -VLANStatus
#
# if ($null -ne $Role) {
# $PSBoundParameters.Role = ValidateIPAMChoice -ProvidedValue $Role -IPAddressRole
# }
$segments = [System.Collections.ArrayList]::new(@('ipam', 'vlans'))

View file

@ -48,8 +48,6 @@
try {
Write-Verbose "Verifying API connectivity..."
$null = VerifyAPIConnectivity
$script:NetboxConfig.Connected = $true
Write-Verbose "Successfully connected!"
} catch {
Write-Verbose "Failed to connect. Generating error"
Write-Verbose $_.Exception.Message
@ -60,14 +58,25 @@
}
}
Write-Verbose "Caching static choices"
$script:NetboxConfig.Choices.Circuits = Get-NetboxCircuitsChoices
$script:NetboxConfig.Choices.DCIM = Get-NetboxDCIMChoices # Not completed yet
$script:NetboxConfig.Choices.Extras = Get-NetboxExtrasChoices
$script:NetboxConfig.Choices.IPAM = Get-NetboxIPAMChoices
#$script:NetboxConfig.Choices.Secrets = Get-NetboxSecretsChoices # Not completed yet
#$script:NetboxConfig.Choices.Tenancy = Get-NetboxTenancyChoices
$script:NetboxConfig.Choices.Virtualization = Get-NetboxVirtualizationChoices
Write-Verbose "Caching API definition"
$script:NetboxConfig.APIDefinition = Get-NetboxAPIDefinition
if ([version]$script:NetboxConfig.APIDefinition.info.version -lt 2.8) {
$Script:NetboxConfig.Connected = $false
throw "Netbox version is incompatible with this PS module. Requires >=2.8.*, found version $($script:NetboxConfig.APIDefinition.info.version)"
}
$script:NetboxConfig.Connected = $true
Write-Verbose "Successfully connected!"
#Write-Verbose "Caching static choices"
#$script:NetboxConfig.Choices.Circuits = Get-NetboxCircuitsChoices
#$script:NetboxConfig.Choices.DCIM = Get-NetboxDCIMChoices # Not completed yet
#$script:NetboxConfig.Choices.Extras = Get-NetboxExtrasChoices
#$script:NetboxConfig.Choices.IPAM = Get-NetboxIPAMChoices
##$script:NetboxConfig.Choices.Secrets = Get-NetboxSecretsChoices # Not completed yet
##$script:NetboxConfig.Choices.Tenancy = Get-NetboxTenancyChoices
#$script:NetboxConfig.Choices.Virtualization = Get-NetboxVirtualizationChoices
Write-Verbose "Connection process completed"
}

View file

@ -0,0 +1,29 @@
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.174
Created on: 4/28/2020 11:57
Created by: Claussen
Organization: NEOnet
Filename: Get-NetboxAPIDefinition.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
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'}
$URI = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $URI -Timeout 10
}

View file

@ -12,6 +12,7 @@
'Connected' = $false
'Choices' = @{
}
'APIDefinition' = $null
}
}

View file

@ -2,9 +2,9 @@
[CmdletBinding()]
param ()
$uriSegments = [System.Collections.ArrayList]::new(@('extras', '_choices'))
$uriSegments = [System.Collections.ArrayList]::new(@('extras'))
$uri = BuildNewURI -Segments $uriSegments -SkipConnectedCheck
$uri = BuildNewURI -Segments $uriSegments -Parameters @{'format' = 'json'} -SkipConnectedCheck
InvokeNetboxRequest -URI $uri
}

View file

@ -16,12 +16,10 @@ function Get-NetboxTenant {
[CmdletBinding()]
param
(
[uint16]$Limit,
[uint16]$Offset,
[string]$Name,
[string]$Slug,
[uint16[]]$Id,
[string]$Query,
@ -32,6 +30,10 @@ function Get-NetboxTenant {
[hashtable]$CustomFields,
[uint16]$Limit,
[uint16]$Offset,
[switch]$Raw
)

View file

@ -46,7 +46,14 @@ function New-NetboxVirtualMachine {
[string]$Comments
)
$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
# $ModelDefinition = $script:NetboxConfig.APIDefinition.definitions.WritableVirtualMachineWithConfigContext
#
# # Validate the status against the APIDefinition
# if ($ModelDefinition.properties.status.enum -inotcontains $Status) {
# throw ("Invalid value [] for Status. Must be one of []" -f $Status, ($ModelDefinition.properties.status.enum -join ', '))
# }
#
#$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines'))
@ -56,3 +63,7 @@ function New-NetboxVirtualMachine {
InvokeNetboxRequest -URI $URI -Method POST -Body $URIComponents.Parameters
}

View file

@ -50,19 +50,19 @@ function Set-NetboxVirtualMachine {
[switch]$Force
)
if ($null -ne $Status) {
$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
}
# if ($null -ne $Status) {
# $PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
# }
#
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines', $Id))
Write-Verbose "Obtaining VM from ID $Id"
$CurrentVM = Get-NetboxVirtualMachine -Id $Id -ErrorAction Stop
#$CurrentVM = Get-NetboxVirtualMachine -Id $Id -ErrorAction Stop
Write-Verbose "Finished obtaining VM"
if ($Force -or $pscmdlet.ShouldProcess($CurrentVM.Name, "Set")) {
if ($Force -or $pscmdlet.ShouldProcess($ID, "Set properties on VM ID")) {
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id', 'Force'
$URI = BuildNewURI -Segments $URIComponents.Segments

View file

@ -60,15 +60,13 @@ function Get-NetboxVirtualMachineInterface {
[CmdletBinding()]
param
(
[uint16]$Limit,
[uint16]$Offset,
[Parameter(ValueFromPipeline = $true)]
[uint16]$Id,
[string]$Name,
[string]$Query,
[boolean]$Enabled,
[uint16]$MTU,
@ -79,6 +77,10 @@ function Get-NetboxVirtualMachineInterface {
[string]$MAC_Address,
[uint16]$Limit,
[uint16]$Offset,
[switch]$Raw
)

View file

@ -66,16 +66,11 @@ function Get-NetboxVirtualizationCluster {
[CmdletBinding()]
param
(
[uint16]$Limit,
[uint16]$Offset,
[string]$Name,
[Alias('q')]
[string]$Query,
[string]$Name,
[Alias('id__in')]
[uint16[]]$Id,
[string]$Group,
@ -90,36 +85,18 @@ function Get-NetboxVirtualizationCluster {
[uint16]$Site_Id,
[uint16]$Limit,
[uint16]$Offset,
[switch]$Raw
)
$uriSegments = [System.Collections.ArrayList]::new(@('virtualization', 'clusters'))
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'clusters'))
$URIParameters = @{
}
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
foreach ($CmdletParameterName in $PSBoundParameters.Keys) {
if ($CmdletParameterName -in $CommonParameterNames) {
# These are common parameters and should not be appended to the URI
Write-Debug "Skipping parameter $CmdletParameterName"
continue
}
if ($CmdletParameterName -eq 'Id') {
# Check if there is one or more values for Id and build a URI or query as appropriate
if (@($PSBoundParameters[$CmdletParameterName]).Count -gt 1) {
$URIParameters['id__in'] = $Id -join ','
} else {
[void]$uriSegments.Add($PSBoundParameters[$CmdletParameterName])
}
} elseif ($CmdletParameterName -eq 'Query') {
$URIParameters['q'] = $PSBoundParameters[$CmdletParameterName]
} else {
$URIParameters[$CmdletParameterName.ToLower()] = $PSBoundParameters[$CmdletParameterName]
}
}
$uri = BuildNewURI -Segments $uriSegments -Parameters $URIParameters
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $uri -Raw:$Raw
}

View file

@ -16,33 +16,28 @@ function Get-NetboxVirtualizationClusterGroup {
[CmdletBinding()]
param
(
[uint16]$Limit,
[uint16]$Offset,
[string]$Name,
[string]$Slug,
[string]$Description,
[string]$Query,
[uint32[]]$Id,
[uint16]$Limit,
[uint16]$Offset,
[switch]$Raw
)
$uriSegments = [System.Collections.ArrayList]::new(@('virtualization', 'cluster-groups'))
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'cluster-groups'))
$URIParameters = @{
}
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
foreach ($CmdletParameterName in $PSBoundParameters.Keys) {
if ($CmdletParameterName -in $CommonParameterNames) {
# These are common parameters and should not be appended to the URI
Write-Debug "Skipping parameter $CmdletParameterName"
continue
}
$URIParameters[$CmdletParameterName.ToLower()] = $PSBoundParameters[$CmdletParameterName]
}
$uri = BuildNewURI -Segments $uriSegments -Parameters $URIParameters
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $uri -Raw:$Raw
}