Last active
August 23, 2016 02:27
-
-
Save conornash/50e4d2dc525e9c1fdfd77a266971edb8 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/python | |
import requests_aws4auth as ra | |
import requests | |
import json | |
hyper_endpoint = "https://us-west-1.hyper.sh/v1.23" | |
hyper_auth = ra.AWS4Auth("ACCESS_KEY", "SECRET_KEY", "us-west-1", "hyper") | |
print "info \n" | |
print requests.get(hyper_endpoint + "/info", auth=hyper_auth).json() | |
print "\n\ncontainer create \n" | |
hyper_container_create_dict = { | |
"Env": [ | |
"FOO=bar", | |
"BAZ=quux" | |
], | |
"Cmd": [ | |
"bash" | |
], | |
"Image": "ubuntu", | |
'Labels': {'sh_hyper_instancetype': 's3'}, | |
} | |
headers = {'content-type': 'application/json'} | |
test = requests.post(hyper_endpoint + "/containers/create?name=table-stakes", | |
data=json.dumps(hyper_container_create_dict), | |
auth=hyper_auth, headers=headers) | |
print test.request.headers | |
cont = test.json()["Id"] | |
test = requests.post(hyper_endpoint + "/containers/{0}/start".format(cont), | |
auth=hyper_auth) | |
print "\n" | |
print test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment