Remove references to _choices API calls

This commit is contained in:
Ben Claussen 2020-12-08 12:11:44 -05:00
parent f29701ad2f
commit acbbb284d3
15 changed files with 2 additions and 1175 deletions

View file

@ -1,38 +0,0 @@
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/23/2020 12:15
Created by: Claussen
Organization: NEOnet
Filename: Get-NetboxCircuitsChoices.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function Get-NetboxCircuitsChoices {
<#
.SYNOPSIS
Gets the choices associated with circuits
.DESCRIPTION
A detailed description of the Get-NetboxCircuitsChoices function.
.EXAMPLE
PS C:\> Get-NetboxCircuitsChoices
.NOTES
Additional information about the function.
#>
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "These are literally 'choices' in Netbox")]
param ()
$uriSegments = [System.Collections.ArrayList]::new(@('circuits', '_choices'))
$uri = BuildNewURI -Segments $uriSegments
InvokeNetboxRequest -URI $uri
}

View file

@ -1,25 +0,0 @@
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/23/2020 12:13
Created by: Claussen
Organization: NEOnet
Filename: Get-NetboxDCIMChoices.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function Get-NetboxDCIMChoices {
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "These are literally 'choices' in Netbox")]
param ()
$uriSegments = [System.Collections.ArrayList]::new(@('dcim', '_choices'))
$uri = BuildNewURI -Segments $uriSegments -Parameters $Parameters
InvokeNetboxRequest -URI $uri
}

View file

@ -1,102 +0,0 @@
function ValidateDCIMChoice {
<#
.SYNOPSIS
Internal function to validate provided values for static choices
.DESCRIPTION
When users connect to the API, choices for each major object are cached to the config variable.
These values are then utilized to validate if the provided value from a user is valid.
.PARAMETER ProvidedValue
The value to validate against static choices
.PARAMETER PowerConnectionStatus
Validate against power connection status values
.PARAMETER InterfaceTemplateFormFactor
Validate against interface template form factor values
.PARAMETER InterfaceConnectionStatus
Validate against interface connection status values
.PARAMETER InterfaceFormFactor
Validate against interface form factor values
.PARAMETER ConsolePortConnectionStatus
Validate against console port connection status values
.PARAMETER DeviceStatus
Validate against device status values
.PARAMETER DeviceFace
Validate against device face values
.PARAMETER RackType
Validate against rack type values
.PARAMETER RackWidth
Validate against rack width values.
.EXAMPLE
PS C:\> ValidateDCIMChoice -ProvidedValue 'rear' -DeviceFace
.EXAMPLE
PS C:\> ValidateDCIMChoice -ProvidedValue 'middle' -DeviceFace
>> Invalid value middle for device:face. Must be one of: 0, 1, Front, Rear
.OUTPUTS
This function returns the integer value if valid. Otherwise, it will throw an error.
.NOTES
Additional information about the function.
.FUNCTIONALITY
This cmdlet is intended to be used internally and not exposed to the user
#>
[CmdletBinding()]
[OutputType([uint16])]
param
(
[Parameter(Mandatory = $true)]
[object]$ProvidedValue,
[Parameter(ParameterSetName = 'power-port:connection_status',
Mandatory = $true)]
[switch]$PowerConnectionStatus,
[Parameter(ParameterSetName = 'interface-template:form_factor',
Mandatory = $true)]
[switch]$InterfaceTemplateFormFactor,
[Parameter(ParameterSetName = 'interface-connection:connection_status',
Mandatory = $true)]
[switch]$InterfaceConnectionStatus,
[Parameter(ParameterSetName = 'interface:form_factor',
Mandatory = $true)]
[switch]$InterfaceFormFactor,
[Parameter(ParameterSetName = 'console-port:connection_status',
Mandatory = $true)]
[switch]$ConsolePortConnectionStatus,
[Parameter(ParameterSetName = 'device:status',
Mandatory = $true)]
[switch]$DeviceStatus,
[Parameter(ParameterSetName = 'device:face',
Mandatory = $true)]
[switch]$DeviceFace,
[Parameter(ParameterSetName = 'rack:type',
Mandatory = $true)]
[switch]$RackType,
[Parameter(ParameterSetName = 'rack:width',
Mandatory = $true)]
[switch]$RackWidth
)
ValidateChoice -MajorObject 'DCIM' -ChoiceName $PSCmdlet.ParameterSetName -ProvidedValue $ProvidedValue
}

View file

@ -1,11 +0,0 @@
function Get-NetboxExtrasChoices {
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "These are literally 'choices' in Netbox")]
param ()
$uriSegments = [System.Collections.ArrayList]::new(@('extras', '_choices'))
$uri = BuildNewURI -Segments $uriSegments
InvokeNetboxRequest -URI $uri
}

View file

@ -1,41 +0,0 @@
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/26/2020 14:23
Created by: Claussen
Organization: NEOnet
Filename: GetChoiceValidValues.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function GetChoiceValidValues {
[CmdletBinding()]
[OutputType([System.Collections.ArrayList])]
param
(
[Parameter(Mandatory = $true)]
[string]$MajorObject,
[Parameter(Mandatory = $true)]
[object]$Choice
)
$ValidValues = New-Object System.Collections.ArrayList
if (-not $script:NetboxConfig.Choices.$MajorObject.$Choice) {
throw "Missing choices for $Choice"
}
[void]$ValidValues.AddRange($script:NetboxConfig.Choices.$MajorObject.$Choice.value)
[void]$ValidValues.AddRange($script:NetboxConfig.Choices.$MajorObject.$Choice.label)
if ($ValidValues.Count -eq 0) {
throw "Missing valid values for $MajorObject.$Choice"
}
return [System.Collections.ArrayList]$ValidValues
}

