Skip to content

Instantly share code, notes, and snippets.

@JustinSencion
Created August 18, 2017 15:04
Show Gist options
  • Save JustinSencion/93a9041de8d923ca71e168741aa0336f to your computer and use it in GitHub Desktop.
Save JustinSencion/93a9041de8d923ca71e168741aa0336f to your computer and use it in GitHub Desktop.
Bash script to remove a server from DeployHQ
#!/bin/bash
USER_NAME="you@example.com"
API_KEY="XXXXXXXX_YOUR_DHQ_API_KEY_XXXXXXXXXXXXX"
DHQ_BASE_URL='SOME_ARBITRARY_GIT_REVISION_HASH_TO_START_FROM'
DHQ_API_PROJ="your-project-shortname"
DHQ_SERVER_GROUP="YOUR_SERVER_GROUP_UUID"
JSON="path to json with deployment creation response"
INSTANCE_ID=`jq -r '.identifier' $JSON`
INSTANCE_NAME=`jq -r '.hostname' $JSON`
DHQ_REV_RESOURCE="projects/$DHQ_API_PROJ/servers/$INSTANCE_ID"
echo "Deleting $INSTANCE_NAME"
echo `curl -X 'DELETE' -u $USER_NAME:$API_KEY $DHQ_BASE_URL$DHQ_REV_RESOURCE`
echo $USER_NAME:$API_KEY $DHQ_BASE_URL$DHQ_REV_RESOURCE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment