* Add `OPTIONS` method validation

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

* Add help block for Get-NetboxTenant

* SkipConnectedCheck for Get-NetboxAPIDefinition

* Correct help block for New-NetboxIPAMAddress

* Add parameter position 0 for 'Address' in Get-NetboxIPAMAddress

* Allow pipeline input for Address parameter in New-NetboxIPAMAddress

* Update parameter types

* Add parameter sets and logic for ID/Query searches

* Add Get-NetboxDCIMSite

* Update psproj

* Update deploy.ps1

* Move Get-NetboxCircuit

* Add Circuit cmdlets
- New-NetboxCircuit
- Get-NetboxCircuitProvider
- Get-NetboxCircuitTermination
- Get-NetboxCircuitType

* Update deploy script output path

* Update Set-NetboxIPAMAddress
- Replace Interface parameter with Assigned_Object_Type and Assigned_Object_Id
- Add validation logic for Assigned_Object_ parameters
- Change Status parameter to string

* Add Get-ModelDefinition function

* Update psproj

* Update deploy.ps1 variables

* Update exported files

* Remove references to `_choices` API calls

* Add Postman collection

* Add Postman collection

* Update deploy.ps1

* Add Set-NetboxIPAMPrefix function

* Increment version to 1.3.0

* Increment version to 1.3.2

Co-authored-by: Ben Claussen <claussen@neonet.org>
This commit is contained in:
Ben Claussen 2021-03-30 11:02:26 -04:00 committed by GitHub
parent 83944e0a45
commit 13b00d4fc9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 168 additions and 156 deletions

View file

