diff --git a/Functions/IPAM/Address/Get-NetboxIPAMAvailableIP.ps1 b/Functions/IPAM/Address/Get-NetboxIPAMAvailableIP.ps1 index 068c2f1..00a4c8a 100644 --- a/Functions/IPAM/Address/Get-NetboxIPAMAvailableIP.ps1 +++ b/Functions/IPAM/Address/Get-NetboxIPAMAvailableIP.ps1 @@ -54,11 +54,13 @@ function Get-NetboxIPAMAvailableIP { [switch]$Raw ) - $Segments = [System.Collections.ArrayList]::new(@('ipam', 'prefixes', $Prefix_ID, 'available-ips')) + process { + $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' - $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 + } } \ No newline at end of file diff --git a/Functions/IPAM/Address/New-NetboxIPAMAddress.ps1 b/Functions/IPAM/Address/New-NetboxIPAMAddress.ps1 index 980a411..b95f136 100644 --- a/Functions/IPAM/Address/New-NetboxIPAMAddress.ps1 +++ b/Functions/IPAM/Address/New-NetboxIPAMAddress.ps1 @@ -90,26 +90,28 @@ function New-NetboxIPAMAddress { [switch]$Raw ) - $Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses')) - $Method = 'POST' + process { + $Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses')) + $Method = 'POST' - # # Value validation - # $ModelDefinition = GetModelDefinitionFromURIPath -Segments $Segments -Method $Method - # $EnumProperties = GetModelEnumProperties -ModelDefinition $ModelDefinition - # - # foreach ($Property in $EnumProperties.Keys) { - # if ($PSBoundParameters.ContainsKey($Property)) { - # Write-Verbose "Validating property [$Property] with value [$($PSBoundParameters.$Property)]" - # $PSBoundParameters.$Property = ValidateValue -ModelDefinition $ModelDefinition -Property $Property -ProvidedValue $PSBoundParameters.$Property - # } - # } - # - $URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters + # # Value validation + # $ModelDefinition = GetModelDefinitionFromURIPath -Segments $Segments -Method $Method + # $EnumProperties = GetModelEnumProperties -ModelDefinition $ModelDefinition + # + # foreach ($Property in $EnumProperties.Keys) { + # if ($PSBoundParameters.ContainsKey($Property)) { + # Write-Verbose "Validating property [$Property] with value [$($PSBoundParameters.$Property)]" + # $PSBoundParameters.$Property = ValidateValue -ModelDefinition $ModelDefinition -Property $Property -ProvidedValue $PSBoundParameters.$Property + # } + # } + # + $URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters - $URI = BuildNewURI -Segments $URIComponents.Segments + $URI = BuildNewURI -Segments $URIComponents.Segments - if ($Force -or $PSCmdlet.ShouldProcess($Address, 'Create new IP address')) { - InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw + if ($Force -or $PSCmdlet.ShouldProcess($Address, 'Create new IP address')) { + InvokeNetboxRequest -URI $URI -Method $Method -Body $URIComponents.Parameters -Raw:$Raw + } } }