mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-13 18:02:29 +00:00
Fix logic for bound parameters
This commit is contained in:
commit
af5315d43a
1 changed files with 6 additions and 4 deletions
|
|
@ -68,10 +68,12 @@ function Set-NetboxIPAMAddress {
|
||||||
|
|
||||||
process {
|
process {
|
||||||
foreach ($IPId in $Id) {
|
foreach ($IPId in $Id) {
|
||||||
if ((-not [string]::IsNullOrWhiteSpace($Assigned_Object_Id))-and [string]::IsNullOrWhiteSpace($Assigned_Object_Type)) {
|
if ($PSBoundParameters.ContainsKey('Assigned_Object_Type') -or $PSBoundParameters.ContainsKey('Assigned_Object_Id')) {
|
||||||
throw "Assigned_Object_Type is required when specifying Assigned_Object_Id"
|
if ((-not [string]::IsNullOrWhiteSpace($Assigned_Object_Id)) -and [string]::IsNullOrWhiteSpace($Assigned_Object_Type)) {
|
||||||
} elseif ((-not [string]::IsNullOrWhiteSpace($Assigned_Object_Type)) -and [string]::IsNullOrWhiteSpace($Assigned_Object_Id)) {
|
throw "Assigned_Object_Type is required when specifying Assigned_Object_Id"
|
||||||
throw "Assigned_Object_Id is required when specifying Assigned_Object_Type"
|
} elseif ((-not [string]::IsNullOrWhiteSpace($Assigned_Object_Type)) -and [string]::IsNullOrWhiteSpace($Assigned_Object_Id)) {
|
||||||
|
throw "Assigned_Object_Id is required when specifying Assigned_Object_Type"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses', $IPId))
|
$Segments = [System.Collections.ArrayList]::new(@('ipam', 'ip-addresses', $IPId))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue