mirror of
https://github.com/benclaussen/NetboxPS.git
synced 2025-12-15 02:35:46 +00:00
Add Site parameter and validation logic
This commit is contained in:
parent
cb4e2f2f57
commit
7aedcf8338
1 changed files with 6 additions and 0 deletions
|
|
@ -22,6 +22,8 @@ function New-NetboxVirtualMachine {
|
||||||
[string]$Name,
|
[string]$Name,
|
||||||
|
|
||||||
[Parameter(Mandatory = $true)]
|
[Parameter(Mandatory = $true)]
|
||||||
|
[uint16]$Site,
|
||||||
|
|
||||||
[uint16]$Cluster,
|
[uint16]$Cluster,
|
||||||
|
|
||||||
[uint16]$Tenant,
|
[uint16]$Tenant,
|
||||||
|
|
@ -56,6 +58,10 @@ function New-NetboxVirtualMachine {
|
||||||
|
|
||||||
#$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
#$PSBoundParameters.Status = ValidateVirtualizationChoice -ProvidedValue $Status -VirtualMachineStatus
|
||||||
|
|
||||||
|
if ($PSBoundParameters.ContainsKey('Cluster') -and (-not $PSBoundParameters.ContainsKey('Site'))) {
|
||||||
|
throw "You must specify a site ID with a cluster ID"
|
||||||
|
}
|
||||||
|
|
||||||
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines'))
|
$Segments = [System.Collections.ArrayList]::new(@('virtualization', 'virtual-machines'))
|
||||||
|
|
||||||
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
$URIComponents = BuildURIComponents -URISegments $Segments -ParametersDictionary $PSBoundParameters
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue