Fixes, added session class
This commit is contained in:
@@ -2,30 +2,23 @@ function Remove-Address {
|
||||
[CmdletBinding(DefaultParameterSetName="ByID")]
|
||||
param (
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,Position=0,ParameterSetName="ByID")]
|
||||
[ValidateScript({ $_ -match "^\d+$" })]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
[int]
|
||||
$Id,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,Position=0,ParameterSetName="ByIP")]
|
||||
[ValidateScript({[ipaddress] $_ })]
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByAddressObject")]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$IP,
|
||||
[parameter(Mandatory=$true,ValueFromPipeline=$true,Position=1,ParameterSetName="ByIP")]
|
||||
[ValidateScript({ $_ -match "^\d+$" })]
|
||||
[ValidateNotNullOrEmpty()]
|
||||
[string]
|
||||
$SubnetId
|
||||
[PS.IPAM.Address]
|
||||
$AddressObject
|
||||
)
|
||||
process {
|
||||
$_params = @{
|
||||
Controller = "addresses"
|
||||
Controller = [PS.IPAM.controllers]::addresses
|
||||
Method = "DELETE"
|
||||
}
|
||||
|
||||
switch ($PSCmdlet.ParameterSetName) {
|
||||
"ByID" { $_identifiers = @($Id) }
|
||||
"ByIP" { $_identifiers = @($IP,$SubnetId) }
|
||||
"ByID" { $_identifiers = @($Id);break }
|
||||
"ByAddressObject" { $_identifiers = @($AddressObject.Id);break }
|
||||
}
|
||||
$_params.Add("Identifiers",$_identifiers)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user