mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 18:02:29 +00:00
Rename ValidateIPAMChoices and ValidateVirtualizationChoices to singluar Choice
This commit is contained in:
parent
b50375722e
commit
b8bfcf33e3
3 changed files with 18 additions and 19 deletions
|
|
@ -23,7 +23,7 @@ function Get-NetboxIPAMChoices {
|
||||||
InvokeNetboxRequest -URI $uri
|
InvokeNetboxRequest -URI $uri
|
||||||
}
|
}
|
||||||
|
|
||||||
function VerifyIPAMChoices {
|
function ValidateIPAMChoice {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Internal function to verify provided values for static choices
|
Internal function to verify provided values for static choices
|
||||||
|
|
@ -60,10 +60,10 @@ function VerifyIPAMChoices {
|
||||||
Verify against service protocol values
|
Verify against service protocol values
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS C:\> VerifyIPAMChoices -ProvidedValue 'loopback' -IPAddressRole
|
PS C:\> ValidateIPAMChoice -ProvidedValue 'loopback' -IPAddressRole
|
||||||
|
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS C:\> VerifyIPAMChoices -ProvidedValue 'Loopback' -IPAddressFamily
|
PS C:\> ValidateIPAMChoice -ProvidedValue 'Loopback' -IPAddressFamily
|
||||||
>> Invalid value Loopback for ip-address:family. Must be one of: 4, 6, IPv4, IPv6
|
>> Invalid value Loopback for ip-address:family. Must be one of: 4, 6, IPv4, IPv6
|
||||||
|
|
||||||
.OUTPUTS
|
.OUTPUTS
|
||||||
|
|
@ -122,7 +122,6 @@ function VerifyIPAMChoices {
|
||||||
|
|
||||||
function Get-NetboxIPAMAggregate {
|
function Get-NetboxIPAMAggregate {
|
||||||
[CmdletBinding()]
|
[CmdletBinding()]
|
||||||
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "These are literally 'choices' in Netbox")]
|
|
||||||
param
|
param
|
||||||
(
|
(
|
||||||
[uint16]$Limit,
|
[uint16]$Limit,
|
||||||
|
|
@ -145,7 +144,7 @@ function Get-NetboxIPAMAggregate {
|
||||||
)
|
)
|
||||||
|
|
||||||
if ($null -ne $Family) {
|
if ($null -ne $Family) {
|
||||||
$PSBoundParameters.Family = VerifyIPAMChoices -ProvidedValue $Family -AggregateFamily
|
$PSBoundParameters.Family = ValidateIPAMChoice -ProvidedValue $Family -AggregateFamily
|
||||||
}
|
}
|
||||||
|
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'aggregates'))
|
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'aggregates'))
|
||||||
|
|
@ -201,15 +200,15 @@ function Get-NetboxIPAMAddress {
|
||||||
)
|
)
|
||||||
|
|
||||||
if ($null -ne $Family) {
|
if ($null -ne $Family) {
|
||||||
$PSBoundParameters.Family = VerifyIPAMChoices -ProvidedValue $Family -IPAddressFamily
|
$PSBoundParameters.Family = ValidateIPAMChoice -ProvidedValue $Family -IPAddressFamily
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($null -ne $Status) {
|
if ($null -ne $Status) {
|
||||||
$PSBoundParameters.Status = VerifyIPAMChoices -ProvidedValue $Status -IPAddressStatus
|
$PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -IPAddressStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($null -ne $Role) {
|
if ($null -ne $Role) {
|
||||||
$PSBoundParameters.Role = VerifyIPAMChoices -ProvidedValue $Role -IPAddressRole
|
$PSBoundParameters.Role = ValidateIPAMChoice -ProvidedValue $Role -IPAddressRole
|
||||||
}
|
}
|
||||||
|
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses'))
|
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses'))
|
||||||
|
|
@ -398,11 +397,11 @@ function Get-NetboxIPAMPrefix {
|
||||||
)
|
)
|
||||||
|
|
||||||
if ($null -ne $Family) {
|
if ($null -ne $Family) {
|
||||||
$PSBoundParameters.Family = VerifyIPAMChoices -ProvidedValue $Family -PrefixFamily
|
$PSBoundParameters.Family = ValidateIPAMChoice -ProvidedValue $Family -PrefixFamily
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($null -ne $Status) {
|
if ($null -ne $Status) {
|
||||||
$PSBoundParameters.Status = VerifyIPAMChoices -ProvidedValue $Status -PrefixStatus
|
$PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -PrefixStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'prefixes'))
|
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'prefixes'))
|
||||||
|
|
@ -485,10 +484,10 @@ function New-NetboxIPAMAddress {
|
||||||
[switch]$Raw
|
[switch]$Raw
|
||||||
)
|
)
|
||||||
|
|
||||||
$PSBoundParameters.Status = VerifyIPAMChoices -ProvidedValue $Status -IPAddressStatus
|
$PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -IPAddressStatus
|
||||||
|
|
||||||
if ($null -ne $Role) {
|
if ($null -ne $Role) {
|
||||||
$PSBoundParameters.Role = VerifyIPAMChoices -ProvidedValue $Role -IPAddressRole
|
$PSBoundParameters.Role = ValidateIPAMChoice -ProvidedValue $Role -IPAddressRole
|
||||||
}
|
}
|
||||||
|
|
||||||
$segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses'))
|
$segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses'))
|
||||||
|
|
@ -580,11 +579,11 @@ function Set-NetboxIPAMAddress {
|
||||||
)
|
)
|
||||||
|
|
||||||
if ($Status) {
|
if ($Status) {
|
||||||
$PSBoundParameters.Status = VerifyIPAMChoices -ProvidedValue $Status -IPAddressStatus
|
$PSBoundParameters.Status = ValidateIPAMChoice -ProvidedValue $Status -IPAddressStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($Role) {
|
if ($Role) {
|
||||||
$PSBoundParameters.Role = VerifyIPAMChoices -ProvidedValue $Role -IPAddressRole
|
$PSBoundParameters.Role = ValidateIPAMChoice -ProvidedValue $Role -IPAddressRole
|
||||||
}
|
}
|
||||||
|
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses', $Id))
|
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses', $Id))
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
Virtualization object functions
|
Virtualization object functions
|
||||||
#>
|
#>
|
||||||
|
|
||||||
function ValidateVirtualizationChoices {
|
function ValidateVirtualizationChoice {
|
||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Internal function to verify provided values for static choices
|
Internal function to verify provided values for static choices
|
||||||
|
|
@ -219,7 +219,7 @@ function Get-NetboxVirtualMachine {
|
||||||
)
|
)
|
||||||
|
|
||||||
if ($null -ne $Status) {
|
if ($null -ne $Status) {
|
||||||
$PSBoundParameters.Status = ValidateVirtualizationChoices -ProvidedValue $Status -VirtualMachineStatus
|
$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines'))
|
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines'))
|
||||||
|
|
@ -491,7 +491,7 @@ function New-NetboxVirtualMachine {
|
||||||
[string]$Comments
|
[string]$Comments
|
||||||
)
|
)
|
||||||
|
|
||||||
$PSBoundParameters.Status = ValidateVirtualizationChoices -ProvidedValue $Status -VirtualMachineStatus
|
$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
||||||
|
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines'))
|
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines'))
|
||||||
|
|
||||||
|
|
@ -578,7 +578,7 @@ function Set-NetboxVirtualMachine {
|
||||||
)
|
)
|
||||||
|
|
||||||
if ($null -ne $Status) {
|
if ($null -ne $Status) {
|
||||||
$PSBoundParameters.Status = ValidateVirtualizationChoices -ProvidedValue $Status -VirtualMachineStatus
|
$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
||||||
}
|
}
|
||||||
|
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines', $Id))
|
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines', $Id))
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ Describe -Name "IPAM tests" -Tag 'Ipam' -Fixture {
|
||||||
InModuleScope -ModuleName 'NetboxPS' -ScriptBlock {
|
InModuleScope -ModuleName 'NetboxPS' -ScriptBlock {
|
||||||
$script:NetboxConfig.Choices.IPAM = (Get-Content "$PSScriptRoot\IPAMChoices.json" -ErrorAction Stop | ConvertFrom-Json)
|
$script:NetboxConfig.Choices.IPAM = (Get-Content "$PSScriptRoot\IPAMChoices.json" -ErrorAction Stop | ConvertFrom-Json)
|
||||||
|
|
||||||
Context -Name "VerifyIPAMChoices" -Fixture {
|
Context -Name "ValidateIPAMChoice" -Fixture {
|
||||||
#It "Should return a valid integer"
|
#It "Should return a valid integer"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue