diff --git a/Functions/IPAM/Range/New-NetboxIPAMAddressRange.ps1 b/Functions/IPAM/Range/New-NetboxIPAMAddressRange.ps1 index 89fee28..dec9a81 100644 --- a/Functions/IPAM/Range/New-NetboxIPAMAddressRange.ps1 +++ b/Functions/IPAM/Range/New-NetboxIPAMAddressRange.ps1 @@ -72,9 +72,9 @@ function New-NetboxIPAMAddressRange { [uint64]$VRF, [object]$Role, - + [hashtable]$Custom_Fields, - + [string]$Description, [string]$Comments, diff --git a/Functions/IPAM/Range/Set-NetboxIPAMAddressRange.ps1 b/Functions/IPAM/Range/Set-NetboxIPAMAddressRange.ps1 index cb1892f..d74d0b3 100644 --- a/Functions/IPAM/Range/Set-NetboxIPAMAddressRange.ps1 +++ b/Functions/IPAM/Range/Set-NetboxIPAMAddressRange.ps1 @@ -7,50 +7,50 @@ function Set-NetboxIPAMAddressRange { [Parameter(Mandatory = $true, ValueFromPipelineByPropertyName = $true)] [uint64[]]$Id, - + [string]$Start_Address, - + [string]$End_Address, - + [object]$Status, - + [uint64]$Tenant, - + [uint64]$VRF, - + [object]$Role, - + [hashtable]$Custom_Fields, - + [string]$Description, - + [string]$Comments, - + [object[]]$Tags, - + [switch]$Mark_Utilized, - + [switch]$Force, - + [switch]$Raw ) - + begin { $Method = 'PATCH' } - + process { foreach ($RangeID in $Id) { $Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-ranges', $RangeID)) - + Write-Verbose "Obtaining IP range from ID $RangeID" $CurrentRange = Get-NetboxIPAMAddressRange -Id $RangeID -ErrorAction Stop - + if ($Force -or $PSCmdlet.ShouldProcess("$($CurrentRange.Start_Address) - $($CurrentRange.End_Address)", 'Set')) { $URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id', 'Force' - + $URI = BuildNewURI -Segments $URIComponents.Segments - + InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method $Method } } diff --git a/NetboxPS.psd1 b/NetboxPS.psd1 index ad4c858..5f32e50 100644 --- a/NetboxPS.psd1 +++ b/NetboxPS.psd1 @@ -12,7 +12,7 @@ RootModule = 'NetboxPS.psm1' # Version number of this module. -ModuleVersion = '1.8.3' +ModuleVersion = '1.8.4' # Supported PSEditions # CompatiblePSEditions = @() @@ -106,7 +106,8 @@ FunctionsToExport = 'Add-NetboxDCIMFrontPort', 'Add-NetboxDCIMInterface', 'Set-NetboxDCIMInterface', 'Set-NetboxDCIMInterfaceConnection', 'Set-NetboxDCIMRearPort', 'Set-NetboxHostName', 'Set-NetboxHostPort', 'Set-NetboxHostScheme', 'Set-NetboxInvokeParams', - 'Set-NetboxIPAMAddress', 'Set-NetboxIPAMPrefix', 'Set-NetboxTimeout', + 'Set-NetboxIPAMAddress', 'Set-NetboxIPAMAddressRange', + 'Set-NetboxIPAMPrefix', 'Set-NetboxTimeout', 'Set-NetboxUnstrustedSSL', 'Set-NetboxVirtualMachine', 'Set-NetboxVirtualMachineInterface', 'Test-NetboxAPIConnected' diff --git a/NetboxPS/NetboxPS.psd1 b/NetboxPS/NetboxPS.psd1 index ad4c858..5f32e50 100644 --- a/NetboxPS/NetboxPS.psd1 +++ b/NetboxPS/NetboxPS.psd1 @@ -12,7 +12,7 @@ RootModule = 'NetboxPS.psm1' # Version number of this module. -ModuleVersion = '1.8.3' +ModuleVersion = '1.8.4' # Supported PSEditions # CompatiblePSEditions = @() @@ -106,7 +106,8 @@ FunctionsToExport = 'Add-NetboxDCIMFrontPort', 'Add-NetboxDCIMInterface', 'Set-NetboxDCIMInterface', 'Set-NetboxDCIMInterfaceConnection', 'Set-NetboxDCIMRearPort', 'Set-NetboxHostName', 'Set-NetboxHostPort', 'Set-NetboxHostScheme', 'Set-NetboxInvokeParams', - 'Set-NetboxIPAMAddress', 'Set-NetboxIPAMPrefix', 'Set-NetboxTimeout', + 'Set-NetboxIPAMAddress', 'Set-NetboxIPAMAddressRange', + 'Set-NetboxIPAMPrefix', 'Set-NetboxTimeout', 'Set-NetboxUnstrustedSSL', 'Set-NetboxVirtualMachine', 'Set-NetboxVirtualMachineInterface', 'Test-NetboxAPIConnected' diff --git a/NetboxPS/NetboxPS.psm1 b/NetboxPS/NetboxPS.psm1 index 0c54be7..52d14cf 100644 --- a/NetboxPS/NetboxPS.psm1 +++ b/NetboxPS/NetboxPS.psm1 @@ -4263,8 +4263,6 @@ function New-NetboxIPAMAddressRange { [hashtable]$Custom_Fields, - [uint64]$Interface, - [string]$Description, [string]$Comments, @@ -5790,6 +5788,69 @@ function Set-NetboxIPAMAddress { #endregion +#region File Set-NetboxIPAMAddressRange.ps1 + + +function Set-NetboxIPAMAddressRange { + [CmdletBinding(ConfirmImpact = 'Medium', + SupportsShouldProcess = $true)] + param + ( + [Parameter(Mandatory = $true, + ValueFromPipelineByPropertyName = $true)] + [uint64[]]$Id, + + [string]$Start_Address, + + [string]$End_Address, + + [object]$Status, + + [uint64]$Tenant, + + [uint64]$VRF, + + [object]$Role, + + [hashtable]$Custom_Fields, + + [string]$Description, + + [string]$Comments, + + [object[]]$Tags, + + [switch]$Mark_Utilized, + + [switch]$Force, + + [switch]$Raw + ) + + begin { + $Method = 'PATCH' + } + + process { + foreach ($RangeID in $Id) { + $Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-ranges', $RangeID)) + + Write-Verbose "Obtaining IP range from ID $RangeID" + $CurrentRange = Get-NetboxIPAMAddressRange -Id $RangeID -ErrorAction Stop + + if ($Force -or $PSCmdlet.ShouldProcess("$($CurrentRange.Start_Address) - $($CurrentRange.End_Address)", 'Set')) { + $URIComponents = BuildURIComponents -URISegments $Segments.Clone() -ParametersDictionary $PSBoundParameters -SkipParameterByName 'Id', 'Force' + + $URI = BuildNewURI -Segments $URIComponents.Segments + + InvokeNetboxRequest -URI $URI -Body $URIComponents.Parameters -Method $Method + } + } + } +} + +#endregion + #region File Set-NetboxIPAMPrefix.ps1