@ -3,7 +3,7 @@
# #
# Generated by: Ben Claussen # Generated by: Ben Claussen
# #
# Generated on: 2021-03-25 # Generated on: 2021-03-30
# #
@{ @{
@ -12,7 +12,7 @@
RootModule = 'NetboxPS.psm1' RootModule = 'NetboxPS.psm1'
# Version number of this module. # Version number of this module.
ModuleVersion = '1.3.0' ModuleVersion = '1.3.2'
# Supported PSEditions # Supported PSEditions
# CompatiblePSEditions = @() # CompatiblePSEditions = @()

View file

@ -3,7 +3,7 @@
# #
# Generated by: Ben Claussen # Generated by: Ben Claussen
# #
# Generated on: 2021-03-25 # Generated on: 2021-03-30
# #
@{ @{
@ -12,7 +12,7 @@
RootModule = 'NetboxPS.psm1' RootModule = 'NetboxPS.psm1'
# Version number of this module. # Version number of this module.
ModuleVersion = '1.3.0' ModuleVersion = '1.3.2'
# Supported PSEditions # Supported PSEditions
# CompatiblePSEditions = @() # CompatiblePSEditions = @()

View file

@ -1888,7 +1888,7 @@ function Get-NetboxIPAMAggregate {
function Get-NetboxIPAMAvailableIP { function Get-NetboxIPAMAvailableIP {
<# <#
.SYNOPSIS .SYNOPSIS
A convenience method for returning available IP addresses within a prefix A convenience method for returning available IP addresses within a prefix
@ -1921,14 +1921,15 @@ function Get-NetboxIPAMAvailableIP {
[Parameter(Mandatory = $true, [Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true)] ValueFromPipelineByPropertyName = $true)]
[Alias('Id')] [Alias('Id')]
[uint16]$Prefix_ID, [int]$Prefix_ID,
[Alias('NumberOfIPs')] [Alias('NumberOfIPs')]
[uint16]$Limit, [int]$Limit,
[switch]$Raw [switch]$Raw
) )
process {
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'prefixes', $Prefix_ID, 'available-ips')) $Segments = [System.Collections.ArrayList]::new(@('ipam', 'prefixes', $Prefix_ID, 'available-ips'))
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'prefix_id' $URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters -SkipParameterByName 'prefix_id'
@ -1936,6 +1937,7 @@ function Get-NetboxIPAMAvailableIP {
$uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters $uri = BuildNewURI -Segments $URIComponents.Segments -Parameters $URIComponents.Parameters
InvokeNetboxRequest -URI $uri -Raw:$Raw InvokeNetboxRequest -URI $uri -Raw:$Raw
}
} }
#endregion #endregion
@ -3203,7 +3205,7 @@ function New-NetboxDCIMDevice {
function New-NetboxIPAMAddress { function New-NetboxIPAMAddress {
<# <#
.SYNOPSIS .SYNOPSIS
Create a new IP address to Netbox Create a new IP address to Netbox
@ -3237,6 +3239,9 @@ function New-NetboxIPAMAddress {
.PARAMETER Description .PARAMETER Description
Description of IP address Description of IP address
.PARAMETER Dns_name
DNS Name of IP address (example : netbox.example.com)
.PARAMETER Force .PARAMETER Force
Do not prompt for confirmation to create IP. Do not prompt for confirmation to create IP.
@ -3261,25 +3266,28 @@ function New-NetboxIPAMAddress {
[object]$Status = 'Active', [object]$Status = 'Active',
[uint16]$Tenant, [int]$Tenant,
[uint16]$VRF, [int]$VRF,
[object]$Role, [object]$Role,
[uint16]$NAT_Inside, [int]$NAT_Inside,
[hashtable]$Custom_Fields, [hashtable]$Custom_Fields,
[uint16]$Interface, [int]$Interface,
[string]$Description, [string]$Description,
[string]$Dns_name,
[switch]$Force, [switch]$Force,
[switch]$Raw [switch]$Raw
) )
process {
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses')) $Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses'))
$Method = 'POST' $Method = 'POST'
@ -3301,6 +3309,7 @@ function New-NetboxIPAMAddress {
if ($Force -or $PSCmdlet.ShouldProcess($Address, 'Create new IP address')) { if ($Force -or $PSCmdlet.ShouldProcess($Address, 'Create new IP address')) {
InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw
} }
}
} }
@ -3750,7 +3759,7 @@ function Remove-NetboxDCIMInterfaceConnection {
#> #>
function Remove-NetboxIPAMAddress { function Remove-NetboxIPAMAddress {
<# <#
.SYNOPSIS .SYNOPSIS
Remove an IP address from Netbox Remove an IP address from Netbox
@ -3776,7 +3785,7 @@ function Remove-NetboxIPAMAddress {
( (
[Parameter(Mandatory = $true, [Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true)] ValueFromPipelineByPropertyName = $true)]
[uint16[]]$Id, [int[]]$Id,
[switch]$Force [switch]$Force
) )
@ -4251,19 +4260,19 @@ function Set-NetboxIPAMAddress {
( (
[Parameter(Mandatory = $true, [Parameter(Mandatory = $true,
ValueFromPipelineByPropertyName = $true)] ValueFromPipelineByPropertyName = $true)]
[uint16[]]$Id, [int[]]$Id,
[string]$Address, [string]$Address,
[string]$Status, [string]$Status,
[uint16]$Tenant, [int]$Tenant,
[uint16]$VRF, [int]$VRF,
[object]$Role, [object]$Role,
[uint16]$NAT_Inside, [int]$NAT_Inside,
[hashtable]$Custom_Fields, [hashtable]$Custom_Fields,
@ -4274,6 +4283,8 @@ function Set-NetboxIPAMAddress {
[string]$Description, [string]$Description,
[string]$Dns_name,
[switch]$Force [switch]$Force
) )
@ -4303,7 +4314,8 @@ function Set-NetboxIPAMAddress {
if ($PSBoundParameters.ContainsKey('Assigned_Object_Type') -or $PSBoundParameters.ContainsKey('Assigned_Object_Id')) { if ($PSBoundParameters.ContainsKey('Assigned_Object_Type') -or $PSBoundParameters.ContainsKey('Assigned_Object_Id')) {
if ((-not [string]::IsNullOrWhiteSpace($Assigned_Object_Id)) -and [string]::IsNullOrWhiteSpace($Assigned_Object_Type)) { if ((-not [string]::IsNullOrWhiteSpace($Assigned_Object_Id)) -and [string]::IsNullOrWhiteSpace($Assigned_Object_Type)) {
throw "Assigned_Object_Type is required when specifying Assigned_Object_Id" throw "Assigned_Object_Type is required when specifying Assigned_Object_Id"
} elseif ((-not [string]::IsNullOrWhiteSpace($Assigned_Object_Type)) -and [string]::IsNullOrWhiteSpace($Assigned_Object_Id)) { }
elseif ((-not [string]::IsNullOrWhiteSpace($Assigned_Object_Type)) -and [string]::IsNullOrWhiteSpace($Assigned_Object_Id)) {
throw "Assigned_Object_Id is required when specifying Assigned_Object_Type" throw "Assigned_Object_Id is required when specifying Assigned_Object_Type"
} }
} }