first working types
This commit is contained in:
@@ -10,19 +10,25 @@ function Get-FirstFreeIP {
|
||||
[ValidateScript({ $_ -match "^\d+$" })]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$Id
|
||||
$Id,
|
||||
[parameter(Mandatory=$false,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="BySubnetObject")]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[PS.IPAM.Subnetwork]
|
||||
$SubnetObject
|
||||
)
|
||||
process {
|
||||
$_params = @{
|
||||
Controller = "subnets"
|
||||
Method = "GET"
|
||||
Controller = [PS.IPAM.controllers]::subnets
|
||||
Method = [PS.IPAM.methods]::GET
|
||||
}
|
||||
switch ($PSCmdlet.ParameterSetName) {
|
||||
"ByID" { $_subnetId = $Id }
|
||||
"ByID" { $_subnetId = $Id; break }
|
||||
"ByCIDR" {
|
||||
$_subnetId = (Get-Subnet -CIDR $CIDR).id
|
||||
if (!$_subnetId) { throw "Cannot find subnet!" }
|
||||
break
|
||||
}
|
||||
"BySubnetObject" { $_subnetId = $SubnetObject.Id; break }
|
||||
}
|
||||
$_identifiers = @($_subnetId,"first_free")
|
||||
$_params.Add("Identifiers",$_identifiers)
|
||||
|
||||
Reference in New Issue
Block a user