-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRemove-DCNMPolicy.ps1
36 lines (34 loc) · 1.02 KB
/
Remove-DCNMPolicy.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function Remove-DCNMPolicy {
<#
.SYNOPSIS
Remove a policies
.DESCRIPTION
This cmdlet will invoke a REST get against the DCNM API Control - Policies
.EXAMPLE
Remove-DCNMPolicy -policyId POLICY-245910
.EXAMPLE
Get-DCNMSwitch -fabricName site1 -SwitchName LEAF-1 | Get-DCNMSwitchPolicy | ? {$_.deleted -eq $true} | Remove-DCNMPolicy -Purge
.PARAMETER Fabric
.PARAMETER Name
/#>
param
(
[Parameter(Mandatory=$true, ValueFromPipelineByPropertyName=$true, ValueFromPipeline=$true)]
[string]$policyId,
[Parameter(Mandatory=$false)]
[switch]$Purge
)
Begin {
$response=@()}
Process {
if ($Purge) {
$uri = "$Global:DCNMHost/rest/control/policies/$policyId"
$response += Remove-DCNMObject -uri $uri} else {
$uri = "$Global:DCNMHost/rest/control/policies/$policyId/mark-delete"
$response += Set-DCNMObject -uri $uri
}
}
End {
$response
}
}