NetboxPS/Functions/IPAM/Address/Get-NetboxIPAMAvailableIP.ps1
Alexis La Goutte 2595c58eaa
(WIP) Enhance IPAM Address (#4)
* Address(IPAM): Fix trailing whitespace (with Visual Code Formater)

* Address(IPAM): Fix PSSA about Command accepts pipeline input but not defined a process block

* Address(IPAM): Add dns_name parameter to Add and Set

* Address(IPAM): all integer are [int] (not uint16)
2021-03-30 10:34:25 -04:00

66 lines
No EOL
1.8 KiB
PowerShell

<#
.NOTES
===========================================================================
Created with: SAPIEN Technologies, Inc., PowerShell Studio 2020 v5.7.172
Created on: 3/19/2020 11:50
Created by: Claussen
Organization: NEOnet
Filename: Get-NetboxIPAMAvailableIP.ps1
===========================================================================
.DESCRIPTION
A description of the file.
#>
function Get-NetboxIPAMAvailableIP {
<#
.SYNOPSIS
A convenience method for returning available IP addresses within a prefix
.DESCRIPTION
By default, the number of IPs returned will be equivalent to PAGINATE_COUNT. An arbitrary limit
(up to MAX_PAGE_SIZE, if set) may be passed, however results will not be paginated
.PARAMETER Prefix_ID
A description of the Prefix_ID parameter.
.PARAMETER Limit
A description of the Limit parameter.
.PARAMETER Raw
A description of the Raw parameter.
.PARAMETER NumberOfIPs
A description of the NumberOfIPs parameter.
.EXAMPLE
PS C:\> Get-NetboxIPAMAvaiableIP -Prefix_ID $value1
.NOTES
Additional information about the function.
#>
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true)]
[Alias('Id')]
[int]$Prefix_ID,
[Alias('NumberOfIPs')]
[int]$Limit,
[switch]$Raw
)
process {
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'prefixes', $Prefix_ID, 'available-ips'))
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'prefix_id'
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $uri -Raw:$Raw
}
}