View file

@ -1,76 +0,0 @@
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/26/2020 14:23
Created by: Claussen
Organization: NEOnet
Filename: ValidateChoice.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function ValidateChoice {
[CmdletBinding()]
[OutputType([uint16], [string], [bool])]
param
(
[Parameter(Mandatory = $true)]
[ValidateSet('Circuits', 'DCIM', 'Extras', 'IPAM', 'Virtualization', IgnoreCase = $true)]
[string]$MajorObject,
[Parameter(Mandatory = $true)]
[string]$ChoiceName,
[Parameter(Mandatory = $true)]
[object]$ProvidedValue
)
$ValidValues = GetChoiceValidValues -MajorObject $MajorObject -Choice $ChoiceName
Write-Verbose "Validating $ChoiceName"
Write-Verbose "Checking '$ProvidedValue' against [$($ValidValues -join ', ')]"
# Coercing everything to strings for matching...
# some values are integers, some are strings, some are booleans
# Join the valid values with a pipe as a delimeter, because some values have spaces
if (([string]($ValidValues -join '|') -split '\|') -inotcontains [string]$ProvidedValue) {
throw "Invalid value '$ProvidedValue' for '$ChoiceName'. Must be one of: $($ValidValues -join ', ')"
}
switch -wildcard ("$MajorObject/$ChoiceName") {
"Circuits" {
# This has things that are not integers
}
"DCIM/*connection_status" {
# This has true/false values instead of integers
try {
$val = [bool]::Parse($ProvidedValue)
} catch {
# It must not be a true/false value
$val = $script:NetboxConfig.Choices.$MajorObject.$ChoiceName.Where({
$_.Label -eq $ProvidedValue
}).Value
}
return $val
}
default {
# Convert the ProvidedValue to the integer value
try {
$intVal = [uint16]"$ProvidedValue"
} catch {
# It must not be a number, get the value from the label
$intVal = [uint16]$script:NetboxConfig.Choices.$MajorObject.$ChoiceName.Where({
$_.Label -eq $ProvidedValue
}).Value
}
return $intVal
}
}
}

View file

@ -1,25 +0,0 @@
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/19/2020 11:54
Created by: Claussen
Organization: NEOnet
Filename: Get-NetboxIPAMChoices.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function Get-NetboxIPAMChoices {
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "These are literally 'choices' in Netbox")]
param ()
$uriSegments = [System.Collections.ArrayList]::new(@('ipam', '_choices'))
$uri = BuildNewURI -Segments $uriSegments -Parameters $Parameters
InvokeNetboxRequest -URI $uri
}

View file

@ -1,109 +0,0 @@
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/19/2020 11:54
Created by: Claussen
Organization: NEOnet
Filename: ValidateIPAMChoice.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function ValidateIPAMChoice {
<#
.SYNOPSIS
Internal function to verify provided values for static choices
.DESCRIPTION
When users connect to the API, choices for each major object are cached to the config variable.
These values are then utilized to verify if the provided value from a user is valid.
.PARAMETER ProvidedValue
The value to validate against static choices
.PARAMETER AggregateFamily
Verify against aggregate family values
.PARAMETER PrefixFamily
Verify against prefix family values
.PARAMETER PrefixStatus
Verify against prefix status values
.PARAMETER IPAddressFamily
Verify against ip-address family values
.PARAMETER IPAddressStatus
Verify against ip-address status values
.PARAMETER IPAddressRole
Verify against ip-address role values
.PARAMETER VLANStatus
Verify against VLAN status values
.PARAMETER ServiceProtocol
Verify against service protocol values
.EXAMPLE
PS C:\> ValidateIPAMChoice -ProvidedValue 'loopback' -IPAddressRole
.EXAMPLE
PS C:\> ValidateIPAMChoice -ProvidedValue 'Loopback' -IPAddressFamily
>> Invalid value Loopback for ip-address:family. Must be one of: 4, 6, IPv4, IPv6
.OUTPUTS
This function returns the integer value if valid. Otherwise, it will throw an error.
.NOTES
Additional information about the function.
.FUNCTIONALITY
This cmdlet is intended to be used internally and not exposed to the user
#>
[CmdletBinding(DefaultParameterSetName = 'service:protocol')]
[OutputType([uint16])]
param
(
[Parameter(Mandatory = $true)]
[object]$ProvidedValue,
[Parameter(ParameterSetName = 'aggregate:family',
Mandatory = $true)]
[switch]$AggregateFamily,
[Parameter(ParameterSetName = 'prefix:family',
Mandatory = $true)]
[switch]$PrefixFamily,
[Parameter(ParameterSetName = 'prefix:status',
Mandatory = $true)]
[switch]$PrefixStatus,
[Parameter(ParameterSetName = 'ip-address:family',
Mandatory = $true)]
[switch]$IPAddressFamily,
[Parameter(ParameterSetName = 'ip-address:status',
Mandatory = $true)]
[switch]$IPAddressStatus,
[Parameter(ParameterSetName = 'ip-address:role',
Mandatory = $true)]
[switch]$IPAddressRole,
[Parameter(ParameterSetName = 'vlan:status',
Mandatory = $true)]
[switch]$VLANStatus,
[Parameter(ParameterSetName = 'service:protocol',
Mandatory = $true)]
[switch]$ServiceProtocol
)
ValidateChoice -MajorObject 'IPAM' -ChoiceName $PSCmdlet.ParameterSetName -ProvidedValue $ProvidedValue
}

View file

@ -1,25 +0,0 @@
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/19/2020 11:56
Created by: Claussen
Organization: NEOnet
Filename: Get-NetboxTenancyChoices.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function Get-NetboxTenancyChoices {
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "These are literally 'choices' in Netbox")]
param ()
$uriSegments = [System.Collections.ArrayList]::new(@('tenancy', '_choices'))
$uri = BuildNewURI -Segments $uriSegments
InvokeNetboxRequest -URI $uri
}

View file

@ -1,25 +0,0 @@
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/19/2020 14:10
Created by: Claussen
Organization: NEOnet
Filename: Get-NetboxVirtualizationChoices.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function Get-NetboxVirtualizationChoices {
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "These are literally 'choices' in Netbox")]
param ()
$uriSegments = [System.Collections.ArrayList]::new(@('virtualization', '_choices'))
$uri = BuildNewURI -Segments $uriSegments
InvokeNetboxRequest -URI $uri
}

View file

@ -1,76 +0,0 @@
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/19/2020 14:12
Created by: Claussen
Organization: NEOnet
Filename: ValidateVirtualizationChoice.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function ValidateVirtualizationChoice {
<#
.SYNOPSIS
Internal function to verify provided values for static choices
.DESCRIPTION
When users connect to the API, choices for each major object are cached to the config variable.
These values are then utilized to verify if the provided value from a user is valid.
.PARAMETER ProvidedValue
The value to validate against static choices
.PARAMETER AggregateFamily
Verify against aggregate family values
.PARAMETER PrefixFamily
Verify against prefix family values
.PARAMETER PrefixStatus
Verify against prefix status values
.PARAMETER IPAddressFamily
Verify against ip-address family values
.PARAMETER IPAddressStatus
Verify against ip-address status values
.PARAMETER IPAddressRole
Verify against ip-address role values
.PARAMETER VLANStatus
Verify against VLAN status values
.PARAMETER ServiceProtocol
Verify against service protocol values
.EXAMPLE
PS C:\> VerifyIPAMChoices -ProvidedValue 'loopback' -IPAddressRole
.EXAMPLE
PS C:\> VerifyIPAMChoices -ProvidedValue 'Loopback' -IPAddressFamily
>> Invalid value Loopback for ip-address:family. Must be one of: 4, 6, IPv4, IPv6
.FUNCTIONALITY
This cmdlet is intended to be used internally and not exposed to the user
.OUTPUT
This function returns nothing if the value is valid. Otherwise, it will throw an error.
#>
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)]
[object]$ProvidedValue,
[Parameter(ParameterSetName = 'virtual-machine:status',
Mandatory = $true)]
[switch]$VirtualMachineStatus
)
ValidateChoice -MajorObject 'Virtualization' -ChoiceName $PSCmdlet.ParameterSetName -ProvidedValue $ProvidedValue
}

View file

@ -12,7 +12,7 @@
RootModule = 'NetboxPS.psm1' RootModule = 'NetboxPS.psm1'
# Version number of this module. # Version number of this module.
ModuleVersion = '1.2.1' ModuleVersion = '1.2.2'
# Supported PSEditions # Supported PSEditions
# CompatiblePSEditions = @() # CompatiblePSEditions = @()

View file

@ -5,7 +5,6 @@
<Folders> <Folders>
<Folder>Functions</Folder> <Folder>Functions</Folder>
<Folder>Functions\DCIM</Folder> <Folder>Functions\DCIM</Folder>
<Folder>Functions\Extras</Folder>
<Folder>Functions\Circuits</Folder> <Folder>Functions\Circuits</Folder>
<Folder>Functions\Virtualization</Folder> <Folder>Functions\Virtualization</Folder>
<Folder>Functions\IPAM</Folder> <Folder>Functions\IPAM</Folder>
@ -47,8 +46,6 @@
<File Build="0" Shared="True" ReferenceFunction="Invoke-CheckNetboxIsConnected_ps1" ExportFunctions="True">Functions\Helpers\CheckNetboxIsConnected.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-CheckNetboxIsConnected_ps1" ExportFunctions="True">Functions\Helpers\CheckNetboxIsConnected.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-BuildNewURI_ps1" ExportFunctions="True">Functions\Helpers\BuildNewURI.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-BuildNewURI_ps1" ExportFunctions="True">Functions\Helpers\BuildNewURI.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-BuildURIComponents_ps1" ExportFunctions="True">Functions\Helpers\BuildURIComponents.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-BuildURIComponents_ps1" ExportFunctions="True">Functions\Helpers\BuildURIComponents.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-GetChoiceValidValues_ps1" ExportFunctions="True">Functions\Helpers\GetChoiceValidValues.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-ValidateChoice_ps1" ExportFunctions="True">Functions\Helpers\ValidateChoice.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-GetNetboxAPIErrorBody_ps1" ExportFunctions="True">Functions\Helpers\GetNetboxAPIErrorBody.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-GetNetboxAPIErrorBody_ps1" ExportFunctions="True">Functions\Helpers\GetNetboxAPIErrorBody.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-InvokeNetboxRequest_ps1" ExportFunctions="True">Functions\Helpers\InvokeNetboxRequest.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-InvokeNetboxRequest_ps1" ExportFunctions="True">Functions\Helpers\InvokeNetboxRequest.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-ThrowNetboxRESTError_ps1" ExportFunctions="True">Functions\Helpers\ThrowNetboxRESTError.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-ThrowNetboxRESTError_ps1" ExportFunctions="True">Functions\Helpers\ThrowNetboxRESTError.ps1</File>
@ -61,8 +58,6 @@
<File Build="0" Shared="True" ReferenceFunction="Invoke-Set-NetboxCredential_ps1" ExportFunctions="True">Functions\Setup\Set-NetboxCredential.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Set-NetboxCredential_ps1" ExportFunctions="True">Functions\Setup\Set-NetboxCredential.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxCredential_ps1" ExportFunctions="True">Functions\Setup\Get-NetboxCredential.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxCredential_ps1" ExportFunctions="True">Functions\Setup\Get-NetboxCredential.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Connect-NetboxAPI_ps1" ExportFunctions="True">Functions\Setup\Connect-NetboxAPI.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Connect-NetboxAPI_ps1" ExportFunctions="True">Functions\Setup\Connect-NetboxAPI.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxExtrasChoices_ps1" ExportFunctions="True">Functions\Extras\Get-NetboxExtrasChoices.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-ValidateDCIMChoice_ps1" ExportFunctions="False">Functions\DCIM\ValidateDCIMChoice.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxIPAMVLAN_ps1" ExportFunctions="True">Functions\IPAM\VLAN\Get-NetboxIPAMVLAN.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxIPAMVLAN_ps1" ExportFunctions="True">Functions\IPAM\VLAN\Get-NetboxIPAMVLAN.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-New-NetboxIPAMVLAN_ps1" ExportFunctions="True">Functions\IPAM\VLAN\New-NetboxIPAMVLAN.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-New-NetboxIPAMVLAN_ps1" ExportFunctions="True">Functions\IPAM\VLAN\New-NetboxIPAMVLAN.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxIPAMRole_ps1" ExportFunctions="True">Functions\IPAM\Role\Get-NetboxIPAMRole.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxIPAMRole_ps1" ExportFunctions="True">Functions\IPAM\Role\Get-NetboxIPAMRole.ps1</File>
@ -74,10 +69,7 @@
<File Build="0" Shared="True" ReferenceFunction="Invoke-New-NetboxIPAMPrefix_ps1" ExportFunctions="True">Functions\IPAM\Prefix\New-NetboxIPAMPrefix.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-New-NetboxIPAMPrefix_ps1" ExportFunctions="True">Functions\IPAM\Prefix\New-NetboxIPAMPrefix.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Remove-NetboxIPAMAddress_ps1" ExportFunctions="True">Functions\IPAM\Address\Remove-NetboxIPAMAddress.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Remove-NetboxIPAMAddress_ps1" ExportFunctions="True">Functions\IPAM\Address\Remove-NetboxIPAMAddress.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Set-NetboxIPAMAddress_ps1" ExportFunctions="True">Functions\IPAM\Address\Set-NetboxIPAMAddress.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Set-NetboxIPAMAddress_ps1" ExportFunctions="True">Functions\IPAM\Address\Set-NetboxIPAMAddress.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-ValidateIPAMChoice_ps1" ExportFunctions="True">Functions\IPAM\ValidateIPAMChoice.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxIPAMChoices_ps1" ExportFunctions="True">Functions\IPAM\Get-NetboxIPAMChoices.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxTenant_ps1" ExportFunctions="True">Functions\Tenancy\Get-NetboxTenant.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxTenant_ps1" ExportFunctions="True">Functions\Tenancy\Get-NetboxTenant.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxTenancyChoices_ps1" ExportFunctions="True">Functions\Tenancy\Get-NetboxTenancyChoices.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxVirtualMachine_ps1" ExportFunctions="True">Functions\Virtualization\VirtualMachine\Get-NetboxVirtualMachine.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxVirtualMachine_ps1" ExportFunctions="True">Functions\Virtualization\VirtualMachine\Get-NetboxVirtualMachine.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-New-NetboxVirtualMachine_ps1" ExportFunctions="True">Functions\Virtualization\VirtualMachine\New-NetboxVirtualMachine.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-New-NetboxVirtualMachine_ps1" ExportFunctions="True">Functions\Virtualization\VirtualMachine\New-NetboxVirtualMachine.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Set-NetboxVirtualMachine_ps1" ExportFunctions="True">Functions\Virtualization\VirtualMachine\Set-NetboxVirtualMachine.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Set-NetboxVirtualMachine_ps1" ExportFunctions="True">Functions\Virtualization\VirtualMachine\Set-NetboxVirtualMachine.ps1</File>
@ -85,10 +77,8 @@
<File Build="0" Shared="True" ReferenceFunction="Invoke-Add-NetboxVirtualMachineInterface_ps1" ExportFunctions="True">Functions\Virtualization\VirtualMachineInterface\Add-NetboxVirtualMachineInterface.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Add-NetboxVirtualMachineInterface_ps1" ExportFunctions="True">Functions\Virtualization\VirtualMachineInterface\Add-NetboxVirtualMachineInterface.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxVirtualMachineInterface_ps1" ExportFunctions="True">Functions\Virtualization\VirtualMachineInterface\Get-NetboxVirtualMachineInterface.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxVirtualMachineInterface_ps1" ExportFunctions="True">Functions\Virtualization\VirtualMachineInterface\Get-NetboxVirtualMachineInterface.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Set-NetboxVirtualMachineInterface_ps1" ExportFunctions="True">Functions\Virtualization\VirtualMachineInterface\Set-NetboxVirtualMachineInterface.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Set-NetboxVirtualMachineInterface_ps1" ExportFunctions="True">Functions\Virtualization\VirtualMachineInterface\Set-NetboxVirtualMachineInterface.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxVirtualizationChoices_ps1" ExportFunctions="True">Functions\Virtualization\Get-NetboxVirtualizationChoices.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxVirtualizationCluster_ps1" ExportFunctions="True">Functions\Virtualization\VirtualizationCluster\Get-NetboxVirtualizationCluster.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxVirtualizationCluster_ps1" ExportFunctions="True">Functions\Virtualization\VirtualizationCluster\Get-NetboxVirtualizationCluster.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxVirtualizationClusterGroup_ps1" ExportFunctions="True">Functions\Virtualization\VirtualizationCluster\Get-NetboxVirtualizationClusterGroup.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxVirtualizationClusterGroup_ps1" ExportFunctions="True">Functions\Virtualization\VirtualizationCluster\Get-NetboxVirtualizationClusterGroup.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-ValidateVirtualizationChoice_ps1" ExportFunctions="True">Functions\Virtualization\ValidateVirtualizationChoice.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxDCIMDevice_ps1" ExportFunctions="True">Functions\DCIM\Devices\Get-NetboxDCIMDevice.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxDCIMDevice_ps1" ExportFunctions="True">Functions\DCIM\Devices\Get-NetboxDCIMDevice.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxDCIMDeviceType_ps1" ExportFunctions="True">Functions\DCIM\Devices\Get-NetboxDCIMDeviceType.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxDCIMDeviceType_ps1" ExportFunctions="True">Functions\DCIM\Devices\Get-NetboxDCIMDeviceType.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxDCIMDeviceRole_ps1" ExportFunctions="True">Functions\DCIM\Devices\Get-NetboxDCIMDeviceRole.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxDCIMDeviceRole_ps1" ExportFunctions="True">Functions\DCIM\Devices\Get-NetboxDCIMDeviceRole.ps1</File>
@ -104,8 +94,6 @@
<File Build="0" Shared="True" ReferenceFunction="Invoke-Remove-NetboxDCIMInterface_ps1" ExportFunctions="True">Functions\DCIM\Interfaces\Remove-NetboxDCIMInterface.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Remove-NetboxDCIMInterface_ps1" ExportFunctions="True">Functions\DCIM\Interfaces\Remove-NetboxDCIMInterface.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Remove-NetboxDCIMInterfaceConnection_ps1" ExportFunctions="True">Functions\DCIM\Interfaces\Remove-NetboxDCIMInterfaceConnection.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Remove-NetboxDCIMInterfaceConnection_ps1" ExportFunctions="True">Functions\DCIM\Interfaces\Remove-NetboxDCIMInterfaceConnection.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxDCIMPlatform_ps1" ExportFunctions="True">Functions\DCIM\Get-NetboxDCIMPlatform.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxDCIMPlatform_ps1" ExportFunctions="True">Functions\DCIM\Get-NetboxDCIMPlatform.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxDCIMChoices_ps1" ExportFunctions="True">Functions\DCIM\Get-NetboxDCIMChoices.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxCircuitsChoices_ps1" ExportFunctions="True">Functions\Circuits\Get-NetboxCircuitsChoices.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxCircuit_ps1" ExportFunctions="True">Functions\Circuits\Circuits\Get-NetboxCircuit.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxCircuit_ps1" ExportFunctions="True">Functions\Circuits\Circuits\Get-NetboxCircuit.ps1</File>
<File Build="2" Shared="True" ReferenceFunction="Invoke-deploy_ps1" ExportFunctions="False">deploy.ps1</File> <File Build="2" Shared="True" ReferenceFunction="Invoke-deploy_ps1" ExportFunctions="False">deploy.ps1</File>
<File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxAPIDefinition_ps1" ExportFunctions="True">Functions\Setup\Support\Get-NetboxAPIDefinition.ps1</File> <File Build="0" Shared="True" ReferenceFunction="Invoke-Get-NetboxAPIDefinition_ps1" ExportFunctions="True">Functions\Setup\Support\Get-NetboxAPIDefinition.ps1</File>

