Created
July 14, 2014 09:11
-
-
Save HowardvanRooijen/4313af807f8405b1b01b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try | |
{ | |
$body = ""; | |
if ([String]::IsNullOrEmpty($apiKey)){ | |
throw "API Key is required" | |
} else { | |
$headers += @{"x-api-key"=($apiKey)}; | |
} | |
if ([String]::IsNullOrEmpty($appName)){ | |
throw "App Name is required" | |
} else { | |
$body += "deployment[app_name]=$appName"; | |
} | |
if (![String]::IsNullOrEmpty($changeLog)){ | |
$body += "&deployment[changelog]=$changeLog"; | |
} | |
if (![String]::IsNullOrEmpty($description)){ | |
$body += "&deployment[description]=$description"; | |
} | |
if (![String]::IsNullOrEmpty($environment)){ | |
$body += "&deployment[environment]=$environment"; | |
} | |
if (![String]::IsNullOrEmpty($revision)){ | |
$body += "&deployment[revision]=$revision"; | |
} | |
if (![String]::IsNullOrEmpty($user)){ | |
$body += "&deployment[user]=$user"; | |
} | |
$result = Invoke-RestMethod -Uri $url -Headers $headers -Body $body | |
Write-Host $result | |
} | |
catch | |
{ | |
Write-Error $_ | |
[System.Environment]::Exit(1) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment