Python function to call Fujitsu's K5 IaaS Orchestration EndPoint
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
def deploy_heat_stack(k5token, stack_name, stack_to_deploy, stack_parameters): | |
"""Summary : K5 HEAT API call to send a heat stack, wrapped in a string, to a K5 Project | |
Returns: | |
TYPE: JSON Object containing the new Stack Id or Error Codes | |
""" | |
orchestrationURL = unicode(get_endpoint(k5token, "orchestration")) + unicode("/stacks") | |
print orchestrationURL | |
token = k5token.headers['X-Subject-Token'] | |
try: | |
response = requests.post(orchestrationURL, | |
headers={ | |
'X-Auth-Token': token, 'Content-Type': 'application/json', 'Accept': 'application/json'}, | |
json={ | |
"files": {}, | |
"disable_rollback": True, | |
"parameters": stack_parameters, | |
"stack_name": stack_name, | |
"template": stack_to_deploy, | |
"timeout_mins": 60 | |
}) | |
return response | |
except: | |
return ("\nUnexpected error:", sys.exc_info()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment