From 9649237394c27fa00fdac6ddf83a0f54580015da Mon Sep 17 00:00:00 2001 From: Ben Claussen Date: Fri, 2 Oct 2020 15:49:46 -0400 Subject: [PATCH] Allow pipeline input for Address parameter in New-NetboxIPAMAddress --- .../IPAM/Address/New-NetboxIPAMAddress.ps1 | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/Functions/IPAM/Address/New-NetboxIPAMAddress.ps1 b/Functions/IPAM/Address/New-NetboxIPAMAddress.ps1 index 1f95759..c5d191b 100644 --- a/Functions/IPAM/Address/New-NetboxIPAMAddress.ps1 +++ b/Functions/IPAM/Address/New-NetboxIPAMAddress.ps1 @@ -65,7 +65,8 @@ function New-NetboxIPAMAddress { [OutputType([pscustomobject])] param ( - [Parameter(Mandatory = $true)] + [Parameter(Mandatory = $true, + ValueFromPipelineByPropertyName = $true)] [string]$Address, [object]$Status = 'Active', @@ -92,17 +93,17 @@ function New-NetboxIPAMAddress { $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 -# } -# } -# + # # 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