33 lines
841 B
PowerShell
33 lines
841 B
PowerShell
function Assign-Tag {
|
|
[CmdletBinding()]
|
|
param (
|
|
[parameter(Mandatory=$true,ValueFromPipeline=$true,ValueFromPipelineByPropertyName=$true,Position=0)]
|
|
[ValidateNotNullOrEmpty()]
|
|
[PS.IPAM.Address]
|
|
$AddressObject,
|
|
[parameter(Mandatory=$true,Position=1)]
|
|
[ValidateNotNullOrEmpty()]
|
|
[PS.IPAM.Tag]
|
|
$Tag
|
|
)
|
|
process {
|
|
$_params = @{
|
|
Controller = [PS.IPAM.controllers]::addresses
|
|
Method = "PATCH"
|
|
}
|
|
$_id = $AddressObject.id
|
|
$_tagid = $Tag.id
|
|
|
|
$_identifiers = @($_id)
|
|
|
|
$_params.Add("Identifiers",$_identifiers)
|
|
|
|
$_body = @{ }
|
|
$_body.Add("tag", $_tagid)
|
|
|
|
$_params.Add("Params",$_body)
|
|
|
|
Invoke-Request @_params
|
|
}
|
|
}
|
|
Export-ModuleMember -Function Assign-Tag |