Fixes, added session class

This commit is contained in:
2022-12-12 13:08:04 +03:00
parent 7d0d1b53ae
commit 5a34f03779
22 changed files with 193 additions and 225 deletions

View File

@@ -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)