Fixing typo + Remove-NSXTDistFirewall function

This commit is contained in:
William Lam
2019-01-04 06:52:09 -08:00
parent 5571a8900a
commit a2c896b81b

View File

@@ -1292,7 +1292,7 @@ Function New-NSXTDistFirewall {
Write-Host -ForegroundColor Red "`nThe NSX-T Proxy session is no longer valid, please re-run the Connect-NSXTProxy cmdlet to retrieve a new token`n" Write-Host -ForegroundColor Red "`nThe NSX-T Proxy session is no longer valid, please re-run the Connect-NSXTProxy cmdlet to retrieve a new token`n"
break break
} else { } else {
Write-Error "Error in creating new NSX-T Distribugted Firewall Rule" Write-Error "Error in creating new NSX-T Distributed Firewall Rule"
Write-Error "`n($_.Exception.Message)`n" Write-Error "`n($_.Exception.Message)`n"
break break
} }
@@ -1331,7 +1331,7 @@ Function Remove-NSXTDistFirewall {
If (-Not $global:nsxtProxyConnection) { Write-error "No NSX-T Proxy Connection found, please use Connect-NSXTProxy" } Else { If (-Not $global:nsxtProxyConnection) { Write-error "No NSX-T Proxy Connection found, please use Connect-NSXTProxy" } Else {
$sectionId = (Get-NSXTDistFirewallSection -Name $Section).Id $sectionId = (Get-NSXTDistFirewallSection -Name $Section).Id
$dfwId = (Get-NSXTDistFirewall -SectionName $Section).Id $dfwId = (Get-NSXTDistFirewall -SectionName $Section | where { $_.id -eq $Id}).Id
$method = "DELETE" $method = "DELETE"
$deleteDistFirewallURL = $global:nsxtProxyConnection.Server + "/policy/api/v1/infra/domains/cgw/communication-maps/$sectionId/communication-entries/$dfwId" $deleteDistFirewallURL = $global:nsxtProxyConnection.Server + "/policy/api/v1/infra/domains/cgw/communication-maps/$sectionId/communication-entries/$dfwId"
@@ -1351,14 +1351,14 @@ Function Remove-NSXTDistFirewall {
Write-Host -ForegroundColor Red "`nThe NSX-T Proxy session is no longer valid, please re-run the Connect-NSXTProxy cmdlet to retrieve a new token`n" Write-Host -ForegroundColor Red "`nThe NSX-T Proxy session is no longer valid, please re-run the Connect-NSXTProxy cmdlet to retrieve a new token`n"
break break
} else { } else {
Write-Error "Error in creating new NSX-T Firewall Rule" Write-Error "Error in removing NSX-T Distributed Firewall Rule"
Write-Error "`n($_.Exception.Message)`n" Write-Error "`n($_.Exception.Message)`n"
break break
} }
} }
if($requests.StatusCode -eq 200) { if($requests.StatusCode -eq 200) {
Write-Host "Succesfully removed NSX-T Distribugted Firewall Rule" Write-Host "Succesfully removed NSX-T Distributed Firewall Rule"
} }
} }
} }