New address in subnet by subnet object
This commit is contained in:
@@ -47,16 +47,28 @@ function New-Address {
|
||||
Port.
|
||||
#>
|
||||
[OutputType([PS.IPAM.address])]
|
||||
[CmdletBinding()]
|
||||
[CmdletBinding(DefaultParameterSetName="BySubnetId")]
|
||||
param (
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0)]
|
||||
Position=0,
|
||||
ParameterSetName="BySubnetId"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[int]
|
||||
$SubnetId,
|
||||
[Parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
ValueFromPipelineByPropertyName=$true,
|
||||
Position=0,
|
||||
ParameterSetName="BySubnetObject"
|
||||
)]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[ps.ipam.subnetwork]
|
||||
$SubnetObject,
|
||||
[parameter(
|
||||
Mandatory=$true,
|
||||
ValueFromPipeline=$true,
|
||||
@@ -175,8 +187,19 @@ function New-Address {
|
||||
Method = "POST"
|
||||
}
|
||||
|
||||
switch ($PSCmdlet.ParameterSetName) {
|
||||
"BySubnetId" {
|
||||
$_subnetId = $SubnetId
|
||||
break
|
||||
}
|
||||
"BySubnetObject" {
|
||||
$_subnetId = $SubnetObject.id
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
$_body = @{
|
||||
subnetId = $SubnetId
|
||||
subnetId = $_subnetId
|
||||
ip = $Ip
|
||||
}
|
||||
if ($Gateway) { $_body.Add("is_gateway", "1") }
|
||||
|
||||
Reference in New Issue
Block a user