View file

@ -12,7 +12,7 @@
RootModule = 'NetboxPS.psm1' RootModule = 'NetboxPS.psm1'
# Version number of this module. # Version number of this module.
ModuleVersion = '1.2.1' ModuleVersion = '1.2.2'
# Supported PSEditions # Supported PSEditions
# CompatiblePSEditions = @() # CompatiblePSEditions = @()

View file

@ -611,52 +611,6 @@ public enum $EnumName
#endregion #endregion
#region File GetChoiceValidValues.ps1
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/26/2020 14:23
Created by: Claussen
Organization: NEOnet
Filename: GetChoiceValidValues.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function GetChoiceValidValues {
[CmdletBinding()]
[OutputType([System.Collections.ArrayList])]
param
(
[Parameter(Mandatory = $true)]
[string]$MajorObject,
[Parameter(Mandatory = $true)]
[object]$Choice
)
$ValidValues = New-Object System.Collections.ArrayList
if (-not $script:NetboxConfig.Choices.$MajorObject.$Choice) {
throw "Missing choices for $Choice"
}
[void]$ValidValues.AddRange($script:NetboxConfig.Choices.$MajorObject.$Choice.value)
[void]$ValidValues.AddRange($script:NetboxConfig.Choices.$MajorObject.$Choice.label)
if ($ValidValues.Count -eq 0) {
throw "Missing valid values for $MajorObject.$Choice"
}
return [System.Collections.ArrayList]$ValidValues
}
#endregion
#region File Get-ModelDefinition.ps1 #region File Get-ModelDefinition.ps1
<# <#
@ -1007,49 +961,6 @@ function Get-NetboxCircuitProvider {
#endregion #endregion
#region File Get-NetboxCircuitsChoices.ps1
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/23/2020 12:15
Created by: Claussen
Organization: NEOnet
Filename: Get-NetboxCircuitsChoices.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function Get-NetboxCircuitsChoices {
<#
.SYNOPSIS
Gets the choices associated with circuits
.DESCRIPTION
A detailed description of the Get-NetboxCircuitsChoices function.
.EXAMPLE
PS C:\> Get-NetboxCircuitsChoices
.NOTES
Additional information about the function.
#>
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "These are literally 'choices' in Netbox")]
param ()
$uriSegments = [System.Collections.ArrayList]::new(@('circuits', '_choices'))
$uri = BuildNewURI -Segments $uriSegments
InvokeNetboxRequest -URI $uri
}
#endregion
#region File Get-NetboxCircuitTermination.ps1 #region File Get-NetboxCircuitTermination.ps1
<# <#
@ -1227,36 +1138,6 @@ function Get-NetboxCredential {
#endregion #endregion
#region File Get-NetboxDCIMChoices.ps1
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/23/2020 12:13
Created by: Claussen
Organization: NEOnet
Filename: Get-NetboxDCIMChoices.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function Get-NetboxDCIMChoices {
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "These are literally 'choices' in Netbox")]
param ()
$uriSegments = [System.Collections.ArrayList]::new(@('dcim', '_choices'))
$uri = BuildNewURI -Segments $uriSegments -Parameters $Parameters
InvokeNetboxRequest -URI $uri
}
#endregion
#region File Get-NetboxDCIMDevice.ps1 #region File Get-NetboxDCIMDevice.ps1
<# <#
@ -1790,22 +1671,6 @@ function Get-NetboxDCIMSite {
} }
#endregion
#region File Get-NetboxExtrasChoices.ps1
function Get-NetboxExtrasChoices {
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "These are literally 'choices' in Netbox")]
param ()
$uriSegments = [System.Collections.ArrayList]::new(@('extras', '_choices'))
$uri = BuildNewURI -Segments $uriSegments
InvokeNetboxRequest -URI $uri
}
#endregion #endregion
#region File Get-NetboxHostname.ps1 #region File Get-NetboxHostname.ps1
@ -2075,36 +1940,6 @@ function Get-NetboxIPAMAvailableIP {
#endregion #endregion
#region File Get-NetboxIPAMChoices.ps1
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/19/2020 11:54
Created by: Claussen
Organization: NEOnet
Filename: Get-NetboxIPAMChoices.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function Get-NetboxIPAMChoices {
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "These are literally 'choices' in Netbox")]
param ()
$uriSegments = [System.Collections.ArrayList]::new(@('ipam', '_choices'))
$uri = BuildNewURI -Segments $uriSegments -Parameters $Parameters
InvokeNetboxRequest -URI $uri
}
#endregion
#region File Get-NetboxIPAMPrefix.ps1 #region File Get-NetboxIPAMPrefix.ps1
<# <#
@ -2532,36 +2367,6 @@ function Get-NetboxIPAMVLAN {
#endregion
#region File Get-NetboxTenancyChoices.ps1
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/19/2020 11:56
Created by: Claussen
Organization: NEOnet
Filename: Get-NetboxTenancyChoices.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function Get-NetboxTenancyChoices {
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "These are literally 'choices' in Netbox")]
param ()
$uriSegments = [System.Collections.ArrayList]::new(@('tenancy', '_choices'))
$uri = BuildNewURI -Segments $uriSegments
InvokeNetboxRequest -URI $uri
}
#endregion #endregion
#region File Get-NetboxTenant.ps1 #region File Get-NetboxTenant.ps1
@ -2690,36 +2495,6 @@ function Get-NetboxTenant {
#endregion #endregion
#region File Get-NetboxVirtualizationChoices.ps1
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/19/2020 14:10
Created by: Claussen
Organization: NEOnet
Filename: Get-NetboxVirtualizationChoices.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function Get-NetboxVirtualizationChoices {
[CmdletBinding()]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "These are literally 'choices' in Netbox")]
param ()
$uriSegments = [System.Collections.ArrayList]::new(@('virtualization', '_choices'))
$uri = BuildNewURI -Segments $uriSegments
InvokeNetboxRequest -URI $uri
}
#endregion
#region File Get-NetboxVirtualizationCluster.ps1 #region File Get-NetboxVirtualizationCluster.ps1
<# <#
@ -4791,389 +4566,6 @@ function ThrowNetboxRESTError {
#endregion #endregion
#region File ValidateChoice.ps1
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/26/2020 14:23
Created by: Claussen
Organization: NEOnet
Filename: ValidateChoice.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function ValidateChoice {
[CmdletBinding()]
[OutputType([uint16], [string], [bool])]
param
(
[Parameter(Mandatory = $true)]
[ValidateSet('Circuits', 'DCIM', 'Extras', 'IPAM', 'Virtualization', IgnoreCase = $true)]
[string]$MajorObject,
[Parameter(Mandatory = $true)]
[string]$ChoiceName,
[Parameter(Mandatory = $true)]
[object]$ProvidedValue
)
$ValidValues = GetChoiceValidValues -MajorObject $MajorObject -Choice $ChoiceName
Write-Verbose "Validating $ChoiceName"
Write-Verbose "Checking '$ProvidedValue' against [$($ValidValues -join ', ')]"
# Coercing everything to strings for matching...
# some values are integers, some are strings, some are booleans
# Join the valid values with a pipe as a delimeter, because some values have spaces
if (([string]($ValidValues -join '|') -split '\|') -inotcontains [string]$ProvidedValue) {
throw "Invalid value '$ProvidedValue' for '$ChoiceName'. Must be one of: $($ValidValues -join ', ')"
}
switch -wildcard ("$MajorObject/$ChoiceName") {
"Circuits" {
# This has things that are not integers
}
"DCIM/*connection_status" {
# This has true/false values instead of integers
try {
$val = [bool]::Parse($ProvidedValue)
} catch {
# It must not be a true/false value
$val = $script:NetboxConfig.Choices.$MajorObject.$ChoiceName.Where({
$_.Label -eq $ProvidedValue
}).Value
}
return $val
}
default {
# Convert the ProvidedValue to the integer value
try {
$intVal = [uint16]"$ProvidedValue"
} catch {
# It must not be a number, get the value from the label
$intVal = [uint16]$script:NetboxConfig.Choices.$MajorObject.$ChoiceName.Where({
$_.Label -eq $ProvidedValue
}).Value
}
return $intVal
}
}
}
#endregion
#region File ValidateDCIMChoice.ps1
function ValidateDCIMChoice {
<#
.SYNOPSIS
Internal function to validate provided values for static choices
.DESCRIPTION
When users connect to the API, choices for each major object are cached to the config variable.
These values are then utilized to validate if the provided value from a user is valid.
.PARAMETER ProvidedValue
The value to validate against static choices
.PARAMETER PowerConnectionStatus
Validate against power connection status values
.PARAMETER InterfaceTemplateFormFactor
Validate against interface template form factor values
.PARAMETER InterfaceConnectionStatus
Validate against interface connection status values
.PARAMETER InterfaceFormFactor
Validate against interface form factor values
.PARAMETER ConsolePortConnectionStatus
Validate against console port connection status values
.PARAMETER DeviceStatus
Validate against device status values
.PARAMETER DeviceFace
Validate against device face values
.PARAMETER RackType
Validate against rack type values
.PARAMETER RackWidth
Validate against rack width values.
.EXAMPLE
PS C:\> ValidateDCIMChoice -ProvidedValue 'rear' -DeviceFace
.EXAMPLE
PS C:\> ValidateDCIMChoice -ProvidedValue 'middle' -DeviceFace
>> Invalid value middle for device:face. Must be one of: 0, 1, Front, Rear
.OUTPUTS
This function returns the integer value if valid. Otherwise, it will throw an error.
.NOTES
Additional information about the function.
.FUNCTIONALITY
This cmdlet is intended to be used internally and not exposed to the user
#>
[CmdletBinding()]
[OutputType([uint16])]
param
(
[Parameter(Mandatory = $true)]
[object]$ProvidedValue,
[Parameter(ParameterSetName = 'power-port:connection_status',
Mandatory = $true)]
[switch]$PowerConnectionStatus,
[Parameter(ParameterSetName = 'interface-template:form_factor',
Mandatory = $true)]
[switch]$InterfaceTemplateFormFactor,
[Parameter(ParameterSetName = 'interface-connection:connection_status',
Mandatory = $true)]
[switch]$InterfaceConnectionStatus,
[Parameter(ParameterSetName = 'interface:form_factor',
Mandatory = $true)]
[switch]$InterfaceFormFactor,
[Parameter(ParameterSetName = 'console-port:connection_status',
Mandatory = $true)]
[switch]$ConsolePortConnectionStatus,
[Parameter(ParameterSetName = 'device:status',
Mandatory = $true)]
[switch]$DeviceStatus,
[Parameter(ParameterSetName = 'device:face',
Mandatory = $true)]
[switch]$DeviceFace,
[Parameter(ParameterSetName = 'rack:type',
Mandatory = $true)]
[switch]$RackType,
[Parameter(ParameterSetName = 'rack:width',
Mandatory = $true)]
[switch]$RackWidth
)
ValidateChoice -MajorObject 'DCIM' -ChoiceName $PSCmdlet.ParameterSetName -ProvidedValue $ProvidedValue
}
#endregion
#region File ValidateIPAMChoice.ps1
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/19/2020 11:54
Created by: Claussen
Organization: NEOnet
Filename: ValidateIPAMChoice.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function ValidateIPAMChoice {
<#
.SYNOPSIS
Internal function to verify provided values for static choices
.DESCRIPTION
When users connect to the API, choices for each major object are cached to the config variable.
These values are then utilized to verify if the provided value from a user is valid.
.PARAMETER ProvidedValue
The value to validate against static choices
.PARAMETER AggregateFamily
Verify against aggregate family values
.PARAMETER PrefixFamily
Verify against prefix family values
.PARAMETER PrefixStatus
Verify against prefix status values
.PARAMETER IPAddressFamily
Verify against ip-address family values
.PARAMETER IPAddressStatus
Verify against ip-address status values
.PARAMETER IPAddressRole
Verify against ip-address role values
.PARAMETER VLANStatus
Verify against VLAN status values
.PARAMETER ServiceProtocol
Verify against service protocol values
.EXAMPLE
PS C:\> ValidateIPAMChoice -ProvidedValue 'loopback' -IPAddressRole
.EXAMPLE
PS C:\> ValidateIPAMChoice -ProvidedValue 'Loopback' -IPAddressFamily
>> Invalid value Loopback for ip-address:family. Must be one of: 4, 6, IPv4, IPv6
.OUTPUTS
This function returns the integer value if valid. Otherwise, it will throw an error.
.NOTES
Additional information about the function.
.FUNCTIONALITY
This cmdlet is intended to be used internally and not exposed to the user
#>
[CmdletBinding(DefaultParameterSetName = 'service:protocol')]
[OutputType([uint16])]
param
(
[Parameter(Mandatory = $true)]
[object]$ProvidedValue,
[Parameter(ParameterSetName = 'aggregate:family',
Mandatory = $true)]
[switch]$AggregateFamily,
[Parameter(ParameterSetName = 'prefix:family',
Mandatory = $true)]
[switch]$PrefixFamily,
[Parameter(ParameterSetName = 'prefix:status',
Mandatory = $true)]
[switch]$PrefixStatus,
[Parameter(ParameterSetName = 'ip-address:family',
Mandatory = $true)]
[switch]$IPAddressFamily,
[Parameter(ParameterSetName = 'ip-address:status',
Mandatory = $true)]
[switch]$IPAddressStatus,
[Parameter(ParameterSetName = 'ip-address:role',
Mandatory = $true)]
[switch]$IPAddressRole,
[Parameter(ParameterSetName = 'vlan:status',
Mandatory = $true)]
[switch]$VLANStatus,
[Parameter(ParameterSetName = 'service:protocol',
Mandatory = $true)]
[switch]$ServiceProtocol
)
ValidateChoice -MajorObject 'IPAM' -ChoiceName $PSCmdlet.ParameterSetName -ProvidedValue $ProvidedValue
}
#endregion
#region File ValidateVirtualizationChoice.ps1
<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/19/2020 14:12
Created by: Claussen
Organization: NEOnet
Filename: ValidateVirtualizationChoice.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function ValidateVirtualizationChoice {
<#
.SYNOPSIS
Internal function to verify provided values for static choices
.DESCRIPTION
When users connect to the API, choices for each major object are cached to the config variable.
These values are then utilized to verify if the provided value from a user is valid.
.PARAMETER ProvidedValue
The value to validate against static choices
.PARAMETER AggregateFamily
Verify against aggregate family values
.PARAMETER PrefixFamily
Verify against prefix family values
.PARAMETER PrefixStatus
Verify against prefix status values
.PARAMETER IPAddressFamily
Verify against ip-address family values
.PARAMETER IPAddressStatus
Verify against ip-address status values
.PARAMETER IPAddressRole
Verify against ip-address role values
.PARAMETER VLANStatus
Verify against VLAN status values
.PARAMETER ServiceProtocol
Verify against service protocol values
.EXAMPLE
PS C:\> VerifyIPAMChoices -ProvidedValue 'loopback' -IPAddressRole
.EXAMPLE
PS C:\> VerifyIPAMChoices -ProvidedValue 'Loopback' -IPAddressFamily
>> Invalid value Loopback for ip-address:family. Must be one of: 4, 6, IPv4, IPv6
.FUNCTIONALITY
This cmdlet is intended to be used internally and not exposed to the user
.OUTPUT
This function returns nothing if the value is valid. Otherwise, it will throw an error.
#>
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)]
[object]$ProvidedValue,
[Parameter(ParameterSetName = 'virtual-machine:status',
Mandatory = $true)]
[switch]$VirtualMachineStatus
)
ValidateChoice -MajorObject 'Virtualization' -ChoiceName $PSCmdlet.ParameterSetName -ProvidedValue $ProvidedValue
}
#endregion
#region File VerifyAPIConnectivity.ps1 #region File VerifyAPIConnectivity.ps1
function VerifyAPIConnectivity { function VerifyAPIConnectivity {