Skip to content

Commit

Permalink
Use IsPresent on switch, throw on Reject
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Horbachuk committed Mar 28, 2020
1 parent 7e9305e commit 0f906dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@

$Response = Invoke-vRARestMethod -Method POST -URI $URI -Body $JSON -Verbose:$VerbosePreference

if ($PSBoundParameters.ContainsKey("Wait")) {
if ($Wait.IsPresent) {

While($true) {

Expand All @@ -158,9 +158,9 @@

Write-Verbose -Message "State: $($Request.state)"

if ($Request.state -eq "SUCCESSFUL" -or $Request.state -Like "*FAILED") {
if ($Request.state -eq "SUCCESSFUL" -or $Request.state -Like "*FAILED" -or $Request.state -Like "*REJECTED") {

if ($Request.state -Like "*FAILED") {
if ($Request.state -Like "*FAILED" -or $Request.state -Like "*REJECTED") {

throw "$($Request.requestCompletion.completionDetails)"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ function Request-vRAResourceAction {

$ResponseId = ($Response.Headers.Location) -replace '^http.*requests/',''

if ($PSBoundParameters.ContainsKey("Wait")) {
if ($Wait.IsPresent) {

While($true) {

Expand All @@ -147,9 +147,9 @@ function Request-vRAResourceAction {

Write-Verbose -Message "State: $($Request.state)"

if ($Request.state -eq "SUCCESSFUL" -or $Request.state -Like "*FAILED") {
if ($Request.state -eq "SUCCESSFUL" -or $Request.state -Like "*FAILED" -or $Request.state -Like "*REJECTED") {

if ($Request.state -Like "*FAILED") {
if ($Request.state -Like "*FAILED" -or $Request.state -Like "*REJECTED") {

throw "$($Request.requestCompletion.completionDetails)"

Expand Down

0 comments on commit 0f906dd

Please sign in to comment.