Files
ps.ipam/functions/public/Remove-Address.ps1
2022-12-12 13:08:04 +03:00

28 lines
943 B
PowerShell

function Remove-Address {
[CmdletBinding(DefaultParameterSetName="ByID")]
param (
[parameter(Mandatory=$true,ValueFromPipeline=$true,Position=0,ParameterSetName="ByID")]
[ValidateNotNullOrEmpty()]
[int]
$Id,
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0,ParameterSetName="ByAddressObject")]
[ValidateNotNullOrEmpty()]
[PS.IPAM.Address]
$AddressObject
)
process {
$_params = @{
Controller = [PS.IPAM.controllers]::addresses
Method = "DELETE"
}
switch ($PSCmdlet.ParameterSetName) {
"ByID" { $_identifiers = @($Id);break }
"ByAddressObject" { $_identifiers = @($AddressObject.Id);break }
}
$_params.Add("Identifiers",$_identifiers)
Invoke-Request @_params
}
}
Export-ModuleMember Remove-Address