-
Notifications
You must be signed in to change notification settings - Fork 1
/
Push-DCNMPolicy.ps1
33 lines (32 loc) · 1.04 KB
/
Push-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
function Push-DCNMPolicy {
<#
.SYNOPSIS
Initiates a push of a DCNM policy to the device it is assign to
.DESCRIPTION
This cmdlet will invoke a REST post against the policies/deploy DCNM API
.EXAMPLE
Push-DCNMPolicy -PolicyID POLICY-212380
.EXAMPLE
Get-DCNMSwitch -fabricName Access | Get-DCNMSwitchPolicy | ? {$_.templateName -eq "nfm_switch_user"} | Push-DCNMPolicy
.PARAMETER PolicyID
PolicyID
/#>
param
(
[Parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true, ValueFromPipeline=$true)]
[string]$PolicyID,
[Parameter(Mandatory=$false, DontShow)]
[switch]$JSON
)
Begin {
$uri = "$Global:DCNMHost/rest/control/policies/deploy"
$body = @()
}
Process {
$body += $PolicyID
}
End {
if ($JSON) {$uri ; $Global:DCNM_JSON = (ConvertTo-Json -InputObject $body -Depth 10) ; $Global:DCNM_JSON} else {
$response = New-DCNMObject -uri $uri -object (ConvertTo-Json -InputObject $body -Depth 10) ; $response}
}
}