mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-15 18:55:46 +00:00
Adding new function to fetch available prefixes
This commit is contained in:
parent
7129e7d3c7
commit
e58dd01223
1 changed files with 42 additions and 0 deletions
42
Functions/IPAM/Prefix/Get-NetboxIPAMAvailablePrefix.ps1
Normal file
42
Functions/IPAM/Prefix/Get-NetboxIPAMAvailablePrefix.ps1
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
function Get-NetboxIPAMAvailablePrefix {
|
||||||
|
<#
|
||||||
|
.SYNOPSIS
|
||||||
|
A convenience method for returning available prefixes within a prefix
|
||||||
|
|
||||||
|
.DESCRIPTION
|
||||||
|
Will return any available prefixes within a prefix.
|
||||||
|
|
||||||
|
.PARAMETER Prefix_ID
|
||||||
|
A description of the Prefix_ID parameter.
|
||||||
|
|
||||||
|
.PARAMETER Raw
|
||||||
|
A description of the Raw parameter.
|
||||||
|
|
||||||
|
.EXAMPLE
|
||||||
|
Get-NetboxIPAMAvailablePrefix -Prefix_ID (Get-NetboxIPAMPrefix -Prefix 192.0.2.0/24).id
|
||||||
|
|
||||||
|
.NOTES
|
||||||
|
Additional information about the function.
|
||||||
|
#>
|
||||||
|
|
||||||
|
[CmdletBinding()]
|
||||||
|
param
|
||||||
|
(
|
||||||
|
[Parameter(Mandatory = $true,
|
||||||
|
ValueFromPipelineByPropertyName = $true)]
|
||||||
|
[Alias('Id')]
|
||||||
|
[uint64]$Prefix_ID,
|
||||||
|
|
||||||
|
[switch]$Raw
|
||||||
|
)
|
||||||
|
|
||||||
|
process {
|
||||||
|
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'prefixes', $Prefix_ID, 'available-prefixes'))
|
||||||
|
|
||||||
|
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'prefix_id'
|
||||||
|
|
||||||
|
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
|
||||||
|
|
||||||
|
InvokeNetboxRequest -URI $uri -Raw:$Raw
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue