Allow pipeline input for Address parameter in New-NetboxIPAMAddress

This commit is contained in:
Ben Claussen 2020-10-02 15:49:46 -04:00
parent a905a8d598
commit 9649237394

View file

@ -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